Code Quality

Clean Code

Writing readable, maintainable code

Write code that reads like well-written prose using Robert C. Martin's Clean Code principles. This skill equips your AI agent with naming conventions, function design, error handling patterns, and refactoring techniques that make codebases maintainable.

Updated Free & MIT-licensed

npx skills add wondelai/skills/clean-code --global

02 What it is

What is the Clean Code skill?

Clean Code is a free AI agent skill built on Robert C. Martin's book. It gives your agent the rules that make code readable — intention-revealing names, functions that do one thing, error handling that doesn't obscure logic — and applies them while it writes and reviews, not in a cleanup pass afterwards.

03 Key concepts

Five principles your agent applies.

Drawn from Clean Code — not advice it repeats back to you, but decisions it makes while it works.

01 Meaningful Names Use intention-revealing names for variables, functions, and classes — the name should tell you why it exists.
02 Small Functions Functions should do one thing, do it well, and do it only. Keep them short, focused, and at one level of abstraction.
03 Comments Are a Failure Good code is self-documenting. If you need a comment, first try to express the intent in code.
04 Error Handling Use exceptions rather than return codes. Write try-catch-finally first, then fill in the body.
05 The Boy Scout Rule Leave the codebase cleaner than you found it — always make small improvements as you go.

04 Fit

When to use it, and
when not to.

four symptoms it fixes, and four it doesn't.

Reach for it when

Your agent writes code that works but reads like it was generated, with names like data2 and 80-line functions.

You're reviewing a pull request and want the naming and function-level problems caught before a human reads it.

A file has grown to the point where nobody can tell what a function does without reading its whole body.

You want a consistent style enforced across a codebase several people (and several agents) touch.

Reach for something else when

The structure is the problem, not the prose. use Clean Architecture for module and dependency boundaries.

You need named, behaviour-preserving transformations with a safety procedure. that's Refactoring.

The code has no tests and you daren't touch it. start with Legacy Code, which gets you a safety net first.

You are trying to reduce interface complexity rather than improve readability. see Software Design.

05 Prompts

Say it like this.

Name the skill at the end of a prompt and the agent applies the framework rather than a vibe. Or say nothing — it loads on its own when a task matches.

example prompts
# 01 · Code review

Review this module for Clean Code violations and suggest refactors using clean-code skill

# 02 · Naming

Rename these functions and variables to be more intention-revealing using clean-code skill

# 03 · Refactoring

Break this 200-line function into clean, single-responsibility functions using clean-code skill

# 04 · Error handling

Refactor the error handling in this service to follow Clean Code patterns using clean-code skill

06 About the author

Robert C. Martin

Co-author of the Agile Manifesto, 50+ years in software

Robert C. Martin (Uncle Bob) is a software engineer, author, and co-author of the Agile Manifesto. He has been a programmer since 1970 and is one of the most influential voices in software craftsmanship.

08 Questions

Before you install.

01

How do I install the Clean Code skill?

Run npx skills add wondelai/skills/clean-code --global. It takes about 30 seconds and needs no account. The Clean Code skill then works in Claude, Claude Code, Claude Cowork, Codex, Cursor, OpenClaw and Hermes Agent — anything that reads the open agentskills.io format — and your agent loads it on its own when a task calls for it. It is free and MIT-licensed, and the source is at https://github.com/wondelai/skills.

02

Which book is the Clean Code skill based on?

It packages Clean Code by Robert C. Martin — co-author of the Agile Manifesto, 50+ years in software. The skill distils the book's method into instructions your agent follows while it works, covering meaningful names, small functions and comments are a failure. It sits in the Code Quality part of the library.

03

Do I need to have read Clean Code to use this skill?

No. The skill carries the operational parts of the book — the naming heuristics, the function-size rules, the argument against explanatory comments — so your agent applies them whether or not you can quote them. The book is still worth reading for the reasoning and the long worked examples, which is why every page here links it.

04

How is this different from the Refactoring skill?

Clean Code is about what good code looks like; Refactoring is about how to get there safely. Clean Code will tell your agent that a function is doing three things and should be split. Refactoring gives it the named transformation — Extract Method — and the discipline of small steps with the tests green between each one. They compose well: Clean Code finds the smell, Refactoring performs the surgery.

05

Will it rewrite my whole codebase if I install it?

No. Skills load when a task calls for them, and they change what your agent does with the code you point it at — nothing runs on its own. In practice you'll see it most in new code your agent writes and in reviews you explicitly ask for. If you want a sweep, ask for one file at a time and keep the diffs reviewable.

06

Some of Clean Code is contested. Does the skill take a side?

It applies the book's principles as written, including the strong positions on comments and function length. Those are the parts practitioners argue about most. Treat its output as an informed opinion to push back on, not a linter — if your team has settled on different conventions, say so in the prompt and it will follow yours.

One skill, one command.

Install Clean Code, or the whole stack.

npx skills add wondelai/skills/clean-code --global

MIT licensed · Claude, Claude Code, Codex, Cursor, OpenClaw, Hermes · No account

  We build the skills you already use. Now we’ll build yours. See what we build  ·  Book a 15-min call