wiki / concepts / karpathy-four-guidelines

Karpathy's Four Guidelines

high confidence updated 2026-08-24 coding-guidelines · agents · principle

Karpathy’s Four Guidelines

Behavioral rules reducing common LLM coding mistakes, from andrej karpathy’s pitfall observations. Bias toward caution over speed; judgment on trivial tasks. [source: karpathy-guidelines-skill-2026]

  1. Think before coding — don’t assume, don’t hide confusion, surface tradeoffs. State assumptions; present competing interpretations instead of picking silently; name what’s confusing and ask.
  2. Simplicity first — minimum code that solves the problem, nothing speculative. No unrequested features/abstractions/configurability. “Would a senior engineer call this overcomplicated?”
  3. Surgical changes — touch only what you must; clean up only your own mess. Every changed line traces to the request. Mention unrelated dead code, don’t delete it.
  4. Goal-driven execution — define verifiable success criteria, loop until verified. “Fix the bug” → “write a test that reproduces it, then make it pass”

Fit with the other layers

#4 is tdd with agents in miniature and powers tracer bullets. #1 is grilling doctrine at code scale. #2-3 are what keeps codebases maintainable for agents.

andrej karpathy, tdd with agents, tracer bullets, grilling doctrine.