规范驱动开发2:spec kit入门与使用

安装 Specify CLI

uv tool install specify-cli --from git+https://github.com/github/spec-kit.git

还有一个中文版本的

uv tool install specify-cn-cli --from git+https://github.com/linfee/spec-kit-cn.git

所以还需要你安装下uv

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

此外,还需要安装python 3.11+, Git

使用

```bash

Create new project 创建新项目,从最新模板初始化一个新的 Specify 项目

specify init <PROJECT_NAME>

Or initialize in existing project 在现有项目中初始化

specify init . --ai claude

Check installed tools 检查已安装的工具,如git,claude , gemini

specify check

```

升级

uv tool install specify-cli --force --from git+https://github.com/github/spec-kit.git

中文版本

uv tool install specify-cn-cli --force --from git+https://github.com/linfee/spec-kit-cn.git

常用

//.当前目录 --no-git 不创建.git目录,

specify init . --no-git --ai copilot --script sh //中文版本换成specify-cn即可

确立项目原则

创建项目的指导原则和开发指南,指导后续开发

在CLI AI工具里面启动

/speckit.constitution Create principles focused on code quality, testing standards, user experience consistency, and performance requirements

创建以代码质量、测试标准、用户体验一致性和性能要求为重点的原则

会创建一个.specify/memory/constitution.md

AI 代理将在规范制定、规划和实施阶段参考这些原则。

创建需求

/speckit.specify Build an application that can help me organize my photos in separate photo albums. Albums are grouped by date and can be re-organized by dragging and dropping on the main page. Albums are never in other nested albums. Within each album, photos are previewed in a tile-like interface.

/speckit.specify 开发一个应用程序,帮助我把我們的照片分门别类地整理在不同的相册中。相册按日期分组,并且可以在主页面通过拖放重新排序。相册不会嵌套在其他相册中。在每个相册中,照片以类似瓷砖的界面进行预览。

描述你想构建的内容。关注 what and why,需求和用户故事之类,而不是技术栈。

制定技术实施计划

可选的 /speckit.clarify 澄清未明确的领域,还可以让cc验证下你的checklist,如:

Read the review and acceptance checklist, and check off each item in the checklist if the feature spec meets the criteria. Leave it empty if it does not.

然后提供你的技术栈和架构选择

/speckit.plan The application uses Vite with minimal number of libraries. Use vanilla HTML, CSS, and JavaScript as much as possible. Images are not uploaded anywhere and metadata is stored in a local SQLite database.

/speckit.plan 该应用程序使用 Vite 并尽量减少库的数量。尽可能使用纯 HTML、CSS 和 JavaScript。图像不会上传到任何地方,元数据存储在本地 SQLite 数据库中。

执行后要检查 research.md 是否使用了正确的技术栈

任务拆解

/speckit.tasks

从你的实施计划创建可操作的待办事项列表

会创建 tasks.md

每个用户故事都拥有自己的一组任务

执行

/speckit.implement 执行所有任务

小结:

所有命令的执行顺序:

/speckit.constitution - 建立项目原则

/speckit.specify - 创建基线规范

/speckit.clarify (可选) - 在规划前询问结构化问题以降低模糊区域的风险 (如果使用,在 /speckit.plan 前运行,也可以在任何阶段运行)

/speckit.plan - 创建实施计划

/speckit.checklist (可选) - 生成质量检查清单以验证需求的完整性、清晰度和一致性 (在 /speckit.plan 后)

/speckit.tasks - 生成可执行任务

/speckit.analyze (可选) - 交叉制品一致性和对齐报告 (在 /speckit.tasks 后,/speckit.implement 前)

/speckit.implement - 执行实施

应该是使用prompt功能实现的

支持从vibe-coding to AI-native development开发新范式

参考

https://github.com/github/spec-kit

相关推荐
吴佳浩2 小时前
Function Calling 为什么不够用?深入拆解 MCP 标准协议的设计哲学
agent·ai编程·mcp
吴佳浩2 小时前
从零手写一个生产级 MCP Server:鉴权、流式传输与状态管理
agent·ai编程·mcp
孟健6 小时前
Jev是什么AI模型?不做自然语言生成为何引发热议
ai编程
why-geo9 小时前
Hermes Agent 与 Python 的会产生什么样的碰撞
人工智能·python·ai编程
小虎AI生活10 小时前
从提效到增收,企业级 Agent 的落地路径与实践拆解
ai编程
RSABLOCKCHAIN10 小时前
antigravity运行vibecoding一般工作原理
ai编程
wangruofeng10 小时前
9 款主流 AI Agent CLI 对比:安装、版本查询与升级命令
aigc·agent·ai编程
全栈弄潮儿11 小时前
AI 生成的代码,哪些地方最容易埋坑?
aigc·openai·ai编程
MayBaymax12 小时前
Spring AI Alibaba Graph 实战:客服工单智能处理
java·ai·ai编程
zhangfeng113312 小时前
ATK(华为算子测试平台)详细介绍 CANN(Compute Architecture for Neural Networks,神经网络计算架构
人工智能·华为·ai编程·npu·cann