agentleFS
5uck1ess5uck1ess/devkit/skills/clean-code/SKILL.md

clean-code

Skill4 starsChanged 4 months agoMITView on GitHub

Clean code principles — meaningful names, small functions, single responsibility, stepdown rule, flat nesting.

112 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, nextjs-react-expert 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.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 5 projects that use this

  • SKB3002Skill

    nextjs-react-expert

    React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.

    Also in 3 projects that use this

  • xfstudioSkill

    bash-pro

    Master of defensive Bash scripting for production automation, CI/CD

    Also in 4 projects that use this

  • xfstudioSkill

    code-refactoring-tech-debt

    You are a technical debt expert specializing in identifying, quantifying, and prioritizing technical debt in software projects. Analyze the codebase to uncover debt, assess its impact, and create acti

    Also in 4 projects that use this

  • flying-diceSkill

    clean-code-review

    Multi-agent clean code audit — each principle gets its own agent

    Also in 3 projects that use this

  • goca-seSkill

    batch-operations

    Apply a change safely across many files — refactors touching more than 5 files, library or API migrations, project-wide renames of symbols/imports/paths, or adding boilerplate to many files. Use when "do it all at once" risks context overflow or silent failures.

    Also in 3 projects that use this

  • +4 more from xfstudio

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 105 edited versions we read keep these.

  • 2

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

    Don't abbreviate unless the abbreviation is universally understood (url, id, config).

    line 11
  2. Very specific:

    Every module/class/function should have one reason to change.

    line 23
  3. Distinctive:

    Ask: "If requirement X changes, how many files do I touch?" If the answer is many, responsibilities are entangled.

    line 25
  4. Distinctive:

    If you're indented more than 2 levels, look for an extraction or early return.

    line 73

“Common” is measured: kept by at least 6 in 10 of the 105 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

Meaningful Names

  • Names should reveal intent. getUserById not getData. isExpired not check.
  • Don't abbreviate unless the abbreviation is universally understood (url, id, config).
  • Booleans read as questions: isReady, hasPermission, shouldRetry.
  • Functions read as actions: calculateTotal, validateInput, sendNotification.

Small Functions

A function should do one thing. If you're describing what a function does and use the word "and," it does too much.

Aim for 5-15 lines. Not a hard rule, but long functions almost always contain extractable sub-functions.

Single Responsibility

Every module/class/function should have one reason to change. If a module handles both parsing and validation, a change to parsing rules forces you to touch validation code (and vice versa).

Ask: "If requirement X changes, how many files do I touch?" If the answer is many, responsibilities are entangled.

The Stepdown Rule

Organize code so readers encounter high-level logic first, details later. A file should read like a newspaper article — headline, summary, then details.

// Good: high-level flow is immediately clear
function processOrder(order) {
  validate(order);
  const total = calculateTotal(order.items);
  return submitPayment(order.customer, total);
}

// Supporting functions follow below
function validate(order) { /* ... */ }
function calculateTotal(items) { /* ... */ }
function submitPayment(customer, total) { /* ... */ }

Public/exported functions at the top. Private/helper functions below.

Flat Nesting

Deeply nested code is hard to follow. Prefer early returns, guard clauses, and extraction.

// Bad: nested
function process(input) {
  if (input) {
    if (input.isValid) {
      if (!input.isProcessed) {
        return doWork(input);
      }
    }
  }
  return null;
}

// Good: flat
function process(input) {
  if (!input) return null;
  if (!input.isValid) return null;
  if (input.isProcessed) return null;
  return doWork(input);
}

If you're indented more than 2 levels, look for an extraction or early return.

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.