查看我的新项目 Multica:一个用于运行和管理 coding agents 的开源平台,支持可复用 skills。
在 X 上关注我:https://x.com/jiayuan_jy
这个仓库提供一组中文优先的 Agent 行为准则,用来改善 Claude Code、Cursor 和其他 coding agents 的协作质量。内容源自 Andrej Karpathy 对 LLM 编码陷阱的观察,重点解决“错误假设、过度复杂、无关改动、缺少验证”这些高频问题。
来自 Andrej 的观察可以概括为三类问题:
模型会替你做错误假设,然后一路执行下去。它们不管理自身困惑,不主动澄清,不呈现矛盾,不展示权衡,也不会在应该反驳时反驳。
它们很容易把代码和 API 搞复杂,堆砌抽象,不清理死代码。明明 100 行能解决的问题,可能会写成 1000 行的臃肿结构。
它们有时会改动或删除自己并不充分理解的代码和注释,即使这些内容与当前任务无关。
这个仓库把约束收敛成四条原则:
| 原则 | 解决的问题 |
|---|---|
| 编码前先思考 | 错误假设、隐藏困惑、缺少权衡 |
| 简洁优先 | 过度复杂、抽象膨胀、提前设计 |
| 精准修改 | 无关编辑、顺手重构、误删代码 |
| 目标驱动执行 | 缺少测试、缺少验证、成功标准模糊 |
如果本准则与 Superpowers 同时生效,Superpowers 负责流程门禁,Karpathy Guidelines 负责实现判断。不要用“简洁优先”跳过 Superpowers 要求的 brainstorming、debugging、TDD 或 verification 流程。
不要替用户做隐含假设。不要掩盖困惑。要把权衡说出来。
LLM 经常会默默选择一种解释,然后直接实现。这个原则要求 Agent 在实现前明确说明:
用能解决问题的最少代码。不要提前设计未被要求的能力。
这条原则用来对抗过度工程:
检验标准:资深工程师会不会觉得这个实现过度复杂?如果会,就重写得更简单。
只改必须改的地方。只清理由你自己的改动造成的问题。
编辑现有代码时:
当你的改动产生孤立代码时:
检验标准:每一行修改都应该能直接追溯到用户的请求。
定义成功标准。循环验证,直到目标被证据证明已经达成。
把指令式任务改写成可验证目标:
| 不要只说 | 应该转换为 |
|---|---|
| “添加校验” | “为无效输入写测试,然后让测试通过” |
| “修复 bug” | “写一个能复现 bug 的测试,然后让它通过” |
| “重构 X” | “确保重构前后测试都通过” |
对于多步骤任务,先写出简短计划:
1. [步骤] -> 验证:[检查方式]
2. [步骤] -> 验证:[检查方式]
3. [步骤] -> 验证:[检查方式]
强成功标准能让 Agent 独立循环执行。弱标准,比如“让它能工作”,通常会导致反复澄清和返工。
CLAUDE.md新项目:
curl -o CLAUDE.md https://raw.githubusercontent.com/Mikko-ww/mk-karpathy-skills/main/CLAUDE.md
已有项目,追加到现有 CLAUDE.md:
echo "" >> CLAUDE.md
curl https://raw.githubusercontent.com/Mikko-ww/mk-karpathy-skills/main/CLAUDE.md >> CLAUDE.md
本仓库包含已提交的 Cursor project rule:.cursor/rules/karpathy-guidelines.mdc。打开本项目时,该规则会因为 alwaysApply: true 自动生效。
更多说明见 CURSOR.md,包括如何复制到其他项目,以及它与 Claude Code plugin 的关系。
本仓库的核心内容应该保持“一份权威源,多种适配入口”。当前建议以 skills/karpathy-guidelines/SKILL.md 作为 skill 语义源,以 CLAUDE.md 作为通用项目指令源。新增平台时,优先从这两份内容同步,不要手写一份新的独立版本。
| Agent / 工具 | 推荐入口 | 当前状态 |
|---|---|---|
| Claude Code | .claude-plugin/ + skills/karpathy-guidelines/SKILL.md | 已内置 |
| Cursor | .cursor/rules/karpathy-guidelines.mdc | 已内置 |
| 通用项目级 Agent | AGENTS.md、CLAUDE.md 或其他根目录指令文件 | 已内置 |
| GitHub Copilot | .github/copilot-instructions.md,也可结合 AGENTS.md、CLAUDE.md 或 GEMINI.md | 已内置 |
| Gemini CLI | GEMINI.md | 已内置 |
| Codex / 其他支持 Agent Skills 的工具 | AGENTS.md,或复制 skills/karpathy-guidelines/SKILL.md 到对应个人或项目 skills 目录 | 已内置项目级入口,可手动安装 skill |
| Cline、Roo Code、Continue、Windsurf 等 | 使用它们支持的 rules / instructions 文件承载同一套准则 | 待逐个平台验证 |
扩展到新 Agent 时,按这个顺序做:
SKILL.md 或 CLAUDE.md 同步正文,不改变四条原则含义。可参考的官方文档:
修改四条原则或 Superpowers 边界说明时,请同步检查这些入口:
skills/karpathy-guidelines/SKILL.mdCLAUDE.mdAGENTS.mdGEMINI.md.cursor/rules/karpathy-guidelines.mdc.github/copilot-instructions.mdREADME.md提交前运行:
python scripts/check-sync.py
python -m unittest tests/test_check_sync.py
更多贡献说明见 CONTRIBUTING.md。
来自 Andrej 的核心建议可以概括为:
不要只告诉 LLM 做什么;给它明确的成功标准,让它围绕目标循环直到达成。
“目标驱动执行”正是这个思想的落地:把模糊指令转换成带验证循环的目标。
如果你看到以下变化,说明这些 guidelines 正在发挥作用:
这些 guidelines 适合与项目自己的规则合并。你可以复制 CLAUDE.md,或把其中内容合并到现有项目指令中。
项目特定规则可以像这样追加:
## Project-Specific Guidelines
- Use TypeScript strict mode
- All API endpoints must have tests
- Follow the existing error handling patterns in `src/utils/errors.ts`
这些 guidelines 偏向谨慎而不是速度。对于简单拼写修复、明显的一行修改等琐碎任务,不需要完整流程。
目标不是拖慢简单工作,而是减少非琐碎任务中代价高昂的错误。
MIT
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub mikko-ww/mk-karpathy-skills --plugin mk-karpathy-skillsBehavioral guidelines to reduce common LLM coding mistakes, derived from Andrej Karpathy's observations on LLM coding pitfalls
Design fluency for frontend development. 1 skill with 23 commands (/impeccable polish, /impeccable audit, /impeccable critique, etc.) and curated anti-pattern detection.
Comprehensive skill pack with 66 specialized skills for full-stack developers: 12 language experts (Python, TypeScript, Go, Rust, C++, Swift, Kotlin, C#, PHP, Java, SQL, JavaScript), 10 backend frameworks, 6 frontend/mobile, plus infrastructure, DevOps, security, and testing. Features progressive disclosure architecture for 50% faster loading.
Access thousands of AI prompts and skills directly in your AI coding assistant. Search prompts, discover skills, save your own, and improve prompts with AI.
Develop, test, build, and deploy Godot 4.x games with Claude Code. Includes GdUnit4 testing, web/desktop exports, CI/CD pipelines, and deployment to Vercel/GitHub Pages/itch.io.
Complete developer toolkit for Claude Code