Disciplined Coding
Apply a disciplined coding loop inspired by the four principles in
multica-ai/andrej-karpathy-skills:
think before coding, prefer simplicity, make surgical changes, and execute against
verifiable goals.
Calibrate Rigor
Match the process to the risk.
- For a typo, obvious one-line fix, or mechanical change, act directly and run a focused check.
- For a reversible local choice, state the assumption briefly and proceed.
- For ambiguity that changes public behavior, data, security, architecture, cost, or migration strategy, surface the interpretations and ask before committing to one.
- Stop when required context is unavailable and guessing could produce a materially different result.
Do not turn caution into ceremony. Ask only when the answer would change the implementation meaningfully.
1. Frame the Goal
Before editing:
- Restate the desired outcome in operational terms.
- Identify constraints from the request, repository instructions, existing patterns, and tests.
- Define observable success criteria.
- Name consequential assumptions or tradeoffs.
Translate vague tasks into checks:
- "Fix the bug" becomes "reproduce the failure, make the reproduction pass, and preserve related behavior."
- "Add validation" becomes "specify invalid inputs and expected responses, then test them."
- "Refactor X" becomes "preserve behavior, reduce the named problem, and keep tests passing before and after."
For multi-step work, use a brief plan with a verification point for each step.
2. Choose the Smallest Sufficient Design
Implement the minimum complete solution.
- Do not add unrequested features, options, fallback paths, or configurability.
- Do not create an abstraction for one use unless it removes real current duplication or isolates a volatile boundary.
- Reuse repository conventions before inventing a new pattern.
- Handle plausible failures at the system boundary. Do not defend against states that the surrounding system makes impossible.
- If the solution is much larger than the problem suggests, pause and look for a simpler design.
Prefer code that a maintainer can understand locally over code optimized for hypothetical future needs.
3. Make a Surgical Change
Keep every changed line traceable to the requested outcome or its verification.
- Inspect before editing and match the existing style.
- Change only the files and lines required by the implementation.
- Avoid drive-by refactors, formatting, renames, comment rewrites, and dependency upgrades.
- Preserve unfamiliar code unless the task requires changing it.
- Remove imports, variables, functions, or tests made obsolete by the current change.
- Mention unrelated problems instead of fixing them without authorization.
Before finishing, inspect the diff and remove accidental or speculative changes.
4. Verify the Outcome
Use the cheapest reliable evidence first, then expand in proportion to risk.
- Run the narrowest test, type check, lint check, build, or reproduction that proves the change.
- Add or update a regression test when behavior changes or a bug is fixed.
- Run broader checks when the change touches shared code, public interfaces, persistence, security, or build configuration.
- Read the final diff for scope, clarity, and unintended behavior.
- Report what passed, what was not run, and any remaining uncertainty.
Do not claim success from code inspection alone when an executable check is available.
Completion Gate
Finish only when all applicable answers are yes:
- Are consequential assumptions explicit or resolved?
- Is this the simplest complete solution?
- Can every changed line be connected to the request?
- Did the change clean up only the artifacts it created?
- Do the verification results demonstrate the stated success criteria?
1---2name: disciplined-coding3description: Implement, fix, refactor, or review code with explicit assumptions, minimal complexity, tightly scoped diffs, and verifiable success criteria. Use for non-trivial coding tasks where ambiguity, overengineering, unrelated edits, or weak verification could create costly mistakes.4---56# Disciplined Coding78Apply a disciplined coding loop inspired by the four principles in9[multica-ai/andrej-karpathy-skills](https://github.com/multica-ai/andrej-karpathy-skills):10think before coding, prefer simplicity, make surgical changes, and execute against11verifiable goals.1213## Calibrate Rigor1415Match the process to the risk.1617- For a typo, obvious one-line fix, or mechanical change, act directly and run a focused check.18- For a reversible local choice, state the assumption briefly and proceed.19- For ambiguity that changes public behavior, data, security, architecture, cost, or migration strategy, surface the interpretations and ask before committing to one.20- Stop when required context is unavailable and guessing could produce a materially different result.2122Do not turn caution into ceremony. Ask only when the answer would change the implementation meaningfully.2324## 1. Frame the Goal2526Before editing:27281. Restate the desired outcome in operational terms.292. Identify constraints from the request, repository instructions, existing patterns, and tests.303. Define observable success criteria.314. Name consequential assumptions or tradeoffs.3233Translate vague tasks into checks:3435- "Fix the bug" becomes "reproduce the failure, make the reproduction pass, and preserve related behavior."36- "Add validation" becomes "specify invalid inputs and expected responses, then test them."37- "Refactor X" becomes "preserve behavior, reduce the named problem, and keep tests passing before and after."3839For multi-step work, use a brief plan with a verification point for each step.4041## 2. Choose the Smallest Sufficient Design4243Implement the minimum complete solution.4445- Do not add unrequested features, options, fallback paths, or configurability.46- Do not create an abstraction for one use unless it removes real current duplication or isolates a volatile boundary.47- Reuse repository conventions before inventing a new pattern.48- Handle plausible failures at the system boundary. Do not defend against states that the surrounding system makes impossible.49- If the solution is much larger than the problem suggests, pause and look for a simpler design.5051Prefer code that a maintainer can understand locally over code optimized for hypothetical future needs.5253## 3. Make a Surgical Change5455Keep every changed line traceable to the requested outcome or its verification.5657- Inspect before editing and match the existing style.58- Change only the files and lines required by the implementation.59- Avoid drive-by refactors, formatting, renames, comment rewrites, and dependency upgrades.60- Preserve unfamiliar code unless the task requires changing it.61- Remove imports, variables, functions, or tests made obsolete by the current change.62- Mention unrelated problems instead of fixing them without authorization.6364Before finishing, inspect the diff and remove accidental or speculative changes.6566## 4. Verify the Outcome6768Use the cheapest reliable evidence first, then expand in proportion to risk.69701. Run the narrowest test, type check, lint check, build, or reproduction that proves the change.712. Add or update a regression test when behavior changes or a bug is fixed.723. Run broader checks when the change touches shared code, public interfaces, persistence, security, or build configuration.734. Read the final diff for scope, clarity, and unintended behavior.745. Report what passed, what was not run, and any remaining uncertainty.7576Do not claim success from code inspection alone when an executable check is available.7778## Completion Gate7980Finish only when all applicable answers are yes:8182- Are consequential assumptions explicit or resolved?83- Is this the simplest complete solution?84- Can every changed line be connected to the request?85- Did the change clean up only the artifacts it created?86- Do the verification results demonstrate the stated success criteria?