Source: https://x.com/karpathy/status/2004607146781278521 | https://x.com/karpathy/status/2015883857489522876 | https://x.com/karpathy/status/2026731645169185220 "It is hard to communicate how much programming has changed." — ~37k likes
Core Principle
You are no longer writing code. You are directing a team of tireless junior engineers.
The shift: write code → write tasks with success criteria → agent loops → human taste review
The 7-Step Inner Loop (Karpathy's Incremental Coding Rhythm)
This is the micro-loop for every coding session:
- Stuff context — Load entire project into context (
files-to-prompt, relevant docs, recent diffs) - Discuss plan — Ask agent for high-level approaches with pros/cons before any code
- Request first draft — Pick one approach, get a minimal first implementation
- Inline learning — Manually review the diff; ask agent to explain any API you don't recognize
- Test — Run tests, check outputs, verify success criteria
- Commit — Only commit what you understand and have verified
- Ask for next — Let agent suggest the next incremental step
Never skip step 4. Understanding atrophies if you rubber-stamp every diff.
CLAUDE.md / AGENTS.md Template
Write this file at the project root to prevent the most common agent failure modes:
# Agent Instructions for [Project Name]
## Behavior Rules
- Make one incremental change at a time. Do NOT refactor unrelated code.
- Always explain WHY you're making a change before the diff.
- If unsure about intent, ASK before implementing.
- Do NOT add new dependencies without explicit approval.
- Prefer simple, readable solutions over clever ones.
## Success Criteria (task-specific — fill in per session)
- [ ] Tests pass: `[test command]`
- [ ] No new lint errors: `[lint command]`
- [ ] Behavior matches: [description of expected output]
## Project Context
- Stack: [language, framework, key libs]
- Entry point: [file]
- Test command: [command]
- Forbidden: [list things agent must never do]
Master Prompt Template
You are an agentic engineer on this project.
Project context: [paste relevant files or use files-to-prompt output]
Task: [specific, unambiguous description]
Success criteria (ALL must be true when done):
1. [verifiable check 1]
2. [verifiable check 2]
3. [verifiable check 3]
Constraints:
- Only change files relevant to this task
- No new dependencies without asking
- Output: one incremental diff at a time
Start by proposing a high-level plan with 2-3 options and trade-offs. Wait for approval before writing code.
Common Failure Modes to Prevent
| Agent Sin | Prevention |
|---|---|
| Over-refactoring | "Only touch files directly related to the task" |
| Sycophantic confirmation | "Tell me what could go wrong with this plan" |
| Hallucinated APIs | "Cite the exact line in the docs for any API you use" |
| Dependency creep | "No new pip/npm installs without asking" |
| No success criteria | Always define DONE before starting |
Workflow
Belongs to workflow: Idea to Launch (Developer)
| Position | Upstream | Downstream |
|---|---|---|
| Step 2 | karpathy-idea-files(Define the idea first) |
karpathy-minimalism(Minimal implementation) |
Full chain:idea-files → agentic-engineering → minimalism → supply-chain-hygiene → vibe-to-agentic
It also often appears as the execution layer in the anti-bias decision-making workflow—when a decision has been made and needs to be implemented, switch to this Skill.
Prompt Contract
You are an agentic engineer. Project context: <files, constraints, current state>. Task: <specific goal>. Success criteria: <verifiable checklist>. First propose a high-level plan with tradeoffs. Then make only the next incremental change. After each change, run the relevant verification and report: changed files, evidence of success, remaining risk, and next step.
Verification Checklist
- Success criteria have been written as checkable items (not vague descriptions)
- Every round of changes has actual verification evidence: tests pass, lint clean, diff scope correct
- The Agent did not modify files outside the task scope
- A human has reviewed the parts of each diff they do not understand (no skipping steps)
- Before the final commit, one can explain in a single sentence to a colleague what was changed and why
When to Apply This Skill
- Starting any coding task > 30 minutes
- Setting up a new project with agent assistance
- Debugging a complex issue (agent as rubber duck + implementer)
- Writing CLAUDE.md / AGENTS.md for a repo