agentleFS
PanPanFRPanPanFR/oh-my-openkilo/skills/clean-code/SKILL.md

clean-code

Skill9 starsChanged 3 months agoMITView on GitHub

Use when writing new code, reviewing PRs, refactoring legacy code, or reviewing code quality, readability, naming conventions, function size

63 other projects use a version of this, 7 of them edited.

Adopted by

Most recently taken up by

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.
  • tiendatworkSkill

    2d-games

    2D game development principles. Sprites, tilemaps, physics, camera.

    Also in 3 projects that use this

  • tiendatworkSkill

    3d-games

    3D game development principles. Rendering, shaders, physics, cameras.

    Also in 3 projects that use this

  • MindrallySkill

    clean-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

  • ratacatSkill

    design-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

  • kayamanSkill

    solid-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

  • DIL8654Skill

    logging-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

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 59 edited versions we read keep these.

  • 3

    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
  1. Very specific:

    No disinformation: don't call it accountList if it's a Map

    line 15
  2. Distinctive:

    No side effects - no secretly changing global state

    line 22
  3. Distinctive:

    Don't comment bad code - rewrite it:

    line 25
  4. Distinctive:

    Don't return null; don't pass null

    line 55

“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.

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

Clean Code

Principles from Robert C. Martin's "Clean Code". Transform "code that works" into "code that is clean": readable and enhanceable by a developer other than its original author.

1. Meaningful Names

  • Intention-revealing: elapsedTimeInDays not d; pronounceable/searchable, no genymdhms
  • No disinformation: don't call it accountList if it's a Map
  • Meaningful distinctions: avoid ProductData vs ProductInfo
  • Classes = nouns (Customer), avoid Manager/Data; methods = verbs (postPayment)

2. Functions

  • Small. Do ONE thing. One level of abstraction per function (don't mix business logic with regex details)
  • Arguments: 0 ideal, 1-2 fine, 3+ needs strong justification
  • No side effects - no secretly changing global state

3. Comments

  • Don't comment bad code - rewrite it:
    # bad: comment explains what code should say
    if employee.flags & HOURLY and employee.age > 65:
    # good: code explains itself
    if employee.isEligibleForFullBenefits():
  • Good comments: legal, intent/why, platform traps, non-obvious constraints, actionable TODOs. Keep concise (1-2 lines max).
  • Bad: mumbling, redundant, misleading, mandated, noise, position markers.
  • AI Comment Slop to eliminate:
    • Decorative separators: // ============, /* ---- ROUTES ---- */, box-drawing borders.
    • Restating the obvious / signature echo: let count = 0; // Initialize count, repeating JSDoc params without added value.
    • Workflow narration: // Step 1: Validate, // Step 2: Process, // Step 3: Return.
    • Empty labels: // Main logic, // Helper function, // Business logic.
    • Vague TODOs: // TODO: improve this without actionable task and context.
    • Decorative emoji in code: // 🚀 Performance, // ✅ Done.
    • End markers: } // end if, # End of function.
    • Line-by-line narration: narrating each line instead of explaining block intent.

4. Formatting

  • Newspaper metaphor: high-level concepts top, details bottom
  • Related lines close together; variables declared near usage

5. Objects & Data Structures

  • Hide implementation behind interfaces
  • Law of Demeter: avoid a.getB().getC().doSomething()
  • DTOs: public variables, no functions

6. Error Handling

  • Exceptions over return codes; write try-catch-finally first (defines scope)
  • Don't return null; don't pass null

7. Unit Tests

  • Three laws of TDD: no production code without failing test; no more test than sufficient to fail; no more production code than sufficient to pass
  • F.I.R.S.T.: Fast, Independent, Repeatable, Self-Validating, Timely

8. Classes

  • Small, single responsibility (SRP); stepdown rule - reads top-down

9. Smells

Rigidity (hard to change), fragility (breaks in many places), immobility (hard to reuse), viscosity (hard to do the right thing), needless complexity/repetition.

Checklist

  • Function < 20 lines? Does exactly one thing?
  • Names searchable and intention-revealing?
  • Comments avoided by making code clearer?
  • Too many arguments?
  • Failing test exists for this change?

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.