A single CLAUDE.md file reached 127K GitHub stars because it addresses a problem developers keep seeing with AI coding agents: messy behavior.
The repo is forrestchang/andrej-karpathy-skills. It takes a few of Andrej Karpathy’s observations about LLM coding failures and turns them into instructions that Claude Code can read before working on a project.
It takes a few of Karpathy’s observations about LLM coding failures and turns them into instructions that Claude Code can read before working on a project.
GitHub currently shows the repo at 127K stars and 12.9K forks.

Andrej Karpathy Skills GitHub. Image by Jim Clyde Monge
The file focuses on four principles:
- Think before coding.
- Keep the solution simple.
- Make surgical changes.
- Define success criteria before implementation.
Those rules map directly to common agent failures. Wrong assumptions. Bloated abstractions. Unrelated edits. Weak verification.
What is CLAUDE.md?
CLAUDE.md is a markdown file that Claude Code reads as a persistent project context. Anthropic’s own docs describe it as a way to give Claude persistent instructions across sessions. Claude Code loads these files at the start of a conversation, alongside other memory systems like auto memory.
That means CLAUDE.md is not just a note for humans. It becomes part of the agent’s working context.
You can use it to tell Claude things like:
## Project commands
- Build: npm run build
- Test: npm test
- Lint: npm run lint
You can also include project-specific rules:
## API conventions
- API errors return { error: string, code: number }
- Dates are stored in UTC
- Feature flags live in config/flags.ts
The important part is that CLAUDE.md should contain information Claude needs in every session. Anthropic recommends adding things when Claude repeats the same mistake, when a code review catches something Claude should have known, or when you keep typing the same correction again and again.
A good CLAUDE.md is not a dumping ground for every preference you have. It is closer to an operating manual for the agent. It should contain a durable context. Build commands. Test commands. Repo conventions. Security rules. Common traps. Repeated lessons from past failures.
The viral repo takes that idea and strips it down even further.
Instead of starting with project architecture, it starts with behavior.
Here is the full CLAUDE.md file from the repo:
# CLAUDE.md
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
## 1. Think Before Coding
**Don't assume. Don't hide confusion. Surface tradeoffs.**
Before implementing:
- State your assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them - don't pick silently.
- If a simpler approach exists, say so. Push back when warranted.
- If something is unclear, stop. Name what's confusing. Ask.
## 2. Simplicity First
**Minimum code that solves the problem. Nothing speculative.**
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.
- No error handling for impossible scenarios.
- If you write 200 lines and it could be 50, rewrite it.
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
## 3. Surgical Changes
**Touch only what you must. Clean up only your own mess.**
When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- If you notice unrelated dead code, mention it - don't delete it.
When your changes create orphans:
- Remove imports/variables/functions that YOUR changes made unused.
- Don't remove pre-existing dead code unless asked.
The test: Every changed line should trace directly to the user's request.
## 4. Goal-Driven Execution
**Define success criteria. Loop until verified.**
Transform tasks into verifiable goals:
- "Add validation" → "Write tests for invalid inputs, then make them pass"
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
- "Refactor X" → "Ensure tests pass before and after"
For multi-step tasks, state a brief plan:
1. [Step] → verify: [check]2. [Step] → verify: [check]3. [Step] → verify: [check]
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
---
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
AI coding agents often fail at execution discipline.
They make silent assumptions, overbuild small fixes, touch unrelated files, rewrite comments, change formatting, and mark tasks as done without verification. The result may look fine in chat, but the diff usually exposes the problem.
A one-file bug fix becomes a six-file review. A small validation change becomes a new abstraction. A quick patch creates behavior changes outside the requested scope.
The CLAUDE.md file sets stricter rules before Claude Code edits the repo.
Here’s what each principle means:
1. Think before coding
This rule targets silent assumptions.
A request like “add validation” can mean client-side validation, server-side validation, schema validation, API validation, test coverage, error messages, or input sanitization.
Claude should not pick one silently. It should state assumptions, surface ambiguity, and ask when the request is unclear.
For non-trivial tasks, one clarification is cheaper than cleaning up the wrong implementation.
2. Simplicity first
This rule targets overengineering.
AI agents often turn small changes into reusable modules, new abstractions, or unnecessary refactorings. That adds names, tests, docs, maintenance, and more behavior to reason about.
The rule is simple: write the minimum code needed. No extra features. No abstraction for single-use code. No configurability unless the task requires it.
3. Surgical changes
This rule targets noisy diffs.
Claude should only touch the code required by the task. No nearby cleanup. No unrelated formatting changes. No variable renames based on preference. No comment rewrites unless they are part of the requested change.
If Claude creates unused imports or orphaned variables, it should remove them. If dead code already existed, it should mention it instead of deleting it.
4. Goal-driven execution
This rule targets weak completion.
“Fix the bug” is too vague. A better instruction is: write a failing test that reproduces the bug, make it pass, then run the relevant test command.
“Add validation” is also weak. A better version is: reject invalid inputs, show the expected error state, and add tests for valid and invalid cases.
Clear success criteria give the agent a target to loop against. Without that, it may stop when the code looks plausible instead of being verified.
What I would add on top of the four rules
The four rules are a good baseline, but I would not stop there for a real project. I would add a thin project layer.
Not a huge architecture essay. Not a full README copy. Not a giant style guide. Just the information that the agent cannot reliably infer or should not guess.
Here is a good structure:
# CLAUDE.md
## Behavior
Use the four Karpathy-inspired rules:
1. Think before coding.
2. Keep solutions simple.
3. Make surgical changes.
4. Define success criteria before implementation.
## Project commands
- Install: pnpm install
- Dev server: pnpm dev
- Typecheck: pnpm typecheck
- Lint: pnpm lint
- Test: pnpm test
- Build: pnpm build
## Project conventions
- Use existing component patterns before creating new ones.
- API errors must return { error: string, code: string }.
- Do not add new dependencies without asking.
- Do not edit generated files.
- Do not change database migrations after they have been committed.
## Watch out
- Auth logic lives in src/lib/auth.
- Payment webhook tests require local environment variables.
- Do not import from internal server modules in client components.
That is enough for many projects.
The uploaded source article also points out that project-specific context should focus on build commands, conventions the code does not show, and lessons from past failures. It warns against duplicating things the agent can already read from the codebase.
That is a good rule.
- Do not paste your entire architecture document into
CLAUDE.mdif Claude can inspect the folders. - Do not list every dependency if Claude can read
package.json. - Do not explain every component if the code is already clear.
- Do not include stale notes that nobody maintains.
Use the file for high-leverage context.
Why developers starred it
The repo went viral because the fix is small and the pain is common.
Most developers using AI coding tools have seen the same issues:
- The agent guesses instead of asking.
- The agent writes more code than needed.
- The agent edits unrelated files.
- The agent stops without strong verification.
The repo gives developers something they can copy into a project in minutes.
No new framework. No new toolchain. No model change. No benchmark setup.
Just a file that improves the agent’s default behavior.
That low-friction setup is a big reason it spread. Developers do not need another complicated agent framework to test the idea. They can add the file, run Claude Code, and inspect whether the diffs get cleaner.
How to use it
The repo supports two main usage paths.
The first is a Claude Code plugin. You add the marketplace, then install the andrej-karpathy-skills plugin.
To install via the marketplace, open Claude Code and run the following command:
/plugin marketplace add forrestchang/andrej-karpathy-skills

Andrej Karpathy Skills installation. Image by Jim Clyde Monge
You should see the “Successfully added marketplace: karpathy-skills” before moving forward with the next step.
Next, install the skill with the following command:
/plugin install andrej-karpathy-skills@karpathy-skills

Andrej Karpathy Skills installation. Image by Jim Clyde Monge
You will be asked for the scope of the plugin.
- Install for you (user scope)
- Install for all collaborators on this repository (project scope)
- Install for you, in this repo only (local scope)
- Back to plugin list
I usually just apply it to the project, so I select the project scope.
If the installation is successful, you should see the successful installation message on the terminal.

Andrej Karpathy Skills installation. Image by Jim Clyde Monge
Reload the plugins by running /reload-plugins, then check if the andrej-karpathy-skills is installed locally.

Andrej Karpathy Skills installation. Image by Jim Clyde Monge
You can also confirm this in the newly created settings.local.json file inside the .claude folder.

Andrej Karpathy Skills installation. Image by Jim Clyde Monge
The other way to use it is through Claude.MD (per-project).
New project:
curl -o CLAUDE.md https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md
Existing project (append):
echo "" >> CLAUDE.md
curl https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md >> CLAUDE.md
Where the four rules are not enough
The four rules are useful, but they are not a full solution.
They will not magically make Claude understand a large enterprise codebase. They will not replace tests. They will not prevent all bad edits. They will not remove the need for human review.
There are several cases where you need more structure.
Large refactors
If the task touches many files, the agent needs more than “make surgical changes.”
A large refactor may require a dependency map, module boundaries, migration steps, and a rollback plan. In this case, you should split the work into smaller tasks and define success criteria for each step.
For example:
Step 1: Identify all imports of the old module.
Step 2: Move the pure helper functions first.
Step 3: Update imports in one package.
Step 4: Run tests for that package.
Step 5: Repeat for the next package.
The point is to keep the agent from doing a giant repo-wide change in one pass.
Security-sensitive code
If the code touches authentication, payments, permissions, or user data, you need stricter rules.
For example:
## Security rules
- Never log access tokens, refresh tokens, passwords, or API keys.
- Never expose server-only environment variables to client components.
- Any auth change must include tests for unauthorized access.
- Any payment webhook change must verify signature validation.
The four rules encourage caution, but they do not know your compliance requirements.
Team workflows
A solo developer can keep rules inside one CLAUDE.md file. A team needs more consistency.
Anthropic’s docs describe different scopes for CLAUDE.md files, including organization-wide instructions, user instructions, project instructions, and local instructions.
This is important for most teams because not every rule belongs in the same place.
- Company security policies may belong at the organization level.
- Project commands belong in the repo.
- Personal workflow preferences belong in a local file.
- Experimental notes should probably stay out of the shared file.
This prevents the shared CLAUDE.md from becoming one person’s personal preference dump.
What this says about AI coding
This repo is a good reminder that model quality is only one part of AI coding.
The model matters, but the harness around the model matters too. Instructions, repo context, success criteria, test commands, and edit boundaries can change the quality of the result.
A capable model with weak instructions can still create messy work. A capable model with clear boundaries is easier to review.
That is why files like CLAUDE.md, Cursor rules, and repo-level agent instructions are becoming part of the development workflow.
They are not just prompt notes. They are operating rules for AI contributors.
Teams already document coding standards for humans. It makes sense to document agent behavior, too.
The repo did not go viral because the CLAUDE.md file is advanced.
It went viral because it names the failures developers keep cleaning up after: Wrong assumptions, overbuilt code, unrelated edits, weak verification.
The file turns those problems into four rules Claude Code can follow before it edits a project.
It will not make Claude perfect. Developers still need to review the diff, run tests, and use judgment.
But as a baseline, it is useful.
A coding agent that asks when unclear, keeps code simple, edits surgically, and verifies against clear goals is easier to trust.
That is what developers want from these tools. Not more code. Better-controlled code.
