martin-clean-code

Provides Robert C. Martin's Clean Code frameworks, heuristics, and chapter references for code review and refactoring guidance.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/zademy/book-to-skill-zademy --skill martin-clean-code-zademy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: martin-clean-code
Source: https://github.com/zademy/book-to-skill-zademy/tree/main/.agents/skills/martin-clean-code
Command: npx skills add https://github.com/zademy/book-to-skill-zademy --skill martin-clean-code-zademy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers often need quick, authoritative guidance on naming, function design, error handling, testing, and refactoring without rereading an entire book. This Skill packages Robert C. Martin's Clean Code into a searchable knowledge base so you can apply its rules directly to code reviews, refactoring decisions, and design discussions. ## Core Features & Use Cases - Core Frameworks Reference: Instant access to the Boy Scout Rule, LeBlanc's Law, Stepdown Rule, Command Query Separation, TDD's Three Laws, F.I.R.S.T., Law of Demeter, and Beck's four rules of Simple Design. - Chapter & Topic Index: Look up any of the 17 chapters by number or topic (naming, functions, comments, error handling, concurrency, boundaries, classes) to load detailed summaries with code examples and anti-patterns. - Smells & Heuristics Catalog: The full C1-C5, E1-E2, F1-F4, G1-G36, J1-J3, N1-N7, T1-T9 checklist for systematic code review. - Use Case: While reviewing a pull request with a 60-line function taking a boolean flag, ask about "functions" to get the small-functions rules, flag-argument split pattern, and argument-count hierarchy to justify concrete refactoring suggestions. ## Quick Start Ask the agent to explain the Clean Code rules for naming and functions, or request a specific chapter like ch07 for error handling guidance.

Frequently Asked Questions about martin-clean-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply Clean Code rules to refactor long functions?▼

Apply the Extract Till You Drop technique: extract until each function does one thing at one level of abstraction, rarely exceeding 20 lines. Use the TO-paragraph test to verify single responsibility, and follow the Stepdown Rule so the file reads top-down by descending abstraction.

What are the Clean Code rules for function arguments?▼

Clean Code ranks argument counts as 0 > 1 > 2 > 3, with three or more requiring strong justification. Boolean flag arguments should be split into two functions, output arguments should be replaced with this, and argument clusters that travel together should be wrapped into an object.

Should I use exceptions or error codes for error handling?▼

Use unchecked exceptions rather than return codes, which clutter callers and violate Command Query Separation. Extract try/catch bodies into their own functions, never return or pass null, and use the Special Case pattern or empty collections for exceptional paths.

What topics does this Clean Code skill cover?▼

It covers all 17 chapters: naming, functions, comments, formatting, objects vs data structures, error handling, boundaries, unit tests, classes, systems, emergence, concurrency, successive refinement, and the full smells and heuristics catalog. It includes a glossary, patterns list, and decision cheatsheet.

When should I not follow Clean Code heuristics?▼

The skill covers book content only and does not replace project-specific judgment or tooling. Some rules are context-dependent, such as file size guidelines being desirable rather than hard limits, and the unchecked-exceptions stance being Martin's trade-off judgment for general applications.