Skip to content

KarpathyLLMCodingGuidelines

Dennis Lee edited this page Jun 25, 2026 · 1 revision

title: Karpathy LLM Coding Guidelines type: technique created: 2026-06-25 last_updated: 2026-06-25 related: ["radar/techniques/BuildingSkillsForClaude", "radar/techniques/StructuredPromptDrivenDevelopment"] sources: ["https://github.com/multica-ai/andrej-karpathy-skills"] radar_quadrant: Techniques radar_ring: Assess radar_position: inner

Karpathy LLM Coding Guidelines

A single CLAUDE.md file encoding four behavioral guardrails against common LLM coding pitfalls, derived from Andrej Karpathy's observations. Distributed as a drop-in merge target for project CLAUDE.md files. 181k GitHub stars as of 2026-06-25.

The Four Principles

1. Think Before Coding -- Surface assumptions before implementing. If multiple interpretations exist, present them rather than choosing silently. Stop and ask when something is unclear.

2. Simplicity First -- Minimum code that solves the problem. No unrequested features, abstractions, configurability, or error handling for impossible scenarios. If 200 lines could be 50, rewrite.

3. Surgical Changes -- Touch only what the request requires. Do not improve adjacent code, refactor working code, or clean up pre-existing dead code. Every changed line must trace directly to the user's request.

4. Goal-Driven Execution -- Transform tasks into verifiable goals. Define success criteria before starting. For multi-step tasks, state a brief plan with per-step verification checks.

Design Intent

The file is explicitly a behavioral override that biases toward caution over speed. It targets the characteristic failure modes of LLM-assisted coding: over-engineering, silent assumption-making, scope creep, and unverified completion. The tradeoff is acknowledged -- for trivial tasks, judgment overrides the guidelines.

The file is designed to merge with project-specific CLAUDE.md instructions rather than replace them.

Radar Assessment

Placed in Assess at inner position. The four principles are well-scoped and directly address the most common failure patterns observed in LLM-assisted coding. The 181k star count reflects genuine adoption. The principles overlap with radar/techniques/BuildingSkillsForClaude (behavioral instruction writing) and radar/techniques/StructuredPromptDrivenDevelopment (prompt discipline). Trial gate: merge the file into an active project CLAUDE.md and measure whether over-engineering and silent assumption incidents decrease across a sprint.

Clone this wiki locally