The Karpathy Method: Spec, Verify, Then Build Your Environment

Ask a top AI model whether you should walk or drive to a car wash 50 meters away and, as Andrej Karpathy pointed out at Sequoia's AI Ascent this year, it may tell you to walk. The model can refactor a huge codebase and still miss that the car has to be there. That gap is why so many AI projects disappoint: the model excels at anything checkable and is blind to context you never gave it. Austin Marchese turned Karpathy's thinking into three layers you can use with Claude today: a spec, a verifier and an environment. This guide shows how to write a spec for AI in all ten steps, with the prompts, and shows where they pay off for a marketing team or agency.

How to write a spec for AI: stop re-prompting, give AI a spec, a checker and rules. Ten steps in three layers, from Austin Marchese's take on Andrej Karpathy's ideas.

The Karpathy method in one table

Layer What it does Steps
Spec Gets your understanding into a form the model can use 1 to 3
Verifier Defines and checks what good looks like 4 to 6
Environment The workspace both live in, and its rules 7 to 10

Karpathy's own summary explains why the order matters: older software automated what you could specify in code, and today's models automate what you can verify. Give them both and they fly.

Why we write the spec before anyone builds

I've built, scaled, and sold three companies, generated over $85 million in the last seven years in my own companies. The expensive mistakes were rarely about effort. They came from building the wrong thing well. At WKND every AI build starts with a written goal and a test for done.

Evidence Source
Top models told to walk 50 m to a car wash Andrej Karpathy, Sequoia AI Ascent 2026
"LLMs can automate what you can verify" Karpathy's Sequoia Ascent summary, 2026
A failing hook lets the action through unless set to block Claude Code hooks documentation

How to write a spec for AI: layer one

Step 1: Uncover the goal before the task

"Build an end-of-month report" is a task. The goal is the decision the report should drive, such as whether to move budget from one channel to another. The model can't guess that, so make it ask. His on-screen card defines the goal as "the conclusions you're trying to draw. The decisions the report drives." Then he types this into Claude Code:

Interview Me To identify the goal of this project

Answer honestly, including what you'd do with the result. That answer is the first paragraph of your spec.

Step 2: Spec in small, agile pieces

The temptation with agents is to hand over the whole job and come back later. That's waterfall, and it means you find the drift at the end. Work in short loops instead: a tight scope, a checkpoint, a review, an adjustment, then the next piece. His two cards say it plainly:

WATERFALL: You take a big task. Complete the whole thing. Show the final result.

AGILE: You break that same task into small buckets and show the result throughout the process.

His loop on screen runs Tight Scope, A Clear Checkpoint, Review the Output, Adjust and Repeat. The line he says: "bias towards smaller and more compartmentalized specs."

Step 3: Be precise and check the key decisions

Every gap in your spec is a guess the model makes for you, and every guess can pull the result away from what you meant. Name the inputs, the outputs, the edge cases and what's out of scope. Then read the spec it writes back to you as if a new hire wrote it. His checklist reads "1 Uncover the Goal. 2 Be Agile with how you work. 3 Be Precise and USE YOUR BRAIN." He types:

Make me verify key decisions explicitly to ensure nothing is missed

Then he puts the whole first layer in one prompt you can copy:

Interview me to find the real goal of this project. Bias toward small, compartmentalized specs. Make me verify key decisions explicitly so nothing is missed.

Karpathy goes further than plan mode here. In the clip Marchese uses, he says he wants a detailed spec designed together with the agent, not just a high-level plan. A good AI coding spec is closer to a short brief than a to-do list. That, in one line, is how to write a spec for AI that holds up.

Layer two: the verifier

Step 4: Define what good looks like up front

A model can't hit a target you never described. "Make the report look good" gives it nothing to check. "Three sections, each ending with one recommendation, numbers matching the source sheet" does. His cards: the vague way is "Make this report good."; the precise way is "The report must have 3 sections, each ends with a recommendation." His prompt card:

Outline the evaluation criteria you will use to ensure a high-quality final product. Be precise.

This is the same idea as step 3, aimed at the output instead of the plan.

Step 5: Use a second model as the critic

Karpathy's point about "ghosts" is that these systems don't respond to pressure the way people do. Pleading or shouting doesn't improve the answer. Checking does. A model trained on different data tends to catch different mistakes, so Marchese has a second one review the first. In Claude Code he uses OpenAI's Codex plugin. The README he shows lists /codex:review for a normal read-only Codex review, /codex:adversarial-review for a steerable challenge review, and installs with /plugin marketplace add openai/codex-plugin-cc. Then he types:

If this turns into a complex build, run the final output by Codex to ensure both systems agree.

We reviewed that plugin separately: see our Codex plugin for Claude Code review.

Step 6: Pull in outside signal

The best check is evidence from outside the chat. If Claude deployed something, connect it to the host so it can confirm the deploy instead of announcing it. If it's writing a monthly report, give it the last three reports as the reference. Outside facts beat the model grading its own homework. His second-layer prompt card puts steps 4 to 6 together:

Before you start, define the precise criteria for a great result, use a past example as the format to match, and have a second AI check the final output.

For more on this, see our guide on how to use AI effectively.

Layer three: the environment, and how to write a spec for AI that sticks

Step 7: Set up your CLAUDE.md

Claude Code reads your CLAUDE.md file at the start of every session, so it's where standing instructions belong. Marchese's covers four things: how the project is laid out, which skills exist and when to use them, where reference material lives, and the rules that always apply. His file opens with a How This Repo Works list, shown on screen word for word: ".claude/skills/: Slash-command workflows", ".claude/agents/: Consultant personas loaded by skills and agent tool", "knowledge/: Three-layer knowledge base", "projects/: Active and completed work", "scripts/: Python utilities for transcript processing", and "Skills are the primary interface. When in doubt, invoke the skill." One rule he reads aloud:

before building anything multi-step, include a verification plan.

Now verification happens by default instead of when you remember to ask.

Step 8: Build your LLM knowledge base

The idea traces to Karpathy, who describes keeping his own notes and sources in a structure his model can browse, and using it to understand topics better. For a business, the equivalent is a tidy folder of your briefs, past reports, brand rules and results that Claude can navigate. His CLAUDE.md shows the layout: "Three layers with different ownership. Do not edit raw/ files." Then knowledge/raw/ for "Immutable source material", knowledge/wiki/ for "Claude-generated synthesis", and knowledge/frameworks/ for "Actionable guides". Generic models know what everyone knows. Your files are what make the output yours. Learning how to write a spec for AI matters less if the model can't find your context.

Step 9: Turn repeat work into skills

His slide puts it in one line: "If you plan on doing something repeatedly, create a custom skill for that." In practice, write it up as a skill: a short handbook for doing that one job well. Then use it a lot. Marchese tells his team that "the best way to find a leak in a hose is to run water through it", and skills work the same way. Our guide on how to write Claude skills covers the craft.

Step 10: Set guardrails: always do, ask first, never do

His slide, "A concrete RULE AI can't bypass", sorts actions into three groups: "Always do. The defaults that agent runs on autopilot." "Ask first. Anything with consequences. Destructive actions, costs, one-way decisions." "Never do. The lines that don't get crossed. Touching production, sending real emails, exposing secrets." In other words, sort every kind of action by what a mistake would cost. Routine work runs on its own. Anything you'd want to double-check waits for approval. A short list of things never happens. The catch: a line in CLAUDE.md is a request, and the model can ignore it. For the never list, Marchese uses a hook that runs before Claude's write or edit tools and blocks changes to a protected folder.

Anthropic's own docs add one detail: a hook that crashes or times out lets the action through unless you set it to block on failure, and the docs recommend permission deny rules for hard limits. Use both for real Claude Code guardrails. His closing prompt audits all three layers at once (his dash shown as a comma):

Check my CLAUDE.md, my knowledge base, my skills, and my guardrails. For each of the top 5 gaps, name the file, the problem, and the exact fix, and flag which risky actions need a hook so I can't bypass them.

Where this pays off for a marketing team

At WKND we see the same pattern across SEO, content and paid media work. The AI part is rarely the problem. The missing spec is. Three places to start:

  • Reporting: write the goal and the done test for your monthly report before automating it.
  • Content: keep brand rules and past winners in a knowledge base so drafts start on brand.
  • Ad accounts: put budget changes on the ask first list and account deletion on the never list.

Worked example: automating a monthly paid media report

A five-person agency wants Claude to draft each client's monthly paid media report.

  1. Goal: the interview surfaces the real purpose: tell the client whether to shift budget between search and social next month.
  2. Small pieces: first the data pull, then the charts, then the commentary, each reviewed before the next.
  3. Precision: the spec names the date range, the attribution window and that refunds are excluded.
  4. Criteria: three sections, each ending in one recommendation, every figure traceable to the export.
  5. Critic: a second model checks the commentary against the numbers and flags two claims the data doesn't support.
  6. Outside signal: last quarter's three approved reports serve as the format reference.
  7. CLAUDE.md: lists the report skill, the data folder and the rule "verify totals before writing".
  8. Knowledge base: each client's goals and past reports live in one folder per client.
  9. Skill: the whole flow becomes a "monthly report" skill, improved after each run.
  10. Guardrails: pulling data runs freely, sending to the client waits for approval, editing raw exports is blocked.

Want your AI workflows built on a real spec?

We sit down with your team, write the goal, the spec and the checks for one workflow, then build it in Claude with the guardrails in place. You approve the spec before anything is built, you keep every file, and nothing gets sent or changed without your sign-off. Why now: the teams writing specs this year will be compounding while everyone else is re-prompting.

What you get Where
A written spec, a working Claude workflow and its guardrails AI automation

Free tools

One free, MIT-licensed skill for Claude, Codex and Grok comes with this guide: Spec Check (checks a spec for the parts a model would otherwise guess; checks evaluation criteria are precise enough to verify; audits a Claude Code project's CLAUDE.md, knowledge base, skills and enforcement; and sorts actions into always do, ask first and never do, with deny rules and a hook that blocks even when it fails). Download the skill (free zip)

FAQ

Is this really Karpathy's method?

The ideas are his (the car wash example, verifiability, detailed specs, LLM knowledge bases). The ten-step structure is Austin Marchese's.

Do I need Claude Code?

Layers one and two work in any chat app. CLAUDE.md, skills and hooks are Claude Code features.

How long should a spec be?

Long enough that the model doesn't have to guess. For a small job, half a page.

Sources

What would your AI build differently if it knew what you actually wanted?

Book a call and we'll write the spec for the workflow you keep re-prompting.

Book a Search Strategy Call