Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Review generated or changed production code with Clean Code, SOLID, DRY, KISS, YAGNI, and LLM-specific failure-mode checks.
.claude/skills/sickn33-clean-code-guard/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | 171% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 125% | 0% |
| case-21 | ✗→✓ | ▲ Improved | 346% | 0% |
| case-22 | ✗→✓ | ▲ Improved | 153% | 0% |
| case-05 | ✓→✗ | ▼ Worse | 158% | 0% |
You are reviewing generated or changed code before it ships. Apply the rules below as a guard pass after the first implementation pass — and once this skill is active, keep applying it to every later code change in the same session, re-running the self-check before delivery after each edit rather than reverting to unguarded output because the skill loaded earlier. If the user explicitly invokes this skill before writing code, use the same rules while writing and still run the self-check before delivery.
Use this skill when reviewing generated or changed code before it ships. Activate it reactively after an agent writes, edits, or refactors production code — especially after a first implementation pass. Re-run the guard pass before delivery after each edit.
This is a portable instruction skill. It requires no MCP server, network access, API key, shell command, local executable, or bundled script. It can be used in any runtime that supports SKILL.md plus directly linked references/ files; agents/openai.yaml is lightweight display metadata.
This skill does not replace project linters, formatters, type checkers, or test runners. Use the project's own tools for mechanical verification; use this skill for the judgement layer around code quality and review.
This skill has three modes — pick based on the user's request.
Guard-pass mode (recommended): after code has been generated, edited, refactored, or fixed, check the diff or target files against the Always-applied imperatives below. Fix violations before presenting, committing, or merging the work.
Live mode (explicit): when the user invokes this skill before a risky code edit, apply the same imperatives while writing, then run the Self-check before delivery checklist. If you violate any rule, fix it before showing the user.
Review mode (triggered when the user asks you to review, audit, critique, or rate code): walk references/review-checklist.md against the target file(s) and produce a structured findings report. Do not edit code in review mode unless asked.
Across all three modes, the rule bodies live in references/. Read the relevant reference file when:
The reference files are:
the work is presented or committed.
report findings from references/review-checklist.md; do not edit unless asked.
while writing, then run the self-check before delivery.
behavior exactly and treat any bug fix as a separate change.
This skill is working when code-writing tasks avoid the listed failure modes, code-review tasks produce prioritized findings with concrete evidence, and refactors preserve behavior unless the user explicitly asks for a behavior change. It should stay silent for conceptual, CI, git workflow, prose, data analysis, and test-running tasks covered by the frontmatter exclusions.
LLM-generated code has measurable, systematic failure modes that generic "follow clean code" instructions do not catch. Examples backed by published research:
The classic principles (Clean Code, SOLID, DRY/KISS/YAGNI) are still the foundation — but this skill adds the AI-specific layer most rule packs miss.
These are the rules to follow on every code change. They are imperative, not suggestions.
data, data2, result, result_final, item, temp, value, obj, info, helper, manager, utils, or handle_*/process_*/do_* without a qualifier. A name must answer why it exists and what it does. (Clean Code Ch. 2)enable_*, use_*_v2, or *_mode, delete it and ship the concrete behavior. (Fowler, "Yagni"){"status": "ok", ...} or canned data from a function whose spec says it does real work. If you cannot implement, fail explicitly with the language's unimplemented or unsupported-operation mechanism and say so. Never disable, skip, or weaken a test to make it pass. (Fowler, Claude Code issue #6984)Rule 16 trusts the contract inside the boundary; the items below stay even while you strip speculation (14), defensive guards (16), and dead code (21). Removing one of these is a behavior change, not a cleanup — keep it, or flag it and ask.
Before you show the user the code you wrote or edited:
If you cannot answer yes to every check, fix before shipping.
After the guard pass, surface it so the user can see it ran (guard-pass and live modes — review mode reports through its own findings format). List each fix as <file>[:<line>] — <what changed>, omitting the line number if it is unstable, then close with one line: clean-code-guard: <N> fixed, <M> flagged for author — or clean-code-guard: clean if nothing triggered. Report only changes you actually made; never estimate a quality score or percentage — no baseline exists, so such a number would be invented. This reports the pass; it does not block presenting or committing.
Refer them to the source name in the relevant references/ file and use references/sources.md only when the URL is needed. The rules are defensible — they come from primary sources (Uncle Bob, Fowler, Hunt & Thomas, McCabe, Metz) and from published 2024–2026 research on LLM code generation. If the user has a context-specific reason to override (e.g., a constructor genuinely needs 8 params for a config DTO), document the exception in a code comment that names the principle being overridden, the reason, and a revisit trigger — the condition under which it should be reconsidered. An exception comment with no revisit trigger is itself a finding on the next pass: a tradeoff with no exit is just deferred debt.
answer the concept directly.
references/review-checklist.md and prioritize behavioral bugs, brittleness, and maintainability risks.
convention and document the exception only when it would otherwise surprise a future maintainer.
runtime-specific rules to this general guard skill.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-17 | pass→pass | 9,486 | 7,151 | -25% | 1 | 1 | 0% | 1,912 | 5,202 | +172% | 0 | 0 | — |
case-01 | fail→fail | 3,710 | 2,503 | -33% | 1 | 1 | 0% | 681 | 4,419 | +549% | 0 | 0 | — |
case-02 | fail→fail | 13,391 | 17,855 | +33% | 1 | 1 | 0% | 3,050 | 8,131 | +167% | 0 | 0 | — |
case-03 | pass→pass | 14,368 | 14,647 | +2% | 1 | 1 | 0% | 2,594 | 6,593 | +154% | 0 | 0 | — |
case-04 | pass→pass | 6,056 | 4,080 | -33% | 1 | 1 | 0% | 1,272 | 4,826 | +279% | 0 | 0 | — |
case-05 | pass→fail | 12,406 | 13,080 | +5% | 1 | 1 | 0% | 2,687 | 6,920 | +158% | 0 | 0 | — |
case-06 | pass→pass | 7,829 | 13,146 | +68% | 1 | 1 | 0% | 1,578 | 6,570 | +316% | 0 | 0 | — |
case-07 | pass→pass | 8,861 | 4,541 | -49% | 1 | 1 | 0% | 1,653 | 4,825 | +192% | 0 | 0 | — |
case-08 | pass→pass | 7,463 | 8,632 | +16% | 1 | 1 | 0% | 1,525 | 5,571 | +265% | 0 | 0 | — |
case-09 | fail→pass | 10,130 | 8,472 | -16% | 1 | 1 | 0% | 2,044 | 5,534 | +171% | 0 | 0 | — |
case-10 | pass→pass | 9,932 | 9,808 | -1% | 1 | 1 | 0% | 2,205 | 5,965 | +171% | 0 | 0 | — |
case-11 | pass→pass | 9,329 | 9,564 | +3% | 1 | 1 | 0% | 1,820 | 5,854 | +222% | 0 | 0 | — |
case-12 | pass→pass | 9,291 | 5,840 | -37% | 1 | 1 | 0% | 1,835 | 5,153 | +181% | 0 | 0 | — |
case-18 | fail→fail | 2,151 | 6,503 | +202% | 1 | 1 | 0% | 351 | 5,265 | +1400% | 0 | 0 | — |
case-13 | pass→fail | 8,782 | 6,652 | -24% | 1 | 1 | 0% | 1,702 | 5,137 | +202% | 0 | 0 | — |
case-14 | pass→pass | 15,315 | 21,411 | +40% | 1 | 1 | 0% | 3,571 | 8,707 | +144% | 0 | 0 | — |
case-15 | pass→pass | 12,452 | 8,709 | -30% | 1 | 1 | 0% | 2,600 | 5,518 | +112% | 0 | 0 | — |
case-16 | pass→pass | 6,771 | 5,598 | -17% | 1 | 1 | 0% | 1,190 | 5,010 | +321% | 0 | 0 | — |
case-19 | fail→pass | 13,685 | 10,895 | -20% | 1 | 1 | 0% | 2,742 | 6,157 | +125% | 0 | 0 | — |
case-20 | fail→fail | 1,361 | 3,154 | +132% | 1 | 1 | 0% | 222 | 4,496 | +1925% | 0 | 0 | — |
case-21 | fail→pass | 5,132 | 4,804 | -6% | 1 | 1 | 0% | 1,066 | 4,754 | +346% | 0 | 0 | — |
case-22 | fail→pass | 14,225 | 17,906 | +26% | 1 | 1 | 0% | 3,209 | 8,124 | +153% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 22 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.