/karpathy:karpathy-difffrom karpathy
Review an in-progress code change (a git diff) against Andrej Karpathy's principles before you commit or accept it. Catches scope creep, collateral file edits, drive-by refactors, reformatting, deletions of code or comments the task never called for, over-engineered new code, and missing verification. Use this whenever the user wants to review a diff or their changes, check whether a change is safe to commit or accept, asks "did the agent touch anything it shouldn't", "review my changes", "check this before I commit", says "karpathy diff" or "/karpathy:diff", or has just had an agent make a batch of edits. Trigger before commits and after agent-made edits even if the user doesn't mention Karpathy.
Ships in karpathy. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Review a code change before it is committed or accepted, against Andrej Karpathy's principles for LLM coding. The governing question is simple:
Does every changed line trace to the task that was asked?
Coding agents reliably do more than they were asked — they refactor adjacent code, reformat, rename, delete comments and code they don't fully understand, and over-build the part they were asked for. None of that is visible if you accept diffs without reading them, which is how most changes get accepted. This review is the safety net under that.
Default to report first, fix on approval. Report what doesn't trace to the task; never revert or rewrite the user's change without their say-so.
Unless the user points somewhere specific, review all uncommitted work:
git diff HEAD
Honor an explicit target if given: staged only (git diff --staged), a commit
range (git diff main...HEAD), a single commit, or a path. Also run
git status to catch new/untracked files and git diff --stat for the shape
of the change. If there is no diff, say so and stop.
The trace test needs to know what the change was meant to do.
State the task you're reviewing against at the top of the report so the user can correct it.
Read the repo's CLAUDE.md / AGENTS.md if present. Projects set their own
rules, and the review must respect them — a project whose defaults explicitly
sanction deleting legacy code or resetting local data has not committed a
violation when the agent does so. Calibrate to the project's stated defaults;
flag against the task, not against a generic ideal.
Walk the diff hunk by hunk. Sort every hunk into one of three buckets:
A clean change is one where every hunk traces. The categories below are the specific ways hunks fail to trace.
Surgical Changes — the core.
Simplicity First — in the new code itself.
Goal-Driven Execution — verification.
Orphans the change created.
Use this structure:
# Karpathy Diff Review
**Task:** <the intent being reviewed against>
**Change:** <N files, +X / -Y lines>
**Traceability:** <X of Y hunks trace to the task>
**Findings:** <N> (<N> critical, <N> warning, <N> nit)
## Findings
### [CRITICAL] <title>
- **Location:** <file:line or hunk>
- **Issue:** <what does not trace, and what it does>
- **Why it matters:** <concrete risk — what could break or rot>
- **Fix:** <specific: revert / restore / split out / remove>
(repeat per finding; order Critical -> Warning -> Nit; consolidate repeated
instances of the same problem into one finding rather than itemizing each)
## What's clean
<name the hunks or files that correctly trace to the task — don't skip this; a
review that only lists faults gives the user no way to trust the verdict>
## Proposed fixes
<a concrete action per finding: which lines to revert, which comment to
restore, which unrelated change to pull into its own commit>
Severity:
After the report, ask: "Want me to apply the proposed fixes?" Then stop.
When approved:
git diff after applying so the user sees the tightened change.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub jokim1/karpathy-skills --plugin karpathy5 skills in this plugin
/karpathy-auditAudit a CLAUDE.md, AGENTS.md, .cursor/rules file, or other AI-agent instruction/memory file against Andrej Karpathy's four LLM-coding principles. Checks two things: whether the file tells the agent to follow the principles (coverage), and whether the file itself earns its context budget - lean, unambiguous, current, contradiction-free, well-layered, and sized for every model that reads it (quality). Use this whenever the user wants to review, audit, critique, tighten, clean up, or improve a CLAUDE.md / AGENTS.md / .cursor/rules / agent memory file, says "karpathy audit" or "/karpathy:audit", asks to configure or set up Karpathy audit checks, asks whether their agent instructions are any good, or wants to apply Karpathy or vibe-coding guidelines to a project. Trigger even if they just say "check my CLAUDE.md" without naming Karpathy./karpathy-refactorEvidence-gated, behavior-preserving refactoring of a subsystem, module, or proposed change — a refactor executor in the spirit of Andrej Karpathy's small-code, verify-everything style, not a generic clean-code pass. Targets candidates with repo-history evidence (churn, co-change, fix clusters — the hotspots where refactoring actually pays off), records a verification baseline before any edit, applies small verified slices with auto-revert, and escalates cross-cutting problems to an architecture pass. Use when the user says "karpathy refactor" or "/karpathy:refactor", asks to refactor, simplify, or clean up a subsystem, wants to review this architecture for refactoring or plan a refactor of this subsystem, asks for a DRY or SOLID review, asks whether code should be split into classes, questions design patterns or framework gravity, suspects overengineering and wants simplification, or asks where refactoring pays off in this repo./karpathy-updateCheck for and update the Karpathy plugin itself. Use when the user says "karpathy update", "/karpathy:update", the client-dependent shorthand "/karpathy update", asks to update or upgrade the Karpathy skill/plugin, or asks whether a Karpathy plugin update is available. This is for plugin updates, not repo wiki content updates./karpathy-wikiBuild, maintain, query, and health-check a local repo wiki / LLM knowledge base for coding agents. Use when the user says "/karpathy:wiki", "/karpathy wiki", "karpathy wiki", asks to set up a repo wiki, asks a repo question that should use a wiki first, wants a task brief before coding, wants wiki updates after code changes, or asks for wiki doctor/lint/health. Implements an OKF-compatible Markdown knowledge bundle under knowledge/wiki with citations to source files, task briefs, surgical updates, and optional advisory stale-wiki reminders.