Create Specifications (GitHub Spec Kit Integration)
创建规范文档(GitHub Spec Kit 集成)
Step 3 of 6 in the Reverse Engineering to Spec-Driven Development process.
Estimated Time: 30 minutes (specs only) to 90 minutes (specs + plans + tasks)
Prerequisites: Step 2 completed (
docs/reverse-engineering/
exists with 9 files)
Output: directory with GitHub Spec Kit structure
从逆向工程到规范驱动开发流程中的第3步(共6步)
预计耗时: 30分钟(仅生成规范)至90分钟(规范+计划+任务)
前置条件: 已完成第2步(
docs/reverse-engineering/
目录存在且包含9个文件)
输出结果: 符合GitHub Spec Kit结构的
目录
Thoroughness Options
详细程度选项
Gear 3 generates different levels of detail based on configuration set in Gear 1:
Option 1: Specs Only (30 min - fast)
- Generate
.specify/specs/###-feature-name/spec.md
for all features
- Constitution and folder structure
- Ready for manual planning with
Option 2: Specs + Plans (45-60 min - recommended)
- Everything from Option 1
- PLUS: Auto-generate for PARTIAL/MISSING features
- Ready for manual task breakdown with
Option 3: Specs + Plans + Tasks (90-120 min - complete roadmap)
- Everything from Option 2
- PLUS: Auto-generate comprehensive (300-500 lines each)
- Ready for immediate implementation
- No additional planning needed
Configuration: Set during Gear 1 (Analyze) via initial questionnaire, stored in
根据第1步中设置的配置,此步骤会生成不同详细程度的内容:
选项1:仅生成规范(30分钟 - 快速模式)
- 为所有功能生成
.specify/specs/###-feature-name/spec.md
- 创建章程文件和目录结构
- 可通过命令手动制定计划
选项2:规范+计划(45-60分钟 - 推荐模式)
- 包含选项1的所有内容
- 额外: 为部分完成/缺失的功能自动生成
- 可通过命令手动拆分任务
选项3:规范+计划+任务(90-120分钟 - 完整路线图)
- 包含选项2的所有内容
- 额外: 自动生成详尽的(每个文件300-500行)
- 可直接用于开发实现
- 无需额外规划
配置说明: 在第1步(分析阶段)通过初始问卷设置,存储在
文件中
When to Use This Skill
何时使用此技能
Use this skill when:
- You've completed Step 2 (Reverse Engineer)
- Have comprehensive documentation in
docs/reverse-engineering/
- Ready to create formal specifications in GitHub Spec Kit format
- Want to leverage slash commands for implementation
Trigger Phrases:
- "Create specifications from documentation"
- "Transform docs into Spec Kit format"
- "Set up GitHub Spec Kit"
- "Initialize Spec Kit for this project"
在以下场景使用此技能:
- 已完成第2步(逆向工程)
docs/reverse-engineering/
目录下有完整的文档
- 准备将文档转换为GitHub Spec Kit格式的正式规范
- 希望使用斜杠命令辅助开发实现
触发关键词:
- "从文档创建规范"
- "将文档转换为Spec Kit格式"
- "设置GitHub Spec Kit"
- "为项目初始化Spec Kit"
What This Skill Does
此技能的作用
Automatically transforms reverse-engineering documentation into GitHub Spec Kit format using F002 automated spec generation:
- Read reverse engineering docs - Parse
docs/reverse-engineering/functional-specification.md
- Extract ALL features - Identify every feature (complete, partial, missing)
- Generate constitution - Create
.specify/memory/constitution.md
with project principles
- Create feature specs - Generate
.specify/specs/###-feature-name/spec.md
for EVERY feature
- Implementation plans - Create for PARTIAL and MISSING features only
- Enable slash commands - Set up commands
Critical: This creates specs for 100% of features, not just gaps!
- ✅ Complete features get specs (for future spec-driven changes)
- ⚠️ Partial features get specs + plans (show what exists + what's missing)
- ❌ Missing features get specs + plans (ready to implement)
Result: Complete spec coverage - entire application under spec control.
自动将逆向工程文档转换为GitHub Spec Kit格式,使用F002自动规范生成工具:
- 读取逆向工程文档 - 解析
docs/reverse-engineering/functional-specification.md
- 提取所有功能 - 识别所有功能(已完成、部分完成、缺失)
- 生成章程文件 - 创建
.specify/memory/constitution.md
,包含项目原则
- 创建功能规范 - 为每个功能生成
.specify/specs/###-feature-name/spec.md
- 生成实现计划 - 仅为部分完成和缺失的功能创建
- 启用斜杠命令 - 配置系列命令
关键说明: 此技能会为100%的功能生成规范,而不仅仅是缺失的部分!
- ✅ 已完成的功能会生成规范(用于未来的规范驱动变更)
- ⚠️ 部分完成的功能会生成规范+计划(说明已实现部分和缺失部分)
- ❌ 缺失的功能会生成规范+计划(可直接用于实现)
最终结果: 完整的规范覆盖 - 整个应用处于规范管控之下。
Configuration Check (FIRST STEP!)
配置检查(第一步!)
Load state file to determine execution plan:
Check thoroughness level (set in Gear 1)
检查详细程度(在第1步设置)
THOROUGHNESS=$(cat .stackshift-state.json | jq -r '.config.gear3_thoroughness // "specs"')
THOROUGHNESS=$(cat .stackshift-state.json | jq -r '.config.gear3_thoroughness // "specs"')
ROUTE=$(cat .stackshift-state.json | jq -r '.path')
ROUTE=$(cat .stackshift-state.json | jq -r '.path')
Check spec output location (Greenfield may have custom location)
检查规范输出位置(新项目可能有自定义位置)
SPEC_OUTPUT=$(cat .stackshift-state.json | jq -r '.config.spec_output_location // "."')
echo "Route: $ROUTE"
echo "Spec output: $SPEC_OUTPUT"
echo "Thoroughness: $THOROUGHNESS"
SPEC_OUTPUT=$(cat .stackshift-state.json | jq -r '.config.spec_output_location // "."')
echo "项目类型: $ROUTE"
echo "规范输出位置: $SPEC_OUTPUT"
echo "详细程度: $THOROUGHNESS"
Determine what to execute
确定执行内容
case "$THOROUGHNESS" in
"specs")
echo "Will generate: Specs only"
GENERATE_PLANS=false
GENERATE_TASKS=false
;;
"specs+plans")
echo "Will generate: Specs + Plans"
GENERATE_PLANS=true
GENERATE_TASKS=false
;;
"specs+plans+tasks")
echo "Will generate: Specs + Plans + Tasks (complete roadmap)"
GENERATE_PLANS=true
GENERATE_TASKS=true
;;
*)
echo "Unknown thoroughness: $THOROUGHNESS, defaulting to specs only"
GENERATE_PLANS=false
GENERATE_TASKS=false
;;
esac
case "$THOROUGHNESS" in
"specs")
echo "将生成: 仅规范"
GENERATE_PLANS=false
GENERATE_TASKS=false
;;
"specs+plans")
echo "将生成: 规范+计划"
GENERATE_PLANS=true
GENERATE_TASKS=false
;;
"specs+plans+tasks")
echo "将生成: 规范+计划+任务(完整路线图)"
GENERATE_PLANS=true
GENERATE_TASKS=true
;;
*)
echo "未知的详细程度: $THOROUGHNESS, 默认使用仅规范模式"
GENERATE_PLANS=false
GENERATE_TASKS=false
;;
esac
If custom location, ensure .specify directory exists there
如果是自定义位置,确保该位置下存在.specify目录
if [ "$SPEC_OUTPUT" != "." ]; then
echo "Creating .specify/ structure at custom location..."
mkdir -p "$SPEC_OUTPUT/.specify/specs"
mkdir -p "$SPEC_OUTPUT/.specify/memory"
mkdir -p "$SPEC_OUTPUT/.specify/templates"
mkdir -p "$SPEC_OUTPUT/.specify/scripts"
fi
**Where specs will be written:**
| Route | Config | Specs Written To |
|-------|--------|------------------|
| Greenfield | spec_output_location set | `{spec_output_location}/.specify/specs/` |
| Greenfield | Not set (default) | `./.specify/specs/` (current repo) |
| Brownfield | Always current | `./.specify/specs/` (current repo) |
**Common patterns:**
- Same repo: `spec_output_location: "."` (default)
- New repo: `spec_output_location: "~/git/my-new-app"`
- Docs repo: `spec_output_location: "~/git/my-app-docs"`
- Subfolder: `spec_output_location: "./new-version"`
---
if [ "$SPEC_OUTPUT" != "." ]; then
echo "在自定义位置创建.specify/结构..."
mkdir -p "$SPEC_OUTPUT/.specify/specs"
mkdir -p "$SPEC_OUTPUT/.specify/memory"
mkdir -p "$SPEC_OUTPUT/.specify/templates"
mkdir -p "$SPEC_OUTPUT/.specify/scripts"
fi
**规范输出位置说明:**
| 项目类型 | 配置 | 规范输出位置 |
|-------|--------|------------------|
| Greenfield | 已设置spec_output_location | `{spec_output_location}/.specify/specs/` |
| Greenfield | 未设置(默认) | `./.specify/specs/`(当前仓库) |
| Brownfield | 始终使用当前 | `./.specify/specs/`(当前仓库) |
**常见配置模式:**
- 同一仓库: `spec_output_location: "."`(默认)
- 新仓库: `spec_output_location: "~/git/my-new-app"`
- 文档仓库: `spec_output_location: "~/git/my-app-docs"`
- 子目录: `spec_output_location: "./new-version"`
---
🤖 Execution Instructions
🤖 执行说明
IMPORTANT: This skill uses automated spec generation tools from F002.
重要提示: 此技能使用F002提供的自动规范生成工具。
Step 1: Install GitHub Spec Kit Scripts
步骤1:安装GitHub Spec Kit脚本
CRITICAL FIRST STEP: Install the prerequisite scripts needed by
commands:
Install Spec Kit scripts to enable /speckit.* commands
安装Spec Kit脚本以启用/speckit.*命令
if [ -f ~/git/stackshift/scripts/install-speckit-scripts.sh ]; then
~/git/stackshift/scripts/install-speckit-scripts.sh .
elif [ -f ~/stackshift/scripts/install-speckit-scripts.sh ]; then
~/stackshift/scripts/install-speckit-scripts.sh .
else
Download directly if script not available
mkdir -p .specify/scripts/bash
BASE_URL="
https://raw.githubusercontent.com/github/spec-kit/main/scripts"
curl -sSLf "$BASE_URL/bash/check-prerequisites.sh" -o .specify/scripts/bash/check-prerequisites.sh
curl -sSLf "$BASE_URL/bash/setup-plan.sh" -o .specify/scripts/bash/setup-plan.sh
curl -sSLf "$BASE_URL/bash/create-new-feature.sh" -o .specify/scripts/bash/create-new-feature.sh
curl -sSLf "$BASE_URL/bash/update-agent-context.sh" -o .specify/scripts/bash/update-agent-context.sh
curl -sSLf "$BASE_URL/bash/common.sh" -o .specify/scripts/bash/common.sh
chmod +x .specify/scripts/bash/*.sh
echo "✅ Downloaded GitHub Spec Kit scripts"
fi
**Why this is needed:**
- `/speckit.analyze` requires `scripts/bash/check-prerequisites.sh`
- `/speckit.implement` requires `scripts/bash/check-prerequisites.sh`
- `/speckit.plan` requires `scripts/bash/setup-plan.sh`
- `/speckit.specify` requires `scripts/bash/create-new-feature.sh`
**Without these scripts, Gear 4 (Gap Analysis) will fail when trying to run `/speckit.analyze`!**
if [ -f ~/git/stackshift/scripts/install-speckit-scripts.sh ]; then
~/git/stackshift/scripts/install-speckit-scripts.sh .
elif [ -f ~/stackshift/scripts/install-speckit-scripts.sh ]; then
~/stackshift/scripts/install-speckit-scripts.sh .
else
如果脚本不可用,直接下载
mkdir -p .specify/scripts/bash
BASE_URL="
https://raw.githubusercontent.com/github/spec-kit/main/scripts"
curl -sSLf "$BASE_URL/bash/check-prerequisites.sh" -o .specify/scripts/bash/check-prerequisites.sh
curl -sSLf "$BASE_URL/bash/setup-plan.sh" -o .specify/scripts/bash/setup-plan.sh
curl -sSLf "$BASE_URL/bash/create-new-feature.sh" -o .specify/scripts/bash/create-new-feature.sh
curl -sSLf "$BASE_URL/bash/update-agent-context.sh" -o .specify/scripts/bash/update-agent-context.sh
curl -sSLf "$BASE_URL/bash/common.sh" -o .specify/scripts/bash/common.sh
chmod +x .specify/scripts/bash/*.sh
echo "✅ 已下载GitHub Spec Kit脚本"
fi
**安装原因:**
- `/speckit.analyze`需要`scripts/bash/check-prerequisites.sh`
- `/speckit.implement`需要`scripts/bash/check-prerequisites.sh`
- `/speckit.plan`需要`scripts/bash/setup-plan.sh`
- `/speckit.specify`需要`scripts/bash/create-new-feature.sh`
**如果未安装这些脚本,第4步(差距分析)运行`/speckit.analyze`时会失败!**
Step 2: Generate Specifications
步骤2:生成规范文档
Use the manual reconciliation approach to generate all specifications:
Use the web reconciliation prompt to create all specs with 100% coverage
使用Web协调提示创建100%覆盖的所有规范
cat web/reconcile-specs.md
This will:
1. Parse `docs/reverse-engineering/functional-specification.md`
2. Extract EVERY feature (complete, partial, missing)
3. Generate constitution and ALL feature specs
4. Create implementation plans for incomplete features
**Expected output**:
- Constitution created
- 15-50 feature specs created (depending on app size)
- 100% feature coverage
- Implementation plans for incomplete features
cat web/reconcile-specs.md
此操作会:
1. 解析`docs/reverse-engineering/functional-specification.md`
2. 提取所有功能(已完成、部分完成、缺失)
3. 生成章程文件和所有功能规范
4. 为未完成的功能创建实现计划
**预期输出:**
- 已创建章程文件
- 已创建15-50个功能规范(根据应用规模而定)
- 100%的功能覆盖
- 为未完成功能生成的实现计划
Step 3: Verify Success
步骤3:验证执行成功
After the tool completes, verify:
.specify/memory/constitution.md
exists
.specify/specs/###-feature-name/
directories created for ALL features
- Each feature has
- PARTIAL/MISSING features have
工具执行完成后,验证以下内容:
.specify/memory/constitution.md
已存在
- 为所有功能创建了
.specify/specs/###-feature-name/
目录
- 每个功能目录下都有
- 部分完成/缺失的功能目录下有
If Automated Tool Fails
若自动工具执行失败
The MCP tool creates all Spec Kit files programmatically - it does NOT need
.
The tool creates:
.specify/memory/constitution.md
(from templates)
.specify/specs/###-feature-name/spec.md
(all features)
.specify/specs/###-feature-name/plan.md
(for incomplete features)
.claude/commands/speckit.*.md
(slash commands)
If the MCP tool fails, use the manual reconciliation prompt:
MCP工具会以编程方式创建所有Spec Kit文件 - 不需要执行
。
工具会创建以下文件:
.specify/memory/constitution.md
(从模板生成)
.specify/specs/###-feature-name/spec.md
(所有功能)
.specify/specs/###-feature-name/plan.md
(仅未完成功能)
.claude/commands/speckit.*.md
(斜杠命令)
如果MCP工具执行失败,使用手动协调提示:
Copy this prompt into Claude.ai:
将以下提示复制到Claude.ai:
cat web/reconcile-specs.md
cat web/reconcile-specs.md
This will manually create all specs with 100% coverage
此操作会手动创建100%覆盖的所有规范
**DO NOT run `specify init`** - it requires GitHub API access and isn't needed since F002 creates all files directly.
This creates:
.specify/
├── memory/
│ └── constitution.md # Project principles (will be generated)
├── templates/ # AI agent configs
├── scripts/ # Automation utilities
└── specs/ # Feature directories (will be generated)
├── 001-feature-name/
│ ├── spec.md # Feature specification
│ ├── plan.md # Implementation plan
│ └── tasks.md # Task breakdown (generated by /speckit.tasks)
└── 002-another-feature/
└── ...
**Note:** GitHub Spec Kit uses `.specify/specs/NNN-feature-name/` directory structure
**请勿运行`specify init`** - 该命令需要GitHub API权限,而F002会直接创建所有文件,因此不需要执行该命令。
创建后的目录结构:
.specify/
├── memory/
│ └── constitution.md # 项目原则(将被生成)
├── templates/ # AI Agent配置
├── scripts/ # 自动化工具
└── specs/ # 功能目录(将被生成)
├── 001-feature-name/
│ ├── spec.md # 功能规范
│ ├── plan.md # 实现计划
│ └── tasks.md # 任务拆分(由/speckit.tasks生成)
└── 002-another-feature/
└── ...
**注意:** GitHub Spec Kit使用`.specify/specs/NNN-feature-name/`目录结构
Step 2: Generate Constitution
步骤2:生成章程文件
From
docs/reverse-engineering/functional-specification.md
, create
.specify/memory/constitution.md
:
Constitution includes:
- Purpose & Values - Why this project exists, core principles
- Technical Decisions - Architecture choices with rationale
- Development Standards - Code style, testing requirements, review process
- Quality Standards - Performance, security, reliability requirements
- Governance - How decisions are made
After generating initial constitution, user can run:
> /speckit.constitution
To refine and update the constitution interactively
从
docs/reverse-engineering/functional-specification.md
创建
.specify/memory/constitution.md
:
章程文件包含:
- 目的与价值观 - 项目存在的意义、核心原则
- 技术决策 - 架构选择及理由
- 开发标准 - 代码风格、测试要求、评审流程
- 质量标准 - 性能、安全、可靠性要求
- 治理规则 - 决策制定流程
生成初始章程后,用户可运行:
> /speckit.constitution
以交互式方式优化和更新章程文件
Step 3: Generate Specifications
步骤3:生成功能规范
Transform
docs/reverse-engineering/functional-specification.md
into individual feature specs in
.specify/specs/FEATURE-ID/
:
Recommended: Use the Task tool with
subagent_type=stackshift:technical-writer
for efficient, parallel spec generation.
Directory Structure (per GitHub Spec Kit conventions):
Each feature gets its own directory:
specs/001-user-authentication/
├── spec.md # Feature specification
└── plan.md # Implementation plan
spec.md format:
将
docs/reverse-engineering/functional-specification.md
转换为
.specify/specs/FEATURE-ID/
下的单个功能规范:
推荐方式: 使用任务工具,设置
subagent_type=stackshift:technical-writer
以高效并行生成规范。
目录结构(遵循GitHub Spec Kit约定):
每个功能都有独立的目录:
specs/001-user-authentication/
├── spec.md # 功能规范
└── plan.md # 实现计划
spec.md格式:
Feature: User Authentication
功能:用户认证
⚠️ PARTIAL - Backend complete, frontend missing login UI
[Description of what this feature does]
- As a user, I want to register an account so that I can save my data
- As a user, I want to log in so that I can access my dashboard
- 作为用户,我希望注册账号以保存我的数据
- 作为用户,我希望登录以访问我的仪表盘
Technical Requirements
技术要求
- Authentication method: JWT
- Password hashing: bcrypt
- Session duration: 24 hours
- API endpoints:
- POST /api/auth/register
- POST /api/auth/login
- POST /api/auth/reset-password
- 认证方式:JWT
- 密码哈希:bcrypt
- 会话时长:24小时
- API端点:
- POST /api/auth/register
- POST /api/auth/login
- POST /api/auth/reset-password
Implementation Status
实现状态
Completed:
- ✅ Backend API endpoints (all 3)
- ✅ Database user model
- ✅ JWT token generation
Missing:
- ❌ Frontend login page
- ❌ Frontend registration page
- ❌ Password reset UI
- ❌ Token refresh mechanism
已完成:
- ✅ 后端API端点(全部3个)
- ✅ 数据库用户模型
- ✅ JWT令牌生成
缺失:
- ❌ 前端登录页面
- ❌ 前端注册页面
- ❌ 密码重置UI
- ❌ 令牌刷新机制
Related Specifications
相关规范
- user-profile.md (depends on authentication)
- authorization.md (extends authentication)
**Use `/speckit.specify` command:**
After generating initial specs, user can run:
/speckit.specify
To create additional specifications or refine existing ones
- user-profile.md(依赖于认证功能)
- authorization.md(扩展认证功能)
**使用`/speckit.specify`命令:**
生成初始规范后,用户可运行:
/speckit.specify
以创建额外规范或优化现有规范
Step 4: Generate Implementation Plans
步骤4:生成实现计划
For each
PARTIAL or
MISSING feature, create
in the feature's directory:
Location: .specify/specs/FEATURE-ID/plan.md
Format:
位置: .specify/specs/FEATURE-ID/plan.md
格式:
Implementation Plan: User Authentication Frontend
实现计划:用户认证前端
Complete the frontend UI for user authentication (login, registration, password reset)
- Backend API fully functional
- No frontend UI components exist
- User lands on placeholder page
- 后端API完全可用
- 无前端UI组件
- 用户访问时显示占位页面
- Complete login page with form validation
- Registration page with email verification
- Password reset flow (email + new password)
- Responsive design for mobile/desktop
- 带表单验证的完整登录页面
- 带邮箱验证的注册页面
- 密码重置流程(邮箱+新密码)
- 适配移动端/桌面端的响应式设计
- Create React components using existing UI library
- Integrate with backend API endpoints
- Add form validation with Zod
- Implement JWT token storage (localStorage)
- Add route protection for authenticated pages
- 使用现有UI库创建React组件
- 与后端API端点集成
- 使用Zod添加表单验证
- 实现JWT令牌存储(localStorage)
- 为认证页面添加路由保护
Risks & Mitigations
风险与缓解措施
- Risk: Token storage in localStorage (XSS vulnerability)
- Mitigation: Consider httpOnly cookies instead
- Risk: No rate limiting on frontend
- Mitigation: Add rate limiting to API endpoints
- 风险:在localStorage中存储令牌(XSS漏洞)
- 缓解:考虑使用httpOnly cookies替代
- 风险:前端无速率限制
- Unit tests for form validation logic
- Integration tests for API calls
- E2E tests for complete auth flow
- 表单验证逻辑的单元测试
- API调用的集成测试
- 完整认证流程的端到端测试
- All acceptance criteria from specification met
- No security vulnerabilities
- Pass all tests
- UI matches design system
**Use `/speckit.plan` command:**
After generating initial plans, user can run:
/speckit.plan
To create or refine implementation plans
- 满足规范中的所有验收标准
- 无安全漏洞
- 通过所有测试
- UI符合设计系统
生成初始计划后,用户可运行:
/speckit.plan
以创建或优化实现计划
Step 5: Mark Implementation Status
步骤5:标记实现状态
In each specification, clearly mark what's implemented vs missing:
- ✅ COMPLETE - Fully implemented and tested
- ⚠️ PARTIAL - Partially implemented (note what exists vs what's missing)
- ❌ MISSING - Not started
This allows
to verify consistency.
在每个规范中,明确标记已实现和缺失的部分:
- ✅ 已完成 - 完全实现并通过测试
- ⚠️ 部分完成 - 部分实现(说明已存在和缺失的内容)
- ❌ 缺失 - 未开始
GitHub Spec Kit Slash Commands
GitHub Spec Kit斜杠命令
After setting up specs, these commands become available:
Validation & Analysis
验证与分析
Check consistency between specs and implementation
检查规范与实现之间的一致性
- Specs marked COMPLETE but implementation missing
- 标记为已完成但实际未实现的规范
- Implementation exists but not in spec
- 已实现但未在规范中记录的内容
- Inconsistencies between related specs
- 相关规范之间的不一致
Generate tasks from implementation plan
从实现计划生成任务
Implement a specific feature
实现特定功能
/speckit.implement <specification-name>
/speckit.implement <specification-name>
Runs through implementation plan step-by-step
逐步执行实现计划
Updates implementation status as it progresses
执行过程中更新实现状态
Resolve underspecified areas
解决规范不明确的部分
Interactive Q&A to fill in missing details
交互式问答以填补缺失的细节
Similar to our complete-spec skill
与complete-spec技能类似
After this skill completes:
.specify/
├── memory/
│ └── constitution.md # Project principles
├── templates/
├── scripts/
└── specs/ # Feature directories
├── 001-user-authentication/
│ ├── spec.md # ⚠️ PARTIAL
│ └── plan.md # Implementation plan
├── 002-fish-management/
│ ├── spec.md # ⚠️ PARTIAL
│ └── plan.md
├── 003-analytics-dashboard/
│ ├── spec.md # ❌ MISSING
│ └── plan.md
└── 004-photo-upload/
├── spec.md # ⚠️ PARTIAL
└── plan.md
docs/reverse-engineering/ # Keep original docs for reference
├── functional-specification.md
├── data-architecture.md
└── ...
此技能执行完成后,目录结构如下:
.specify/
├── memory/
│ └── constitution.md # 项目原则
├── templates/
├── scripts/
└── specs/ # 功能目录
├── 001-user-authentication/
│ ├── spec.md # ⚠️ 部分完成
│ └── plan.md # 实现计划
├── 002-fish-management/
│ ├── spec.md # ⚠️ 部分完成
│ └── plan.md
├── 003-analytics-dashboard/
│ ├── spec.md # ❌ 缺失
│ └── plan.md
└── 004-photo-upload/
├── spec.md # ⚠️ 部分完成
└── plan.md
docs/reverse-engineering/ # 保留原始文档作为参考
├── functional-specification.md
├── data-architecture.md
└── ...
For Greenfield Separate Directory
对于新项目的独立目录
If
is an absolute path (e.g.,
):
After Gear 3, .specify/ exists in BOTH locations:
Original repo:
~/git/my-app/
├── [original code]
├── .specify/ # Created here first
└── docs/
New repo (created and initialized):
~/git/my-new-app/
├── .specify/ # COPIED from original repo
├── README.md
└── .gitignore
Why copy?
- New repo needs specs for commands
- New repo is self-contained and spec-driven
- Can develop independently going forward
- Original repo keeps specs for reference
第3步执行完成后,两个位置都会存在.specify/目录:
原始仓库:
~/git/my-app/
├── [原始代码]
├── .specify/ # 首先在此创建
└── docs/
新仓库(已创建并初始化):
~/git/my-new-app/
├── .specify/ # 从原始仓库复制而来
├── README.md
└── .gitignore
复制原因:
- 新仓库需要规范以支持命令
- 新仓库是独立的规范驱动项目
- 可独立进行后续开发
- 原始仓库保留规范作为参考
Integration with Original Toolkit
与原始工具集的集成
Reverse-Engineered Docs → Spec Kit Artifacts:
| Original Doc | Spec Kit Artifact | Location |
|---|
| functional-specification.md | constitution.md | |
| functional-specification.md | Individual feature specs | |
| data-architecture.md | Technical details in specs | Embedded in specifications |
| operations-guide.md | Operational notes in constitution | .specify/memory/constitution.md
|
| technical-debt-analysis.md | Implementation plans | |
Keep both:
docs/reverse-engineering/
- Comprehensive reference docs
- - Spec Kit format for commands
逆向工程文档 → Spec Kit制品:
| 原始文档 | Spec Kit制品 | 位置 |
|---|
| functional-specification.md | constitution.md | |
| functional-specification.md | 单个功能规范 | |
| data-architecture.md | 规范中的技术细节 | 嵌入在规范文档中 |
| operations-guide.md | 章程中的操作说明 | .specify/memory/constitution.md
|
| technical-debt-analysis.md | 实现计划 | |
同时保留两者:
docs/reverse-engineering/
- 完整的参考文档
- - 适用于命令的Spec Kit格式文档
Step 4: Generate Plans (Optional - Thoroughness Level 2+)
步骤4:生成计划(可选 - 详细程度2级及以上)
If user selected Option 2 or 3, automatically generate implementation plans for all PARTIAL/MISSING features.
如果用户选择了选项2或3,自动为所有部分完成/缺失的功能生成实现计划。
-
Scan specs directory:
bash
find .specify/specs -name "spec.md" -type f | sort
-
Identify incomplete features:
- Parse status from each spec.md
- Filter for ⚠️ PARTIAL and ❌ MISSING
- Skip ✅ COMPLETE features (no plan needed)
-
Generate plans in parallel (5 at a time):
javascript
// For each PARTIAL/MISSING feature
Task({
subagent_type: 'general-purpose',
model: 'sonnet',
description: `Create plan for ${featureName}`,
prompt: `
Read: .specify/specs/${featureId}/spec.md
Generate implementation plan following /speckit.plan template:
- Assess current state (what exists vs missing)
- Define target state (all acceptance criteria)
- Determine technical approach
- Break into implementation phases
- Identify risks and mitigations
- Define success criteria
Save to: .specify/specs/${featureId}/plan.md
Target: 300-500 lines, detailed but not prescriptive
`
});
-
Verify coverage:
- Check every PARTIAL/MISSING spec has plan.md
- Report summary (e.g., "8 plans generated for 8 incomplete features")
-
扫描规范目录:
bash
find .specify/specs -name "spec.md" -type f | sort
-
识别未完成的功能:
- 解析每个spec.md中的状态
- 筛选出⚠️部分完成和❌缺失的功能
- 跳过✅已完成的功能(无需计划)
-
并行生成计划(一次最多5个):
javascript
// 针对每个部分完成/缺失的功能
Task({
subagent_type: 'general-purpose',
model: 'sonnet',
description: `Create plan for ${featureName}`,
prompt: `
Read: .specify/specs/${featureId}/spec.md
Generate implementation plan following /speckit.plan template:
- Assess current state (what exists vs missing)
- Define target state (all acceptance criteria)
- Determine technical approach
- Break into implementation phases
- Identify risks and mitigations
- Define success criteria
Save to: .specify/specs/${featureId}/plan.md
Target: 300-500 lines, detailed but not prescriptive
`
});
-
验证覆盖范围:
- 检查每个部分完成/缺失的规范都有plan.md
- 生成摘要报告(例如:"为8个未完成功能生成了计划")
Step 5: Generate Tasks (Optional - Thoroughness Level 3 Only)
步骤5:生成任务(可选 - 仅详细程度3级)
If user selected Option 3, automatically generate comprehensive task breakdowns for all plans.
如果用户选择了选项3,自动为所有计划生成详尽的任务拆分。
-
Scan for plans:
bash
find .specify/specs -name "plan.md" -type f | sort
-
Generate tasks in parallel (3 at a time - slower due to length):
javascript
// For each plan
Task({
subagent_type: 'general-purpose',
model: 'sonnet',
description: `Create tasks for ${featureName}`,
prompt: `
Read: .specify/specs/${featureId}/spec.md
Read: .specify/specs/${featureId}/plan.md
Generate COMPREHENSIVE task breakdown:
- Break into 5-10 logical phases
- Each task has: status, file path, acceptance criteria, code examples
- Include Testing phase (unit, integration, E2E)
- Include Documentation phase
- Include Edge Cases section
- Include Dependencies section
- Include Acceptance Checklist
- Include Priority Actions
Target: 300-500 lines (be thorough!)
Save to: .specify/specs/${featureId}/tasks.md
`
});
-
Verify quality:
- Check each tasks.md is > 200 lines
- Flag if too short (< 200 lines)
- Report summary (e.g., "8 task files generated, avg 427 lines")
-
扫描计划文件:
bash
find .specify/specs -name "plan.md" -type f | sort
-
并行生成任务(一次最多3个 - 因内容较长速度较慢):
javascript
// 针对每个计划
Task({
subagent_type: 'general-purpose',
model: 'sonnet',
description: `Create tasks for ${featureName}`,
prompt: `
Read: .specify/specs/${featureId}/spec.md
Read: .specify/specs/${featureId}/plan.md
Generate COMPREHENSIVE task breakdown:
- Break into 5-10 logical phases
- Each task has: status, file path, acceptance criteria, code examples
- Include Testing phase (unit, integration, E2E)
- Include Documentation phase
- Include Edge Cases section
- Include Dependencies section
- Include Acceptance Checklist
- Include Priority Actions
Target: 300-500 lines (be thorough!)
Save to: .specify/specs/${featureId}/tasks.md
`
});
-
验证质量:
- 检查每个tasks.md的长度超过200行
- 如果长度不足200行则标记为异常
- 生成摘要报告(例如:"生成了8个任务文件,平均427行")
In .stackshift-state.json:
json
{
"config": {
"gear3_thoroughness": "specs+plans+tasks", // or "specs" or "specs+plans"
"plan_parallel_limit": 5,
"task_parallel_limit": 3
}
}
Or ask user interactively if not set.
在.stackshift-state.json中:
json
{
"config": {
"gear3_thoroughness": "specs+plans+tasks", // 或"specs"或"specs+plans"
"plan_parallel_limit": 5,
"task_parallel_limit": 3
}
}
如果未设置,可交互式询问用户。
After running this skill, you should have:
Thoroughness Level 1 (Specs Only):
- ✅ directory initialized
- ✅ created with project principles
- ✅ Individual feature specifications in
- ✅ Implementation status clearly marked (✅/⚠️/❌)
- ✅ slash commands available
Thoroughness Level 2 (Specs + Plans):
- ✅ Everything from Level 1
- ✅ for every PARTIAL/MISSING feature
- ✅ 100% plan coverage for incomplete features
- ✅ Ready for manual task breakdown or
Thoroughness Level 3 (Specs + Plans + Tasks):
- ✅ Everything from Level 2
- ✅ for every planned feature
- ✅ Comprehensive task lists (300-500 lines each)
- ✅ Complete roadmap ready for implementation
- ✅ No additional planning needed
运行此技能后,应满足以下条件:
详细程度1级(仅规范):
- ✅ 已初始化.specify/目录
- ✅ 已创建包含项目原则的constitution.md
- ✅ 在.specify/specs/下有单个功能规范
- ✅ 已明确标记实现状态(✅/⚠️/❌)
- ✅ 斜杠命令可用
详细程度2级(规范+计划):
- ✅ 包含1级的所有内容
- ✅ 每个部分完成/缺失的功能都有plan.md
- ✅ 未完成功能的计划覆盖率100%
- ✅ 可手动拆分任务或使用/speckit.tasks命令
详细程度3级(规范+计划+任务):
- ✅ 包含2级的所有内容
- ✅ 每个计划都有tasks.md
- ✅ 详尽的任务列表(每个300-500行)
- ✅ 完整的路线图可直接用于实现
- ✅ 无需额外规划
Once specifications are created in Spec Kit format, proceed to:
Step 4: Gap Analysis - Use
to identify inconsistencies and the gap-analysis skill to create prioritized implementation plan.
一旦规范文档以Spec Kit格式创建完成,继续执行:
第4步:差距分析 - 使用
识别不一致性,并使用差距分析技能创建优先级实现计划。
- specify init my-app
- Generate constitution.md from functional-specification.md
- Create individual feature specs from functional requirements
- Mark implementation status (✅/⚠️/❌)
- Generate implementation plans for gaps
- specify init my-app
- 从functional-specification.md生成constitution.md
- 从功能需求创建单个功能规范
- 标记实现状态(✅/⚠️/❌)
- 为未完成功能生成实现计划
Shows: "5 PARTIAL features, 3 MISSING features, 2 inconsistencies"
显示:"5个部分完成的功能,3个缺失的功能,2处不一致"
/speckit.implement user-authentication
/speckit.implement user-authentication
Walks through implementation plan step-by-step
逐步执行实现计划
Add new features as needed
根据需要添加新功能
- Spec Kit uses directory (not )
- Specifications are markdown files, not JSON/YAML
- Implementation status uses emoji markers: ✅ ⚠️ ❌
- commands are slash commands in Claude Code, not CLI
- Constitution is a living document, update as project evolves
- Keep reverse-engineering docs as comprehensive reference
- Use
stackshift:technical-writer
agent for efficient parallel spec generation
- Always use flag with for non-interactive mode
Remember: This integrates your reverse-engineered codebase with GitHub Spec Kit, enabling the full
workflow for ongoing development.
- Spec Kit使用目录(而非)
- 规范文档为Markdown文件,而非JSON/YAML
- 实现状态使用表情符号标记:✅ ⚠️ ❌
- 命令是Claude Code中的斜杠命令,而非CLI命令
- 章程是活文档,随项目发展更新
- 保留逆向工程文档作为完整参考
- 使用
stackshift:technical-writer
代理高效并行生成规范
- 在非交互模式下,使用时始终添加参数
注意: 此技能将您的逆向工程代码库与GitHub Spec Kit集成,使您能够使用完整的
工作流进行后续开发。