Skip to content
Back to search

karpathy-skills

MarketplaceWorks with Claude CodeGitHub

A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked yesterday
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/multica-ai-andrej-karpathy-skills/badge.svg)](/listings/multica-ai-andrej-karpathy-skills)

HTML

<a href="/listings/multica-ai-andrej-karpathy-skills"><img src="/api/listings/multica-ai-andrej-karpathy-skills/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

**Option A: Claude Code Plugin (recommended)**

From within Claude Code, first add the marketplace:

/plugin marketplace add forrestchang/andrej-karpathy-skills

Then install the plugin:

/plugin install andrej-karpathy-skills@karpathy-skills

This installs the guidelines as a Claude Code plugin, making the skill available across all your projects.

**Option B: 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

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 29 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "karpathy-skills",
  3. "id": "karpathy-skills",
  4. "owner": {
  5. "name": "forrestchang"
  6. },
  7. "metadata": {
  8. "description": "Behavioral guidelines to reduce common LLM coding mistakes, derived from Andrej Karpathy's observations",
  9. "version": "1.0.0"
  10. },
  11. "plugins": [
  12. {
  13. "name": "andrej-karpathy-skills",
  14. "source": "./",
  15. "description": "Behavioral guidelines to reduce common LLM coding mistakes: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution",
  16. "version": "1.0.0",
  17. "author": {
  18. "name": "forrestchang"
  19. },
  20. "keywords": [
  21. "guidelines",
  22. "best-practices",
  23. "coding",
  24. "karpathy"
  25. ],
  26. "category": "workflow"
  27. }
  28. ]
  29. }
README.md · README · 171 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Karpathy-Inspired Claude Code Guidelines
  2. > Check out my new project [Multica](https://github.com/multica-ai/multica) — an open-source platform for running and managing coding agents with reusable skills.
  3. >
  4. > Follow me on X: [https://x.com/jiayuan_jy](https://x.com/jiayuan_jy)
  5. A single `CLAUDE.md` file to improve Claude Code behavior, derived from [Andrej Karpathy's observations](https://x.com/karpathy/status/2015883857489522876) on LLM coding pitfalls.
  6. English | [简体中文](./README.zh.md)
  7. ## The Problems
  8. From Andrej's post:
  9. > "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."
  10. > "They really like to overcomplicate code and APIs, bloat abstractions, don't clean up dead code... implement a bloated construction over 1000 lines when 100 would do."
  11. > "They still sometimes change/remove comments and code they don't sufficiently understand as side effects, even if orthogonal to the task."
  12. ## The Solution
  13. Four principles in one file that directly address these issues:
  14. | Principle | Addresses |
  15. |-----------|-----------|
  16. | **Think Before Coding** | Wrong assumptions, hidden confusion, missing tradeoffs |
  17. | **Simplicity First** | Overcomplication, bloated abstractions |
  18. | **Surgical Changes** | Orthogonal edits, touching code you shouldn't |
  19. | **Goal-Driven Execution** | Leverage through tests-first, verifiable success criteria |
  20. ## The Four Principles in Detail
  21. ### 1. Think Before Coding
  22. **Don't assume. Don't hide confusion. Surface tradeoffs.**
  23. LLMs often pick an interpretation silently and run with it. This principle forces explicit reasoning:
  24. - **State assumptions explicitly** — If uncertain, ask rather than guess
  25. - **Present multiple interpretations** — Don't pick silently when ambiguity exists
  26. - **Push back when warranted** — If a simpler approach exists, say so
  27. - **Stop when confused** — Name what's unclear and ask for clarification
  28. ### 2. Simplicity First
  29. **Minimum code that solves the problem. Nothing speculative.**
  30. Combat the tendency toward overengineering:
  31. - No features beyond what was asked
  32. - No abstractions for single-use code
  33. - No "flexibility" or "configurability" that wasn't requested
  34. - No error handling for impossible scenarios
  35. - If 200 lines could be 50, rewrite it
  36. **The test:** Would a senior engineer say this is overcomplicated? If yes, simplify.
  37. ### 3. Surgical Changes
  38. **Touch only what you must. Clean up only your own mess.**
  39. When editing existing code:
  40. - Don't "improve" adjacent code, comments, or formatting
  41. - Don't refactor things that aren't broken
  42. - Match existing style, even if you'd do it differently
  43. - If you notice unrelated dead code, mention it — don't delete it
  44. When your changes create orphans:
  45. - Remove imports/variables/functions that YOUR changes made unused
  46. - Don't remove pre-existing dead code unless asked
  47. **The test:** Every changed line should trace directly to the user's request.
  48. ### 4. Goal-Driven Execution
  49. **Define success criteria. Loop until verified.**
  50. Transform imperative tasks into verifiable goals:
  51. | Instead of... | Transform to... |
  52. |--------------|-----------------|
  53. | "Add validation" | "Write tests for invalid inputs, then make them pass" |
  54. | "Fix the bug" | "Write a test that reproduces it, then make it pass" |
  55. | "Refactor X" | "Ensure tests pass before and after" |
  56. For multi-step tasks, state a brief plan:
  57. ```
  58. 1. [Step] → verify: [check]
  59. 2. [Step] → verify: [check]
  60. 3. [Step] → verify: [check]
  61. ```
  62. Strong success criteria let the LLM loop independently. Weak criteria ("make it work") require constant clarification.
  63. ## Install
  64. **Option A: Claude Code Plugin (recommended)**
  65. From within Claude Code, first add the marketplace:
  66. ```
  67. /plugin marketplace add forrestchang/andrej-karpathy-skills
  68. ```
  69. Then install the plugin:
  70. ```
  71. /plugin install andrej-karpathy-skills@karpathy-skills
  72. ```
  73. This installs the guidelines as a Claude Code plugin, making the skill available across all your projects.
  74. **Option B: CLAUDE.md (per-project)**
  75. New project:
  76. ```bash
  77. curl -o CLAUDE.md https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md
  78. ```
  79. Existing project (append):
  80. ```bash
  81. echo "" >> CLAUDE.md
  82. curl https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md >> CLAUDE.md
  83. ```
  84. ## Using with Cursor
  85. This repository includes a committed Cursor project rule ([`.cursor/rules/karpathy-guidelines.mdc`](.cursor/rules/karpathy-guidelines.mdc)) so the same guidelines apply when you open the project in Cursor. See **[CURSOR.md](CURSOR.md)** for setup, using the rule in other projects, and how this relates to Claude Code.
  86. ## Key Insight
  87. From Andrej:
  88. > "LLMs are exceptionally good at looping until they meet specific goals... Don't tell it what to do, give it success criteria and watch it go."
  89. The "Goal-Driven Execution" principle captures this: transform imperative instructions into declarative goals with verification loops.
  90. ## How to Know It's Working
  91. These guidelines are working if you see:
  92. - **Fewer unnecessary changes in diffs** — Only requested changes appear
  93. - **Fewer rewrites due to overcomplication** — Code is simple the first time
  94. - **Clarifying questions come before implementation** — Not after mistakes
  95. - **Clean, minimal PRs** — No drive-by refactoring or "improvements"
  96. ## Customization
  97. These guidelines are designed to be merged with project-specific instructions. Add them to your existing `CLAUDE.md` or create a new one.
  98. For project-specific rules, add sections like:
  99. ```markdown
  100. ## Project-Specific Guidelines
  101. - Use TypeScript strict mode
  102. - All API endpoints must have tests
  103. - Follow the existing error handling patterns in `src/utils/errors.ts`
  104. ```
  105. ## Tradeoff Note
  106. These guidelines bias toward **caution over speed**. For trivial tasks (simple typo fixes, obvious one-liners), use judgment — not every change needs the full rigor.
  107. The goal is reducing costly mistakes on non-trivial work, not slowing down simple tasks.
  108. ## License
  109. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.