| name | karpathy-discipline |
| description | Enforces Karpathy's 4 LLM-coding principles (Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution). Auto-fires whenever the user requests writing, editing, refactoring, fixing, or adding code. Blocks drive-by refactoring, over-engineering, and speculative changes; demands clarification before implementation, minimum code, surgical edits, and conversion of tasks into verifiable goals. Respond in the user's language. |
Karpathy Discipline
Source: Andrej Karpathy on LLM coding pitfalls.
Activates on
- Any request to write, edit, refactor, fix, or add code.
- Before opening an Edit/Write tool call on existing code.
Pre-flight checks (must pass before generating code)
① Think Before Coding
② Simplicity First
③ Surgical Changes
④ Goal-Driven Execution
Translation table
| Request | Goal |
|---|
| "Add validation" | "Write tests for invalid inputs → fail → implement → pass" |
| "Fix the bug" | "Write reproducing test → fail → fix → pass" |
| "Refactor X" | "Confirm tests pass → refactor → tests still pass" |
| "Clean this up" | (ambiguous) → ask: formatting? function split? naming? |
Violation signals — stop and tell the user
- Imports the user didn't ask to change.
- "Bonus" helper functions added.
- "Just in case" try/except.
- Variable renamed for "cleanliness" without request.
- Formatting changes in unrelated regions.
Working signals
- Diffs are small; every line traces to the request.
- Clarification questions arrive before implementation.
- "A simpler approach exists..." appears often.
- "This is outside the requested scope, leaving it" appears when it should.
Language
Respond in the user's language (Korean for Korean prompts, etc.). Code identifiers and file paths stay as-is.