---
title: "Karpathy's Four Guidelines"
description: "Four foundational coding conduct rules for agents: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven."
section: "concepts"
type: "concept"
created: "2026-08-22"
updated: "2026-08-24"
confidence: "high"
tags: ["coding-guidelines", "agents", "principle"]
canonical: "https://pyweb.dev/wiki/karpathy-four-guidelines"
---
# Karpathy's Four Guidelines

Behavioral rules reducing common LLM coding mistakes, from [andrej karpathy](/wiki/andrej-karpathy)'s pitfall
observations. Bias toward caution over speed; judgment on trivial tasks. [[source: karpathy-guidelines-skill-2026]](/wiki/raw/articles/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](/wiki/tdd-with-agents) in miniature and powers [tracer bullets](/wiki/tracer-bullets). #1 is
[grilling doctrine](/wiki/grilling-doctrine) at code scale. #2-3 are what keeps codebases maintainable for agents.

## Related
[andrej karpathy](/wiki/andrej-karpathy), [tdd with agents](/wiki/tdd-with-agents), [tracer bullets](/wiki/tracer-bullets), [grilling doctrine](/wiki/grilling-doctrine).

---

## Agent Navigation

cluster: person (170 pages) | betweenness: 86.1

### References (outbound)
- [Andrej Karpathy](https://pyweb.dev/wiki/andrej-karpathy.md)
- [TDD With Agents](https://pyweb.dev/wiki/tdd-with-agents.md)
- [Grilling Doctrine](https://pyweb.dev/wiki/grilling-doctrine.md)

### Referenced by (inbound)
- [Agentic Manual Testing](https://pyweb.dev/wiki/agentic-manual-testing.md)
- [Build-From-Scratch Pedagogy](https://pyweb.dev/wiki/build-from-scratch-pedagogy.md)
- [First-Principles Thinking](https://pyweb.dev/wiki/first-principles-thinking.md)
- [Git for Agentic Workflows](https://pyweb.dev/wiki/git-for-agentic-workflows.md)
- [Subagents and Context Management](https://pyweb.dev/wiki/subagents-and-context-management.md)
- [TDD With Agents](https://pyweb.dev/wiki/tdd-with-agents.md)
- [Tracer Bullets](https://pyweb.dev/wiki/tracer-bullets.md)
- [Andrej Karpathy](https://pyweb.dev/wiki/andrej-karpathy.md)

### Evidence (verified primary sources)
- [karpathy-guidelines-skill-2026](https://pyweb.dev/wiki/raw/articles/karpathy-guidelines-skill-2026.md) | origin: https://github.com/multica-ai/andrej-karpathy-skills/blob/main/skills/karpathy-guidelines/SKILL.md | ingested: 2026-08-22 | sha256: 3dbba31cbdb82e77622b5e9f337405d3b934498957fe88f021500746844073f4

### Machine endpoints
- Knowledge graph: https://pyweb.dev/api/graph.json
- Graph analysis: https://pyweb.dev/api/graph-analysis.json
- Context index: https://pyweb.dev/llms.txt
