Analyze and fix code using Robert C. Martin's Clean Code principles — naming, functions, SOLID, DRY, code smells. Usable in review mode (audit) or guide mode (during code writing).
<prime_directive> READABILITY AND SIMPLICITY ALWAYS WIN.
Clean Code rules are tools, not dogma. If strictly applying a rule makes the code harder to understand, less simple, or more complex overall — DO NOT apply it.
Before applying any rule, ask: "Does this change make the code easier to understand for the next developer?" If the answer is NO or UNCERTAIN → skip the change, explain why.
Examples where NOT to apply Clean Code blindly:
url, id, i) to a verbose name → noise, not clarityThe goal is a codebase that any developer can read fluently. Rules serve that goal — not the other way around. </prime_directive>
<parameters> </parameters> <modes> </modes><quick_start>
Audit existing code:
/clean-code src/features/auth
/clean-code src/services/user.service.ts
Auto mode (no confirmation):
/clean-code -a src/features/auth
Report only (no fixes applied):
/clean-code -r src/features/auth
Guide mode (during code writing):
/clean-code --guide
→ Loads principles into context to guide the current writing session.
</quick_start>
| Flag | Description |
|---|---|
-a | Auto mode: apply all fixes without confirmation |
-e | Economy mode: no subagents, direct tools only |
-r | Report only: produce the report without applying fixes |
--guide | Guide mode: load principles to guide code writing |
Analyze existing code → identify violations → propose/apply fixes.
Workflow: step-01-analyze.md → step-02-fix.md
--guide)Load Clean Code principles into context to guide a code writing session. No multi-step workflow — act as an active reference while the agent writes.
In guide mode:
references/clean-code-principles.md<state_variables>
| Variable | Type | Description |
|---|---|---|
{target} | string | File, feature or folder to analyze |
{auto_mode} | boolean | -a: apply without confirmation |
{economy_mode} | boolean | -e: no subagents |
{report_only} | boolean | -r: report only, no fixes |
{guide_mode} | boolean | --guide: writing mode |
</state_variables>
<reference_files>
| File | When to load |
|---|---|
references/clean-code-principles.md | Always — before any analysis or writing |
</reference_files>
<entry_point>
If --guide:
→ Load references/clean-code-principles.md + confirm guide mode. Done.
Otherwise:
→ Load steps/step-01-analyze.md
</entry_point>
<step_files>
| Step | File | Purpose |
|---|---|---|
| 01 | steps/step-01-analyze.md | Read code, identify violations |
| 02 | steps/step-02-fix.md | Apply corrections |
</step_files>
<when_to_use>
Trigger this skill when:
/clean-code --guide before writing or review after/clean-code src/features/xxx/clean-code -a src/modulePrinciples covered:
</when_to_use>
<execution_rules>
references/clean-code-principles.md before analyzing or fixing-a)<success_criteria>