uncle-bob-clean-code-best-practices
SKILL.md
Robert C. Martin (Uncle Bob) Clean Code Best Practices
Comprehensive software craftsmanship guide based on Robert C. Martin's "Clean Code: A Handbook of Agile Software Craftsmanship". Contains 45 rules across 8 categories, prioritized by impact to guide code reviews, refactoring decisions, and new development.
When to Apply
Reference these guidelines when:
- Writing new functions, classes, or modules
- Naming variables, functions, classes, or files
- Reviewing code for maintainability issues
- Refactoring existing code to improve clarity
- Writing or improving unit tests
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Meaningful Names | CRITICAL | name- |
| 2 | Functions | CRITICAL | func- |
| 3 | Comments | HIGH | cmt- |
| 4 | Formatting | HIGH | fmt- |
| 5 | Objects and Data Structures | MEDIUM-HIGH | obj- |
| 6 | Error Handling | MEDIUM-HIGH | err- |
| 7 | Unit Tests | MEDIUM | test- |
| 8 | Classes and Systems | MEDIUM | class- |
Quick Reference
1. Meaningful Names (CRITICAL)
name-intention-revealing- Use names that reveal intentname-avoid-disinformation- Avoid misleading namesname-meaningful-distinctions- Make meaningful distinctionsname-pronounceable- Use pronounceable namesname-searchable- Use searchable namesname-avoid-encodings- Avoid encodings in namesname-class-noun- Use noun phrases for class namesname-method-verb- Use verb phrases for method names
2. Functions (CRITICAL)
func-small- Keep functions smallfunc-one-thing- Functions should do one thingfunc-abstraction-level- Maintain one level of abstractionfunc-minimize-arguments- Minimize function argumentsfunc-no-side-effects- Avoid side effectsfunc-command-query-separation- Separate commands from queriesfunc-prefer-exceptions- Prefer exceptions to error codesfunc-dry- Do not repeat yourself
3. Comments (HIGH)
cmt-express-in-code- Express yourself in code, not commentscmt-explain-intent- Use comments to explain intentcmt-avoid-redundant- Avoid redundant commentscmt-avoid-commented-out-code- Delete commented-out codecmt-warning-consequences- Use warning comments for consequences
4. Formatting (HIGH)
fmt-vertical-formatting- Use vertical formatting for readabilityfmt-horizontal-alignment- Avoid horizontal alignmentfmt-team-rules- Follow team formatting rulesfmt-indentation- Respect indentation rules
5. Objects and Data Structures (MEDIUM-HIGH)
obj-data-abstraction- Hide data behind abstractionsobj-data-object-asymmetry- Understand data/object anti-symmetryobj-law-of-demeter- Follow the Law of Demeterobj-avoid-hybrids- Avoid hybrid data-object structuresobj-dto- Use DTOs for data transfer
6. Error Handling (MEDIUM-HIGH)
err-use-exceptions- Use exceptions instead of return codeserr-write-try-catch-first- Write try-catch-finally firsterr-provide-context- Provide context with exceptionserr-define-by-caller-needs- Define exceptions by caller needserr-avoid-null- Avoid returning and passing null
7. Unit Tests (MEDIUM)
test-first-law- Follow the three laws of TDDtest-keep-clean- Keep tests cleantest-one-assert- One assert per testtest-first-principles- Follow FIRST principlestest-build-operate-check- Use Build-Operate-Check pattern
8. Classes and Systems (MEDIUM)
class-small- Keep classes smallclass-cohesion- Maintain class cohesionclass-organize-for-change- Organize classes for changeclass-isolate-from-change- Isolate classes from changeclass-separate-concerns- Separate construction from use
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
Weekly Installs
7
Repository
pproenca/dot-skillsGitHub Stars
71
First Seen
Jan 24, 2026
Security Audits
Installed on
trae4
claude-code4
antigravity3
gemini-cli3
opencode2
codex2