规范驱动开发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 小时前
记忆库能通过测试,不等于回答值得信:Coding Agent Memory 的两层评估设计
github·ai编程
喂你一颗橘子糖2 小时前
我用 Codex 跑长任务:快照、Loop 和单线写入,解决三个失控问题
ai编程
李剑一2 小时前
瑞幸也AI上了?我用AI命令行帮我点了一杯咖啡,但是我花了不止一杯咖啡钱
aigc·openai·ai编程
leoZ2312 小时前
记忆系统与 Agent 定制完全指南(六):Agent 编排与调度
ai编程
Ai拆代码的曹操3 小时前
opencode CLI 源码拆解:yargs + effectCmd 双层架构如何管理 20+ 子命令
架构·ai编程·opencode·源码拆解
AINative软件工程3 小时前
LLM 应用的熔断降级工程实践:Circuit Breaker 不只是重试的升级版
后端·llm·ai编程
倔强的石头_12 小时前
不想每次都从头解释:我用 Doubao-Seed-Evolving 做了一个「稿件接力站」
ai编程
大模型码小白14 小时前
【Python零基础教程】继承、多态与魔法函数:面向对象编程三大核心特性详解
java·大数据·开发语言·人工智能·python·ai编程
-XWB-15 小时前
【LLM】Agent Planning 完全指南:8 种纯 LLM 范式 + 8 种混合规划模式详解(二)
人工智能·经验分享·aigc·学习方法·ai编程
沉默王二15 小时前
腾讯一面,我霸气反问:“你说你们在做Agent项目,说说 SubAgent、Plan 模式、Skill 调用这些你们都是怎么做的?”面试官一直在擦汗。。
面试·agent·ai编程