# Karpathy's rules for Claude Code

> Rules that stop Claude Code from guessing, overbuilding, or rewriting unrelated code.

- **What it does:** Adds a single rules file that tells Claude Code to ask when unsure, keep its code simple, change only what you asked for, and check its work with tests. You end up with fewer surprise rewrites and less bloated code.
- **Agents:** Claude Code and Codex (through orbit-connect), Claude and ChatGPT (through the Orbit connector)
- **Install:** `npx -y --loglevel=error orbit-connect@0.3.33 install skl_9faaa3f77f3c322fe47e92bf`
- **Creator:** @orbit.builders on Instagram
- **Safety:** Checked by Orbit: use with care. Installs third-party plugin and CLAUDE.md from unpinned GitHub main
- **Last updated:** 2026-11-15
- **Page:** https://orbitinbox.app/s/karpathy-s-rules-for-claude-code

## Skill

---
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

Shared by @orbit.builders, credited on Orbit.