mcpbeat Sign in

Karpathy Guidelines Skill for Claude

Behavioral guardrails for LLM-assisted coding. Use when writing, reviewing, or refactoring code in any project to avoid overcomplication, keep changes surgical, surface assumptions early, and execute against verifiable success criteria.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
413
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/alirezarezvani/ClaudeForge --skill karpathy-guidelines

The instruction itself

8 sections, as written by the author

Karpathy Guidelines for LLM Coding

Behavioral guardrails for code generation in Claude Code projects, distilled from observations on common LLM coding failure modes. Apply these to every editing, reviewing, and refactoring task.

> Attribution: adapted from the MIT-licensed karpathy-guidelines skill by Forrest Chang

> (https://github.com/forrestchang/andrej-karpathy-skills), inspired by Andrej Karpathy's

> commentary on where LLM-generated code typically goes wrong.

> ClaudeForge integrates these principles so every project initialised or enhanced through

> /enhance-claude-md ships with them in its CLAUDE.md.


When to Apply

Apply on every non-trivial task: writing new code, editing existing code, code review, refactoring, and bug fixing. They are intentionally conservative — bias toward caution over speed.


1. Think Before Coding

Surface what is uncertain. Do not paper over confusion with plausible-sounding code.

  • State assumptions before implementing; if any are load-bearing and you are not sure, ask.
  • If the request admits more than one reasonable interpretation, list them rather than silently picking one.
  • If a simpler approach exists than the one the user proposed, say so and explain the tradeoff.
  • When something is genuinely unclear, stop. Identify what is unclear in concrete terms, then ask.

2. Simplicity First

Write the minimum code that solves the stated problem. Nothing speculative.

  • Do not add features that were not requested.
  • Do not introduce abstractions when there is only one call site.
  • Do not add configuration knobs or extension points on speculation.
  • Do not add error handling for conditions that cannot occur in this code path.
  • If the first draft is 200 lines and a 50-line version would do, rewrite it before shipping.

Self-check: a senior engineer skimming this diff — would they say it is overcomplicated for what was asked? If yes, simplify.


3. Surgical Changes

Touch only what the task requires. Do not opportunistically refactor.

  • Do not "improve" adjacent code, comments, or formatting that the task did not require touching.
  • Do not refactor code that is working, even when you would have written it differently.
  • Match the surrounding code's style and conventions, even when they differ from your defaults.
  • If you notice unrelated dead code or bugs, surface them in the response — do not silently delete or fix them.

When your own changes leave orphans:

  • Remove imports, variables, and helpers that your edits made unreachable.
  • Do not remove pre-existing dead code unless explicitly asked.

Diff test: every changed line should be traceable to the user's request. If a line is not, drop it.


4. Goal-Driven Execution

Turn the task into a verifiable goal, then iterate until the verification passes.

  • Convert vague requests into checkable success criteria before coding:
  • "Add validation" → write the failing tests for invalid inputs first, then make them pass.
  • "Fix the bug" → write a test that reproduces the bug, then make it pass.
  • "Refactor X" → confirm the existing tests pass, refactor, confirm they still pass.
  • For multi-step tasks, state the plan inline with verification per step:
1. <step> → verify: <how you will check>
2. <step> → verify: <how you will check>
3. <step> → verify: <how you will check>

Strong success criteria let you loop without supervision. Vague ones ("make it work") force the user back into the loop.


Integration with ClaudeForge

  • The slash command /enhance-claude-md injects a ## Behavioral Guidelines section into every generated or enhanced CLAUDE.md, summarising these four principles with a link back to this skill.
  • The claude-md-guardian agent preserves the section across automated maintenance updates.
  • skill/generator.py and skill/template_selector.py insert the section unconditionally — these principles are not opt-in.

Effectiveness Indicators

The guidelines are working when diffs trend smaller, rewrites caused by overcomplication drop, and clarifying questions arrive before implementation rather than after a failed attempt.

Other skills for the same job

different authors, same section of the catalogue
Karpathy Guidelines
by hyyhf
×3

Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.

629 tokens
Plan Writing
by ComeOnOliver
×2

Structured task planning with clear breakdowns, dependencies, and verification criteria. Use when implementing features, refactoring, or any multi-step work.

4k tokens
Modern Javascript Patterns
by ComeOnOliver
×2

Master ES6+ features including async/await, destructuring, spread operators, arrow functions, promises, modules, iterators, generators, and functional programming patterns for writing clean, efficient JavaScript code. Use when refactoring legacy code, implementing modern patterns, or optimizing JavaScript applications.

9k tokens
Modern Javascript Patterns
by ComeOnOliver
×2

Master ES6+ features including async/await, destructuring, spread operators, arrow functions, promises, modules, iterators, generators, and functional programming patterns for writing clean, efficient JavaScript code. Use when refactoring legacy code, implementing modern patterns, or optimizing JavaScript applications.

8k tokens
Contributor Pr Description
by flutter
vendor ×1

Guidelines and format for writing pull request descriptions in this repository. Use this skill whenever the user asks you to draft a pull request description, submit a PR, or update a PR description.

697 tokens
Angular Best Practices
by lingxling
×1

Angular performance optimization and best practices guide. Use when writing, reviewing, or refactoring Angular code for optimal performance, bundle size, and rendering efficiency.

4k tokens
Gh Fix CI
by christophacham
×1

Use when a user asks to debug or fix failing GitHub PR checks that run in GitHub Actions. Uses `gh` to inspect checks and logs, summarize failure context, draft a fix plan, and implement only after explicit approval. Treats external providers (for example Buildkite) as out of scope and reports only the details URL. Do NOT use for addressing PR review comments (use gh-address-comments) or general CI outside GitHub Actions.

7k tokens scripts
Angular Best Practices
by ComeOnOliver
×1

Angular performance optimization and best practices guide. Use when writing, reviewing, or refactoring Angular code for optimal performance, bundle size, and rendering efficiency.

6k tokens

How to use it

Copy the folder

Take alirezarezvani/karpathy-guidelines from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.