agentleFS
jjmrochajjmrocha/coding-skills/coding-discipline/SKILL.md

coding-discipline

Skill1 starsChanged 30 days agoMITView on GitHub

Use when writing or modifying code, especially in agentic flows — before composing diffs, generating new modules, or applying suggested fixes

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    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. Distinctive:

    Parallel solution: Before writing a new helper, pattern, or solution, ask: *does this codebase already solve this problem class?*

    line 35
  2. Very specific:

    Helper: before writing formatDate/chunk/parseId, grep for similar names and inspect existing utils modules.

    line 37
  3. Very specific:

    Library: before adding a dependency, check package.json / go.mod / pyproject.toml for an existing equivalent.

    line 38

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

Coding Discipline

If you can name the failure mode you're about to commit, you usually won't commit it.

Six failure modes most common in LLM-written code, with the counter for each.

The Six Failure Modes

Failure modeSymptomCounter
Silent assumptionPicking one reading of an ambiguous askState the assumption, or ask
Scope creepTouching adjacent code "while here"Every changed line traces to the ask
Speculative complexityAdding config/abstraction nobody asked forBuild the smallest thing
HallucinationReferencing symbols/APIs/paths that don't existVerify before writing; run before claiming done
DriftLosing the original goal over a long sessionStop when the verifiable check passes
Parallel solutionNew helper/pattern for a problem the repo already solves — or a tidier variant of one it already usesSearch first; reuse what exists, and match its shape instead of improving it

Falsifiable Tests

Silent assumption. Before any non-trivial change, name the load-bearing assumption in one sentence. If you can't, you don't know what you're building. If two readings are reasonable, present both — e.g., "Reading 'cache user lookups' as in-process LRU rather than shared cache — flag if you meant the latter."

Scope creep. A diff answers one question: what did the user ask for? Every other line is contraband. Allowed: orphans your own change created (unused imports, dead branches you rewrote). Not allowed: "while I'm here" reformatting, renaming, dead-code removal, style sweeps — mention them in your reply, don't commit them. Two unrelated chunks → split the diff.

Speculative complexity. Does a second caller exist right now that needs a different value? No → don't add the parameter. The same test kills: "I'll make this configurable", base classes for hypothetical implementations, wrappers for hypothetical callers, and handling structurally impossible errors. If the simplest version is half the size, write that one.

Hallucination. Look it up before writing — prefer serena symbolic tools (find_symbol, get_symbols_overview, find_referencing_symbols) over Read/Grep; context7 for external library docs; grep/Read otherwise. "It should work" ≠ "I ran it and it works". When you couldn't confirm, mark uncertainty: "I think it's obj.foo() but haven't verified."

Drift. Restate the request as one of: a failing test you'll make pass, a specific output you'll produce, a specific observable behavior. For multi-step work: 2–4 steps, each paired with its check. A step is done when its check passes — not before.

Parallel solution. Before writing a new helper, pattern, or solution, ask: does this codebase already solve this problem class?

  • Pattern: pagination/validation/auth/error-handling/retries/logging/config — find an existing one and copy its shape.
  • Helper: before writing formatDate/chunk/parseId, grep for similar names and inspect existing utils modules.
  • Library: before adding a dependency, check package.json / go.mod / pyproject.toml for an existing equivalent.

Parallel solutions double maintenance, split conventions, and confuse future readers about which version is canonical.

Finding the existing solution isn't enough — copy its shape. A tidier variant of a pattern the repo uses everywhere is still a parallel solution: the repo now has two ways to do one job, and yours is the outlier. Match the existing verbosity even when a wrapper would be cleaner. If the tidier version is genuinely better, propose it as its own change — never smuggle it in as a side effect.

Pre-Commit Self-Check

  1. Assumption — stated, or "n/a"?
  2. Scope — every changed line traces to the request?
  3. Simplicity — could a senior cut this in half?
  4. Verification — confirmed referenced symbols/APIs exist? Ran the code, not just wrote it?
  5. Goal — can you name the check that proves this is done?
  6. Reuse — checked the codebase for an existing solution (helpers, patterns, libraries), and matched its shape rather than improving it?

A "no" on any line: stop and revise; don't ship and explain.

Red Flags

Inner thoughtWhat it means
"I'll just guess what they meant"Surface the assumption
"While I'm here, let me also…"Scope creep — stop
"Let me add a flag for flexibility" / "That's real flexibility, not speculation"No second caller exists → don't add the parameter
"I'll handle every conceivable error"Many are structurally impossible
"I'm pretty sure that method exists" / "It should work"Hallucination — look it up; run before claiming done
"I lost track of what they wanted"Drift — restate the goal
"I'll just write a quick helper" / "I'll add a library for this"Grep first; the repo may already solve it
"The repo does this inline everywhere, but a wrapper is cleaner"Still a parallel solution — copy the inline shape; propose the wrapper separately

For trivial tasks (typo fix, one-line rename), use judgment — this skill biases toward caution.

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.

Reviews can't be read right now.

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.