用 Skill 开发 Skill 并测试 Skill
Vibe Coding 一阵子,对 skill 的认知一直保持在 “自带环境的 prompt 模版”的阶段。盲目装上一堆 skill 无疑会加大 token 消耗,且更大概率会触发语义矛盾让 agent 左右为难,但不用又显得太“过”装清高了,更不用说那 skill 是真有用啊。考虑到媒体放卫星式的噪音,我自己动手写了几个 skill,目前 CC 和 Codex 都使用一套 skill 配置。这篇文章简单记录一下过程中的有趣发现。
仓库地址为:我在 GitHub 上的 skills-repo
那个万星的 andrej-karpathy-skills 到底做了什么
有一个经媒体大力宣传,GitHub 上 Starred 过万的项目,叫 andrej-karpathy-skills。号称一个 skill 便能让你的 agent 按照 “vibe coding” 概念的提出者 Andrej Karpathy 的理念来写代码。听着很诱人对不对,颇有种请祖师爷上身的感觉。
Skill 本体很简单,一个 65 行纯文本 markdown 文件,没有附带任何脚本,没有黑魔法,就像仓库介绍一样 “A single CLAUDE.md file to improve Claude Code behavior”。
这 65 行的内容,是对 Karpathy 在 2026 年 1 月发布的一条推文进行内容压缩、指令化,来指导 agent 行为。举例来说
[Karpathy's Post] They also don't manage their confusion, they don't seek clarifications, they don't surface inconsistencies, they don't present tradeoffs, they don't push back when they should, and they are still a little too sycophantic.
K 在这段话中列举了 agent 当前阶段一些表现不佳的方面,比如遇到模糊概念擅自作主,过于迎合用户(You're absolutely right!)等等。
[Skill.md] 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.
Skill 针对 Karpathy 的吐槽反向要求,表达成这四条。核心很简单,要求 agent 对一切模糊概念与用户进行“交互式确认”。
我完整阅读完原始 Post,并使用了这个 Skill 两天。诚然,它确实能缓解一些问题,但还是太粗暴太naive了,毕竟压缩是有代价的,而且对 Karpathy 所述内容的理解因人/agent而异。我自己重新写了个 Karpathy Behavioral Guidelines (KBG) skill。倒不是吹嘘自己的理解比原仓库更好(不可能,毕竟都用了差不多的 model 哈哈哈),我个人的建议是这样的,每个人都应当重新读一下原始 Post,并根据你自己的理解/喜好,edit/rewrite/write 一套适合自己的 KBG skill。想想看,你就像在指导一个知识储备很丰富但理解不了你意图的实习生一样,最重要的是让 ta 和你合作更加融洽。拷贝一个上万 star 的 skill只能说你克隆了原始作者的理解,但你和他的行为方式一样吗?他命令的风格是你的风格吗?他认定放弃自由度和效率换取准确度的 tradeoff 和你完全一致吗?对我而言,答案是否定的。
Agent 用 Skill 来写 Skill
Codex 系统自带的 skill 中有一个叫 Skill Creator。功能不仅包含构建新的 skill,还可以用来更新现有 skill,进行迭代。比如我的 git-commit-assist skill 首版运行状况不及预期,就通过这个 “元 skill“ 进行修改。
细想还是挺有趣的,用 Skill 来写 Skill,像是 agent 领域的自我指涉(self-reference)。这个说法不准确,可能用 Skill Creator 来修改 Skill Creator 才算。
请好好写 description
之前编写项目 description 或者仓库 description 时我总是不够用心,因为这个描述对实际功能不造成影响。Agent skill 不一样,description 决定了 agent 什么时候会调用这个 skill,并影响 skill 的实际效果。
比如下面这段 skill 描述:
---
name: git-commit-assist
description: Draft Angular-style git commit messages and complete git commit workflows with explicit AI participation metadata. Use when the user asks to create a commit, says "git commit", "commit this", "write a commit message", "will commit", "help me commit" in English or Chinese, or needs to choose AI attribution and Co-authored-by (coauthor) trailers for a commit.
---
意料之外的事
分享一个有趣的意料之外的事,当我进行 git-commit-assist 这个 skill 时,修改完成但还没有推送更新,即编辑的 /tmp/skills 包含新版本 git-commit-assist 但是 ~/.claude/skills 中的还是旧版本。新版本主要功能就是调用了一个 AskUserQuestion 来让 agent 和用户进行交互式确认。当我在 claude 中敲出 help me commit 的时候 Claude 使用了新版本的功能。至于原因,可能是我太傻了没意识到哈哈哈我还问了下他,各位可以按自己理解解释下。