Karpathy Coder — Active Coding Discipline

Karpathy Coder enforces Andrej Karpathy's four coding principles—think before coding, simplicity first, surgical changes, and goal-driven execution—when writing, reviewing, or committing code. It ships Python tools that detect violations, a review agent, a slash command, and a pre-commit hook to keep LLM-generated code disciplined.

✨ What it does

  • Enforces 4 principles: surface assumptions, keep it simple, make surgical changes, define verifiable goals.
  • Provides Python tools: complexity_checker, diff_surgeon, assumption_linter, goal_verifier.
  • Includes a sub-agent (karpathy-reviewer) that runs all principles against a diff.
  • Ships a pre-commit hook (karpathy-gate.sh) that warns on violations.
  • Offers a slash command /karpathy-check for quick review.
  • Provides references with anti-patterns and enforcement patterns.

🎯 When to use it

  • Before committing code, to run a full 4-principle review on staged changes.
  • When reviewing a diff or checking if code is overcomplicated.
  • When starting a non-trivial implementation or multi-step task with unclear requirements.
  • When you suspect the LLM might be overcoding or making hidden assumptions.

🚀 How to use

Trigger: /karpathy-check

Trigger with the slash command /karpathy-check or by asking for a Karpathy-style review (e.g., 'review my diff', 'check complexity', 'am I overcomplicating this'). The skill expects code changes or a plan to review. Example prompts:

/karpathy-check
Review my diff for Karpathy violations before I commit.

📄 Output: A review report highlighting violations of the four principles, with suggestions for simplification and goal verification.

📦 Add this skill to Claude Code

# 1. Get the skills repo
git clone --depth 1 https://github.com/alirezarezvani/claude-skills /tmp/claude-skills

# 2. Copy this skill into your project (or ~/.claude/skills for all projects)
mkdir -p .claude/skills
cp -r /tmp/claude-skills/engineering/karpathy-coder/skills/karpathy-coder .claude/skills/karpathy-coder

Skill source: engineering/karpathy-coder/skills/karpathy-coder/SKILL.md

⚠️ Good to know

The principles bias toward caution over speed; for trivial tasks, use judgment. The tools are stdlib-only and require Python to run.

❓ FAQ

What does the /karpathy-check command do?

It runs the full 4-principle review on your staged changes, dispatching the karpathy-reviewer sub-agent.

What tools are included?

The skill includes Python scripts: complexity_checker.py, diff_surgeon.py, assumption_linter.py, and goal_verifier.py, plus a pre-commit hook.

When should I relax the principles?

For trivial tasks like typo fixes or obvious one-liners, use judgment. The principles matter most for non-trivial changes, unfamiliar code, multi-step tasks, or code reviewed by humans.

🤖 Overview, features, install steps and FAQ were generated from the project's SKILL.md on Sep 4, 2026. Always check the original source before running commands.