# Clean code

> Clean code is an open-source agent skill for developer tools. Guides agents to write, review and refactor code with SOLID and clean architecture. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/btseee/clean-code-skills/tree/main/skills/clean-code
- **Repository:** https://github.com/btseee/clean-code-skills
- **GitHub stars:** 26
- **License:** MIT
- **Skill name:** clean-code
- **Collection:** https://github.com/btseee/clean-code-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill gives a coding agent a structured method for changing code in any language: it loads project context first, reads nearby code and framework conventions, places new files by their role, and then makes surgical edits with a verification step. It covers SOLID principles, design patterns, and the dependency rule, and it sets boundaries that are enforced only when a project declares its layers.

The workflow is organized around a set of commands such as init, audit, clean-up, new-project, plan and review, each pointing to its own reference file. Optional Python scripts can detect the stack, scan the repository, map folder structure and check layer boundaries, writing their output only to a local .clean/ folder and never touching the network. Their results are treated as evidence rather than verdicts.

The skill expects a project to be accessible from the agent's working directory and a Python 3.8+ interpreter if the optional scripts are used. Nothing else is required, since the guidance works with no tooling at all.

## When your agent uses it

> Use when writing, editing, reviewing, testing, planning, or refactoring code in any language or framework; creating files or deciding where code and folders belong; designing or changing module boundaries, layers, and dependencies; starting a new project; auditing or cleaning up an existing one; or compressing agent instruction files. Covers SOLID, design patterns, and the dependency rule.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs Python scripts](https://github.com/btseee/clean-code-skills/tree/HEAD/skills/clean-code)
- [No network calls found in its scripts](https://github.com/btseee/clean-code-skills/tree/HEAD/skills/clean-code)
- [License: MIT](https://github.com/btseee/clean-code-skills/tree/HEAD/skills/clean-code)

## Features

- **Context loading gate:** Reads stack details, recorded decisions and project instructions before any non-trivial edit.
- **Dependency rule enforcement:** Keeps source dependencies pointing inward when a project declares its architectural layers.
- **Review checklist:** Provides a diff review checklist and risk levels for judging the quality of a change.
- **Project audit and cleanup:** Supports auditing an existing codebase and running a tracked refactoring campaign on request.
- **Optional boundary scripts:** Includes Python helpers that map folder structure and check imports against declared layers.
- **Compression of agent instructions:** Shortens agent instruction files while leaving managed blocks untouched.

## Good for

- Refactor a messy module into smaller units with clear responsibilities
- Review a pull request for layering and naming problems
- Audit an existing project and propose a cleanup plan
- Plan a new feature before writing any code
- Set up a new project with a sensible folder structure
- Compress a long AGENTS.md or CLAUDE.md file

## Install

### Claude Code

This skill ships in the `clean-code-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add btseee/clean-code-skills
/plugin install clean-code-skills@clean-code-skills
```

Or copy only this skill to `~/.claude/skills/clean-code`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/btseee/clean-code-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/clean-code &&
cp -R "$tmp/skills/clean-code" ~/.claude/skills/clean-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/clean-code` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/clean-code` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/btseee/clean-code-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/clean-code &&
cp -R "$tmp/skills/clean-code" ~/.agents/skills/clean-code &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/clean-code` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/clean-code` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/btseee/clean-code-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/clean-code &&
cp -R "$tmp/skills/clean-code" ~/.cursor/skills/clean-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/clean-code` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/btseee/clean-code-skills.git --path skills/clean-code
```

Or copy the folder to `~/.gemini/skills/clean-code` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/clean-code`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/btseee/clean-code-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/clean-code &&
cp -R "$tmp/skills/clean-code" ~/.copilot/skills/clean-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/clean-code` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/btseee/clean-code-skills.git
```

Then copy `clean-code-skills/skills/clean-code` into your agent's skills folder as `clean-code`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does Clean code need any tools installed?

No, it works with no tooling. The optional scripts need Python 3.8 or newer.

### Does Clean code write files into my project?

Only the init, audit and new-project commands create a .clean/ folder, and the optional scripts write only to .clean/.

### Does Clean code make network requests?

The scripts are stated never to use the network.

### Which clients can use Clean code?

It is published as a Claude Code plugin marketplace entry and follows the shared SKILL.md format.

### How do I install Clean code in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/clean-code to use it in all your projects, or to .claude/skills/clean-code in one project. Or install the clean-code-skills plugin, which includes it: /plugin marketplace add btseee/clean-code-skills, then /plugin install clean-code-skills@clean-code-skills.

### Does Clean code run scripts?

Yes. It runs Python scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Clean code?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Clean code?

The closest alternatives to Clean code are Code review and quality, Code simplification, Review and refactor, Code simplifier and Code simplification.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Code review and quality](https://ai-powered.com/skills/code-review-and-quality): Code review and quality is an open-source agent skill for developer tools.
- [Code simplification](https://ai-powered.com/skills/code-simplification): Code simplification is an open-source agent skill for developer tools.
- [Review and refactor](https://ai-powered.com/skills/review-and-refactor): Review and refactor is an open-source agent skill for developer tools.
- [Code simplifier](https://ai-powered.com/skills/code-simplifier): Code simplifier is an open-source agent skill for developer tools.
- [Code simplification](https://ai-powered.com/skills/code-simplification-ajyadav013): Code simplification is an open-source agent skill for developer tools.
- [Architecture review](https://ai-powered.com/skills/architecture-review): Architecture review is an open-source agent skill for developer tools.
- [Code](https://ai-powered.com/skills/code): Code is an open-source agent skill for developer tools.
- [Code review expert](https://ai-powered.com/skills/code-review-expert): Code review expert is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/clean-code
