clean-code
Installation
SKILL.md
Writing Clean Code
Overview
Code is read far more often than it is written, so optimize the artifact for the next reader. This skill is a small set of decisions to apply when you write a new function, name a new entity, or touch a non-trivial block of logic. Each decision pairs with a check a reviewer (human or agent) could apply by reading the diff.
When to invoke
Invoke when you're about to:
- Add a new function, method, class, struct, or module
- Name a new entity that other code will reference (variable, function, type, file)
- Modify ≥3 lines of non-trivial logic — branching, loops, conditional dispatch, or anything that reads as "behavior" rather than "wiring"
- Add or replace a comment block of more than one line
- Copy-paste a block of logic from elsewhere in the codebase
- Review code for readability, naming, duplication, or structural quality
If you're unsure whether the change is non-trivial, ask: would a reviewer pause on this hunk to think about it? If yes, invoke.