Claude Code 新功能:自动运行 verify 技能进行提交前代码审查
Claude Code used to commit your changes right after making them, and reviewing t…
提供了可直接复制使用的 Prompt 模板,清晰演示了如何配置 Claude Code 的自定义技能以实现自动化代码审查,结构完整且具备实操参考价值。
Claude Code used to commit your changes right after making them, and reviewing them was up to you. In the new version, if your project has a skill named verify, 𝗖𝗹𝗮𝘂𝗱𝗲 𝗿𝘂𝗻𝘀 𝗶𝘁 𝗲𝘃𝗲𝗿𝘆 𝘁𝗶𝗺𝗲 𝗯𝗲𝗳𝗼𝗿𝗲 𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁𝘀 𝗳𝗼𝗿 𝘆𝗼𝘂.
过去,Claude Code 会在你完成更改后立即提交这些更改,而审查工作则由你负责。在新版本中,如果你的项目中有一个名为 verify 的技能(skill),𝗖𝗹𝗮𝘂𝗱𝗲 𝗿𝘂𝗻𝘀 𝗶𝘁 𝗲𝘃𝗲𝗿𝘆 𝘁𝗶𝗺𝗲 𝗯𝗲𝗳𝗼𝗿𝗲 𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁𝘀 𝗳𝗼𝗿 𝘆𝗼𝘂。
For what to check, you can borrow 𝘁𝗵𝗲 𝗿𝗲𝘃𝗶𝗲𝘄 𝘀𝘁𝗮𝗻𝗱𝗮𝗿𝗱 𝗢𝗽𝗲𝗻𝗔𝗜 𝘄𝗿𝗼𝘁𝗲 𝗳𝗼𝗿 𝗖𝗼𝗱𝗲𝘅: prioritize behavior changes, data loss and missing edge-case tests, and say what input triggers each problem. Commits that only touch docs or tests skip it. If you haven't updated in a while, run claude update in your terminal first.
关于要检查的内容,你可以借鉴 𝘁𝗵𝗲 𝗿𝗲𝘃𝗶𝗲𝘄 𝘀𝘁𝗮𝗻𝗱𝗮𝗿𝗱 𝗢𝗽𝗲𝗻𝗔𝗜 𝘄𝗿𝗼𝘁𝗲 𝗳𝗼𝗿 𝗖𝗼𝗱𝗲𝘅:优先关注行为变更、数据丢失和缺失的边界情况测试,并说明每个问题是由什么输入触发的。仅涉及文档或测试的提交将跳过此步骤。如果你有一段时间没有更新了,请先在终端中运行 claude update。
Send this to Claude Code 👇
将此发送给 Claude Code 👇
"First, check my Claude Code version. If it's older than 2.1.286, stop and remind me to run claude update.
"首先,检查我的 Claude Code 版本。如果它早于 2.1.286,请停止并提醒我运行 claude update。
Read OpenAI's Codex code review guide: https://learn.chatgpt.com/docs/code-review
阅读 OpenAI 的 Codex 代码审查指南:https://learn.chatgpt.com/docs/code-review
Then create a project-level skill in this repo at .claude/skills/verify/SKILL.md with the three steps below. Claude Code runs a skill named verify automatically before every commit, so only create this file and don't add a hook. If a verify skill already exists, add these three steps after what's there and don't overwrite it. 1. Run the checks the project already has: tests, type checks, lint. Skip any it doesn't have. If one fails, stop and say exactly where. 2. Review the changes about to be committed against the guide's review standard, and write the standard itself into SKILL.md: start with a one-line summary; prioritize behavior changes, data loss and missing edge-case tests; for each finding, give the triggering input, the expected behavior and the actual behavior. Only report problems you can point to in the code. Skip style issues. 3. If you find a behavior change that shouldn't happen or anything that could lose data, don't commit. Fix it and start again from step 1. If only other problems are left, list them and commit as usual.
然后在此仓库的 .claude/skills/verify/SKILL.md 中创建一个项目级技能,包含以下三个步骤。Claude Code 会在每次提交前自动运行名为 verify 的技能,因此只需创建此文件,不要添加钩子(hook)。如果已存在 verify 技能,请在现有内容之后添加这三个步骤,不要覆盖它。 1. 运行项目已有的检查:测试、类型检查、lint。跳过任何不存在的检查。如果某项检查失败,请停止并明确指出位置。 2. 根据指南中的审查标准审查即将提交的更改,并将该标准本身写入 SKILL.md:以一行摘要开头;优先关注行为变更、数据丢失和缺失的边界情况测试;对于每个发现的问题,提供触发输入、预期行为和实际行为。仅报告你能在代码中指出的问题。跳过样式问题。 3. 如果发现不应发生的行为变更或可能导致数据丢失的情况,请勿提交。修复它并从第 1 步重新开始。如果只剩下其他问题,列出它们并按常规方式提交。
When you're done, show me SKILL.md and remind me of two things: it replaces the built-in /verify, and it only takes effect in a new session."
完成后,向我展示 SKILL.md 并提醒我两件事:它取代了内置的 /verify,并且它仅在新会话中生效。"
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力