agentleFS
berkeley-humanoidsberkeley-humanoids/Skills/skills/clean-coding/SKILL.md

clean-coding

Skill4 starsChanged 34 days agoCC0-1.0View on GitHub

Minimal, direct code with the smallest scoped diff, concise names, and no speculative config, one-use helpers, dead code, or history comments. Use when writing or reviewing code.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. berkeley-humanoids/skills★ 4100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    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 repository8 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. About 0 are common, 17 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write the smallest obvious implementation that satisfies the current requirement.

    line 8
  2. Distinctive:

    Follow established project conventions for mechanical style.

    line 10
  3. Distinctive:

    Do not add flexibility, extension points, defensive branches, or settings for hypothetical future needs.

    line 15
  4. Distinctive:

    Prefer a simple data representation that removes special cases over adding conditionals around them.

    line 16
  5. Distinctive:

    Use the shortest conventional name that is unambiguous at its scope.

    line 21
  6. Distinctive:

    Prefer concise domain names.

    line 23
  7. Very specific:

    Do not encode change history or recency: no new, old, v2, final, fixed, or similar suffixes unless they are the actual domain distinction.

    line 26
  8. Distinctive:

    Do not introduce a variable merely to name a simple expression used once unless the name materially improves clarity.

    line 27
  9. Distinctive:

    Every parameter and return value must be necessary and used.

    line 31
  10. Very specific:

    Use explicit signatures. Do not use a bare * keyword-only marker.

    line 32
  11. Distinctive:

    Prefer straightforward control flow and eliminate special cases when the data or structure can make them ordinary cases.

    line 34
  12. Distinctive:

    Do not extract a private helper merely to shorten a function.

    line 35
  13. Distinctive:

    Do not introduce module/global state for convenience when a local, parameter, or object attribute is sufficient.

    line 40
  14. Distinctive:

    Do not turn a stable implementation constant into configurable state merely to make it adjustable.

    line 41
  15. Distinctive:

    Do not scatter config values across unrelated implementation files.

    line 43
  16. Distinctive:

    Never restate obvious code.

    line 53
  17. Distinctive:

    If an old decision contains an enduring fact, keep only the fact:

    line 55
  18. Distinctive:

    No commented-out code, superseded branches, unused parameters, or compatibility paths kept "just in case".

    line 65
  19. Very specific:

    Delete from __future__ import annotations unless the module needs deferred evaluation, such as annotations that reference …

    line 66
  20. Very specific:

    Never invent metadata such as _note, reason, changed_from, old_value, or migration_note to preserve conversation history.

    line 68
  21. Distinctive:

    Read the diff as if you had never seen the conversation.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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 Coding

Write the smallest obvious implementation that satisfies the current requirement. Unnecessary generality is a bug. Every added line needs a concrete reason to exist now.

Follow established project conventions for mechanical style. Do not make unrelated edits.

Keep the implementation direct

  • Reuse existing code and the standard library before adding abstractions, dependencies, files, or configuration.
  • Do not add flexibility, extension points, defensive branches, or settings for hypothetical future needs.
  • Prefer a simple data representation that removes special cases over adding conditionals around them.
  • Preserve existing behavior and interfaces unless the task requires changing them.

Names

Use the shortest conventional name that is unambiguous at its scope. Names describe what a thing is, not its history or implementation story.

  • Prefer concise domain names; do not turn identifiers into English sentences.
  • Spell words out. Use an abbreviation only when it is standard in the domain or already conventional in the codebase (cmd, idx, ms); never invent contractions or drop vowels. Write _left / _right, not _l / _r.
  • Include units or reference frames when ambiguity matters: timeout_ms, pos_world.
  • Do not encode change history or recency: no new, old, v2, final, fixed, or similar suffixes unless they are the actual domain distinction.
  • Do not introduce a variable merely to name a simple expression used once unless the name materially improves clarity.

Functions and control flow

  • Every parameter and return value must be necessary and used. Remove unused arguments, single-value flags, and redundant conditions.
  • Use explicit signatures. Do not use a bare * keyword-only marker. Avoid *args and **kwargs; use them only when an interface you do not control requires forwarding them.
  • Validate at the boundary. Do not repeat checks internally for states that cannot occur.
  • Prefer straightforward control flow and eliminate special cases when the data or structure can make them ordinary cases.
  • Do not extract a private helper merely to shorten a function. Inline one-use helpers. Extract when logic is reused by another code path or an interface requires a separate callable.
  • Long function bodies are fine when they represent one readable procedure. Use sparse section comments to divide major steps instead of scattering the flow across helpers.

State and configuration

  • Do not introduce module/global state for convenience when a local, parameter, or object attribute is sufficient.
  • Do not turn a stable implementation constant into configurable state merely to make it adjustable.
  • Real user/project configuration belongs in the project's existing centralized config location. If none exists, create one organized config module/file only when there are enough genuine settings to justify a configuration surface.
  • Do not scatter config values across unrelated implementation files.

Comments and docstrings

Code is self-explanatory by default. Write a comment only for:

  1. a section header in a long procedure;
  2. a non-obvious pitfall or easy-to-miss correctness issue;
  3. an enduring constraint, invariant, unit/frame convention, protocol rule, or rationale.

Never restate obvious code. Never turn conversation, debugging, or diff history into source-code provenance: no "changed from", "previously", "for now", "after debugging", or similar narration.

If an old decision contains an enduring fact, keep only the fact:

// Raised from 100 Hz after debugging -> // Controller diverges below 200 Hz.

Otherwise delete the comment. History belongs in the issue, commit, PR, or design document.

Docstrings are brief API overviews, not walkthroughs. State only purpose and non-obvious contract details such as units, frames, side effects, ownership, or exceptional behavior. Omit docstrings when the name, signature, and types already say enough. Do not add Args: / Returns: blocks that merely repeat the signature.

Dead code and structured config

  • No commented-out code, superseded branches, unused parameters, or compatibility paths kept "just in case". Version control holds history.
  • Delete from __future__ import annotations unless the module needs deferred evaluation, such as annotations that reference TYPE_CHECKING-only imports.
  • In JSON/YAML/TOML/URDF/MJCF and similar files, add only fields consumed by the program, defined by the schema, or requested by the user.
  • Never invent metadata such as _note, reason, changed_from, old_value, or migration_note to preserve conversation history.

Before done

Read the diff as if you had never seen the conversation. Remove any added comment, helper, argument, condition, config field, global, file, or abstraction that is not required by the resulting system.

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.