clean-code
Skill266 starsChanged 10 months agoApache-2.0View on GitHub
Clean, maintainable, human-readable code principles combined with anti-over-engineering discipline: naming, single responsibility, DRY, and scoping changes to exactly what was requested. Use when writing new code, refactoring existing code, reviewing code for quality, or deciding how much abstraction a change actually needs.
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 9 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
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
- 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
- VoDaiLocz/kilo-kit-mcp★ 27same 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 repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blazorSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- expo-react-native-javascript-best-practicesSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. 0 are common, 24 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 59 edited versions we read keep these.
24
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Avoid abbreviations unless they're universally understood in the domain (id, url — fine.
- Distinctive: line 29
Use descriptive constant names that explain the value's purpose, not just its value.
- Distinctive: line 30
Keep constants at the top of the file or in a dedicated constants module when shared across files.
- Distinctive: line 34
Don't comment on what the code does — make the code self-documenting through naming and structure instead.
- Distinctive: line 35
Use comments to explain *why* something is done a certain way, especially when the reason isn't visible in the code (a workaround for a …
- Distinctive: line 36
Document public APIs, genuinely complex algorithms, and non-obvious side effects.
- Distinctive: line 42
If a function needs a comment to explain what it does, that's a signal to split it into named sub-functions instead.
- Distinctive: line 78
Keep related code together (a feature's components, hooks, and styles in one directory, not scattered by file type).
- Distinctive: line 80
Use consistent file and folder naming conventions across the codebase.
- Distinctive: line 84
Only change what was asked.
- Distinctive: line 85
When the right level of abstraction is unclear, ask rather than guessing toward the more elaborate option.
- Distinctive: line 86
Do not modify unrequested code, even if it looks improvable — a drive-by refactor in an unrelated function expands the review surface and …
- Distinctive: line 87
Do not add abstractions (interfaces, factories, plugin systems, config layers) without a concrete, current need.
- Distinctive: line 88
Do not import a new dependency to solve a problem a few lines of existing code already solve.
- Distinctive: line 89
Do not rewrite entire files for small changes — a targeted diff is easier to review and safer to ship than a full-file rewrite.
- Distinctive: line 90
Do not add error handling for scenarios that cannot occur given the surrounding code's guarantees — defensive code for impossible states …
- Distinctive: line 108
Leave code cleaner than you found it, scoped to the area you're already touching — not as license to refactor unrelated files.
- Distinctive: line 112
Write a failing test before fixing a bug, so the fix is verified and the bug can't silently regress.
- Distinctive: line 113
Keep tests readable and maintainable — a test that's harder to understand than the code it tests has failed at its job.
- Distinctive: line 114
Test edge cases and error conditions explicitly, not just the happy path.
- Distinctive: line 118
Write clear, specific commit messages that explain why a change was made.
- Distinctive: line 120
Use meaningful branch names that describe the work, not the author or the date.
- Distinctive: line 124
Only the requested code changed — no unrelated files touched.
- Distinctive: line 125
No abstraction was added without a concrete need that exists today.
- Distinctive: line 126
No dependency was added that duplicates something already available.
“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
This skill covers writing code that is easy to read and change, and — just as important — avoiding the over-engineering that makes code harder to read and change in the name of "best practices." Both halves matter together: clean code is simple code, not merely well-decorated code.
Workflow for Writing or Reviewing Code
- Scope the change — Identify exactly what was asked for. Note what's out of scope before writing anything.
- Reach for the simplest solution first — Prefer the direct, obvious implementation over a general or configurable one, unless a concrete current need justifies more.
- Name things for their purpose — Choose names that reveal intent before writing the body of a function or the shape of a type.
- Keep functions single-purpose — If a function needs a comment to explain what it does, split it.
- Remove duplication deliberately — Extract shared logic only once it's actually duplicated (see Rule of Three below), not preemptively.
- Write or update tests — Cover the new behavior and the edge cases it introduces.
- Verify scope before delivery — Confirm only the requested code changed, check for a simpler approach you might have missed, and confirm no unrequested files were touched.
Meaningful Names
- Variables, functions, and classes should reveal their purpose from the name alone.
- Names should explain why something exists and how it's used, not just its type or contents (
activeUserIds, notlist1). - Avoid abbreviations unless they're universally understood in the domain (
id,url— fine;usrCfgTmp— not fine).
Constants Over Magic Numbers
- Replace hard-coded values with named constants (
MAX_RETRY_COUNT = 3, not a bare3three call sites later). - Use descriptive constant names that explain the value's purpose, not just its value.
- Keep constants at the top of the file or in a dedicated constants module when shared across files.
Smart Comments
- Don't comment on what the code does — make the code self-documenting through naming and structure instead.
- Use comments to explain why something is done a certain way, especially when the reason isn't visible in the code (a workaround for a library bug, a non-obvious ordering requirement).
- Document public APIs, genuinely complex algorithms, and non-obvious side effects.
Single Responsibility
- Each function should do exactly one thing.
- Functions should be small and focused enough to be understood without scrolling.
- If a function needs a comment to explain what it does, that's a signal to split it into named sub-functions instead.
DRY — Don't Repeat Yourself
- Extract repeated code into reusable functions once the repetition is real, not anticipated.
- Share common logic through a proper abstraction — a shared function or module, not copy-paste with tweaks.
- Maintain a single source of truth for any given piece of business logic or configuration value.
Encapsulation
- Hide implementation details behind a clear interface; callers shouldn't need to know how a thing works to use it.
- Move nested conditionals into well-named functions or guard clauses instead of deep
if/elsetrees.
// Before
function canCheckout(cart) {
if (cart.items.length > 0) {
if (cart.user.isVerified) {
if (cart.total <= cart.user.creditLimit) {
return true;
}
}
}
return false;
}
// After
function canCheckout(cart) {
const hasItems = cart.items.length > 0;
const isWithinCreditLimit = cart.total <= cart.user.creditLimit;
return hasItems && cart.user.isVerified && isWithinCreditLimit;
}Clean Structure
- Keep related code together (a feature's components, hooks, and styles in one directory, not scattered by file type).
- Organize code in a logical hierarchy that mirrors how the domain is understood.
- Use consistent file and folder naming conventions across the codebase.
Avoiding Over-Engineering
- Only change what was asked. The simplest solution that satisfies the request comes first.
- When the right level of abstraction is unclear, ask rather than guessing toward the more elaborate option.
- Do not modify unrequested code, even if it looks improvable — a drive-by refactor in an unrelated function expands the review surface and the risk of the change.
- Do not add abstractions (interfaces, factories, plugin systems, config layers) without a concrete, current need. A single implementation doesn't need an interface "in case" a second one shows up later — that's speculative generality (YAGNI: "You Aren't Gonna Need It").
- Do not import a new dependency to solve a problem a few lines of existing code already solve.
- Do not rewrite entire files for small changes — a targeted diff is easier to review and safer to ship than a full-file rewrite.
- Do not add error handling for scenarios that cannot occur given the surrounding code's guarantees — defensive code for impossible states adds reading cost without adding safety.
Rule of Three
- Tolerate duplication the first two times a pattern appears.
- Extract an abstraction on the third occurrence, once the actual shape of the shared logic is clear — extracting after one or two instances often guesses wrong about what's actually shared.
Signs of Over-Engineering
- A configuration option that has only ever been set to one value.
- An interface with exactly one implementation and no test double that needs a second.
- A generic
optionsobject accreting fields for hypothetical future callers. - A plugin/strategy pattern introduced before there are two strategies to switch between.
Code Quality Maintenance
- Refactor continuously in small steps rather than deferring cleanup to a dedicated "refactor sprint."
- Fix technical debt early, while the context for why the code looks the way it does is still fresh.
- Leave code cleaner than you found it, scoped to the area you're already touching — not as license to refactor unrelated files.
Testing
- Write a failing test before fixing a bug, so the fix is verified and the bug can't silently regress.
- Keep tests readable and maintainable — a test that's harder to understand than the code it tests has failed at its job.
- Test edge cases and error conditions explicitly, not just the happy path.
Version Control
- Write clear, specific commit messages that explain why a change was made.
- Make small, focused commits — one logical change per commit.
- Use meaningful branch names that describe the work, not the author or the date.
Before Delivery Checklist
- Only the requested code changed — no unrelated files touched.
- No abstraction was added without a concrete need that exists today.
- No dependency was added that duplicates something already available.
- A simpler approach was considered and ruled out, not just skipped.
- New behavior has test coverage, including at least one edge case.
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.

