speckit-specify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spec Kit Specify Skill

Spec Kit Specify Skill

When to Use

使用场景

  • The user wants a new or updated feature spec from a natural language description.
  • 用户希望根据自然语言描述生成新的功能规格说明书或更新现有规格。

Inputs

输入内容

  • Feature description from the user.
  • Repo context with
    .specify/
    scripts and templates.
If the description is missing or unclear, ask a targeted question before continuing.
  • 用户提供的功能描述。
  • 包含
    .specify/
    脚本和模板的仓库上下文。
如果描述缺失或不清晰,请先提出针对性问题再继续。

Workflow

工作流程

The user's feature description in the request is the input. Do not ask them to repeat it unless it is missing.
Given that feature description, do this:
  1. Generate a concise short name (2-4 words) for the branch:
    • Analyze the feature description and extract the most meaningful keywords
    • Create a 2-4 word short name that captures the essence of the feature
    • Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
    • Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
    • Keep it concise but descriptive enough to understand the feature at a glance
    • Examples:
      • "I want to add user authentication" → "user-auth"
      • "Implement OAuth2 integration for the API" → "oauth2-api-integration"
      • "Create a dashboard for analytics" → "analytics-dashboard"
      • "Fix payment processing timeout bug" → "fix-payment-timeout"
  2. Check for existing branches before creating new one:
    a. First, fetch all remote branches to ensure we have the latest information:
    bash
    git fetch --all --prune
    b. Find the highest feature number across all sources for the short-name:
    • Remote branches:
      git ls-remote --heads origin | grep -E 'refs/heads/[0-9]+-<short-name>$'
    • Local branches:
      git branch | grep -E '^[* ]*[0-9]+-<short-name>$'
    • Specs directories: Check for directories matching
      specs/[0-9]+-<short-name>
    c. Determine the next available number:
    • Extract all numbers from all three sources
    • Find the highest number N
    • Use N+1 for the new branch number
    d. Run the script
    .specify/scripts/bash/create-new-feature.sh --json "<feature description>"
    with the calculated number and short-name:
    • Pass
      --number N+1
      and
      --short-name "your-short-name"
      along with the feature description
    • Bash example:
      .specify/scripts/bash/create-new-feature.sh --json --number 5 --short-name "user-auth" "Add user authentication"
    • PowerShell example:
      .specify/scripts/bash/create-new-feature.sh -Json -Number 5 -ShortName "user-auth" "Add user authentication"
    IMPORTANT:
    • Check all three sources (remote branches, local branches, specs directories) to find the highest number
    • Only match branches/directories with the exact short-name pattern
    • If no existing branches/directories found with this short-name, start with number 1
    • You must only ever run this script once per feature
    • The JSON is provided in the terminal as output - always refer to it to get the actual content you're looking for
    • The JSON output will contain BRANCH_NAME and SPEC_FILE paths
    • For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'''m Groot' (or double-quote if possible: "I'm Groot")
  3. Load
    .specify/templates/spec-template.md
    to understand required sections.
  4. Follow this execution flow:
    1. Parse user description from Input If empty: ERROR "No feature description provided"
    2. Extract key concepts from description Identify: actors, actions, data, constraints
    3. For unclear aspects:
      • Make informed guesses based on context and industry standards
      • Only mark with [NEEDS CLARIFICATION: specific question] if:
        • The choice significantly impacts feature scope or user experience
        • Multiple reasonable interpretations exist with different implications
        • No reasonable default exists
      • LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total
      • Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
    4. Fill User Scenarios & Testing section If no clear user flow: ERROR "Cannot determine user scenarios"
    5. Generate Functional Requirements Each requirement must be testable Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
    6. Define Success Criteria Create measurable, technology-agnostic outcomes Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion) Each criterion must be verifiable without implementation details
    7. Identify Key Entities (if data involved)
    8. Return: SUCCESS (spec ready for planning)
  5. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
  6. Specification Quality Validation: After writing the initial spec, validate it against quality criteria:
    a. Create Spec Quality Checklist: Generate a checklist file at
    FEATURE_DIR/checklists/requirements.md
    using the checklist template structure with these validation items:
    markdown
    # Specification Quality Checklist: [FEATURE NAME]
    
    **Purpose**: Validate specification completeness and quality before proceeding to planning
    **Created**: [DATE]
    **Feature**: [Link to spec.md]
    
    ## Content Quality
    
    - [ ] No implementation details (languages, frameworks, APIs)
    - [ ] Focused on user value and business needs
    - [ ] Written for non-technical stakeholders
    - [ ] All mandatory sections completed
    
    ## Requirement Completeness
    
    - [ ] No [NEEDS CLARIFICATION] markers remain
    - [ ] Requirements are testable and unambiguous
    - [ ] Success criteria are measurable
    - [ ] Success criteria are technology-agnostic (no implementation details)
    - [ ] All acceptance scenarios are defined
    - [ ] Edge cases are identified
    - [ ] Scope is clearly bounded
    - [ ] Dependencies and assumptions identified
    
    ## Feature Readiness
    
    - [ ] All functional requirements have clear acceptance criteria
    - [ ] User scenarios cover primary flows
    - [ ] Feature meets measurable outcomes defined in Success Criteria
    - [ ] No implementation details leak into specification
    
    ## Notes
    
    - Items marked incomplete require spec updates before the speckit-clarify or speckit-plan skills
    b. Run Validation Check: Review the spec against each checklist item:
    • For each item, determine if it passes or fails
    • Document specific issues found (quote relevant spec sections)
    c. Handle Validation Results:
    • If all items pass: Mark checklist complete and proceed to step 6
    • If items fail (excluding [NEEDS CLARIFICATION]):
      1. List the failing items and specific issues
      2. Update the spec to address each issue
      3. Re-run validation until all items pass (max 3 iterations)
      4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
    • If [NEEDS CLARIFICATION] markers remain:
      1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
      2. LIMIT CHECK: If more than 3 markers exist, keep only the 3 most critical (by scope/security/UX impact) and make informed guesses for the rest
      3. For each clarification needed (max 3), present options to user in this format:
        markdown
        ## Question [N]: [Topic]
        
        **Context**: [Quote relevant spec section]
        
        **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
        
        **Suggested Answers**:
        
        | Option | Answer                    | Implications                          |
        | ------ | ------------------------- | ------------------------------------- |
        | A      | [First suggested answer]  | [What this means for the feature]     |
        | B      | [Second suggested answer] | [What this means for the feature]     |
        | C      | [Third suggested answer]  | [What this means for the feature]     |
        | Custom | Provide your own answer   | [Explain how to provide custom input] |
        
        **Your choice**: _[Wait for user response]_
      4. CRITICAL - Table Formatting: Ensure markdown tables are properly formatted:
        • Use consistent spacing with pipes aligned
        • Each cell should have spaces around content:
          | Content |
          not
          |Content|
        • Header separator must have at least 3 dashes:
          |--------|
        • Test that the table renders correctly in markdown preview
      5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
      6. Present all questions together before waiting for responses
      7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
      8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
      9. Re-run validation after all clarifications are resolved
    d. Update Checklist: After each validation iteration, update the checklist file with current pass/fail status
  7. Report completion with branch name, spec file path, checklist results, and readiness for the next phase (speckit-clarify or speckit-plan).
NOTE: The script creates and checks out the new branch and initializes the spec file before writing.
请求中的用户功能描述即为输入内容。除非描述缺失,否则不要要求用户重复提供。
根据该功能描述,执行以下步骤:
  1. 生成简洁的短名称(2-4个单词):
    • 分析功能描述,提取最有意义的关键词
    • 创建一个2-4个单词的短名称,精准概括功能核心
    • 尽可能使用“动作-名词”格式(例如:"add-user-auth", "fix-payment-bug")
    • 保留技术术语和缩写(OAuth2、API、JWT等)
    • 保持简洁但足够描述,让人一眼就能理解功能
    • 示例:
      • "我想添加用户认证" → "user-auth"
      • "为API实现OAuth2集成" → "oauth2-api-integration"
      • "创建数据分析仪表盘" → "analytics-dashboard"
      • "修复支付处理超时bug" → "fix-payment-timeout"
  2. 创建新分支前检查现有分支
    a. 首先,拉取所有远程分支以确保获取最新信息:
    bash
    git fetch --all --prune
    b. 查找该短名称对应的所有来源中的最高功能编号:
    • 远程分支:
      git ls-remote --heads origin | grep -E 'refs/heads/[0-9]+-<short-name>$'
    • 本地分支:
      git branch | grep -E '^[* ]*[0-9]+-<short-name>$'
    • 规格目录:检查是否存在匹配
      specs/[0-9]+-<short-name>
      的目录
    c. 确定下一个可用编号:
    • 从所有三个来源中提取所有编号
    • 找到最高编号N
    • 新分支使用N+1作为编号
    d. 运行脚本
    .specify/scripts/bash/create-new-feature.sh --json "<feature description>"
    ,传入计算出的编号和短名称:
    • 同时传入
      --number N+1
      --short-name "your-short-name"
      以及功能描述
    • Bash示例:
      .specify/scripts/bash/create-new-feature.sh --json --number 5 --short-name "user-auth" "Add user authentication"
    • PowerShell示例:
      .specify/scripts/bash/create-new-feature.sh -Json -Number 5 -ShortName "user-auth" "Add user authentication"
    重要提示
    • 必须检查所有三个来源(远程分支、本地分支、规格目录)以找到最高编号
    • 仅匹配完全符合短名称模式的分支/目录
    • 如果没有找到该短名称对应的现有分支/目录,则从编号1开始
    • 每个功能只能运行一次该脚本
    • 终端会输出JSON内容,请始终参考该内容获取所需的实际信息
    • JSON输出将包含BRANCH_NAME和SPEC_FILE路径
    • 对于参数中的单引号(如"I'm Groot"),使用转义语法:例如 'I'''m Groot'(或尽可能使用双引号:"I'm Groot")
  3. 加载
    .specify/templates/spec-template.md
    以了解必填章节。
  4. 遵循以下执行流程:
    1. 解析输入中的用户描述 若为空:报错 "未提供功能描述"
    2. 从描述中提取核心概念 识别:参与者、动作、数据、约束
    3. 处理不明确的内容:
      • 根据上下文和行业标准做出合理推测
      • 仅在以下情况标记为[需要澄清:具体问题]:
        • 选择会对功能范围或用户体验产生重大影响
        • 存在多种合理解读且影响不同
        • 没有合理的默认值
      • 限制:最多保留3个[需要澄清]标记
      • 按影响优先级排序:范围 > 安全/隐私 > 用户体验 > 技术细节
    4. 填写用户场景与测试章节 若无法确定用户流程:报错 "无法确定用户场景"
    5. 生成功能需求 每个需求必须可测试 对未指定的细节使用合理默认值(在假设章节中记录假设)
    6. 定义成功标准 创建可衡量、与技术无关的结果 同时包含定量指标(时间、性能、数量)和定性指标(用户满意度、任务完成情况) 每个标准必须无需实现细节即可验证
    7. 识别关键实体(如果涉及数据)
    8. 返回:成功(规格已准备好进入规划阶段)
  5. 按照模板结构将规格内容写入SPEC_FILE,用从功能描述(参数)中提取的具体细节替换占位符,同时保留章节顺序和标题。
  6. 规格质量验证:生成初始规格后,对照质量标准进行验证:
    a. 创建规格质量检查清单:使用检查清单模板结构在
    FEATURE_DIR/checklists/requirements.md
    生成检查清单文件,包含以下验证项:
    markdown
    # 规格质量检查清单: [FEATURE NAME]
    
    **目的**: 在进入规划阶段前验证规格的完整性和质量
    **创建日期**: [DATE]
    **功能**: [链接到spec.md]
    
    ## 内容质量
    
    - [ ] 无实现细节(语言、框架、API)
    - [ ] 聚焦用户价值和业务需求
    - [ ] 面向非技术相关人员编写
    - [ ] 所有必填章节已完成
    
    ## 需求完整性
    
    - [ ] 无[需要澄清]标记
    - [ ] 需求可测试且明确
    - [ ] 成功标准可衡量
    - [ ] 成功标准与技术无关(无实现细节)
    - [ ] 所有验收场景已定义
    - [ ] 已识别边缘情况
    - [ ] 范围明确界定
    - [ ] 已识别依赖关系和假设
    
    ## 功能就绪状态
    
    - [ ] 所有功能需求都有明确的验收标准
    - [ ] 用户场景覆盖主要流程
    - [ ] 功能满足成功标准中定义的可衡量结果
    - [ ] 规格中未包含实现细节
    
    ## 备注
    
    - 未完成的项需要更新规格,之后才能使用speckit-clarify或speckit-plan技能
    b. 执行验证检查:对照每个检查项审核规格:
    • 确定每个项是否通过
    • 记录发现的具体问题(引用规格中的相关章节)
    c. 处理验证结果
    • 如果所有项通过:标记检查清单完成,进入步骤6
    • 如果有项未通过(不包含[需要澄清])
      1. 列出未通过的项和具体问题
      2. 更新规格以解决每个问题
      3. 重新运行验证,直到所有项通过(最多3次迭代)
      4. 如果3次迭代后仍未通过,在检查清单备注中记录剩余问题并警告用户
    • 如果仍有[需要澄清]标记
      1. 从规格中提取所有[需要澄清:...]标记
      2. 限制检查:如果超过3个标记,仅保留3个最关键的(按范围/安全/UX影响排序),其余部分做出合理推测
      3. 对于每个需要澄清的问题(最多3个),以如下格式呈现给用户:
        markdown
        ## 问题 [N]: [主题]
        
        **上下文**: [引用规格中的相关章节]
        
        **需要了解的信息**: [来自需要澄清标记的具体问题]
        
        **建议答案**:
        
        | 选项 | 答案                    | 影响说明                          |
        | ------ | ------------------------- | ------------------------------------- |
        | A      | [第一个建议答案]  | 对功能的影响     |
        | B      | [第二个建议答案] | 对功能的影响     |
        | C      | [第三个建议答案]  | 对功能的影响     |
        | 自定义 | 提供您自己的答案   | 说明如何提供自定义输入 |
        
        **您的选择**: _[等待用户回复]_
      4. 关键 - 表格格式:确保Markdown表格格式正确:
        • 使用一致的间距,管道符对齐
        • 每个单元格内容前后有空格:
          | 内容 |
          而非
          |内容|
        • 表头分隔线至少有3个短横线:
          |--------|
        • 在Markdown预览中测试表格是否正确渲染
      5. 按顺序编号问题(Q1、Q2、Q3 - 最多3个)
      6. 一次性呈现所有问题,然后等待回复
      7. 等待用户回复所有问题的选择(例如:"Q1: A, Q2: 自定义 - [详情], Q3: B")
      8. 更新规格,将每个[需要澄清]标记替换为用户选择或提供的答案
      9. 解决所有澄清问题后重新运行验证
    d. 更新检查清单:每次验证迭代后,更新检查清单文件中的当前通过/未通过状态
  7. 报告完成情况,包括分支名称、规格文件路径、检查清单结果,以及是否准备好进入下一阶段(speckit-clarify或speckit-plan)。
注意:脚本会创建并切换到新分支,并在写入前初始化规格文件。

Outputs

输出内容

  • specs/<feature>/spec.md
  • specs/<feature>/checklists/requirements.md
  • New feature branch created by
    .specify/scripts/bash/create-new-feature.sh
  • specs/<feature>/spec.md
  • specs/<feature>/checklists/requirements.md
  • .specify/scripts/bash/create-new-feature.sh
    创建的新功能分支

Next Steps

后续步骤

After generating the spec:
  • Clarify requirements with speckit-clarify.
  • Plan implementation with speckit-plan.
生成规格后:
  • 使用speckit-clarify澄清需求。
  • 使用speckit-plan规划实现方案。

General Guidelines

通用指南

Quick Guidelines

快速指南

  • Focus on WHAT users need and WHY.
  • Avoid HOW to implement (no tech stack, APIs, code structure).
  • Written for business stakeholders, not developers.
  • DO NOT create any checklists that are embedded in the spec. That will be a separate skill.
  • 聚焦用户需要什么以及为什么需要
  • 避免涉及如何实现(不提及技术栈、API、代码结构)。
  • 文档面向业务相关人员,而非开发人员。
  • 不要在规格说明书中嵌入任何检查清单,这将由单独的Skill处理。

Section Requirements

章节要求

  • Mandatory sections: Must be completed for every feature
  • Optional sections: Include only when relevant to the feature
  • When a section doesn't apply, remove it entirely (don't leave as "N/A")
  • 必填章节:每个功能都必须完成这些章节
  • 可选章节:仅当与功能相关时才包含
  • 当某个章节不适用时,直接删除(不要保留为"N/A")

For AI Generation

AI生成注意事项

When creating this spec from a user prompt:
  1. Make informed guesses: Use context, industry standards, and common patterns to fill gaps
  2. Document assumptions: Record reasonable defaults in the Assumptions section
  3. Limit clarifications: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
    • Significantly impact feature scope or user experience
    • Have multiple reasonable interpretations with different implications
    • Lack any reasonable default
  4. Prioritize clarifications: scope > security/privacy > user experience > technical details
  5. Think like a tester: Every vague requirement should fail the "testable and unambiguous" checklist item
  6. Common areas needing clarification (only if no reasonable default exists):
    • Feature scope and boundaries (include/exclude specific use cases)
    • User types and permissions (if multiple conflicting interpretations possible)
    • Security/compliance requirements (when legally/financially significant)
Examples of reasonable defaults (don't ask about these):
  • Data retention: Industry-standard practices for the domain
  • Performance targets: Standard web/mobile app expectations unless specified
  • Error handling: User-friendly messages with appropriate fallbacks
  • Authentication method: Standard session-based or OAuth2 for web apps
  • Integration patterns: RESTful APIs unless specified otherwise
根据用户提示创建规格说明书时:
  1. 做出合理推测:利用上下文、行业标准和常见模式填补信息空白
  2. 记录假设:在假设章节中记录合理的默认值
  3. 限制澄清次数:最多保留3个[需要澄清:具体问题]标记 - 仅用于以下关键决策:
    • 对功能范围或用户体验有重大影响
    • 存在多种合理解读且影响不同
    • 没有合理的默认值
  4. 优先澄清事项:范围 > 安全/隐私 > 用户体验 > 技术细节
  5. 以测试人员视角思考:任何模糊的需求都应在“可测试且明确”的检查项中不通过
  6. 常见需要澄清的领域(仅当没有合理默认值时):
    • 功能范围和边界(包含/排除特定用例)
    • 用户类型和权限(当存在多种冲突解读时)
    • 安全/合规要求(当涉及法律/财务重大影响时)
合理默认值示例(无需询问):
  • 数据保留:领域内的行业标准实践
  • 性能目标:标准Web/移动应用预期,除非特别指定
  • 错误处理:用户友好的提示和适当的回退方案
  • 认证方式:Web应用默认使用基于会话或OAuth2的方式
  • 集成模式:默认使用RESTful API,除非特别指定

Success Criteria Guidelines

成功标准指南

Success criteria must be:
  1. Measurable: Include specific metrics (time, percentage, count, rate)
  2. Technology-agnostic: No mention of frameworks, languages, databases, or tools
  3. User-focused: Describe outcomes from user/business perspective, not system internals
  4. Verifiable: Can be tested/validated without knowing implementation details
Good examples:
  • "Users can complete checkout in under 3 minutes"
  • "System supports 10,000 concurrent users"
  • "95% of searches return results in under 1 second"
  • "Task completion rate improves by 40%"
Bad examples (implementation-focused):
  • "API response time is under 200ms" (too technical, use "Users see results instantly")
  • "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
  • "React components render efficiently" (framework-specific)
  • "Redis cache hit rate above 80%" (technology-specific)
成功标准必须满足:
  1. 可衡量:包含具体指标(时间、百分比、数量、比率)
  2. 与技术无关:不提及框架、语言、数据库或工具
  3. 以用户为中心:从用户/业务视角描述结果,而非系统内部细节
  4. 可验证:无需了解实现细节即可测试/验证
良好示例
  • "用户可在3分钟内完成结账"
  • "系统支持10,000并发用户"
  • "95%的搜索可在1秒内返回结果"
  • "任务完成率提升40%"
不良示例(聚焦实现):
  • "API响应时间低于200ms"(过于技术化,建议使用"用户可立即看到结果")
  • "数据库可处理1000 TPS"(实现细节,建议使用面向用户的指标)
  • "React组件高效渲染"(框架特定)
  • "Redis缓存命中率高于80%"(技术特定)