| name | clean-code |
| description | Routes to Clean Code sub-skills for naming, functions, comments, and error handling based on Robert C. Martin's Clean Code |
Clean Code
Based on Robert C. Martin's Clean Code: A Handbook of Agile Software Craftsmanship.
When to Use This Skill
Trigger on:
- Code review requests mentioning "clean code", "readability", "naming", "comments"
- Writing new functions, classes, or modules
- Refactoring existing code for clarity
- Debates about naming conventions, function length, or comment density
Do NOT trigger on:
- Architecture or system design (use architecture skills)
- Performance optimization (use optimization skills)
- Refactoring code smells (use refactoring skills)
- Debugging runtime errors (use systematic-debugging)
Sub-Skills
| Topic | Skill | Use When |
|---|
| Naming | clean-code:naming | Variables, functions, classes, modules need clear names |
| Functions | clean-code:functions | Designing or reviewing function size, arguments, structure |
| Comments | clean-code:comments | Deciding when/how to comment code |
| Error Handling | clean-code:error-handling | Designing exception strategy and error boundaries |
Core Principles
- Clean code reads like well-written prose -- every line expresses intent
- Functions should be small -- then smaller; rarely > 20 lines
- Names reveal intent -- if a name requires a comment, it is not descriptive enough
- Comments are apologies -- fix the code first, then comment only what cannot be made obvious
- Error handling is not optional -- wrap errors at boundaries, never swallow exceptions silently
- Boy Scout Rule -- leave the code cleaner than you found it
Source
Distilled from Clean Code by Robert C. Martin. Full extracted content: output/clean-code/SKILL.md.