Claude Code

The Clean Code Author's Own Rules for Claude: Test First, Smallest Fix, Then Clean

Robert C. Martin, the author of Clean Code, turned his coding rules into one free Claude skill, past 8,000 stars. What it makes Claude do, how to install it in a minute, and the catch

2min read
1prompts to copy
3numbered steps
5sections

AI writes code fast, but it often writes it messy: big functions, no tests, fixes bolted onto fixes. Robert C. Martin, the author of the famous book Clean Code, published his own working rules as a Claude skill. Once it's on, Claude works the way he does.

Here's what changes, how to install it, and what you need for the extra checks.

What Claude does with it

  • Test first: before it changes your code, Claude writes a test that fails for the reason it expects.
  • Smallest fix: it makes the smallest change that makes that test pass, nothing extra.
  • Then clean: it refactors, fixes the root cause instead of hiding the crash, and proves the behaviour didn't change.
  • Mess score: every function gets a score (complexity times missing test coverage); anything at 10 or more gets split or tested.
  • A log: Claude keeps a log of every action and why, and reports it when it's done. Small commits that say what changed and how it was proven.

Free, for your email

Get the full setup steps + the copy-paste setup prompt

The rest of this guide (4 more sections, 1 copy-paste prompt) opens right here. The setup prompt, one paste into Claude that sets it all up, comes by email only. Use your real address.

Unlocks: Step 1: install it (one file) · Step 2 (optional): the scoring tools · The catch · Sources

50,000+ follow where these guides come from. No spam, reply “unsubscribe” any time.

Free MCP directory

Make your AI 100x more powerful.

Connect Claude, ChatGPT or Cursor to the apps you already use. Thousands of servers, one click to set up.

Browse free MCP servers

Read next