agentleFS
andrewthetechieandrewthetechie/andrew-skills/skills/martin-clean-code/SKILL.md

martin-clean-code

Skill6 starsChanged 4 months agoMITView on GitHub

Reference and application guide to Robert C. Martin's Clean Code.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use size and count as design signals.

    line 25
  2. Distinctive:

    Follow this loop for implementation, refactoring, and review work.

    line 29
  3. Distinctive:

    Read every file whose branch matches observed evidence, then stop.

    line 46
  4. Distinctive:

    Read the topic index when one concern spans several chapters.

    line 68
  5. Distinctive:

    Read the cheatsheet first when the task is a broad review rather than one diagnosed smell.

    line 69
  6. Distinctive:

    Read the patterns catalog when selecting a concrete transformation after diagnosing a smell.

    line 70
  7. Distinctive:

    Read the glossary when an unfamiliar book term affects the decision.

    line 71

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Martin clean code

Apply the book's guidance within current project constraints. When rules conflict, rank them:

  1. Correctness and explicit requirements.
  2. Security and data integrity.
  3. Repository and language standards.
  4. Tests and measured evidence.
  5. Clarity for the next reader.
  6. Book heuristics.

Use size and count as design signals. Base decisions on responsibility and change pressure.

Operating loop

Follow this loop for implementation, refactoring, and review work.

  1. Establish the baseline. Name the required behavior and its protecting test or validation. Record the current result.
  2. Diagnose one concrete smell. Cite the code evidence and name the responsibility or concept involved.
  3. Route the smell. Read each matching chapter or pattern before selecting a change.
  4. Act within authority, on one path only:
    • Change task: make one scoped improvement. Preserve behavior outside the requested change.
    • Review task: record the finding as file and line, the evidence quoted from the code, the rule it breaks, and the recommended move. Account for every in-scope instance of the selected rule. Leave the code as you found it.
  5. Validate the result. Run the complete relevant tests or validation commands. Record each pass, failure, or unavailable validation.
  6. Compare before and after. State how the result changes readability, coupling, duplication, or change cost.

Repeat steps 2 through 6 while in-scope smells remain.

Complete the task after you cover every requested change or finding. Required validations must pass, or each remaining failure needs an explanation.

Route by evidence

Read every file whose branch matches observed evidence, then stop.

EvidenceRead
The task needs the book's quality or economic frameClean code
Names hide intent, domain meaning, or side effectsMeaningful names
Functions mix behaviors, arguments, or abstraction levelsFunctions
Comments compensate for unclear codeComments
File layout hides relationships or reading orderFormatting
Object navigation, data exposure, or class cohesion obstructs a changeObjects and data structures and Classes
Error paths, exception context, or null handling obscures behaviorError handling
A third-party interface leaks into application codeBoundaries
Tests or test-driven development constrain safe changeUnit tests
Construction or framework details dominate policySystems
Passing code still contains duplication or unclear intentEmergence
Shared state, scheduling, deadlock, or shutdown creates riskConcurrency
Each new feature makes the structure worseSuccessive refinement
Untested or unowned legacy code must change safelyJUnit internals and Refactoring SerialDate
A review needs a broad diagnostic catalogSmells and heuristics

Conditional references

  • Read the topic index when one concern spans several chapters.
  • Read the cheatsheet first when the task is a broad review rather than one diagnosed smell.
  • Read the patterns catalog when selecting a concrete transformation after diagnosing a smell.
  • Read the glossary when an unfamiliar book term affects the decision.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.