clean-code
Skill10 starsChanged 2 months agoMITView on GitHub
Knowledge base distilled from "Clean Code: A Handbook of Agile Software Craftsmanship" by Robert C. Martin (Uncle Bob): all 17 chapters plus a decision cheat sheet, a technique and pattern catalogue, a glossary, and a cross-language map. Use it to apply Uncle Bob's frameworks for meaningful names, small functions, comments, formatting, objects vs data structures, error handling, boundaries, unit tests / TDD, class design (SRP), systems, concurrency, refactoring, and code smells — while writing code, reviewing a diff, cleaning up, or doing TDD. Trigger phrases: clean code, 整洁代码, 代码整洁, 重构, refactor, 代码质量; naming, 命名, meaningful names, 变量名, 函数名, 命名规范; 函数设计, 小函数, do one thing, 函数拆分; 注释, comments, 该不该写注释; TDD, 单元测试, unit test, 测试驱动, clean tests; 异常处理, error handling, 异常设计; 代码味道, code smell, 坏味道, 反模式, code review; SRP, 面向对象, 类设计, 对象与数据结构, 并发.
63 other projects use a version of this.
Adopted by
Most recently taken up by
- superplanehq/superplanetheir own version, first seen Oct 5, 2026
- JeffreyFerreiras/ai-skillstheir own version, first seen Oct 5, 2026
- sbluemin/fleet-harnesstheir own version, first seen Oct 4, 2026
- jd-solanki/krutrimboxtheir own version, first seen Sep 27, 2026
- samirpatil2000/skillstheir own version, first seen Sep 26, 2026
- btseee/clean-code-skillstheir own version, first seen Sep 25, 2026
Used with
Projects with it also use 2d-games, 3d-games and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
tiendatworkSkill2d-games
2D game development principles. Sprites, tilemaps, physics, camera.
Also in 3 projects that use this
tiendatworkSkill3d-games
3D game development principles. Rendering, shaders, physics, cameras.
Also in 3 projects that use this
MindrallySkillclean-architecture
Guidelines for implementing Clean Architecture patterns in Flutter and Go applications, with emphasis on separation of concerns, dependency rules, and testability.
Also in 7 projects that use this
ratacatSkilldesign-patterns
Use when designing software architecture, refactoring code structure, solving recurring design problems, or when code exhibits symptoms like tight coupling, rigid hierarchies, scattered responsibilities, or difficult-to-test components. Also use when choosing between architectural approaches or reviewing code for structural improvements.
Also in 5 projects that use this
kayamanSkillsolid-principles
Enforces SOLID principles (SRP, OCP, LSP, ISP, DIP) in object-oriented and multi-paradigm code. Use when designing classes and interfaces, evaluating responsibility assignment, reviewing code for coupling issues, applying dependency inversion, refactoring fat interfaces, or checking that subtypes are truly substitutable.
Also in 3 projects that use this
DIL8654Skilllogging-patterns
Keep logs structured, correlated, low-noise, and safe for production support. Use when adding operational logging, reviewing observability, or improving diagnostics in .NET services.
Also in 3 projects that use this
- +6 more from tiendatwork
Other versions63 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 63
- superplanehq/superplane★ 7.7ksame name
- ciembor/agent-rules-books★ 2.9ksame name
- wondelai/skills★ 2.3ksame name
- decebals/claude-code-java★ 747same name
- Mindrally/skills★ 266same name
- xenitV1/claude-code-maestro★ 229same name
- techygarg/lattice★ 197same name
- ratacat/claude-skills★ 56same name
- DGouron/review-flow★ 44same name
- kumaran-is/claude-code-onboarding★ 36same name
53 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-coding-styleSkill
- article-deconstructorSkill
- black-humor-writingSkill
- chatgpt-bridgeSkill
- claude-rememberSkill
- claude-simplifySkill
- curriculum-designSkill
- de-ai-writingSkill
- design-md-extractorSkill
- edulabSkill
- github-analyzerSkill
- graspSkill
- image-designSkill
- infocardSkill
- jira-server-pat-cliSkill
- llm-aiopsSkill
- mckinsey-coverSkill
- mlx-ttsSkill
- novel-writingSkill
- obsidian-kb-builderSkill
- pdf2mdSkill
- prompt-enhancerSkill
- skill-security-checkSkill
- snowflake-novel-writerSkill
- spec-imageSkill
- teach-eli5Skill
- video-dubbingSkill
- video-minutesSkill
- wechat-article-writerSkill
- weitoutiao-creatorSkill
- workbuddy-context-handoffSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 59 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 51
Read that one file; preloading references/ defeats the routing table.
- Distinctive: line 52
Follow a chapter's cross-reference only when the question actually needs it.
- Very specific: line 59
Read references/cheatsheet.md — it is the review lens.
- Distinctive: line 107
Pass all tests: before any other design improvement — Simple Design rule 1 (Ch 12).
- Distinctive: line 115
Stop once the routed file answers the question.
- Distinctive: line 116
Do not chase a framework past the one linked chapter unless the user wants the derivation.
“Common” is measured: kept by at least 6 in 10 of the 59 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clean Code
Author: Robert C. Martin (Uncle Bob) | Pages: ~462 | Chapters: 17 | Generated: 2026-08-24
Purpose
A synthesised study aid for Clean Code: it maps every named framework, principle, anti-pattern, and heuristic in the book to a reference file, then routes a question or a review finding to the file that answers it. It produces grounded advice with chapter citations — not the book text, and not a linting tool.
When to Use
- Naming, functions, comments, formatting, objects vs data structures, error handling, boundaries, tests/TDD, classes/SRP, systems, concurrency, refactoring, code smells.
- A live review or cleanup where you must name why something is a smell and what to do.
- Studying the book, or asking "what does Uncle Bob say about X".
- Trigger phrases: 整洁代码, 重构, 代码质量, 命名, 函数设计, 注释, 代码味道, 反模式, 测试驱动; clean code, naming, TDD, error handling, code smell, code review, SRP.
When NOT to Use
- Review-and-fix of a diff ->
claude-simplifyruns the review and applies fixes; this skill only supplies the justification the review cites. - Beyond the book — design patterns, architecture, framework idioms -> say it is out of scope; do not extrapolate book positions.
- Untrusted third-party code safety ->
skill-security-check. - Language tooling (linters, formatters, rule configs) -> not covered.
Workflow
A. Look something up
- Classify the question into a topic in the Decision Rules table.
- Read that one file; preloading
references/defeats the routing table. - Follow a chapter's cross-reference only when the question actually needs it.
- Answer from the loaded content, citing chapter and heuristic ids (
Ch 3,G5,F1). - For a non-Java language, read
references/appendix-lang-map.mdand translate rather than quoting Java syntax.
B. Apply the book to a live code review
- Read
references/cheatsheet.md— it is the review lens. - Tag each diff finding with its C/E/F/G/J/N/T heuristic id; load
references/chapters/ch17-smells-and-heuristics.mdfor tags absent from the cheat sheet. - Name the fixing framework, then load the chapter that owns it via the routing table.
- Load
references/patterns.mdwhen the fix is a technique and you need its trade-offs. - Report each finding as: id -> why -> fix -> citation.
Decision Rules
Route by topic; load exactly one row's file:
| Topic | File | Topic | File |
| Boy Scout Rule, LeBlanc's law, professionalism | references/chapters/ch01-clean-code.md | Classes, SRP, cohesion | references/chapters/ch10-classes.md |
| Naming: intent-revealing, no encodings | references/chapters/ch02-meaningful-names.md | Systems: construction vs use, DI, factory | references/chapters/ch11-systems.md |
| Functions: Do One Thing, step-down, CQS, args | references/chapters/ch03-functions.md | Four Rules of Simple Design, emergence | references/chapters/ch12-emergence.md |
| Comments: good vs bad | references/chapters/ch04-comments.md | Concurrency: isolation, shared state | references/chapters/ch13-concurrency.md |
| Formatting: newspaper metaphor, ordering | references/chapters/ch05-formatting.md | Args case study, festering pile, refinement | references/chapters/ch14-successive-refinement.md |
| Objects vs data, Law of Demeter | references/chapters/ch06-objects-and-data-structures.md | Extract Method, Collecting Parameter | references/chapters/ch15-junit-internals.md |
| Errors, null, Special Case | references/chapters/ch07-error-handling.md | enum over int, Feature Envy fix, factory | references/chapters/ch16-refactoring-serialdate.md |
| Boundaries, learning tests, adapters | references/chapters/ch08-boundaries.md | Smells (C/E/F/G/J/N/T), DRY, ONE SWITCH | references/chapters/ch17-smells-and-heuristics.md |
| TDD three laws, F.I.R.S.T., BUILD-OPERATE-CHECK | references/chapters/ch09-unit-tests.md |
Cross-chapter topics: Demeter / Feature Envy -> ch06 + ch17; DRY -> ch12 + ch17; refactoring -> ch14 + ch16; Boy Scout Rule -> ch01 + ch15.
Other routing:
- One-line definition only ->
references/core-frameworks.md; escalate to the chapter after. - Concrete technique or pattern + trade-offs ->
references/patterns.md. - A term you cannot place ->
references/glossary.md, which names its chapter. - A "what should I decide" question ->
references/cheatsheet.md. - Conflict between two answers -> apply Priority below.
Constraints
- Never present this skill as the book's verbatim text. It is a study aid; attribute paraphrases as "the book's argument", never as a quotation.
- Cite chapter and heuristic ids whenever you assert a principle.
- Do not summarise detail away. One-liners orient only; when reasoning or edge cases matter, read the chapter and answer from it.
- Principles are language-agnostic. Java examples are carriers, not the rule.
- Stay in scope. Outside Clean Code, say so instead of inventing book positions.
Priority
When rules compete:
- Pass all tests before any other design improvement — Simple Design rule 1 (Ch 12).
- Then, in the book's order: remove duplication, polish expressiveness, minimise the number of classes/methods (Ch 12).
- Project conventions and language idioms override the Java-specific J-series heuristics.
- Name the smell before proposing the fix — an unnamed finding cannot be checked.
Stop Conditions
- Stop once the routed file answers the question; never read all 17 chapters.
- Do not chase a framework past the one linked chapter unless the user wants the derivation.
- Topic outside the book -> stop and say so.
Verification
- The answer cites at least one chapter or heuristic id.
- Only the routed file(s) were loaded, not the whole
references/directory. - Non-Java requests were translated via
references/appendix-lang-map.md. - Nothing is presented as a verbatim book quotation.
- Review findings are reported as id -> why -> fix -> citation.
Output
- Outcome: Clean Code guidance with chapter citations, or a coded review of a diff.
- Done when: the question is classified, the routed reference was read, and the answer cites its source.
- Evidence: the framework or smell id, its chapter, and the concrete change to make.
References
Load only when needed:
references/core-frameworks.md— read for a one-line definition before escalating.references/cheatsheet.md— read first for any live review or "what should I decide" case.references/glossary.md— read when a term is unfamiliar; it gives the owning chapter.references/patterns.md— read when the fix needs a technique and its trade-offs.references/appendix-lang-map.md— read before quoting Java syntax to a non-Java user.references/chapters/— read only the single chapter named by the routing table.
Related Skills
claude-simplify— runs a diff review and fixes findings; pair with this skill for the taxonomy behind each finding.skill-security-check— pre-install safety review, a different concern.
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
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.

