由于 trendforge.devlive.top 访问受限,请切换到 trendforge.devlive.org 域名

spec-kit

💫 助你快速上手规范驱动开发的开源工具包

在 GitHub 上查看

Spec Kit:以 Typer CLI 驱动 AI 代理的规格开发流程

Spec Kit 是用 Python CLI 把规格驱动开发、缺陷修复和创意评估流程注入 AI 编码代理的开源工具包。

先看结论

Spec Kit 是 GitHub 开源的 AI 编程助手工具包,核心是 `specify-cli`。它把 Spec-Driven Development、缺陷修复和想法评估变成可复用流程:SDD 通过 constitution、specify、plan、tasks、implement、converge 等命令推进;bug 与 assess 作为扩展按需安装,分别产出修复验证和 `go / needs-clarification / kill` 决策。 实现上,CLI 基于 Python/Typer,在 `specify init` 时把模板、命令和脚本安装到具体代理环境;wheel 内置核心资产,支持离线初始化。项目通过 extensions、presets、workflows、workflow steps、bundles 和 catalog 分层组合,用户可添加命令、覆盖模板、改写工作流、搭建私有目录;integrations 覆盖多种编码代理,并提供认证、MCP 与工件清单能力。 特色是流程独立可选、组件可组合、可离线与企业内网使用,同时保持契约测试和目录版本一致性,适合希望让 AI 编码代理按团队规范交付可追溯结果的开发团队。

适合谁

可快速用 AI 代理把想法转为规格、计划和任务,减少流程混乱。

上手门槛

较低:uv 安装 CLI 后一条 init 命令即可生成项目,但真正价值取决于代理使用与流程定制。

源码看点

Typer CLI 组织、目录/清单解析、工作流执行、扩展安装与 MCP 暴露,以及模板如何驱动代理。

  • 省掉自建 AI 代理流程脚手架

    specify init 随 wheel 内置模板、命令、脚本与 speckit 工作流,可离线生成多代理项目结构。

  • 规格到实现可追溯

    constitution/specify/plan/tasks/implement/converge 命令与模板把需求、计划、任务和验证串成链路。

  • 多代理复用同一流程

    integrations 目录覆盖 Copilot、Claude、Cursor 等,按集成生成对应命令,不锁定单一代理。

  • 组件化定制与分发

    extension/preset/workflow/bundle 与 catalog 支持项目本地覆盖、overlay 和私有目录,便于团队标准化。

  • 离线与企业部署

    pyproject 将核心资产与 catalog 快照强制打包进 wheel,支持 air-gapped 安装与发现。

  • 项目初始化与代理集成
  • 规格驱动开发流程
  • 缺陷修复与想法评估扩展
  • 扩展、预设、工作流与 Bundle 管理
  • 目录搜索与私有目录认证
  • MCP 服务暴露
  • 离线安装与核心资产打包
  • 模板覆盖与项目本地定制
  • ai-agent
  • spec-driven-development
  • mcp
  • cli
  • workflow-automation
  • extension-system
  • catalog
  • bug-fixing
  • idea-assessment
  • air-gapped
  • contract-testing
  • preset
  • devtools
  • typer
  • pydantic
  • lark
  • pathspec
  • hatchling
  • workflow-engine
  • AI 代理流程脚手架
  • 规格驱动开发
  • 缺陷修复验证
  • 创意评估决策
  • 企业离线分发
各类读者的适用性
  • 个人开发者 · 高

    可快速用 AI 代理把想法转为规格、计划和任务,减少流程混乱。

  • 小团队 · 高

    可用预设、扩展和 Bundle 统一代码质量门禁与交付流程。

  • 企业 · 中

    支持私有目录、认证与离线分发,但需要治理社区组件和代理访问。

  • 学习者 · 中

    适合学习 SDD 与 CLI/工作流设计,但概念和组件较多。

架构与源码

src/specify_cli 是核心 Python/Typer CLI,分为 artifacts、authentication、bundles、extensions、integrations、presets、workflows 与 mcp_server 等域。specify init 从 wheel 内 core_pack 取出模板、命令、脚本与 speckit 工作流,按集成适配器写入目标项目;代理执行 Markdown 命令后,由 bash/PowerShell/Python 脚本解析特性路径、校验前置文件并输出 JSON。扩展、预设、工作流和 Bundle 通过 catalog/manifest 解析、版本校验和安装器落入 .specify;workflow 引擎用 lark 表达式、overlay 与 step 执行编排,MCP server 对外暴露目录与执行能力。技术上依赖 Typer/Click、Rich、Pydantic、PyYAML/json5、pathspec、packaging、MCP,并用 hatchling 把核心资产打包进 wheel 以支持离线。

上手实践

较低:uv 安装 CLI 后一条 init 命令即可生成项目,但真正价值取决于代理使用与流程定制。

  • 约10分钟(不含 AI 代理账号准备)
  • 3 步安装
  • Python 3.11+、uv;CLI 依赖 Typer、Rich、PyYAML、MCP、Pydantic 等并随 wheel 打包
  • Python 3.11+ 与 uv 使用经验
  • 至少一种 AI 编码代理
  • Git 基础
  • Markdown/YAML 基础

Spec Kit 5分钟快速开始

Install the Specify CLI, bootstrap a project for Spec-Driven Development, and verify the generated artifacts in under five minutes.

环境要求

支持的操作系统

LinuxmacOSWindows

运行环境

Python>=3.11必需

所需工具

uv

Install and run the specify-cli tool in an isolated environment

AI coding agent

Execute Spec Kit slash commands such as /speckit-specify

必需

操作步骤

1

Install the Specify CLI

Install the specify-cli package. The project name in pyproject.toml is specify-cli and it exposes the specify command via the specify_cli:main entry point. If you do not have uv, use pip instead.

Install the CLI as an isolated tool with uv
uv tool install specify-cli
Alternative installation with pip
pip install specify-cli

预期结果::Running specify --help prints the CLI usage text, confirming the command is on your PATH.

The package requires Python 3.11 or newer. No API keys or external services are needed for local project initialization.

2

Initialize a new project

Create a new directory and bootstrap it with Spec Kit templates, scripts, and the default speckit workflow. Replace copilot with the integration key for your AI coding agent.

Scaffold a new project named my-project for GitHub Copilot
specify init my-project --integration copilot

预期结果::A new my-project directory is created containing .specify/, templates/, and agent integration files.

Run specify init --help to list all supported --integration values. Initialization works offline because assets are bundled in the wheel.

3

Enter the project and inspect artifacts

Change into the generated project and verify the Spec Kit metadata directory was created.

Enter the newly created project
cd my-project
List the Spec Kit metadata directory
ls .specify

预期结果::You see the .specify directory with subdirectories such as memory/ and configuration files for extensions.

To adopt Spec Kit in an existing repository, run specify init . --integration <agent> from the project root instead.

4

Add an optional bundled extension

Install the bug-fixing extension from the bundled catalog to see additional Spec Kit capabilities. This step is optional but demonstrates the extension system.

Install the bundled bug extension into the current project
specify extension add bug

预期结果::The CLI reports that the bug extension was installed. New agent commands such as /speckit-bug-assess become available.

Other bundled extensions include assess, git, agent-context, and github. You can search and manage them with the specify extension command group.

Verify your setup

Confirm that the CLI is installed, the project is initialized, and bundled extensions are available.

specify --help runs without errors
The my-project directory contains a .specify folder
specify extension add bug completes successfully

快速提示

Adoption

Use specify init . --integration copilot inside an existing codebase.

Offline

Templates, scripts, extensions, and workflows are bundled in the wheel, so initialization works offline.

Discovery

Run specify --help to discover command groups for extensions, presets, workflows, and bundles.

常见问题

1

specify: command not found

Ensure Python 3.11+ is installed and on your PATH. If you used pip install --user, add the user scripts directory to PATH. If you used uv, restart your terminal or run uv tool update-shell.

2

Python version is too old

The package requires Python >=3.11 as declared in pyproject.toml. Install a newer Python release or use uv python install 3.11.

3

Agent does not recognize /speckit-* commands after init

Verify you passed the correct --integration key for your agent. Re-run specify init . --integration <key> in the project root, or consult the integration documentation for the exact invocation syntax.

下一步

Run the SDD flow in your agent

Open the project in your AI coding agent and run /speckit-constitution, then /speckit-specify to create your first specification.

Explore bundled processes

Add the assess extension with specify extension add assess to evaluate ideas, or explore presets and workflows with specify preset list and specify workflow list.

Read the command reference

Review the SDD, bugfix, and assessment command references to understand the full agentic workflow.

学习路径
学习路径指南
难度等级
初级
预计时长
1-2周(每天2-3小时)
适合人群
具备 Python 基础、想理解 AI 编程工具链与 CLI 架构的开发者;希望为 Spec Kit 贡献扩展、预设或修复缺陷的工程师

学习目标:你将掌握 specify-cli 的模块化架构(CLI 入口、资产打包、集成适配器、目录与清单机制),能够独立运行测试、修改模板/脚本、开发自定义扩展,并提交符合契约测试规范的 PR。

前置知识

Python 3.11+

项目要求 Python >=3.11,核心包 src/specify_cli 使用现代类型语法与 Pydantic v2,必须掌握异步基础、类型注解与包结构。

Typer / Click

CLI 完全基于 Typer>=0.24.0 与 Click>=8.2.1 构建,命令注册、参数解析、回调钩子均依赖二者,读源码前需理解 Command、Group、Context 等概念。

Pydantic v2

bundles、presets、workflows、artifacts 等模块大量使用 pydantic>=2.13.0 做 schema 校验与序列化,需掌握 BaseModel、Field、model_validate 等 API。

Rich

_console.py 及交互式命令使用 rich 渲染表格、进度条与面板,了解 Console、Table、Prompt 即可顺利调试输出。

YAML / JSON5

扩展、预设、工作流、目录(catalog)配置均基于 YAML;部分配置兼容 JSON5(json5>=0.13.0),需掌握嵌套结构与引用解析。

pytest

测试体系庞大(tests/ 下含 contract、integration、unit 等),贡献前必须会跑单测、读 fixture 与 parametrize。

Git / GitHub Actions

契约测试(tests/contract/)锁定 wheel 打包与 catalog 一致性,CI 会校验 bash/Python/PowerShell 脚本 parity,需理解基础 Git 操作与 CI 失败排查。

学习步骤

1

环境准备与项目跑通

2-3小时

安装工具链并克隆仓库

安装 Python 3.11+、uv(README 推荐)。执行 `git clone https://github.com/github/spec-kit.git` 后进入仓库,阅读 pyproject.toml 确认依赖与构建后端 hatchling。

不要直接 pip install,使用 `uv sync` 或 `uv tool install specify-cli` 保持依赖隔离。

以可编辑模式安装 CLI 并运行冒烟测试

在仓库根目录执行 `uv pip install -e .`,然后运行 `specify --help`。打开 src/specify_cli/__init__.py,找到 Typer 入口 `main` 与命令注册逻辑,理解 CLI 如何挂载子命令。

若命令未生效,检查 `[project.scripts]` 中 `specify =

使用场景

Spec Kit 通过为 AI 编程代理提供结构化的规范驱动开发、缺陷修复与想法评估流程,以及可组合的扩展、预设、工作流与离线打包能力,帮助团队以规范为中心构建软件。

  • 规范驱动开发(SDD)功能构建

    在使用 AI 编程代理构建功能或应用时,缺乏从需求规范到计划、任务和代码实现的系统化流程,导致意图漂移与质量不可控。

    通过核心 SDD 工作流,在代理聊天中依次执行 /speckit-constitution、/speckit-specify、/speckit-plan、/speckit-tasks、/speckit-implement 与 /speckit-converge 命令,将规范贯穿规划、实现与收敛全过程。

    在 GitHub Copilot 中运行 `/speckit-specify Build a photo organizer with albums grouped by date and a tile preview of each album.`,随后执行 `/speckit-plan Use Vite with vanilla JavaScript...`、`/speckit-tasks`、`/speckit-implement`,并重复 `/speckit-converge` 直至报告 `Converged`。

  • 缺陷评估与修复

    面对线上缺陷时,需要系统性地评估根因、限定修复范围并记录验证结果,而非临时修补。

    安装 bug 扩展后,依次运行 /speckit-bug-assess、/speckit-bug-fix 与 /speckit-bug-test 技能,在 .specify/bugs/<slug>/ 下生成评估、修复与验证报告。

    执行 `specify extension add bug` 后,在代理中输入 `/speckit-bug-assess "Submitting an empty password crashes the login form." slug=login-crash`,接着运行 `/speckit-bug-fix slug=login-crash` 和 `/speckit-bug-test slug=login-crash`,最终查看 `verified` 判定。

  • 想法评估与决策

    在投入开发资源前,缺乏基于证据的决策机制来判断一个想法是否值得 pursue。

    安装 assess 扩展,通过 /speckit-assess-intake、/speckit-assess-research、/speckit-assess-define、/speckit-assess-shape 与 /speckit-assess-decide 五个阶段收集证据并产出 go / needs-clarification / kill 决策。

    运行 `specify extension add assess` 后,执行 `/speckit-assess-intake "Let users work offline and sync when they reconnect." slug=offline-mode`,依次完成后续阶段,最终在 `.specify/assessments/offline-mode/decision.md` 中获得决策。

  • 团队流程定制与扩展

    不同团队有各自的规范、术语或方法论,需要定制 Spec Kit 的模板、命令与自动化流程,或引入全新流程。

    使用 preset 调整模板、命令与术语;通过 extension 添加自定义命令、质量门禁或外部工具连接;利用 workflow 与 overlay 自动化提示、命令与检查;或将扩展、预设、工作流打包为 bundle 共享。

    为满足监管 traceability 要求,创建一个 preset 修改 plan 模板;或通过 `specify extension add` 安装 git 扩展来自动化分支创建与提交;也可使用 workflow overlay 修改已安装工作流而无需 fork。

  • 多代理适配与离线部署

    团队使用不同的 AI 编程代理(如 Copilot、Claude、Codex 等),且企业环境常需离线或防火墙内运行。

    `specify init` 支持通过 `--integration` 参数为特定代理生成项目脚手架;wheel 包内置核心模板、脚本、扩展、工作流与预设,确保 `specify init` 在无网络环境下可用。

    执行 `uv tool install specify-cli` 后,运行 `specify init my-project --integration copilot` 为 Copilot 生成项目;在 air-gapped 环境中,直接使用已打包的 wheel 安装并初始化,无需访问外部 catalog。

适用边界

  • 不想使用 AI 编码代理、只追求纯本地脚本的团队
  • 需要图形化 IDE 一体化体验的人
  • 拒绝审查社区目录组件、追求完全开箱即用信任的组织
  • 只需要简单代码补全或对话插件的场景
  • extension/workflow/bundle 可从目录或 URL 安装,社区 catalog 未经审计,存在供应链风险,需自行审查源码。
  • 集成代理众多且版本为 1.4.6.dev0,命令语法与适配器可能随代理平台变化而漂移。
  • 核心资产与目录打包在 wheel 中,升级时可能出现模板/脚本版本不一致,需依赖契约测试与升级命令。

tests/ 覆盖 contract、extensions、integrations、workflows;pyproject 锁定 wheel 资产;版本 1.4.6.dev0 仍高频演进。

  • Kiro

    Kiro 是内置规格流程的 IDE;Spec Kit 是代理无关的 CLI/工具包。

    想要开箱即用的图形 IDE 与内置代理,不愿维护 CLI/模板时选 Kiro。

  • Aider

    Aider 侧重 AI 结对编程与 Git 变更;Spec Kit 侧重规格、计划、任务与收敛流程。

    主要目标是快速让 AI 改代码,而不是建立可追溯规格流程时选 Aider。

  • Continue

    Continue 是 IDE 内的 AI 编程助手;Spec Kit 提供跨代理的流程与组件管理。

    只需要编辑器内补全/对话,不需要跨代理流程治理时选 Continue。