
介绍 GitHub 开源工具包 Spec Kit(99.1k stars)如何通过七步结构化工作流解决 AI Agent 因模糊指令产生不可维护代码的问题,含安装命令、真实使用示例与四条社区已知限制。
"We treat coding agents like search engines when we should be treating them more like literal-minded pair programmers."「我们把 coding agent 当搜索引擎使,但其实应该把它们当作字面化思维的结对编程伙伴。」1
specify CLI 驱动的七步工作流,每步产出 Markdown 文件落盘,作为下一步的输入——Agent 的记忆不在对话上下文里,而在文件系统里。2| 命令 | 作用 | 产出文件 |
|---|---|---|
/speckit.constitution | 设定项目不变原则(测试标准、安全约束等) | .specify/memory/constitution.md |
/speckit.specify | 将自然语言描述转为结构化 spec | specs/<编号>/spec.md(含验收标准) |
/speckit.clarify(可选) | Agent 向你提问澄清模糊点 | — |
/speckit.plan | 基于 spec 生成技术方案 | plan.md、data-model.md、contracts/ |
/speckit.tasks | 将 plan 拆分为可执行任务列表 | tasks.md(含并行任务标注 [P]) |
/speckit.analyze(可选) | 分析复杂度和风险 | — |
/speckit.implement | 按序执行 tasks.md,遵循 TDD | 代码 + 测试 |
.cursorrules / CLAUDE.md 的关键设计:它包含 9 条不变开发原则(Library-First、Test-First、Anti-Abstraction 等),会在每个 phase 作为 gate 强制执行,不因 Agent 的上下文漂移而失效。3 这也是它和只告诉 Agent「如何行为」的规则文件的本质区别——Spec Kit 告诉它「具体构建什么」,并保留从意图到输出的完整追溯链。specify 分发,只能从 GitHub 安装,PyPI 上的同名包不是官方维护的。2uv(推荐)或 pipx、以及一个支持的 AI coding agent。uv tool install specify-cli \
--from git+https://github.com/github/spec-kit.git@v0.8.9uvx --from git+https://github.com/github/spec-kit.git@v0.8.9 \
specify init MY_PROJECT --integration claudespecify init MY_PROJECT --integration claude
# 或者 cursor、copilot、gemini、codex 等 30+ 选项specify 会根据你选择的 --integration 参数,把 Spec Kit 的工作流命令写入对应的位置:.claude/commands/.cursor/skills/.github/prompts//speckit.specify)即可触发工作流。/speckit.specify Build an application that can help me organize
my photos in separate photo albums...
/speckit.plan The application uses Vite with minimal number of
libraries...
/speckit.tasks
/speckit.implement/speckit.specify 一步就生成了 32 个结构化任务,涵盖环境设置、数据模型、API 集成、命令实现、测试和部署。他的总结是:4"For me, the biggest win isn't just better code — it's better thinking habits. By forcing me to define specs and edge cases, spec-kit improved how I approach problems overall."「对我来说,最大的收获不是更好的代码,而是更好的思维习惯。强制定义 spec 和边界情况这件事,改变了我整体解决问题的方式。」
github.com
xbsoftware.com
fundesk.io
x.com
This story was produced automatically by a channel. One sentence is all it takes for Neodrop to keep producing for you.