---
name: karpathy-claude-guidelines
description: Use when you want Claude Code to stop guessing, overbuilding, and rewriting unrelated code; it adds a CLAUDE.md file with four rules - think before coding, keep it simple, make surgical changes, and verify with tests.
---
# Karpathy's rules for Claude Code
## What it does
This project is a single `CLAUDE.md` file, derived from Andrej Karpathy's observations on how LLMs go wrong when coding. It also ships as a Claude Code plugin and as a standalone skill folder (`skills/karpathy-guidelines/SKILL.md`), plus a Cursor project rule (`.cursor/rules/karpathy-guidelines.mdc`) for people using Cursor. Whichever form you install, it gives Claude four principles:
1. **Think Before Coding** - state assumptions explicitly, present multiple interpretations when ambiguous, push back if a simpler approach exists, stop and ask when confused instead of guessing.
2. **Simplicity First** - minimum code that solves the problem, no speculative features, no unrequested abstractions or configurability, no error handling for impossible cases.
3. **Surgical Changes** - touch only what the request requires, don't "improve" adjacent code or formatting, match existing style, remove only the dead code your own change created.
4. **Goal-Driven Execution** - turn tasks into verifiable goals (e.g. "write a test that reproduces the bug, then make it pass"), and state a short plan with a verify step for multi-step work.
The README notes these guidelines bias toward caution over speed, so use judgment on trivial changes like typo fixes.
## What you need
- Claude Code installed in your project (for the plugin or CLAUDE.md options).
- `curl` available if you use the CLAUDE.md download option.
- Cursor, only if you want the Cursor project rule version.
- No accounts, API keys, or paid plans are mentioned in the source.
## Setup
**Option A: Claude Code plugin (recommended)**
```
/plugin marketplace add forrestchang/andrej-karpathy-skills
/plugin install andrej-karpathy-skills@karpathy-skills
```
This makes the guidelines available across all your projects.
**Option B: CLAUDE.md file, new project**
```bash
curl -o CLAUDE.md https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md
```
**Option B: CLAUDE.md file, existing project (append)**
```bash
echo "" >> CLAUDE.md
curl https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md >> CLAUDE.md
```
**Option C: Install just the skill folder**
```bash
mkdir -p ~/.claude/skills
cp -R skills/karpathy-guidelines ~/.claude/skills/
```
For the Cursor rule, see the source's `CURSOR.md` for setup details: https://github.com/multica-ai/andrej-karpathy-skills/blob/main/CURSOR.md
You can merge these guidelines with your own project-specific instructions by adding a "Project-Specific Guidelines" section underneath them in `CLAUDE.md`, as described in the README.
## How to use it with Claude
- "Add input validation to this form" - Claude should write tests for invalid inputs first, then make them pass, instead of just writing the validation.
- "Fix this bug in the checkout flow" - Claude should write a test that reproduces the bug before fixing it.
- "Refactor this function" - Claude should state its plan, keep changes minimal, and confirm tests pass before and after.
- "This behavior is ambiguous, what should happen for an empty list?" - Claude should state its assumption or ask instead of silently picking one interpretation.
- "Clean up this file" - Claude should touch only the lines related to your request and mention, not delete, unrelated dead code it notices.
## Credits
Made by multica-ai (Karpathy-Inspired Claude Code Guidelines), packaged by Orbit.
https://github.com/multica-ai/andrej-karpathy-skills — license: MIT