create-specs

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

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:
.specify/
directory with GitHub Spec Kit structure

从逆向工程到规范驱动开发流程中的第3步(共6步)
预计耗时: 30分钟(仅生成规范)至90分钟(规范+计划+任务) 前置条件: 已完成第2步(
docs/reverse-engineering/
目录存在且包含9个文件) 输出结果: 符合GitHub Spec Kit结构的
.specify/
目录

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
    /speckit.plan
Option 2: Specs + Plans (45-60 min - recommended)
  • Everything from Option 1
  • PLUS: Auto-generate
    plan.md
    for PARTIAL/MISSING features
  • Ready for manual task breakdown with
    /speckit.tasks
Option 3: Specs + Plans + Tasks (90-120 min - complete roadmap)
  • Everything from Option 2
  • PLUS: Auto-generate comprehensive
    tasks.md
    (300-500 lines each)
  • Ready for immediate implementation
  • No additional planning needed
Configuration: Set during Gear 1 (Analyze) via initial questionnaire, stored in
.stackshift-state.json

根据第1步中设置的配置,此步骤会生成不同详细程度的内容:
选项1:仅生成规范(30分钟 - 快速模式)
  • 为所有功能生成
    .specify/specs/###-feature-name/spec.md
  • 创建章程文件和目录结构
  • 可通过
    /speckit.plan
    命令手动制定计划
选项2:规范+计划(45-60分钟 - 推荐模式)
  • 包含选项1的所有内容
  • 额外: 为部分完成/缺失的功能自动生成
    plan.md
  • 可通过
    /speckit.tasks
    命令手动拆分任务
选项3:规范+计划+任务(90-120分钟 - 完整路线图)
  • 包含选项2的所有内容
  • 额外: 自动生成详尽的
    tasks.md
    (每个文件300-500行)
  • 可直接用于开发实现
  • 无需额外规划
配置说明: 在第1步(分析阶段)通过初始问卷设置,存储在
.stackshift-state.json
文件中

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
    /speckit
    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格式的正式规范
  • 希望使用
    /speckit
    斜杠命令辅助开发实现
触发关键词:
  • "从文档创建规范"
  • "将文档转换为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:
  1. Read reverse engineering docs - Parse
    docs/reverse-engineering/functional-specification.md
  2. Extract ALL features - Identify every feature (complete, partial, missing)
  3. Generate constitution - Create
    .specify/memory/constitution.md
    with project principles
  4. Create feature specs - Generate
    .specify/specs/###-feature-name/spec.md
    for EVERY feature
  5. Implementation plans - Create
    plan.md
    for PARTIAL and MISSING features only
  6. Enable slash commands - Set up
    /speckit.*
    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自动规范生成工具:
  1. 读取逆向工程文档 - 解析
    docs/reverse-engineering/functional-specification.md
  2. 提取所有功能 - 识别所有功能(已完成、部分完成、缺失)
  3. 生成章程文件 - 创建
    .specify/memory/constitution.md
    ,包含项目原则
  4. 创建功能规范 - 为每个功能生成
    .specify/specs/###-feature-name/spec.md
  5. 生成实现计划 - 仅为部分完成和缺失的功能创建
    plan.md
  6. 启用斜杠命令 - 配置
    /speckit.*
    系列命令
关键说明: 此技能会为100%的功能生成规范,而不仅仅是缺失的部分!
  • ✅ 已完成的功能会生成规范(用于未来的规范驱动变更)
  • ⚠️ 部分完成的功能会生成规范+计划(说明已实现部分和缺失部分)
  • ❌ 缺失的功能会生成规范+计划(可直接用于实现)
最终结果: 完整的规范覆盖 - 整个应用处于规范管控之下。

Configuration Check (FIRST STEP!)

配置检查(第一步!)

Load state file to determine execution plan:
bash
undefined
加载状态文件以确定执行计划:
bash
undefined

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"')

Check route

检查项目类型

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
/speckit.*
commands:
bash
undefined
关键第一步: 安装
/speckit.*
命令所需的前置脚本:
bash
undefined

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:
bash
undefined
使用手动协调方法生成所有规范:
bash
undefined

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:
  1. .specify/memory/constitution.md
    exists
  2. .specify/specs/###-feature-name/
    directories created for ALL features
  3. Each feature has
    spec.md
  4. PARTIAL/MISSING features have
    plan.md

工具执行完成后,验证以下内容:
  1. .specify/memory/constitution.md
    已存在
  2. 为所有功能创建了
    .specify/specs/###-feature-name/
    目录
  3. 每个功能目录下都有
    spec.md
  4. 部分完成/缺失的功能目录下有
    plan.md

If Automated Tool Fails

若自动工具执行失败

The MCP tool creates all Spec Kit files programmatically - it does NOT need
specify init
.
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:
bash
undefined
MCP工具会以编程方式创建所有Spec Kit文件 - 不需要执行
specify init
工具会创建以下文件:
  • .specify/memory/constitution.md
    (从模板生成)
  • .specify/specs/###-feature-name/spec.md
    (所有功能)
  • .specify/specs/###-feature-name/plan.md
    (仅未完成功能)
  • .claude/commands/speckit.*.md
    (斜杠命令)
如果MCP工具执行失败,使用手动协调提示:
bash
undefined

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
Use
/speckit.constitution
command:
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
命令:
生成初始章程后,用户可运行:
> /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:
markdown
undefined
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格式:
markdown
undefined

Feature: User Authentication

功能:用户认证

Status

状态

⚠️ PARTIAL - Backend complete, frontend missing login UI
⚠️ 部分完成 - 后端已完成,前端缺少登录UI

Overview

概述

[Description of what this feature does]
[该功能的描述]

User Stories

用户故事

  • 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
  • 作为用户,我希望注册账号以保存我的数据
  • 作为用户,我希望登录以访问我的仪表盘

Acceptance Criteria

验收标准

  • User can register with email and password
  • User can log in with credentials
  • User can reset forgotten password
  • JWT tokens issued on successful login
  • 用户可以使用邮箱和密码注册
  • 用户可以使用凭证登录
  • 用户可以重置遗忘的密码
  • 登录成功后会颁发JWT令牌

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
  • ❌ 令牌刷新机制

Dependencies

依赖项

None

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
undefined
  • user-profile.md(依赖于认证功能)
  • authorization.md(扩展认证功能)

**使用`/speckit.specify`命令:**
生成初始规范后,用户可运行:
/speckit.specify
以创建额外规范或优化现有规范
undefined

Step 4: Generate Implementation Plans

步骤4:生成实现计划

For each PARTIAL or MISSING feature, create
plan.md
in the feature's directory:
Location:
.specify/specs/FEATURE-ID/plan.md
Format:
markdown
undefined
为每个部分完成缺失的功能,在其目录下创建
plan.md
位置:
.specify/specs/FEATURE-ID/plan.md
格式:
markdown
undefined

Implementation Plan: User Authentication Frontend

实现计划:用户认证前端

Goal

目标

Complete the frontend UI for user authentication (login, registration, password reset)
完成用户认证的前端UI(登录、注册、密码重置)

Current State

当前状态

  • Backend API fully functional
  • No frontend UI components exist
  • User lands on placeholder page
  • 后端API完全可用
  • 无前端UI组件
  • 用户访问时显示占位页面

Target State

目标状态

  • Complete login page with form validation
  • Registration page with email verification
  • Password reset flow (email + new password)
  • Responsive design for mobile/desktop
  • 带表单验证的完整登录页面
  • 带邮箱验证的注册页面
  • 密码重置流程(邮箱+新密码)
  • 适配移动端/桌面端的响应式设计

Technical Approach

技术方案

  1. Create React components using existing UI library
  2. Integrate with backend API endpoints
  3. Add form validation with Zod
  4. Implement JWT token storage (localStorage)
  5. Add route protection for authenticated pages
  1. 使用现有UI库创建React组件
  2. 与后端API端点集成
  3. 使用Zod添加表单验证
  4. 实现JWT令牌存储(localStorage)
  5. 为认证页面添加路由保护

Tasks

任务

  • Create LoginPage component
  • Create RegistrationPage component
  • Create PasswordResetPage component
  • Add form validation
  • Integrate with API endpoints
  • Add loading and error states
  • Write component tests
  • Update routing configuration
  • 创建LoginPage组件
  • 创建RegistrationPage组件
  • 创建PasswordResetPage组件
  • 添加表单验证
  • 与API端点集成
  • 添加加载和错误状态
  • 编写组件测试
  • 更新路由配置

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替代
  • 风险:前端无速率限制
    • 缓解:为API端点添加速率限制

Testing Strategy

测试策略

  • Unit tests for form validation logic
  • Integration tests for API calls
  • E2E tests for complete auth flow
  • 表单验证逻辑的单元测试
  • API调用的集成测试
  • 完整认证流程的端到端测试

Success Criteria

成功标准

  • 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
undefined
  • 满足规范中的所有验收标准
  • 无安全漏洞
  • 通过所有测试
  • UI符合设计系统

**使用`/speckit.plan`命令:**
生成初始计划后,用户可运行:
/speckit.plan
以创建或优化实现计划
undefined

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
/speckit.analyze
to verify consistency.

在每个规范中,明确标记已实现和缺失的部分:
  • 已完成 - 完全实现并通过测试
  • ⚠️ 部分完成 - 部分实现(说明已存在和缺失的内容)
  • 缺失 - 未开始
此标记可让
/speckit.analyze
验证一致性。

GitHub Spec Kit Slash Commands

GitHub Spec Kit斜杠命令

After setting up specs, these commands become available:
设置好规范后,以下命令将可用:

Validation & Analysis

验证与分析

bash
undefined
bash
undefined

Check consistency between specs and implementation

检查规范与实现之间的一致性

/speckit.analyze
/speckit.analyze

Identifies:

识别以下内容:

- Specs marked COMPLETE but implementation missing

- 标记为已完成但实际未实现的规范

- Implementation exists but not in spec

- 已实现但未在规范中记录的内容

- Inconsistencies between related specs

- 相关规范之间的不一致

undefined
undefined

Implementation

实现

bash
undefined
bash
undefined

Generate tasks from implementation plan

从实现计划生成任务

/speckit.tasks
/speckit.tasks

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

执行过程中更新实现状态

undefined
undefined

Clarification

澄清

bash
undefined
bash
undefined

Resolve underspecified areas

解决规范不明确的部分

/speckit.clarify
/speckit.clarify

Interactive Q&A to fill in missing details

交互式问答以填补缺失的细节

Similar to our complete-spec skill

与complete-spec技能类似


---

---

Output Structure

输出结构

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
greenfield_location
is an absolute path (e.g.,
~/git/my-new-app
):
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
    /speckit.*
    commands
  • New repo is self-contained and spec-driven
  • Can develop independently going forward
  • Original repo keeps specs for reference

如果
greenfield_location
是绝对路径(例如
~/git/my-new-app
):
第3步执行完成后,两个位置都会存在.specify/目录:
原始仓库:
~/git/my-app/
├── [原始代码]
├── .specify/           # 首先在此创建
└── docs/
新仓库(已创建并初始化):
~/git/my-new-app/
├── .specify/           # 从原始仓库复制而来
├── README.md
└── .gitignore
复制原因:
  • 新仓库需要规范以支持
    /speckit.*
    命令
  • 新仓库是独立的规范驱动项目
  • 可独立进行后续开发
  • 原始仓库保留规范作为参考

Integration with Original Toolkit

与原始工具集的集成

Reverse-Engineered Docs → Spec Kit Artifacts:
Original DocSpec Kit ArtifactLocation
functional-specification.mdconstitution.md
.specify/memory/
functional-specification.mdIndividual feature specs
.specify/specs/
data-architecture.mdTechnical details in specsEmbedded in specifications
operations-guide.mdOperational notes in constitution
.specify/memory/constitution.md
technical-debt-analysis.mdImplementation plans
.specify/specs/
Keep both:
  • docs/reverse-engineering/
    - Comprehensive reference docs
  • .specify/memory/
    - Spec Kit format for
    /speckit
    commands

逆向工程文档 → Spec Kit制品:
原始文档Spec Kit制品位置
functional-specification.mdconstitution.md
.specify/memory/
functional-specification.md单个功能规范
.specify/specs/
data-architecture.md规范中的技术细节嵌入在规范文档中
operations-guide.md章程中的操作说明
.specify/memory/constitution.md
technical-debt-analysis.md实现计划
.specify/specs/
同时保留两者:
  • docs/reverse-engineering/
    - 完整的参考文档
  • .specify/memory/
    - 适用于
    /speckit
    命令的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,自动为所有部分完成/缺失的功能生成实现计划。

Process

流程

  1. Scan specs directory:
    bash
    find .specify/specs -name "spec.md" -type f | sort
  2. Identify incomplete features:
    • Parse status from each spec.md
    • Filter for ⚠️ PARTIAL and ❌ MISSING
    • Skip ✅ COMPLETE features (no plan needed)
  3. 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
      `
    });
  4. Verify coverage:
    • Check every PARTIAL/MISSING spec has plan.md
    • Report summary (e.g., "8 plans generated for 8 incomplete features")

  1. 扫描规范目录:
    bash
    find .specify/specs -name "spec.md" -type f | sort
  2. 识别未完成的功能:
    • 解析每个spec.md中的状态
    • 筛选出⚠️部分完成和❌缺失的功能
    • 跳过✅已完成的功能(无需计划)
  3. 并行生成计划(一次最多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
      `
    });
  4. 验证覆盖范围:
    • 检查每个部分完成/缺失的规范都有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,自动为所有计划生成详尽的任务拆分。

Process

流程

  1. Scan for plans:
    bash
    find .specify/specs -name "plan.md" -type f | sort
  2. 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
      `
    });
  3. 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")

  1. 扫描计划文件:
    bash
    find .specify/specs -name "plan.md" -type f | sort
  2. 并行生成任务(一次最多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
      `
    });
  3. 验证质量:
    • 检查每个tasks.md的长度超过200行
    • 如果长度不足200行则标记为异常
    • 生成摘要报告(例如:"生成了8个任务文件,平均427行")

Configuration

配置

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
  }
}
如果未设置,可交互式询问用户。

Success Criteria

成功标准

After running this skill, you should have:
Thoroughness Level 1 (Specs Only):
  • .specify/
    directory initialized
  • constitution.md
    created with project principles
  • ✅ Individual feature specifications in
    .specify/specs/
  • ✅ Implementation status clearly marked (✅/⚠️/❌)
  • /speckit.*
    slash commands available
Thoroughness Level 2 (Specs + Plans):
  • ✅ Everything from Level 1
  • plan.md
    for every PARTIAL/MISSING feature
  • ✅ 100% plan coverage for incomplete features
  • ✅ Ready for manual task breakdown or
    /speckit.tasks
Thoroughness Level 3 (Specs + Plans + Tasks):
  • ✅ Everything from Level 2
  • tasks.md
    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/下有单个功能规范
  • ✅ 已明确标记实现状态(✅/⚠️/❌)
  • /speckit.*
    斜杠命令可用
详细程度2级(规范+计划):
  • ✅ 包含1级的所有内容
  • ✅ 每个部分完成/缺失的功能都有plan.md
  • ✅ 未完成功能的计划覆盖率100%
  • ✅ 可手动拆分任务或使用/speckit.tasks命令
详细程度3级(规范+计划+任务):
  • ✅ 包含2级的所有内容
  • ✅ 每个计划都有tasks.md
  • ✅ 详尽的任务列表(每个300-500行)
  • ✅ 完整的路线图可直接用于实现
  • ✅ 无需额外规划

Next Step

下一步

Once specifications are created in Spec Kit format, proceed to:
Step 4: Gap Analysis - Use
/speckit.analyze
to identify inconsistencies and the gap-analysis skill to create prioritized implementation plan.

一旦规范文档以Spec Kit格式创建完成,继续执行:
第4步:差距分析 - 使用
/speckit.analyze
识别不一致性,并使用差距分析技能创建优先级实现计划。

Example Workflow

示例工作流

bash
undefined
bash
undefined

This skill runs

此技能执行的操作

  1. specify init my-app
  2. Generate constitution.md from functional-specification.md
  3. Create individual feature specs from functional requirements
  4. Mark implementation status (✅/⚠️/❌)
  5. Generate implementation plans for gaps
  1. specify init my-app
  2. 从functional-specification.md生成constitution.md
  3. 从功能需求创建单个功能规范
  4. 标记实现状态(✅/⚠️/❌)
  5. 为未完成功能生成实现计划

User can then run

用户后续可运行

/speckit.analyze
/speckit.analyze

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

逐步执行实现计划

/speckit.specify
/speckit.specify

Add new features as needed

根据需要添加新功能


---

---

Technical Notes

技术说明

  • Spec Kit uses
    .specify/
    directory (not
    specs/
    )
  • Specifications are markdown files, not JSON/YAML
  • Implementation status uses emoji markers: ✅ ⚠️ ❌
  • /speckit
    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
    --ai claude
    flag with
    specify init
    for non-interactive mode

Remember: This integrates your reverse-engineered codebase with GitHub Spec Kit, enabling the full
/speckit.*
workflow for ongoing development.
  • Spec Kit使用
    .specify/
    目录(而非
    specs/
  • 规范文档为Markdown文件,而非JSON/YAML
  • 实现状态使用表情符号标记:✅ ⚠️ ❌
  • /speckit
    命令是Claude Code中的斜杠命令,而非CLI命令
  • 章程是活文档,随项目发展更新
  • 保留逆向工程文档作为完整参考
  • 使用
    stackshift:technical-writer
    代理高效并行生成规范
  • 在非交互模式下,使用
    specify init
    时始终添加
    --ai claude
    参数

注意: 此技能将您的逆向工程代码库与GitHub Spec Kit集成,使您能够使用完整的
/speckit.*
工作流进行后续开发。