Graphic tutorial: Three steps to install the four principles of Karpathy into Claude Code, AI will never "rewrite" your code smoothly again图文教程:三步把 Karpathy 四原则装进 Claude Code,AI 再也不会「顺手重写」你的代码
The Karpathy prompt principle skill package only has one page of CLAUDE.md, but the difference in the behavior of the agent before and after it is installed is visible to the naked eye. This tutorial uses three steps to complete the installation, merge your own project rules, and use a small task to check the effect. It also comes with a Cursor user-specific solution.
Karpathy 提示原则技能包只有一页 CLAUDE.md,但装上前后智能体的行为差别肉眼可见。本教程用三个步骤完成安装、合并你自己的项目规则,并用一个小任务验收效果,附 Cursor 用户专属方案。

Step 1: Choose an installation method第一步:选一种安装方式
Claude Code users (recommended): Enter /plugin marketplace add forrestchang/andrej-karpathy-skills in the session, then enter /plugin install andrej-karpathy-skills@karpathy-skills, it will take effect globally.
Project-level users: curl -o CLAUDE.md https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md; or go to the "AI Skill Package" column of this site to download the source code package, unzip it and get CLAUDE.md, which can also be installed offline.
Claude Code 用户(推荐):在会话里输入 /plugin marketplace add forrestchang/andrej-karpathy-skills,再输入 /plugin install andrej-karpathy-skills@karpathy-skills,全局生效。
项目级用户:curl -o CLAUDE.md https://raw.githubusercontent.com/forrestchang/andrej-karpathy-skills/main/CLAUDE.md;或者到本站「AI技能包」栏目下载源码包解压取 CLAUDE.md,离线也能装。

Step 2: Incorporate your own project rules第二步:合并你自己的项目规则
For projects that already have CLAUDE.md, use >> to append rather than overwrite. The four principles will be automatically incorporated into your existing command system.
Add a section of Project-Specific Guidelines at the end of the file to spell out the project conventions, such as "TypeScript strict mode" and "all API endpoints must have tests", so that general principles and project specifications do not conflict with each other.
已有 CLAUDE.md 的项目用 >> 追加而不是覆盖,四原则会自动并入你现有的指令体系。
在文件末尾加一段 Project-Specific Guidelines 写死项目约定,比如「TypeScript strict 模式」「所有 API 端点必须有测试」,让通用原则和项目规范互不冲突。
Step 3: Use a small task for acceptance第三步:用一个小任务验收
Let Claude fix a small bug and observe three points: whether the assumptions and trade-offs are listed before starting; whether the diff only contains relevant changes; whether the test is written first and then passed.
If all three are successful, it means that the skill has taken effect; if it still runs silently, restart the session to confirm that the skill has been loaded, and then check whether CLAUDE.md is overwritten by the project rules.
让 Claude 修一个小 bug,观察三点:动手前是否列出了假设与权衡;diff 是否只包含相关改动;是否先写测试再让测试通过。
三条全中说明技能已生效;如果它还是默默跑偏,重启会话确认技能已加载,再检查 CLAUDE.md 是否被项目规则覆盖。

Advanced: How to install Cursor and other agents进阶:Cursor 与其他智能体怎么装
Cursor users: The warehouse comes with .cursor/rules/karpathy-guidelines.mdc. It will automatically take effect after you put it into the .cursor/rules directory of the project and open the project.
Other agents such as Codex / Cline: Just paste the contents of CLAUDE.md into their respective rule files (such as AGENTS.md). The principle itself has nothing to do with the tool.
Cursor 用户:仓库自带 .cursor/rules/karpathy-guidelines.mdc,放进项目的 .cursor/rules 目录后打开项目自动生效。
Codex / Cline 等其他智能体:把 CLAUDE.md 的内容粘贴进各自的规则文件(如 AGENTS.md)即可,原则本身与工具无关。
Use reminder使用提醒
The supporting resource for this tutorial is the source code of the Karpathy prompt principle skill package, see the "AI Skill Package" column (19 KB). MIT license, can be freely merged with any project rules; this article is compiled from public information, and the resources are only for learning and exchange.
本教程配套资源为 Karpathy 提示原则技能包源码,见「AI技能包」栏目(19 KB)。MIT 许可,可与任何项目规则自由合并;本文整理自公开资料,资源仅供学习交流。
本篇为图文教程,直接按步骤操作即可,无需下载文件。
阅读与点赞数据保存在你的浏览器本地,欢迎留下你的想法。
今日正能量学一点,用一点;今天种下的种子,会长成明天的能力。去免费下载专区 →广告
评论 文明发言,让讨论更有价值