clarification
Use when a user's request is vague, ambiguous, or underspecified. Explores the codebase first, then runs an iterative Q&A loop…
Behavioral guardrails to prevent common LLM coding mistakes — enforces surgical changes, assumption verification, and scope discipline before and during implementation. Use when implementing features, modifying code, or when you notice yourself about to make changes without
$ npx -y skills add tmdgusya/engineering-discipline --skill karpathy --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/karpathyContext preview
The summary Claude sees to decide when to auto-load this skill.
Behavioral guardrails to prevent common LLM coding mistakes — enforces surgical changes, assumption verification, and scope discipline before and during implementation. Use when implementing features, modifying code, or when you notice yourself about to make changes without
name: karpathy description: Behavioral guardrails to prevent common LLM coding mistakes — enforces surgical changes, assumption verification, and scope discipline before and during implementation. Use when implementing features, modifying code, or when you notice yourself about to make changes without reading the existing code first.
A preventive thinking discipline for code implementation. Activates before and during code writing to block the most common mistakes LLMs make when generating code.
This is not about performance (that's `rob-pike`) or debugging (that's `systematic-debugging`). This is about the act of writing code itself — reading before writing, changing only what's asked, verifying instead of assuming, and defining what "done" means before starting.
These rules have no exceptions.
1. **Read before you write.** Do not modify a file you haven't read. Do not modify a function without understanding the callers. Do not modify a module without understanding its role. 2. **Scope to the request.** Change what was asked. Nothing more. No "while I'm here" improvements, no opportunistic refactoring, no adding features that weren't requested. 3. **Verify, don't assume.** If you think a function does X, read it. If you think a type has field Y, check it. If you think a test covers scenario Z, find it. Assumptions are the primary source of LLM coding errors. 4. **Define success before starting.** Before writing any code, state what "done" looks like in concrete, verifiable terms. If you can't define it, you don't understand the task yet.
Every change should be the minimum edit that achieves the goal.
**Before writing, ask:**
**Prohibited additions unless explicitly requested:**
One task, one change. If you discover something else that needs fixing, note it — don't fix it now.
LLMs generate code based on patterns. Codebases have their own patterns. These often conflict.
**Before modifying any file:**
1. Read the file 2. Identify the conventions it uses (naming, error handling, patterns, structure) 3. Match those conventions exactly in your changes
**Before modifying any function:**
1. Find all callers 2. Understand the contract (what goes in, what comes out, what side effects) 3. Ensure your change doesn't break the contract
**Before adding a new file:**
1. Check if similar functionality exists elsewhere 2. Follow the project's file organization pattern 3. Use the same naming conventions as neighboring files
Do not invent new patterns. Follow the ones that exist.
Every assumption is a potential bug. The most dangerous assumptions are the ones that feel obvious.
**Common assumptions that cause failures:**
| Assumption | Verification | |---|---| | "This function returns X" | Read the function | | "This field is always present" | Check the type definition and upstream producers | | "This test covers that case" | Read the test | | "This import path is correct" | Check the file exists at that path | | "This API accepts these parameters" | Read the API definition or documentation | | "This library works this way" | Check the version and docs | | "This config value is set" | Check the actual config |
When in doubt, grep. When confident, grep anyway.
Before writing code, state what "done" means.
Format:
Done when: - [ ] <specific, verifiable condition> - [ ] <specific, verifiable condition> - [ ] <specific, verifiable condition>
Bad criteria:
Good criteria:
If you can't write specific criteria, you don't understand the task. Go back and clarify.
LLMs love to anticipate future needs. This produces code that is more complex than necessary.
**Block these impulses:**
Build for what is needed today. Tomorrow's problems will have tomorrow's context.
| Impulse | Rule Violated | Response | |---|---|---| | "Let me quickly refactor this while I'm here" | Rule 1 | One task, one change. Note it for later. | | "I know how this works, I'll just write the fix" | Rule 2 | Read first. Your mental model may be wrong. | | "This probably takes a string" | Rule 3 | Check the type. "Probably" means you don't know.
Engineering discipline skills for AI coding agents. Works with Claude Code, Gemini CLI, OpenCode, Codex, and Cursor.
Use when a user's request is vague, ambiguous, or underspecified. Explores the codebase first, then runs an iterative Q&A loop…
Corrective cleanup of AI-generated code — removes LLM-specific patterns while preserving behavior. Use when the user says…
Orchestrates multi-day execution of complex tasks through milestones. Each milestone goes through plan-crafting, run-plan…
Decomposes complex, multi-day tasks into optimized milestones (ultraplan). Broad parallel exploration grounds a draft milestone…
Use when a task's scope is clear and multi-step implementation is needed, before touching code. Triggered after clarification is…
Use after run-plan completes to independently verify the implementation. Reads only the plan document and inspects the codebase…