Modern Creator
Eric Tech · YouTube

Karpathy's Skill Just Fixed Claude Code's Biggest Problem

How to embed Karpathy's four AI-coding guardrails into CLAUDE.md — and wire them to Superpowers, GSD, and G-Stack for the full workflow.

Posted
1 weeks ago
Duration
Format
Tutorial
educational
Views
39.4K
861 likes
Big Idea

The argument in one line.

Embedding Karpathy's four coding principles (think before coding, simplicity, surgical changes, goal-driven execution) directly into CLAUDE.md creates always-on guardrails that prevent AI hallucination, and combining them with triggered skills like Superpowers and G-Stack maxi.

Who This Is For

Read if. Skip if.

READ IF YOU ARE…
  • You're using Claude Code with a CLAUDE.md file already in place and want to reduce hallucinations, over-engineering, and unintended side effects in AI-generated code.
  • A software engineer building with Claude who struggles with the model making assumptions instead of asking clarification questions before executing tasks.
  • You're familiar with prompt engineering or system instructions and want to see how to layer Karpathy's four principles into your existing Claude workflow without breaking current setups.
SKIP IF…
  • You're not using Claude or Claude Code as your primary AI development tool — this is framework-specific and won't transfer cleanly to other models.
  • You've already implemented custom guardrails or a mature system prompt workflow — this is introductory-level on principle application, not advanced customization.
TL;DR

The full version, fast.

Andrej Karpathy's four-principle skill, distilled from a 7M-view X post, addresses the three failure modes that wreck AI-generated code: silent assumptions, gratuitous complexity, and unrequested side effects. The mechanism is a CLAUDE.md guardrail block enforcing think-before-coding, simplicity-first, surgical changes, and goal-driven execution � embedded into the model's always-on personality rather than triggered as an on-demand skill. Install it via the curl one-liner on existing projects, then have Claude reconcile duplicate headings and redundant framing against your existing rules before committing. For maximum accuracy, pair the guardrails with triggered frameworks like Superpowers, GSD, and G-Stack, routing each principle to a matching skill � brainstorming for new features, debugging for failures, plan-writing for multi-file work, symbolize for pre-commit cleanup.

Members feature

Chat with this breakdown.

Modern Creator members can chat with any breakdown — ask for the hook, quote a framework, find the exact transcript moment. Unlocks at T2: refer 3 friends + add your own API key.

Create a free account →
Chapters

Where the time goes.

00:0000:47

01 · Intro — Karpathy's 4 problems with LLM coding

Names the authority (Karpathy, 100K stars, 7M views), states the three problems: wrong assumptions, over-complicated code, rogue edits.

00:4701:48

02 · School community CTA

Mid-video ad read for Skool community — AI agents, automations, Claude Code masterclass, weekly live calls.

01:4802:57

03 · The Four Principles

Walks through all four rules in the README: think before coding, simplicity first, surgical changes, goal-driven execution.

02:5704:03

04 · Install options

Three install paths: Claude Code plugin (global), new project curl, existing project append-curl.

04:0305:30

05 · Live install on bookzero.ai

Runs the append command, opens git diff, then asks Claude Code to merge conflicts and clean up the CLAUDE.md.

05:3007:48

06 · CLAUDE.md vs Skills (Superpowers / GSD / G-Stack)

Defines the key distinction: CLAUDE.md rules are always-on personality; skills are triggered. Compares functionality overlap and unique contributions.

07:4810:10

07 · Combining Karpathy rules with skills

Maps each principle to a specific skill invocation path: brainstorming, debugging, planning, simplify-before-commit, test-driven dev, security review.

10:1011:03

08 · Outro + playlist CTA

Subscribe ask, link to full spectrum-dev frameworks playlist in description.

Atomic Insights

Lines worth screenshotting.

  • Karpathy's four principles — think before coding, simplicity first, surgical changes, goal-driven execution — address the four most common ways language models fail on real engineering tasks.
  • The think-before-coding principle forces the model to ask clarifying questions rather than acting on assumptions, which eliminates the most common source of wasted build cycles.
  • Simplicity first means that if a senior engineer would call the output overcomplicated, it should be rewritten — the success criterion is the judgment of an experienced human reviewer.
  • Surgical changes means the model must never modify code unrelated to the explicit instruction — scope creep in AI-generated diffs is as expensive as scope creep in human development.
  • Goal-driven execution requires a defined success criterion before coding begins — vague goals produce vague code, and the model needs to know what done looks like before it starts.
  • CLAUDE.md rules are always-on behavioral guardrails; skills are triggered explicitly — installing the Karpathy principles into CLAUDE.md enforces them on every session without any user action.
  • Merging the Karpathy skill into an existing CLAUDE.md requires a deduplication pass — the model should audit for contradictions and redundancies before the rules go live.
  • After pasting the four principles, asking Claude to review the CLAUDE.md for conflicts and merge cleanly is the correct installation process rather than naive append.
  • GSD, Superpowers, and G-Stack are skill frameworks that must be invoked — Karpathy's principles in CLAUDE.md run automatically, making them complementary rather than competing.
  • The Karpathy skills repo hit over 100,000 GitHub stars because the four principles solve problems every Claude Code user has encountered within their first week of use.
  • Removing meta-framing and duplicate headers when installing the principles makes the CLAUDE.md shorter and more readable — less instruction text means faster model comprehension per session.
  • The combination of always-on CLAUDE.md guardrails and triggered skill frameworks gives Claude Code both a behavioral baseline and a structured process layer for complex projects.
Takeaway

Four Coding Guardrails Embedded in CLAUDE.md Prevent the Three Most Common AI Coding Mistakes

Claude Code setup

Eric Tech's walkthrough of the Karpathy principles shows that the four guardrails — think before coding, simplicity first, surgical changes, goal-driven execution — address the exact failure modes most AI coding sessions hit, and that embedding them in CLAUDE.md makes them always-on rather than remembered-sometimes.

01Intro — Karpathy's 4 problems with LLM coding
  • Three failure modes named: wrong assumptions without clarification, over-complicated code, rogue edits with unknown side effects
  • The four principles address each failure mode directly — this is applied engineering, not general best practice
03The Four Principles
  • Think before coding, simplicity first, surgical changes, goal-driven execution — four rules that constrain the four most common AI coding failure modes
  • Each principle has a specific behavior it prevents — understanding the target failure mode is what makes the rule stick
04Install options
  • Three paths: Claude Code plugin (global), new project curl, existing project append-curl — the append path preserves your existing CLAUDE.md content
  • Existing project append is the right path for any active project — it adds without destroying
05Live install on bookzero.ai
  • Append command → git diff → ask Claude to merge conflicts and clean up — letting the model handle its own rule file merge is faster and more reliable than manual editing
  • The git diff step is the review checkpoint — always check what changed before accepting the merged CLAUDE.md
06CLAUDE.md vs Skills
  • CLAUDE.md rules are always-on — they inject into every session whether or not they are relevant to the current task
  • Skills are triggered on demand — they inject context only when explicitly invoked, which preserves context budget for the actual task
07Combining Karpathy rules with skills
  • Each principle maps to a specific skill invocation: think-before-coding maps to a planning skill, simplicity maps to a simplify-before-commit skill, goal-driven maps to test-driven development
  • The combination of always-on guardrails and triggered skills is the complete accuracy stack — neither alone is sufficient
Glossary

Terms worth knowing.

CLAUDE.md
A project-level instruction file read automatically at the start of every Claude Code session. Rules placed here apply to every action the model takes in that project, without needing to be invoked.
Claude Code
Anthropic's command-line coding agent that runs inside a developer's terminal, reads and edits project files, and executes shell commands to build software.
Skill
A self-contained Claude Code capability bundle (instructions plus optional scripts) that the model loads on demand when a matching trigger fires, rather than being active on every turn.
Plugin marketplace
A directory inside Claude Code where users can browse and install skill or plugin bundles published by others, similar to an app store for agent capabilities.
Always-on rule vs triggered skill
Always-on rules live in CLAUDE.md and shape every response by default; triggered skills only load when their description matches the current request, keeping the base context smaller.
Guardrails
Explicit constraints written into a model's instructions that block unwanted behavior, such as forbidding speculative code or scope creep.
Hallucination
When a language model fabricates code, APIs, or facts that look plausible but do not actually exist or do not match the real codebase.
Spec-driven development
A workflow where the model first writes a written specification, converts it into a checklist of tasks, and only then executes — preventing it from coding before the goal is clear.
Surgical changes
Edits limited strictly to the lines required by the request, with no incidental refactoring, formatting, or improvements to unrelated code.
Goal-driven execution
Framing a task as a verifiable success criterion (such as a failing test that must pass) so the model can loop on its own work until the goal is objectively met.
git diff
A command that shows exactly which lines were added, removed, or changed in files, used here to inspect what an install script wrote into an existing config file.
curl install command
A one-line shell instruction that downloads a remote script and runs it, commonly used to bootstrap tools or append rules into a local project file.
Superpowers
A third-party skill pack for Claude Code that adds structured workflows such as brainstorming, systematic debugging, and pre-commit polishing.
GSD
Short for Get Stuff Done — a skill framework that enforces a planning phase before any code is written, then drives execution from the resulting task list.
G-Stack
A skill bundle that layers planning, role-based agents, and execution steps on top of Claude Code to keep multi-file changes coherent.
Git worktree
A Git feature that lets multiple branches be checked out into separate folders at the same time, so isolated experiments or agent runs do not interfere with the main working copy.
Test-driven development
A practice of writing a failing automated test that captures the desired behavior first, then writing only enough code to make that test pass.
Resources Mentioned

Things they pointed at.

Quotables

Lines you could clip.

05:10
It's personality embedded into the model's brain — every time it does something, it knows this because it's embedded into its soul.
Perfect one-liner for why CLAUDE.md matters more than any individual promptTikTok hook↗ Tweet quote
06:50
Superpowers and G-Stack teach how to work carefully but they don't say how much to do — these guardrails fix that gap.
Tight contrast, no setup needed, names the problem and the fix in one breathIG reel cold open↗ Tweet quote
08:50
The possibility here is endless — just pick the skill you want and add it into your CLAUDE.md and Claude knows exactly what skill is gonna trigger.
Inspirational closer; expandable into a whole threadnewsletter pull-quote↗ Tweet quote
The Script

Word for word.

metaphoranalogy
00:00In this video, we're gonna go over this Andrew Kaparvi skills, which gone over a 100,000 stars on GitHub, and this skill is derived from this x post that Andrew Kaparvi has wrote. And if you don't know what Andrew Kaparvi is, he is previously a director of AI at Tesla and a founding team at OpenAI. And currently, this X post has gone over 7,000,000 views on X.
00:19And essentially, what this skill does is addressing the problems that Angi Kaparvi sees on X. And the first problem we see is the model here always make the wrong assumption. So it doesn't ask clarification question.
00:30When you give it a prompt, it just act on it. And the second problem they see is that a model here oftentimes overcomplicating things.
00:37Things can be run-in 100 lines, often rows in a thousand lines. And oftentimes, large language model here making changes that they're not supposed to without a clear understanding about the full side effects. So that's why in this video, we're gonna take a look at what it is, how does it work, and how is it different compared to any other skills that we have used in the past.
00:54So with that being said, if you're interested, let's get into the video. Now before we continue, I recently launched our school community where I help you to master AI agents, automations, and so much more. And that's all coming from someone who used to work as a senior AI software engineer at companies like Amazon and Microsoft.
01:10And in this community, you're gonna get over a 100 plus video materials like templates and workflows that I personally built and sold over a 100 plus times. On top of that, you're also gonna get access to our weekly live calls. And just to give you an idea, this week, we're actually running a Clawcode masterclass where we're gonna dive into how to improve Clawcode's accuracy when we're gonna use it to build the applications.
01:29Plus, you're also gonna get full community supports where you're get a chance to ask questions and get direct answers back. So if you're ready to level up, make sure to jump right in, and I'll see you in a community. Alright.
01:38So to get started, let's take a look at what this skill is trying to offer. So right here, can see this skill here offers four principles that we can use in our project, which will basically roll inside of our CloudMD file. So first principle here you can see is think before coding.
01:51Largely new model here, like I said, makes wrong assumptions, doesn't clarify things, and by having this principle, it's gonna force AI here to have to think before it's gonna do the execution. And the second here is simplicity. Things that can be wrote in 100 lines of code never should be wrote like 500 or a thousand lines of code.
02:09Right? Never should be complicating things. And the success criteria here is that if a senior engineer says that this is over complicated, that we should definitely simplify.
02:17And that's exactly what this principle is trying to solve. And the third one here is surgical changes. So let's say we're making changes.
02:23Large language models should never touch code that are not related to the instruction that we provide, and that's essentially what this principle does. And the last one that we have is goal driven execution. We need to have a clear goal on exactly how large an extra model can perform before it's going to do the executions.
02:39And it's similar to the first one, but we need to have a clear success criteria for the expected behavior on the end results. And that's the four principles that the skill is trying to introduce, and they all compacted down into a single CloudMV file that we can add into a project to make sure that large language model here never hallucinates when writing code.
02:57Now to put this into practice, here you can see it tells exactly how to install this. First of all, what we can do here is that we can install this in Claw plugins. Simply, we're just gonna add the skill in our marketplace and install it.
03:07And the second option that we have is, let's say, you want to install this not globally, but in a project level, simply you can just do this curl command here and add this onto your new project. But if you have an existing project, you can simply just gonna run this command right here, and simply it's gonna write this rule onto your CloudWeb file onto your existing project.
03:24Now for my case here, I do have an existing project called BookZero dot a I, where I help business here to manage receipts and transactions all using AI. What And I wanna do here is I wanna install this onto this project and see how does it work. Now in order to install this, all I had to do here is just gonna copy this command.
03:38It's gonna install this on existing projects. So here, I'm just gonna come over to a project terminal, open a new terminal, and just gonna paste that command here. And what this essentially, this command does is going to modify my CloudMD file by simply adding those four rows onto there.
03:52So in this case, I'm gonna click click on enter, and you can see that it's going to modify my CloudMD file. So now if I would open the git diff, and here you can see this is the change that has applied. And for most of you guys, you probably already have your CloudMD file with your existing project.
04:05And by installing it, it might have some contradiction or conflict with your existing rules. So what I highly recommend you to do is basically tell Cloudcode to basically try to modify your ClawdMD file once you paste that, once you paste those four principal to see if there's any contradictions, any conflicts, anything that's not following what you have in your ClawdMD file.
04:25Like, try to merge the conflicts that you have. And you can see here that this is what it recommends. After it pastes it from the original Cardpathic Skills repository, here's some problem that I found.
04:34For example, we have the duplicate h one tag for the CloudMD file because the CloudMD file already has that. And here you can see there's some meta framing here that really tells a human reader what a doc does, but the CloudMD file here doesn't really need that. It needs the instruction, a clear instruction on exactly what it needs to do.
04:51Now we also have removed some redundant stuff that's not really relevant to our CloudMD file, and you can see Cloggo has also removed that and make it more concise. So again, same rule, less to read, so that we can be able to make our CloudMD file here more shorter. So now you can see if I were to close this, this is exactly what it has modified.
05:08Right? So you can see we have our behavior guardrails, that's gonna be an h two tag, and now we have our think before coding and simplicity first, as well as the surgical changes and the goal driven executions.
05:21So you can see that all the four principles are still here, and there's no conflicts between what we have above versus what we have here. K? So you can see that's exactly how this works.
05:28Alright. So now you know exactly how to install it. Let's take a look at the clear difference between how is it different compared to all the skills that we have mentioned on this channel, like Gstack, Supa Powers, GSD, all those frameworks that we have introduced.
05:41And a clear difference is this. GSD, Suhowers, GSDTACK, they are all skills.
05:46They're all skills that are being triggered whenever we trigger them. Right? But Clawd.
05:50Md file is different. It's that we enforce those rules instead of our Claude. D file, kinda like personality embedded into the bottle's brain.
05:58That every time when it do something, we don't have to mention it. It knows that because it's embedded into its personality, embedded into its soul that is gonna follow these four constraints every time we do something.
06:08When it asks to do do anything, like maybe helping us to writing a blog post or helping us to generate images or helping us to writing code, it's going to embed that. It's going to do this exactly like we mentioned in our CloudMD file. So that's the clear difference between the two.
06:23Now other than their types, let's talk about the functionalities. Right?
06:27Because these four principles actually cover a lot of those things that we have mentioned previously on this channel for those skills that we have mentioned, like GSTAC, superpower, and GST. How is it different, right, in terms of functionality?
06:39And you can see here that I asked AI on exactly the difference. And you can see here that rule number two and rule number three here has pointed out by AI that is uniquely different compared to superpower and GSTAC because none of them has mentioned anything about, like, adding extra stuff or staying your length or they don't really mention about these things as, like, the constraints.
06:59They both teach how to work carefully, but they don't know how much, like, to do. Right? Your guardrails here, which is, you know, our CloudMD file here, fix that gap by mentioning these things.
07:08Right? And we also have something that's similar to what we have with superpower g stack is rule number one and rule number four, which is think people coding and goal driven. Right?
07:16That's exactly what spectrum development does. It's creating the plan before doing executions. And what superpower and g stack does different is not just bunch of text sets inside of a CloudMD file, it's a framework that we have to first write our spec.
07:31From spec created a to do list, and from to do list creating a action. Right? That's exactly what superpower and g stack does.
07:38It's creating a framework that large numbers model here follow, but it doesn't built into the brain. But most of them are very similar. Right?
07:44The same rule, the same concept is very similar between the two. But that's why my recommendation, my workflow is combining the all of them.
07:52Right? Combining the two. Not just showing them the constraints, but also giving them the path on exactly which skill to trigger.
07:59For example, each of the principles that Karpathy has mentioned, like think before coding, like don't assume, like, service the the trade off before writing code, we will give them the path on exactly what skill to trigger. For example, just couple of MD files is not gonna cut it.
08:14We're gonna let them to basically direct them to trigger the superpower skills. Like, for example, the superpower brainstorming skill for adding new features. Or if it's like bug, error, or test, like, test error, like test failure, we're gonna have them trigger the superpower system debugging skill.
08:29If it's a multi step, like three files, we're just gonna directly having to trigger the writing plan skill or the GSD planning phase skill. Basically, try to execute it really fast, creating a to do list and try to execute it.
08:42Right? And for simplicity first, there's actually bunch of skills for simplicity, like making code more simplified, like minimize the code that solves the problem, nothing speculative. So you can see before committing, polish.
08:54So whenever we try to commit things, okay, well, let's trigger the Symbolize skill and try to Symbolize everything. Alright. So pretty much that's it for this video and alright.
09:01So you can see that's pretty much it for this video. And if you do find this video, please make sure to like this video, consider subscribing for more content like this. But with that being said, I will see you in the next video.
09:10And honestly, don't even stop there. You can also include in G Stack, like the auto plan skill, where you can do have different roles here to introduce for think before coding. The possibility here is is endless.
09:20Right? You can actually add a lot of things in here. For example, there's also surgical changes.
09:24You can also add, like, using different work trees for, you know, breaking it into different environments, and there's also goal driven executions.
09:32Right? Making sure that we're setting a clear goal, right, for the success criteria. So implement a feature or bug fix.
09:39Okay. Well, let's trigger the test driven developments here. If it's like executing a a written plan, well, let's do the executing plans.
09:45Right? So there's actually a lot of skills that does that. For example, if we want to do a security review, there's also security review.
09:51There's also data audits. There's also QA. So we'll give them path to the skills that we have and making sure that not only following the constraints, but also calling the right skills to act on it.
10:01Right? So you can see the possibility here is endless, and you can just pick the skill that you want and just add it into your cloud.me file, and Cloud knows exactly what skill is gonna trigger based on your preference. Okay.
10:11So pretty much that's it for this video. And, honestly, I don't want to have my CloudMD file here to be too long, so I just wanted to keep it short. Just keep some skills that I really like inside of our CloudMD file.
10:21Alright. So you can see that's exactly the engine capacity skills. And, of course, if you're interested in learning more about spectrum data frameworks, be sure to check out the playlist here inside of the description below where I show you all the spectrum data frameworks that I've talked about on this channel on how you can be able to make your large entry model here to be highly accurate when performing task on your project.
10:39Right? So if you're interested for that, uh, make sure to check it out in the link in the description below. But with that being said, if you do feel like this video, please make sure to like this video, Consider subscribing for more content like this.
10:48But with that being said, I'll see you in the next video.
The Hook

The bait, then the rug-pull.

One hundred thousand GitHub stars and seven million X views. When Andrej Karpathy — ex-Tesla AI director, OpenAI founding team — writes down what's wrong with how LLMs code, the community listens. Eric Tech took those four rules and dropped them into a real Claude Code project to find out if they actually work. They do. But the bigger move is what you do after the install.

Frameworks

Named ideas worth stealing.

NaN:NaNlist

The Four Karpathy Coding Principles

  1. Think Before Coding
  2. Simplicity First
  3. Surgical Changes
  4. Goal-Driven Execution

Embedded as always-on CLAUDE.md guardrails. Derived from Karpathy's X post on LLM coding pitfalls.

Steal forAny CLAUDE.md file — paste these in and tell Claude to merge with your existing rules
NaN:NaNconcept

CLAUDE.md = Personality, Skills = Triggers

CLAUDE.md rules fire on every message without invocation. Skills require explicit trigger. Combine both: CLAUDE.md sets the floor, skills add the workflow ceiling.

Steal forExplaining to clients or students why CLAUDE.md matters beyond just preferences
NaN:NaNmodel

Karpathy + Skills Wiring Map

  1. Think Before Coding: superpowers brainstorming (features) / superpowers static-debugging (bugs)
  2. Multi-step task: superpowers writing-plans or gsd plan-phase
  3. Simplicity First: simplify skill before commit
  4. Surgical Changes: scope-creep guard; worktrees per change
  5. Goal-Driven: gsd test-driven-dev, superpowers verification, security-review

Eric's final recommended CLAUDE.md shape: Karpathy rules + per-rule skill routing.

Steal forTemplate for a combined CLAUDE.md that routes every situation to the right skill
CTA Breakdown

How they asked for the click.

00:47product
I recently launched our school community where I help you to master AI agents, automations, and so much more

Placed at ~45s before the main tutorial content. Own-product ad. Also pushed a playlist CTA at the outro.

Storyboard

Visual structure at a glance.

open
hookopen00:00
CTA
ctaCTA00:58
4 rules
value4 rules01:48
install
valueinstall02:57
live demo
valuelive demo04:04
comparison
valuecomparison05:30
combine
valuecombine07:48
outro
ctaoutro10:40
Frame Gallery

Visual moments.