setup-speckit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Setup Spec-Kit

搭建Spec-Kit

Install Spec-Kit into a target repository, enabling the full Specification-Driven Development (SDD) pipeline: specify → clarify → plan → tasks → implement → analyze → checklist → constitution.
将Spec-Kit安装到目标代码仓库中,启用完整的规范驱动开发(Specification-Driven Development,SDD)流程:定义规范 → 明确需求 → 制定计划 → 拆分任务 → 开发实现 → 分析复盘 → 检查清单 → 项目章程。

When to Use

使用场景

  • Bootstrapping a new repo for speckit workflows
  • Adding SDD to an existing project
  • 为新仓库初始化speckit工作流
  • 为现有项目添加SDD流程

Source Forks

源码分支

ForkRepoNotes
fellowship-dev (default)fellowship-dev/spec-kitLeaner, fewer tokens, opinionated defaults
upstreamgithub/spec-kitOriginal, more verbose, higher token cost
Default to the fellowship-dev fork. If the user explicitly requests the upstream version, warn that it uses significantly more tokens per invocation due to longer templates and prompts.
分支仓库地址说明
fellowship-dev(默认)fellowship-dev/spec-kit更精简,占用token更少,带有预设的默认配置
upstreamgithub/spec-kit原版,内容更详尽,token消耗更高
默认使用fellowship-dev分支。如果用户明确要求使用upstream版本,需提醒该版本因模板和提示语更长,每次调用会消耗更多token。

Prerequisites

前置条件

  • Git available in the target repo
  • Target repo has a
    .claude/
    directory (run
    setup-harness
    first if not)
  • 目标仓库已安装Git
  • 目标仓库存在
    .claude/
    目录(若不存在,需先运行
    setup-harness

What Gets Installed

安装内容

target-repo/
├── .specify/
│   ├── scripts/bash/          # create-new-feature.sh, setup-plan.sh, common.sh, etc.
│   ├── templates/             # spec, plan, tasks, checklist, constitution templates
│   └── memory/
│       └── constitution.md    # Project principles (customized or default)
├── .claude/commands/
│   ├── speckit.specify.md     # /speckit.specify <issue-number>
│   ├── speckit.plan.md        # /speckit.plan
│   ├── speckit.tasks.md       # /speckit.tasks
│   ├── speckit.implement.md   # /speckit.implement
│   ├── speckit.clarify.md     # /speckit.clarify
│   ├── speckit.checklist.md   # /speckit.checklist
│   ├── speckit.analyze.md     # /speckit.analyze
│   └── speckit.constitution.md
└── specs/                     # Created per-feature by /speckit.specify
target-repo/
├── .specify/
│   ├── scripts/bash/          # create-new-feature.sh, setup-plan.sh, common.sh等脚本
│   ├── templates/             # 规范、计划、任务、检查清单、项目章程模板
│   └── memory/
│       └── constitution.md    # 项目原则(可自定义或使用默认)
├── .claude/commands/
│   ├── speckit.specify.md     # /speckit.specify <issue-number>
│   ├── speckit.plan.md        # /speckit.plan
│   ├── speckit.tasks.md       # /speckit.tasks
│   ├── speckit.implement.md   # /speckit.implement
│   ├── speckit.clarify.md     # /speckit.clarify
│   ├── speckit.checklist.md   # /speckit.checklist
│   ├── speckit.analyze.md     # /speckit.analyze
│   └── speckit.constitution.md
└── specs/                     # 由/speckit.specify命令按功能创建

Installation Steps

安装步骤

1. Clone Spec-Kit to a temp directory

1. 将Spec-Kit克隆到临时目录

bash
undefined
bash
undefined

Default: fellowship-dev fork (leaner, recommended)

默认:fellowship-dev分支(更精简,推荐使用)

SPECKIT_SRC=$(mktemp -d) git clone --depth 1 https://github.com/fellowship-dev/spec-kit.git "$SPECKIT_SRC"
SPECKIT_SRC=$(mktemp -d) git clone --depth 1 https://github.com/fellowship-dev/spec-kit.git "$SPECKIT_SRC"

Alternative: upstream (more verbose, higher token cost)

备选:upstream分支(内容更详尽,token消耗更高)

git clone --depth 1 https://github.com/github/spec-kit.git "$SPECKIT_SRC"

git clone --depth 1 https://github.com/github/spec-kit.git "$SPECKIT_SRC"

undefined
undefined

2. Create target directories

2. 创建目标目录

bash
mkdir -p .specify/scripts/bash .specify/templates .specify/memory
mkdir -p .claude/commands
mkdir -p specs
bash
mkdir -p .specify/scripts/bash .specify/templates .specify/memory
mkdir -p .claude/commands
mkdir -p specs

3. Copy scripts

3. 复制脚本

bash
cp "$SPECKIT_SRC"/scripts/bash/*.sh .specify/scripts/bash/
chmod +x .specify/scripts/bash/*.sh
bash
cp "$SPECKIT_SRC"/scripts/bash/*.sh .specify/scripts/bash/
chmod +x .specify/scripts/bash/*.sh

4. Copy templates

4. 复制模板

bash
cp "$SPECKIT_SRC"/templates/spec-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/plan-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/tasks-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/checklist-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/constitution-template.md .specify/templates/
bash
cp "$SPECKIT_SRC"/templates/spec-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/plan-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/tasks-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/checklist-template.md .specify/templates/
cp "$SPECKIT_SRC"/templates/constitution-template.md .specify/templates/

5. Copy Claude Code slash commands

5. 复制Claude Code斜杠命令

bash
cp "$SPECKIT_SRC"/templates/commands/specify.md .claude/commands/speckit.specify.md
cp "$SPECKIT_SRC"/templates/commands/plan.md .claude/commands/speckit.plan.md
cp "$SPECKIT_SRC"/templates/commands/tasks.md .claude/commands/speckit.tasks.md
cp "$SPECKIT_SRC"/templates/commands/implement.md .claude/commands/speckit.implement.md
cp "$SPECKIT_SRC"/templates/commands/clarify.md .claude/commands/speckit.clarify.md
cp "$SPECKIT_SRC"/templates/commands/checklist.md .claude/commands/speckit.checklist.md
cp "$SPECKIT_SRC"/templates/commands/analyze.md .claude/commands/speckit.analyze.md
cp "$SPECKIT_SRC"/templates/commands/constitution.md .claude/commands/speckit.constitution.md
bash
cp "$SPECKIT_SRC"/templates/commands/specify.md .claude/commands/speckit.specify.md
cp "$SPECKIT_SRC"/templates/commands/plan.md .claude/commands/speckit.plan.md
cp "$SPECKIT_SRC"/templates/commands/tasks.md .claude/commands/speckit.tasks.md
cp "$SPECKIT_SRC"/templates/commands/implement.md .claude/commands/speckit.implement.md
cp "$SPECKIT_SRC"/templates/commands/clarify.md .claude/commands/speckit.clarify.md
cp "$SPECKIT_SRC"/templates/commands/checklist.md .claude/commands/speckit.checklist.md
cp "$SPECKIT_SRC"/templates/commands/analyze.md .claude/commands/speckit.analyze.md
cp "$SPECKIT_SRC"/templates/commands/constitution.md .claude/commands/speckit.constitution.md

6. Initialize constitution

6. 初始化项目章程

If the project doesn't have a constitution yet:
bash
cp .specify/templates/constitution-template.md .specify/memory/constitution.md
Ask the user if they want to customize it now or use the default. Key decisions:
  • Test-first vs test-after
  • Library-first preference
  • Max complexity per feature
  • Framework-specific principles
如果项目尚未有章程:
bash
cp .specify/templates/constitution-template.md .specify/memory/constitution.md
询问用户是否要立即自定义章程还是使用默认版本。关键决策点:
  • 先测试后开发 vs 先开发后测试
  • 优先使用现有库 vs 自行开发
  • 单个功能的最大复杂度
  • 框架相关原则

7. Clean up

7. 清理临时文件

bash
rm -rf "$SPECKIT_SRC"
bash
rm -rf "$SPECKIT_SRC"

8. Ensure required GitHub labels exist

8. 确保所需GitHub标签存在

bash
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')

gh label create "in-progress" --repo "$REPO" --color "97f157" --description "Issue is actively being worked on" 2>/dev/null || true
gh label create "ready-to-work" --repo "$REPO" --color "f6a80a" --description "PRD complete, ready for implementation" 2>/dev/null || true
bash
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')

gh label create "in-progress" --repo "$REPO" --color "97f157" --description "Issue is actively being worked on" 2>/dev/null || true
gh label create "ready-to-work" --repo "$REPO" --color "f6a80a" --description "PRD complete, ready for implementation" 2>/dev/null || true

9. Verify installation

9. 验证安装结果

bash
ls .specify/scripts/bash/*.sh      # Scripts present and executable
ls .specify/templates/*.md         # Templates present
ls .claude/commands/speckit.*.md   # Slash commands present
cat .specify/memory/constitution.md # Constitution initialized
gh label list --repo "$REPO" | grep -E "in-progress|ready-to-work"
bash
ls .specify/scripts/bash/*.sh      # 脚本已存在且可执行
ls .specify/templates/*.md         # 模板已存在
ls .claude/commands/speckit.*.md   # 斜杠命令已存在
cat .specify/memory/constitution.md # 章程已初始化
gh label list --repo "$REPO" | grep -E "in-progress|ready-to-work"

Post-Install

安装后操作

  • Run
    /speckit.constitution
    to customize principles for this project
  • The repo is now ready for
    /speckit.specify <issue-number>
    workflows
  • 运行
    /speckit.constitution
    自定义项目原则
  • 仓库现在已准备好使用
    /speckit.specify <issue-number>
    工作流

SDD Philosophy (Terse)

SDD核心理念(精简版)

  • Specs ≤50 lines, bullets only
  • Plans ≤50 lines, table-driven decisions
  • Tasks ≤40 lines, checkboxes, no prose
  • Constitution enforces principles (test-first, library-first, simplicity)
  • Branch naming:
    <issue-number>-<short-name>
  • 规范文档≤50行,仅使用列表项
  • 计划文档≤50行,采用表格驱动决策
  • 任务列表≤40行,使用复选框,无冗长描述
  • 项目章程强制执行原则(先测试后开发、优先使用现有库、简洁性)
  • 分支命名规则:
    <issue-number>-<short-name>