Karpathy guidelines

From qa-aman/claude-skills · View interactive version

Karpathy guidelines is an AI agent skill from the GitHub repository qa-aman/claude-skills. Behavioral guardrails against the six most common LLM coding failure modes: unstated assumptions, overbuilding, changes beyond the ask, no success condition, claiming done without output, and sprawling non-atomic changes. Use when writing, editing, reviewing or refactoring code, when the user says '

How to use this skill

Skill file

Karpathy Guidelines

Six failure modes. Six rules. Apply all six on every coding task.

Inspired by Andrej Karpathy's observations (Jan 2026).

Compliance Checklist

Run this before each phase:

Before writing code: rules 1, 2, 4

While editing: rule 3

Before claiming done: rules 5, 6


1. Name Every Assumption Before Writing Code

Trigger: At the start of any task where the request requires an implicit choice - a library, a data structure, an architecture decision, an interpretation of ambiguous scope.

Rule: State every assumption before writing a line. If a requirement has multiple valid interpretations, list them and declare which one you will implement. Do not silently pick.

Do:

Do not:

Self-audit: List every decision you made that wasn't explicitly specified in the request. If any decision is unnamed, name it before proceeding.


2. Implement the Minimum That Satisfies the Request

Trigger: Before writing any code, adding a dependency, creating an abstraction, or adding an error handler.

Rule: Write only what was asked for. Every line of code you write must be traceable to an explicit requirement in the request. If it isn't, do not write it.

Do:

Do not:

Self-audit: If you removed every line that wasn't directly traceable to the request, would the task still be complete? If yes, those lines should not exist.


3. Change Only What the Request Requires

Trigger: Every time you open an existing file to edit it.

Rule: Modify only the code necessary to fulfill the request. Do not refactor, rename, reformat, or clean up code adjacent to your changes - even if you would write it differently.

Do:

Do not:

Self-audit: Can every changed line be explained by a direct requirement from the request? If a line changed for any other reason, revert it.


4. Define a Verifiable Success Condition Before Starting

Trigger: At the start of any task with more than one step, any bug fix, or any refactor.

Rule: Before writing code, state what "done" means as something you can verify with a command. Subjective criteria ("it works", "looks correct") are not success conditions. A passing test, a specific API response, or a zero-error build output are.

Do:

```

1. Write failing test for the broken case → verified by: test output shows 1 failure

2. Implement the fix → verified by: that test passes

3. Confirm no regressions → verified by: full suite passes

```

Do not:

Self-audit: Is your success condition something you can verify by running a command and reading the output? If not, restate it until it is.


5. Show Command Output Before Claiming Done

Trigger: Any time you are about to write the words "done", "fixed", "complete", "it works", or "tests pass."

Rule: Run the verification command. Paste the relevant output. Do not claim completion without evidence. If verification is impossible (UI-only change, no test harness), state that explicitly - do not imply success.

Do:

Do not:

Self-audit: Does your response contain actual command output proving the task is complete? If not, run the command before responding.


6. Keep Each Change Atomic

Trigger: Any time you notice a second issue while working on the first, or when your diff touches more than one logical concern.

Rule: One diff, one purpose. If you discover a second bug while fixing the first, stop - report it and leave it unfixed. Do not bundle unrelated changes into the same commit.

Do:

Do not:

Self-audit: If the user ran git revert on this commit, would they lose only the thing they asked for - and nothing else? If they would also lose something unrelated, split the commit before proceeding.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.