Back to Skills

clean-code-guard

Review generated or changed production code before it ships, using Clean Code, SOLID, DRY, KISS, YAGNI, and LLM-specific failure-mode checks in any programming language. Best used reactively after an agent writes, edits, refactors, or fixes code, before presenting, committing, or merging the result. Use when the user asks "review this PR", "is this safe to merge?", "make this cleaner", "audit this code", "refactor this", "fix this bug", or after a coding agent produced implementation code. Can a

948stars110forksUpdated 7/2/2026

Security Assessment

Safe(100/100)
Security Score100/100

About clean-code-guard

A reactive review layer for production code, applying Clean Code, SOLID, DRY, KISS, and YAGNI principles alongside checks for failure modes specific to LLM-generated code, across any programming language. It is designed to run as a guard pass after an agent writes, edits, refactors, or fixes code, before the result is presented, committed, or merged, catching problems that generic "follow clean code" instructions tend to miss.

Three modes cover different situations. Guard-pass mode checks a diff or target files against a set of always-applied imperatives once an implementation exists. Live mode applies the same rules while writing when the skill is explicitly invoked before a risky edit, followed by a self-check before delivery. Review mode walks a structured checklist against the target files and produces prioritized findings without editing code unless asked. The imperatives cover intention-revealing names, small single-purpose functions, an argument ceiling, command/query separation, comment discipline, matching existing file style, and the five SOLID rules.

The distinguishing focus is a catalogue of systematic ways LLMs produce bad code, for example duplicated knowledge, hallucinated packages, catch-all error handling that swallows failures, and agents declaring success against failing tests, each grounded in published research cited within the skill. Rule bodies and the full review checklist live in linked reference files read on demand: naming and functions, comments and formatting, SOLID, DRY/KISS/YAGNI, AI failure modes, the review checklist, and a sources bibliography. It is a portable instruction skill requiring no MCP server, network access, API key, or bundled script, and it deliberately does not replace project linters, formatters, type checkers, or test runners, which handle mechanical verification while the skill supplies the judgement layer. It stays silent for conceptual questions, CI and tooling config, git workflow, test running, pure architecture discussion, prose, data analysis, and test-code review.

FAQ

What principles does clean-code-guard check code against?

Clean Code, SOLID, DRY, KISS, and YAGNI, plus a layer of checks for failure modes specific to LLM-generated code, applicable in any programming language.

Does it require an MCP server, API key, or network access?

No. It is a portable instruction skill that needs only SKILL.md and its linked reference files, with no MCP server, network, API key, shell command, or bundled script.

What are the three modes and how do they differ?

Guard-pass mode checks a diff after code is generated, live mode applies the rules while writing when explicitly invoked before a risky edit, and review mode produces prioritized findings from a checklist without editing code unless asked.

When should this skill not be used?

For factual or conceptual questions, CI and tooling config, git workflow, running or debugging tests, pure architecture discussion, prose, data analysis, or test-code review, which is handled by a separate test-guard skill.

Does it replace my linter and test runner?

No. It explicitly does not replace project linters, formatters, type checkers, or test runners; those do the mechanical verification while the skill provides the judgement layer around quality and review.

All Files

9 files
references/solid.md10.0 KB
View
references/review-checklist.md7.0 KB
View
SKILL.md14.4 KB
View
references/comments-and-formatting.md5.1 KB
View
agents/openai.yaml0.2 KB
View
references/ai-failure-modes.md14.0 KB
View
references/dry-kiss-yagni.md8.1 KB
View
references/naming-and-functions.md6.3 KB
View
references/sources.md2.6 KB
View

Install clean-code-guard

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill