clean-code
Principles and practices for writing readable, maintainable, and testable code
npx skills add cosmicstack-labs/mercury-agent-skills --skill clean-code --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Clean Code Write code that humans can read, understand, and change with confidence. ## Core Principles ### 1. Mean What You Say — Say What You Mean Code is communication. Every name, structure, and abstraction should reveal intent. If you need a comment to explain *what* the code does, the code is failing at communication. ### 2. Small Things, Done Well Small functions, small classes, small files. Each unit of code should have one clear responsibility and do it well. Composability beats complexity. ### 3. The Boy Scout Rule Leave the code cleaner than you found it. Every commit should improve the codebase incrementally — even if it's just renaming one variable or extracting one function. ### 4. Testability == Design Quality If code is hard to test, it has a design problem. Testable code is modular, decoupled, and honest about its dependencies. --- ## Clean Code Scoring Rubric Use this rubric to evaluate code quality on a scale of 1-5 for each dimension: | Dimension | 1 (Poor) | 3 (Adequate) | 5 (Excellent) | |-----------|----------|---------------|----------------| | **Naming** | Single-letter vars, ambiguous abbreviations | Descriptive but occasionally redundant | Reveals intent
- Core Principles
- 1. Mean What You Say — Say What You Mean
- 2. Small Things, Done Well
- 3. The Boy Scout Rule
- 4. Testability == Design Quality
- Clean Code Scoring Rubric
- Actionable Guidance
- Naming
- Functions
- Comments
- Error Handling
- Testing
- Code Smells to Hunt
- Common Mistakes
What does the clean-code skill do?
Principles and practices for writing readable, maintainable, and testable code
How do I install it?
Run `npx skills add cosmicstack-labs/mercury-agent-skills --skill clean-code --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From cosmicstack-labs/mercury-agent-skills, a repository with 364 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.