Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
alirezarezvani avatar

Karpathy Coder

  • 972 installs
  • 23.5k repo stars
  • Updated July 17, 2026
  • alirezarezvani/claude-skills

karpathy-coder is an active coding discipline skill that enforces Andrej Karpathy's four coding principles for developers who want LLM-assisted sessions to surface assumptions, stay simple, make surgical changes, and def

About

karpathy-coder is an MIT-licensed agent skill (version 2.3.0) that enforces Andrej Karpathy's four core coding principles during every LLM-assisted coding session: surface assumptions before coding, keep it simple, make surgical changes, and define verifiable goals. It triggers on phrases like review my diff, check complexity, am I overcomplicating this, karpathy check, and before I commit. The skill runs as a fork context and is compatible with claude-code, codex-cli, cursor, antigravity, opencode, and gemini-cli. Developers reach for karpathy-coder when an LLM might be overcoding, adding unnecessary abstraction, or shipping changes without explicit success criteria—acting as an active coding discipline guardrail rather than a one-time linter pass.

  • Enforces 4 Karpathy principles: surface assumptions, keep it simple, make surgical changes, define verifiable goals
  • Ships Python detection tools, review agent, slash command, and pre-commit hook
  • Triggers on "review my diff", "check complexity", "am I overcomplicating this", "karpathy check", or "before I commit"
  • Prevents overcomplicated abstractions, dead code, and unstated assumptions
  • Hard-gate: run before any commit or major code change when using LLM agents

Karpathy Coder by the numbers

  • 972 all-time installs (skills.sh)
  • +11 installs in the week ending Jul 29, 2026 (Skillselion tracking)
  • Ranked #125 of 1,356 Code Review & Quality skills by installs in the Skillselion catalog
  • Security screen: CRITICAL risk (skills.sh audit)
  • Data as of Jul 31, 2026 (Skillselion catalog sync)
npx skills add https://github.com/alirezarezvani/claude-skills --skill karpathy-coder

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs972
repo stars23.5k
Security audit2 / 3 scanners passed
Last updatedJuly 17, 2026
Repositoryalirezarezvani/claude-skills

How do you stop LLMs from overcoding complex diffs?

Automatically enforce Andrej Karpathy’s four core coding principles during every LLM-assisted coding session.

Who is it for?

Developers using LLM coding assistants who want a pre-commit discipline check against overengineering and bloated diffs.

Skip if: Greenfield prototyping sessions where exploratory throwaway code is intentional and no commit is planned.

When should I use this skill?

The user says review my diff, check complexity, karpathy check, before I commit, or expresses concern about overcomplicating LLM-generated code.

What you get

A reviewed diff with surfaced assumptions, simplified changes, surgical scope, and explicitly defined verifiable success criteria.

  • reviewed diff notes
  • surfaced assumptions list
  • verifiable goal definitions

By the numbers

  • Enforces 4 Karpathy coding principles in version 2.3.0
  • Compatible with 6 coding agent CLIs listed in manifest metadata

Files

SKILL.mdMarkdownGitHub ↗

Karpathy Coder — Active Coding Discipline

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

The four principles

1. Think Before Coding

Don't assume. Don't hide confusion. Surface tradeoffs.

  • State assumptions explicitly. If uncertain, ask.
  • If multiple interpretations exist, present them — don't pick silently.
  • If a simpler approach exists, say so. Push back when warranted.
  • If something is unclear, stop. Name what's confusing. Ask.

2. Simplicity First

Minimum code that solves the problem. Nothing speculative.

  • No features beyond what was asked.
  • No abstractions for single-use code.
  • No "flexibility" or "configurability" that wasn't requested.
  • No error handling for impossible scenarios.
  • If you write 200 lines and it could be 50, rewrite it.

The test: Would a senior engineer say this is overcomplicated? If yes, simplify.

3. Surgical Changes

Touch only what you must. Clean up only your own mess.

  • Don't "improve" adjacent code, comments, or formatting.
  • Don't refactor things that aren't broken.
  • Match existing style, even if you'd do it differently.
  • If you notice unrelated dead code, mention it — don't delete it.
  • Remove imports/variables/functions that YOUR changes made unused.
  • Don't remove pre-existing dead code unless asked.

The test: Every changed line should trace directly to the user's request.

4. Goal-Driven Execution

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]

Slash command

/karpathy-check — Run the full 4-principle review on your staged changes.

Python tools (scripts/)

All tools are stdlib-only. Run with --help.

ScriptWhat it detects
complexity_checker.pyOver-engineering: too many classes, deep nesting, high cyclomatic complexity, unused params, premature abstractions
diff_surgeon.pyDiff noise: lines that don't trace to the stated goal — comment changes, style drift, drive-by refactors
assumption_linter.pyHidden assumptions in a plan: unasked features, missing clarifications, silent interpretation choices
goal_verifier.pyWeak success criteria: vague plans without verifiable checks, missing test assertions

Sub-agent

karpathy-reviewer — Runs all 4 principles against a diff. Dispatched by /karpathy-check or manually before committing.

Pre-commit hook

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

  • references/karpathy-principles.md — the source quotes, deeper context, when to relax each principle
  • references/anti-patterns.md — 10+ before/after examples across Python, TypeScript, and shell
  • references/enforcement-patterns.md — how to wire hooks, CI integration, team adoption

When to relax

These principles bias toward caution over speed. For trivial tasks (typo fixes, obvious one-liners), use judgment. The principles matter most on:

  • Non-trivial implementations (>20 lines changed)
  • Code you don't fully understand
  • Multi-step tasks with unclear requirements
  • Anything that will be reviewed by humans

Cross-tool compatibility

Installs via plugin for Claude Code. For other tools, copy the principles into your schema file:

ToolSchema file
Claude CodeCLAUDE.md (auto-loaded by plugin)
Codex CLIAGENTS.md
CursorAGENTS.md or .cursorrules
Antigravity / OpenCode / Gemini CLIAGENTS.md

Related skills (chains via context: fork)

  • `self-eval` — honest quality scoring after completing work
  • `code-reviewer` — broader code review; karpathy-coder focuses on the 4 LLM-specific pitfalls
  • `llm-wiki` — compound knowledge; karpathy-coder ensures you don't overcomplicate while building it

Related skills

How it compares

Use karpathy-coder over generic lint skills when the goal is session-level coding discipline and anti-overcoding guardrails, not syntax rule enforcement.

FAQ

What are Karpathy's four principles in karpathy-coder?

karpathy-coder enforces four principles: surface assumptions before coding, keep it simple, make surgical changes, and define verifiable goals. The skill version 2.3.0 triggers during writing, reviewing, or committing code when LLMs might overengineer solutions.

Which agents support karpathy-coder?

karpathy-coder lists compatible tools including claude-code, codex-cli, cursor, antigravity, opencode, and gemini-cli. The MIT-licensed skill runs in fork context and activates on phrases like review my diff, karpathy check, and before I commit.

Is Karpathy Coder safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Code Review & Qualitytestingintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.