clean-code
Write readable maintainable code: clear names, small units, low coupling, high cohesion. Optimize for changeability, not abstraction count; do not over-engineer.
SKILL.mdskills/architecture/clean-code/SKILL.md
GitHubclean-code
Optimize for changeability, not abstraction count. Small, named, tested units with one reason to change.
Activate when
- Writing or reviewing any code for readability/maintainability; naming, sizing, or duplication decisions.
Do NOT activate for
- Architectural pattern choice (see architecture/*, language-modularity); formatting-only (see tooling/formatting).
Procedure
- Names: reveal intent, pronounceable, consistent with the domain glossary; no encodings, no lies.
- Units: small functions/modules with one reason to change; nesting shallow; control flow explicit; no boolean-parameter explosions.
- Duplication: remove real duplication (rule of three); do NOT abstract on speculation (YAGNI); DRY for knowledge, not keystrokes.
- Smells that block: god modules/classes, hidden temporal coupling, global mutable state, circular deps, leaky abstractions, swallowed errors, stringly-typed APIs.
- Anti-over-engineering: every abstraction must name its second caller or the volatile dependency it protects; otherwise inline.
- Verify: reviewer can state each unit's contract in one sentence; complexity down or justified; tests unaffected in behavior.