/clean-code-skills:clean-code [init | audit | clean-up | new-project <description> | plan <task> | review [files] | compress [files]]from clean-code-skills
Applies SOLID principles, design patterns, and the dependency rule when writing, editing, reviewing, or refactoring code. Guides module boundaries, project structure, and code cleanup.
Ships in clean-code-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You forget everything between sessions. scripts/ and references/ resolve from this file's
folder. Read in order; trivial edits (typo, comment) skip this gate and the review checklist.
.clean/context.json; missing: run scripts/detect_stack.py, or read manifests and
file extensions.packs or under "Read next" with the file-read tool (naming a pack
is not reading it), except framework packs whose pack_scopes exclude your area. By hand:
clean-packs index in references/framework-map.md; none: answer its adaptation questions..clean/architecture.md; see Layer Rules..clean/decisions.md, .clean/ledger.md. Recorded decisions are settled; resume,
never restart, campaigns in progress..clean/structure.md rows (grep path) or
scripts/map_structure.py --path <area>; by hand, list the folder, open the two or three most
similar files.AGENTS.md, CLAUDE.md, CONTRIBUTING.md, ARCHITECTURE.md,
README.md.On conflict, first wins: project instructions, recorded decisions, declared layers, local
conventions, framework pack, language pack, this skill. Only init, audit, new-project create
.clean/; plain sessions read it, offer to persist at the end.
review-checklist.md);
bug: reproducer test first; refactor: tests before and after. Never claim success without
running something.references/review-checklist.md, self-check included.Placement. Role decides folder, per pack roles and project layout; mirror similar files. New
file only without a cohesive home, then fully wired: imports, exports, registration, routes, DI,
build config; unreferenced files are dead code. Never default to repository root or current
directory. Never create sibling variants (_v2, _new, _final, _copy) or grow junk drawers
(utils, helpers, common); name the concept. Narrowest access modifier.
One job per unit, every scale: needs "and" to describe? Split. Parsing, domain rules, persistence, external calls, presentation, wiring: separate homes. Orchestrators sequence collaborators, hold no business rules. New behavior goes to its owning unit, not the open file. Different actors' code stays apart, even if identical today.
Minimal code. Before writing code, stop at the first yes: Unneeded (YAGNI)? Write nothing. Already in the codebase? Reuse it. Standard library, platform, or installed dependency does it? Use that. One line? Write it. Else write the minimum. Never cut safety: validation, error handling, security, accessibility.
Code. Names reveal intent in project vocabulary, one word per concept. Functions: one thing,
one abstraction level, few arguments, no flag arguments. Comments: why, briefly. Never swallow
errors: handle where a decision can be made, keep causes, model expected outcomes as values. Tests:
Three Laws of TDD, F.I.R.S.T.; never weaken, skip, or delete failing tests. Verify every API
against installed versions in .clean/context.json, never memory. Deduplicate only copies that
must change together (DRY). Formatter owns formatting. Design priority: tests pass, no duplicated
knowledge, intent expressed, fewest elements.
Security. Validate and encode input at every trust boundary, parameterize queries, keep authorization beside the operation it protects, never put secrets in code, committed config, or logs.
Strict when .clean/architecture.md declares layers: check with scripts/check_boundaries.py, or
read changed files' imports, naming each layer. Undeclared: follow the framework pack's idiomatic
structure; these rules guide judgement.
main./clean-code <argument> (or $clean-code, @clean-code, /skill:clean-code) and plain language
route identically.
| Argument | Follow |
|---|---|
init (alias questions, "interview me") | references/init.md |
audit | references/audit-report.md; changes no code |
clean-up | references/project-refactor.md with .clean/ledger.md; no ledger: propose an audit (file count), await consent |
new-project <description> | references/new-project.md |
plan <task> | references/plan.md; edits nothing |
review [files] | references/review-checklist.md, The review Command; edits nothing |
compress [files] | references/compress.md; never touches the managed block |
| (none) | this file; references/session-protocol.md for multi-step or resumable work |
Read only what the task needs, from references/; long files via their Contents:
| Task | Read |
|---|---|
| Review; agent smells A1-A10 | review-checklist.md |
| Risk level: LOW, MEDIUM, HIGH | review-checklist.md, Risk Levels |
| Comment cleanup (C1-C5, G12) | comments.md |
| Architecture style, design pattern, data access | patterns.md |
| New dependency | framework-map.md, Dependencies And Package Idioms |
| New boundary, layer, framework, or database | architecture.md |
| Tests | tests.md |
| Concurrency | concurrency.md |
| Security, trust boundaries, data versus objects, performance | principles.md |
| Naming or triaging a smell | smell-triage.md; IDs (G17, N7, T5...) in chapter-map.md |
| A named rule, exactly | canon.md |
| State for the next session | memory-protocol.md |
| Worked examples, templates | examples.md |
| Host hooks, commands, install paths | host-matrix.md |
Scripts detect_stack.py, scan_repo.py, map_structure.py, check_boundaries.py, check_compression.py: flags, findings, exit codes; output is evidence, never a verdict | tools.md |
Surgical (default): smallest slice; report unrelated smells, never fix them unless a requested
outcome needs it ("make the suite pass"): smallest fix, reported separately, never a weakened test.
Campaign (explicit request only): references/project-refactor.md; never a behavior change
inside a refactor batch.
.clean/decisions.md; files added or moved and .clean/ exists:
scripts/map_structure.py --write run.assets/hooks/claude-settings.json (opens in a new tab)assets/hooks/pre-commit (opens in a new tab)assets/templates/architecture.md (opens in a new tab)assets/templates/decisions.md (opens in a new tab)assets/templates/ledger.md (opens in a new tab)references/architecture-map.md (opens in a new tab)references/architecture.md (opens in a new tab)references/audit-report.md (opens in a new tab)references/canon.md (opens in a new tab)references/chapter-map.md (opens in a new tab)references/comments.md (opens in a new tab)references/compress.md (opens in a new tab)references/concurrency.md (opens in a new tab)references/examples.md (opens in a new tab)references/framework-map.md (opens in a new tab)references/frameworks/angular.md (opens in a new tab)references/frameworks/aspnet-core.md (opens in a new tab)references/frameworks/django.md (opens in a new tab)references/frameworks/drupal.md (opens in a new tab)references/frameworks/express.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
clean-code, clean-architecture, solid, design-patterns, code-review, refactoring
npx claudepluginhub btseee/clean-code-skills --plugin clean-code-skillsOther plugins' skills for the same job