anshuxinha/karpathy-skills-extended
A lightweight pre-coding check for Codex, Claude, Cursor, Antigravity, Gemini, and Grok: look up what you can, and ask o
Actual rules from this repo
Path in source repo: .cursor/rules/karpathy-skills-extended.mdc · format: mdc
---
description: On every request, ask only knowledge gaps that would change the outcome. Keep Karpathy's coding rules.
alwaysApply: true
---
# Karpathy skills, extended
Canonical text: `skills/karpathy-skills-extended/SKILL.md`. This Cursor rule is the same procedure, with `alwaysApply: true`, for Cursor sessions. Codex, Claude, Antigravity, Gemini, and Grok load the skill file or `rules/karpathy-skills-extended.md` instead. Copy this file to `~/.cursor/rules/` for every Cursor project. If you change the behavior, edit the skill first, then replace this body so the copies stay the same.
Apply this on every user message, including when nobody named this skill. The host may be Codex, Claude, Cursor, Antigravity, Gemini, or Grok. The check is the same in each. Do not announce the check.
The four coding rules below follow Andrej Karpathy's notes on agents that assume, overbuild, and edit code they were not asked to touch (https://x.com/karpathy/status/2015883857489522876), in the form published by https://github.com/multica-ai/andrej-karpathy-skills. The gap check is the part this skill adds. Matt Pocock's grill-me (https://github.com/mattpocock/skills) asks the user to settle every branch of a plan before work starts. That session fits a soft idea. On an ordinary prompt it runs long. This skill keeps one piece of it: if a decision belongs to the user, ask them. Ask only the gaps that pass the tests below, then do the task.
## Gap check
Run this before you edit, write, delete, send, or commit to a plan.
A gap meets all four tests:
1. The user did not state it, and no earlier message in this conversation settled it.
2. You cannot get it by reading the repo, docs, tools, or config.
3. More than one plausible answer exists.
4. The choice would change the files, behavior, audience, schema, copy, or the check for done.
If a fact fails any test, it is not a gap. Look it up, or take the reading that matches the request and the surrounding code. You may name that choice in one line while you work. Lookup is your job. Do it before you call something a gap. Decisions about intent are the user's.
### When you ask
- One round, then wait. Leave the work that depends on the answer undone. You may keep reading.
- Three questions at most. One is the usual case. If more than three facts block you, ask the three that unblock the most, and name the others in one line as deferred.
- Each question names the missing fact, what would change, and the answer you recommend if they tell you to choose.
- Plain sentences. No design-tree rounds. No second round unless their answer creates a new gap that passes the four tests.
- If they skip a question, say you choose, or answer only part of the round, use your recommendation for the rest and continue.
- If you already asked this gap and they answered, do not ask again.
### When you stay quiet
Do the work and do not mention the check when:
- The request has one reading.
- They delegated the choice ("you pick", "whatever is simplest", "match the rest").
- The repo, a user rule, or an earlier turn already answers it.
- The open choice is an implementation detail with a local convention.
- The only question you have is whether to continue.
A one-line fix does not need the full coding rigor below. Use judgment.
If they ask for a full grilling session, run that session. This short check is the default, not a veto on an interview they requested.
## Coding rules
If a skill named karpathy-guidelines is also loaded, follow it as well. On a fact that passes the four tests, this gap check wins: stop and ask. Do not treat a written assumption as a substitute for their answer.
### Think before coding
Name a tradeoff when it would change the design. When a simpler approach would do, say so in one sentence and take it, unless they asked for the other one. If you are confused, name the confusion. If that confusion passes the four tests, ask.
### Simplicity first
Write the minimum that solves the request. No extra features, no abstraction for a single use, no configuration they did not ask for, no handling for cases that cannot happen. If a senior engineer would call the design overcomplicated, cut it.
### Surgical changes
Change lines the request requires. Match the surrounding style. Do not refactor, reformat, or delete adjacent code. If you notice unrelated dead code, mention it and leave it. Remove imports, variables, and functions that your edit made unused.
### Goal-driven execution
Turn the task into a check you can run. A bug fix is a check that fails before the fix and passes after. For several steps, write a short plan with a check on each step, then run the checks.
## Examples
"Add a delete button on the patient row." Passing gap: hide the row, mark the record inactive, or remove the record. Ask one question. Recommend the pattern that table already uses. Wait.
"Rename getUser to fetchUser in src/api.ts." One reading. Rename it.
Why this is listed
This repository appears on Cursor Rules Live because it matches the tracker's GitHub Search criteria (cursor-rules) and was active in the recent indexing window. The tracker refreshes every 15 minutes, so the metadata above reflects the state at the most recent index pass. If the data here looks stale, the source repository may have been archived or moved out of the tracked topic; the next cron tick will reconcile.