engineering/karpathy-coder/skills/karpathy-coder/SKILL.md
Use when writing, reviewing, or committing code to enforce Karpathy's 4 coding principles — surface assumptions before coding, keep it simple, make surgical changes, define verifiable goals. Triggers on "review my diff", "check complexity", "am I overcomplicating this", "karpathy check", "before I commit", or any code quality concern where the LLM might be overcoding.
npx skillsauth add alirezarezvani/claude-skills karpathy-coderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Derived from Andrej Karpathy's observations on LLM coding pitfalls. This is not just guidelines — it ships Python tools that detect violations, a review agent, a slash command, and a pre-commit hook.
"The models make wrong assumptions on your behalf and just run along with them without checking. They don't manage their confusion, don't seek clarifications, don't surface inconsistencies, don't present tradeoffs, don't push back when they should."
"They really like to overcomplicate code and APIs, bloat abstractions, don't clean up dead code... implement a bloated construction over 1000 lines when 100 would do."
"LLMs are exceptionally good at looping until they meet specific goals... Don't tell it what to do, give it success criteria and watch it go."
— Andrej Karpathy
Don't assume. Don't hide confusion. Surface tradeoffs.
Minimum code that solves the problem. Nothing speculative.
The test: Would a senior engineer say this is overcomplicated? If yes, simplify.
Touch only what you must. Clean up only your own mess.
The test: Every changed line should trace directly to the user's request.
Define success criteria. Loop until verified.
| Instead of... | Transform to... | |---|---| | "Add validation" | "Write tests for invalid inputs, then make them pass" | | "Fix the bug" | "Write a test that reproduces it, then make it pass" | | "Refactor X" | "Ensure tests pass before and after" |
For multi-step tasks, state a brief plan:
1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]
/karpathy-check — Run the full 4-principle review on your staged changes.
scripts/)All tools are stdlib-only. Run with --help.
| Script | What it detects |
|---|---|
| complexity_checker.py | Over-engineering: too many classes, deep nesting, high cyclomatic complexity, unused params, premature abstractions |
| diff_surgeon.py | Diff noise: lines that don't trace to the stated goal — comment changes, style drift, drive-by refactors |
| assumption_linter.py | Hidden assumptions in a plan: unasked features, missing clarifications, silent interpretation choices |
| goal_verifier.py | Weak success criteria: vague plans without verifiable checks, missing test assertions |
karpathy-reviewer — Runs all 4 principles against a diff. Dispatched by /karpathy-check or manually before committing.
hooks/karpathy-gate.sh — runs complexity_checker.py and diff_surgeon.py on staged files. Warns (non-blocking) when violations are found. Wire it via .claude/settings.json or Husky.
references/karpathy-principles.md — the source quotes, deeper context, when to relax each principlereferences/anti-patterns.md — 10+ before/after examples across Python, TypeScript, and shellreferences/enforcement-patterns.md — how to wire hooks, CI integration, team adoptionThese principles bias toward caution over speed. For trivial tasks (typo fixes, obvious one-liners), use judgment. The principles matter most on:
Installs via plugin for Claude Code. For other tools, copy the principles into your schema file:
| Tool | Schema file |
|---|---|
| Claude Code | CLAUDE.md (auto-loaded by plugin) |
| Codex CLI | AGENTS.md |
| Cursor | AGENTS.md or .cursorrules |
| Antigravity / OpenCode / Gemini CLI | AGENTS.md |
context: fork)self-eval — honest quality scoring after completing workcode-reviewer — broader code review; karpathy-coder focuses on the 4 LLM-specific pitfallsllm-wiki — compound knowledge; karpathy-coder ensures you don't overcomplicate while building itdevelopment
Use when someone wants to run a weekly review, close open loops, audit stalled projects and commitments, get their system back to trusted, restart a lapsed review habit, or says "/cs:weekly-review". Walks David Allen's three-phase loop — GET CLEAR, GET CURRENT, GET CREATIVE — with deterministic scripts that inventory open loops, gate the checklist with named gaps, and score commitment health 0-100.
development
Use when someone wants to decide whether a meeting is worth calling, price a meeting in dollars, build a timeboxed agenda with desired outcomes, or turn messy meeting notes into owned action items — or says "should this be a meeting", "/cs:meeting-prep", or "/cs:meeting-actions". Runs a cost gate (ASYNC / NOT-READY / MEET), builds a decision-first agenda, and extracts an owner + due-date checklist that flags every orphan.
development
Convert a rambling description of a desired outcome into one polished, autonomous /goal prompt ready to paste into a fresh session. Use when the user says "/fable-goal", "turn this into a goal prompt", "write me a fable prompt", "write the prompt that builds X", or rambles about something they want made and asks for the prompt that makes it happen. The output is a single copy-paste prompt, never the build itself. Do NOT use when the user wants the thing built right now in this session — only when they want the PROMPT that will make it happen in a fresh session.
development
Use when someone wants to plan a deep work day, time-block their calendar or task list, budget or cut shallow work, protect focus hours, track deep-work sessions and streaks, run an end-of-day shutdown ritual, or says "/deep-work" or "/time-block". Classifies tasks deep vs shallow, builds an energy-first time-blocked schedule that refuses deep demand past the 4-hour ceiling, batches shallow work into at most two windows, and logs focus sessions against a weekly target.