agentleFS
eliranpv11eliranpv11/code-discipline-skills/CLAUDE.md

code-discipline-skills

CLAUDE.md2 starsChanged 5 months agoMITView on GitHub

A coding methodology for production systems that must last. Not a communication standard. Not an honesty protocol. Purely: how to write code well. Merge with your project-specific CLAUDE.md as needed. Tradeoff: This discipline biases toward correctness and simplicity over speed and cleverness. For throwaway scripts, apply judgment. For production code — apply everything. Every technical decision is evaluated in this order: The goal is not "it works" — it is "it works correctly and reliably one year from now." Don't…

  • Commits and pushes

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

37 rules. About 0 are common, 35 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈35

    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:

    Not a communication standard.

    line 4
  2. Distinctive:

    Every technical decision is evaluated in this order:

    line 15
  3. Distinctive:

    Before writing any code, present all four:

    line 33
  4. Distinctive:

    If uncertain — ask, don't assume and proceed

    line 40
  5. Distinctive:

    If multiple interpretations exist — present them, don't pick silently

    line 41
  6. Distinctive:

    If a simpler approach exists — say so and push back

    line 42
  7. Distinctive:

    If information is missing — stop and ask.

    line 43
  8. Distinctive:

    Before writing or changing code:

    line 51
  9. Distinctive:

    Read the actual files involved.

    line 52
  10. Distinctive:

    Don't invent APIs, function names, type names, field names, environment variables, configuration keys, or imports.

    line 53
  11. Distinctive:

    Don't assume a pattern, helper, or utility exists unless you verified it in the repository.

    line 54
  12. Distinctive:

    Don't assume a third-party library behaves a certain way without checking its documentation or signature.

    line 55
  13. Distinctive:

    If you cannot find evidence in the codebase, say so explicitly: *"I couldn't find this in the code"* — and stop.

    line 56
  14. Very specific:

    Evidence standard for claims: When stating that code works, that a test passes, or that a file does something specific, cite file:line and …

    line 60
  15. Distinctive:

    No features beyond what was asked

    line 68
  16. Distinctive:

    No abstractions for single-use code

    line 69
  17. Distinctive:

    No error handling for impossible scenarios

    line 71
  18. Distinctive:

    If you write 200 lines and it could be 50, rewrite it

    line 72
  19. Distinctive:

    All code must be modular, readable, testable, and defensible in a code review.

    line 74
  20. Distinctive:

    Ask: *"Would a senior engineer say this is overcomplicated?"* If yes, simplify.

    line 77
  21. Distinctive:

    When editing existing code:

    line 85
  22. Distinctive:

    Don't "improve" adjacent code, comments, or formatting

    line 86
  23. Distinctive:

    Don't refactor things that aren't broken

    line 87
  24. Distinctive:

    If you notice unrelated dead code, mention it — don't delete it

    line 89
  25. Very specific:

    Remove only imports/variables/functions that YOUR changes made unused

    line 90
  26. Distinctive:

    BEFORE — Read the file completely.

    line 94
  27. Distinctive:

    AFTER — Run affected tests.

    line 100
  28. Distinctive:

    Verify tests assert real-world behavior, not just mock matches.

    line 101
  29. Distinctive:

    Document in changelog with facts, not narrative.

    line 102
  30. Distinctive:

    BEFORE COMMIT — Get explicit approval.

    line 104
  31. Distinctive:

    Before changing behavior, identify the contracts your change touches.

    line 114
  32. Distinctive:

    Don't change a contract silently.

    line 125
  33. Distinctive:

    If a contract must change, surface the impact: who consumes it, what breaks, what migration looks like.

    line 126
  34. Distinctive:

    Prefer additive changes (new field, new endpoint, new flag) over breaking changes (rename, remove, restructure).

    line 127
  35. Distinctive:

    When in doubt about who depends on a surface, search the codebase and ask before changing.

    line 128
  36. Distinctive:

    Every change must include tests, or a clear explanation of why not

    line 153
  37. Distinctive:

    Before each step, answer all four:

    line 180

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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
CLAUDE.md

Code Discipline

A coding methodology for production systems that must last. Not a communication standard. Not an honesty protocol. Purely: how to write code well.

Merge with your project-specific CLAUDE.md as needed.

Tradeoff: This discipline biases toward correctness and simplicity over speed and cleverness. For throwaway scripts, apply judgment. For production code — apply everything.


Priority Order

Every technical decision is evaluated in this order:

  1. Stability
  2. Reliability
  3. Readability
  4. Maintainability
  5. Scalability
  6. Performance
  7. Elegance

The goal is not "it works" — it is "it works correctly and reliably one year from now."


1. Think Before Coding

Don't assume. Surface tradeoffs. Map blast radius.

Before writing any code, present all four:

  1. Working assumptions — what are you assuming to be true?
  2. Constraints and risks — what could go wrong?
  3. Multiple valid solutions? — if yes, stop and present options; do not choose independently
  4. Dependencies and blast radius — what else is affected by this change?

Rules:

  • If uncertain — ask, don't assume and proceed
  • If multiple interpretations exist — present them, don't pick silently
  • If a simpler approach exists — say so and push back
  • If information is missing — stop and ask; do not proceed without answers

2. Verify Reality Before Acting

Don't code from memory. The codebase is the source of truth.

Before writing or changing code:

  • Read the actual files involved. Don't work from a remembered shape.
  • Don't invent APIs, function names, type names, field names, environment variables, configuration keys, or imports.
  • Don't assume a pattern, helper, or utility exists unless you verified it in the repository.
  • Don't assume a third-party library behaves a certain way without checking its documentation or signature.
  • If you cannot find evidence in the codebase, say so explicitly: "I couldn't find this in the code" — and stop. Do not fill the gap from memory.

The test: Every function call, import, type, and field in your code must trace to a verified source — an actual file, an actual signature, or documentation you read.

Evidence standard for claims: When stating that code works, that a test passes, or that a file does something specific, cite file:line and the quoted code or output. Paste actual command output rather than summarizing it. "It should work" and "I believe" are not evidence.


3. Simplicity First

Minimum code that solves the problem. Nothing speculative.

  • No features beyond what was asked
  • No abstractions for single-use code
  • No "flexibility" or "configurability" that wasn't requested
  • No error handling for impossible scenarios
  • If you write 200 lines and it could be 50, rewrite it

All code must be modular, readable, testable, and defensible in a code review. There must be no magic numbers, hidden state, overly clever constructs, or silent failures.

Ask: "Would a senior engineer say this is overcomplicated?" If yes, simplify.


4. Surgical Changes

Touch only what you must. Clean up only your own mess.

When editing existing code:

  • Don't "improve" adjacent code, comments, or formatting
  • Don't refactor things that aren't broken
  • Match existing style, even if you'd do it differently
  • If you notice unrelated dead code, mention it — don't delete it
  • Remove only imports/variables/functions that YOUR changes made unused

Required steps:

BEFORE — Read the file completely. Map dependencies and blast radius. Identify affected tests. Check if a suitable solution already exists in the project.

DURING — Change only what's needed. No unrelated refactoring. Preserve working behavior. No duplication.

AFTER — Run affected tests. Run full test suite. Verify zero regressions. Verify tests assert real-world behavior, not just mock matches. Document in changelog with facts, not narrative.

BEFORE COMMIT — Get explicit approval. Show exactly what's being committed. No hidden files.

The test: Every changed line should trace directly to the request.


5. Respect Existing Contracts

Public surfaces are commitments. Treat them as such.

Before changing behavior, identify the contracts your change touches. Contracts include:

  • Function and method signatures (parameters, return types, thrown errors)
  • API request and response shapes
  • Database schemas and column types
  • Event names and payloads
  • CLI flags and command names
  • Configuration keys and environment variables
  • Error codes and error formats
  • File formats your code reads or writes

Rules:

  • Don't change a contract silently. A silent rename, removal, or reshape is a breaking change disguised as cleanup.
  • If a contract must change, surface the impact: who consumes it, what breaks, what migration looks like.
  • Prefer additive changes (new field, new endpoint, new flag) over breaking changes (rename, remove, restructure).
  • When in doubt about who depends on a surface, search the codebase and ask before changing.

The test: If your change crosses a system boundary, you must name the boundary and the consumers before changing it.


6. Goal-Driven Execution

Define success criteria. Loop until verified.

Transform tasks into verifiable goals:

  • "Add validation" → "Write tests for invalid inputs, then make them pass"
  • "Fix the bug" → "Write a test that reproduces it, then make it pass"
  • "Refactor X" → "Ensure tests pass before and after"

For multi-step tasks, state a plan:

1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]

Checkpoint between steps: Complete and verify each step before starting the next. Do not chain steps without confirming the previous one succeeded. Catching divergence at step 2 is much cheaper than catching it at step 5.

Testing principles:

  • Every change must include tests, or a clear explanation of why not
  • Tests must verify real behavior — not just match mocks
  • A passing suite means the tests think it works — verify they test the right thing
  • State certainty level explicitly when uncertain about an API or behavior

Strong success criteria let you work independently. Weak criteria ("make it work") require constant clarification.


Mandatory Prohibitions

ProhibitionDetail
❌ No guessing or inventingIf information is missing — stop and ask. Never fill gaps independently.
❌ No unrequested featuresNo "we could also" implemented. Any addition requires explicit approval.
❌ No broad refactorsChange only what was requested. No "while I'm here" modifications.
❌ No band-aidsNo temporary values without expiry. No hardcoded test values in production. No silent error swallowing.
❌ No claims without evidenceWhen stating that code works, that a test passes, or that a file does something — cite file:line plus the quoted code or output. Paste actual command output, do not summarize it. "It should work" is not evidence.
❌ No fake completionNever claim "done" without verification. If something was not verified, say so explicitly: "Implemented, but not verified because..."
❌ No dangerous actions without approvalExplicit approval required before destructive actions: deleting files, dropping schemas, force-pushing, removing tests, disabling checks, large rewrites, or modifying authentication or authorization logic.
❌ No committing without approvalThe user must say "commit now" before git commit, "push now" before git push, "deploy now" before deployment.

Mandatory Review Questions

Before each step, answer all four:

  1. Is this the most professional and simplest solution?
  2. Does this change preserve what already works?
  3. Is this a reasonable production-grade solution?
  4. Would this pass code review at a top-tier engineering organization?

Only if all four answers are positive — proceed.


These guidelines are working if: changes are smaller and more focused, no unrequested features appear in diffs, every task has a verifiable definition of done before work begins, and contracts are preserved unless an explicit migration is agreed upon.

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.