Karpathy principles

From athola/claude-night-market · View interactive version

Karpathy principles is an AI agent skill from the GitHub repository athola/claude-night-market. Pre-implementation gate covering think-first, simplicity, surgical edits, and verifiable goals. Use when starting implementation to verify the approach.

How to use this skill

Skill file

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.

(Andrej Karpathy, on agentic coding failure modes)

What This Is

A four-principle contract for reducing the most common

LLM coding pitfalls. Compact entry-point. Each

principle has a deeper-dive skill in night-market;

this skill is the index.

Derivation: distilled by Forrest Chang

(forrestchang/andrej-karpathy-skills, MIT) from

Karpathy's observations. Full attribution in

references/source-attribution.md.

When To Use

done

When NOT to Use

These principles bias toward caution over speed. For

cases listed in modules/tradeoff-acknowledgment.md,

use judgment: trivial fixes, exploratory spikes,

documentation-only edits, and time-boxed prototypes.

The Four Principles

1. Think Before Coding

**State assumptions. Surface confusion. Match tone to

evidence.**

list them. Do not silently pick.

when the simpler path is correct.

assumptions are the cheapest bug to prevent and the

most expensive to find later.

Calibrated tone beats confident hand-waving.

Deep dives: Skill(imbue:rigorous-reasoning) for the

sycophancy guard, Skill(superpowers:brainstorming)

for option generation, /spec-kit:speckit-clarify

command for ambiguity drilldown.

2. Simplicity First

**Minimum code that solves the problem. Nothing

speculative.**

They really like to overcomplicate code and APIs,

bloat abstractions.

(Andrej Karpathy, on the same agentic-coding thread)

requested

it

Self-check: would a senior engineer say this is

overcomplicated? See modules/senior-engineer-test.md.

Deep dives: Skill(imbue:scope-guard) for the

worthiness formula and branch budgets,

Skill(leyline:additive-bias-defense) for burden of

proof on every addition,

Skill(conserve:code-quality-principles) for the

KISS / YAGNI / SOLID foundation.

Record the Tradeoff (decision journal)

When this step settles a decision with real alternatives, record it to

docs/tradeoffs.md while the reasoning is live (draft and confirm):

a tradeoff entry (the decision, the options weighed, and what was

sacrificed, with phase set to plan). Show the draft and append

on confirmation.

ENTRY TEMPLATE, and assign the next TR-NNN id.

3. Surgical Changes

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

mess.**

formatting

differently

as well as its style. During a migration, use the

target model and never copy the superseded one,

even when it is the majority. See

Skill(conserve:elegant-code) rung 2

not delete it

remove the orphans you created. Pre-existing dead

code stays unless asked.

The trace-back test: every changed line should trace

directly to the user's request.

Deep dives: Skill(imbue:justify) for additive-bias

audits on diffs, Skill(leyline:additive-bias-defense)

for the burden-of-proof contract, the

bounded-discovery.md rule for read-budget caps.

4. Goal-Driven Execution

**Define verifiable success criteria. Loop until

verified.**

Transform vague tasks into checkable goals:

pass"

then make it pass"

For multi-step tasks, state a brief plan with

verification per step. Strong success criteria let

you loop independently. Weak criteria require

constant clarification.

See modules/verifiable-goals.md for the full

reformulation template.

Deep dives: Skill(imbue:proof-of-work) for the Iron

Law (no implementation without a failing test first),

Skill(superpowers:test-driven-development) for the

RED-GREEN-REFACTOR loop.

The Karpathy Self-Check

Before you ship, four questions:

| Principle | Question |

|-----------|----------|

| Think Before Coding | Did I list assumptions, or did I guess silently? |

| Simplicity First | Would a senior engineer call this overcomplicated? |

| Surgical Changes | Does every changed line trace to the request? |

| Goal-Driven Execution | Can I prove this is done with a check, not a feeling? |

Four "yes" answers means ship. Anything else means

iterate.

Modules

with before/after diffs

three-question self-check battery

reformulation template with worked examples

principles do not apply

References

primary citation, Forrest Chang derivation, license,

adjacent prior art

Related Skills

branch budgets

hidden-assumption guard

proof on every addition

YAGNI, SOLID

RED-GREEN-REFACTOR

options before committing

for the full gate-skill federation graph (this skill

is the synthesis hub)

Required Progress Items

When invoked as a pre-flight gate, create:

satisfied

Exit Criteria

concrete artifact (assumption list, scope rationale,

diff trace, verification plan).

the implementation begins.

recorded to docs/tradeoffs.md (or the in-file

template) when real alternatives were weighed.

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.