规范驱动开发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 小时前
UiPath推出AI编程“总指挥台”,SiFive发布RISC-V第三代猛兽
人工智能·学习·google·程序员·ai编程·risc-v·开源工具
zyk_computer2 小时前
AI 时代,或许 Rust 比 Python 更合适
人工智能·后端·python·ai·rust·ai编程·vibe coding
不可食用盐6 小时前
# AI开发基于 Tauri 2 + React 的所见即所得 Markdown 编辑器
react.js·rust·ai编程
Pkmer7 小时前
古法编程·新解:Python 类型注解的"一箭三雕"之术
python·ai编程
Nightwatchman7 小时前
收藏了两年 AI 编程教程,最后能留在手里的几乎没什么
ai编程
ZengLiangYi8 小时前
Cursor 的 state.vscdb 解析踩坑记
ai编程
Larcher8 小时前
# 告别“古法编程”:吴恩达 AI 课程学习笔记与生日贺卡项目实战
前端·github·ai编程
ZengLiangYi8 小时前
Codex CLI / Trae / Copilot 数据源接入
ai编程
Json_8 小时前
Claude Code 使用指南:高频命令、快捷键、核心功能与实战技巧详解
agent·ai编程·claude