specify
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTemplates: If you need the template files referenced below (spec-template.md, plan-template.md, etc.), they are available in the BB-Skills repository at. If installed locally, checktemplates/or the project's~/.bb-skills/templates/directory.templates/
模板说明: 如果你需要下文提到的模板文件(spec-template.md、plan-template.md等),可在BB-Skills仓库的目录中获取。若已本地安装,请检查templates/或项目的~/.bb-skills/templates/目录。templates/
User Input
用户输入
text
$ARGUMENTSYou MUST consider the user input before proceeding (if not empty).
text
$ARGUMENTS在继续操作前,你必须参考用户输入内容(若不为空)。
Outline
执行大纲
The text the user typed when invoking this skill is the feature description. Assume you always have it available in this conversation. Do not ask the user to repeat it unless they provided an empty command.
Given that feature description, do this:
-
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"
-
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 --pruneb. 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. Create the feature branch and spec directory structure:- Create and checkout a new branch named
N+1-<short-name> - Create the specs directory:
specs/N+1-<short-name>/ - Initialize the spec file at
specs/N+1-<short-name>/spec.md
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 create one branch per feature
- Remote branches:
-
Collect BuildBetter context (best-effort):
- Derive from the spec file path.
FEATURE_DIR - If BuildBetter context collection is available, run it to gather customer evidence using the feature description.
- The collector writes:
FEATURE_DIR/buildbetter-context.jsonFEATURE_DIR/buildbetter-context.mdFEATURE_DIR/user-stories.md
- Handle collector status:
- : Use BuildBetter evidence directly.
ok - : Use available evidence and preserve warnings.
partial - : Continue without BuildBetter data and add a note in spec assumptions.
skipped - : Continue without BuildBetter data, warn explicitly, and preserve any generated artifacts.
error
- Derive
-
Load the spec template and BuildBetter artifacts (if present) to understand required sections and evidence context.
-
Follow this execution flow:
- Parse user description from Input If empty: ERROR "No feature description provided"
- Extract key concepts from description and BuildBetter evidence
Identify: actors, actions, data, constraints
- Pull exact customer quotes from when available
buildbetter-context.md - Pull existing stories from when available
user-stories.md - Track each requirement/story to one or more evidence IDs () when available
BB-EXTRACTION-*
- Pull exact customer quotes from
- 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
- Fill User Scenarios & Testing section
If no clear user flow: ERROR "Cannot determine user scenarios"
- Prioritize evidence-backed user journeys first
- Generate Functional Requirements Each requirement must be testable Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
- 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
- Identify Key Entities (if data involved)
- Add evidence traceability annotations:
- Each major user story includes
Evidence References - Requirements include evidence IDs where relevant
- If BuildBetter unavailable, explicitly mark assumptions as non-evidence-backed
- Each major user story includes
- Return: SUCCESS (spec ready for planning)
-
Write the specification to the spec file using the template structure, replacing placeholders with concrete details derived from the feature description and BuildBetter context while preserving section order and headings.
-
Specification Quality Validation: After writing the initial spec, validate it against quality criteria:a. Create Spec Quality Checklist: Generate a checklist file atusing the checklist template structure with these validation items:
FEATURE_DIR/checklists/requirements.mdmarkdown# 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 using the bb-clarify or bb-plan skillsb. 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 8
-
If items fail (excluding [NEEDS CLARIFICATION]):
- List the failing items and specific issues
- Update the spec to address each issue
- Re-run validation until all items pass (max 3 iterations)
- If still failing after 3 iterations, document remaining issues in checklist notes and warn user
-
If [NEEDS CLARIFICATION] markers remain:
-
Extract all [NEEDS CLARIFICATION: ...] markers from the spec
-
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
-
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]_ -
CRITICAL - Table Formatting: Ensure markdown tables are properly formatted:
- Use consistent spacing with pipes aligned
- Each cell should have spaces around content: not
| Content ||Content| - Header separator must have at least 3 dashes:
|--------| - Test that the table renders correctly in markdown preview
-
Number questions sequentially (Q1, Q2, Q3 - max 3 total)
-
Present all questions together before waiting for responses
-
Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
-
Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
-
Re-run validation after all clarifications are resolved
-
d. Update Checklist: After each validation iteration, update the checklist file with current pass/fail status -
Report completion with branch name, spec file path, BuildBetter artifact paths, checklist results, and readiness for the next phase (use the bb-clarify or bb-plan skills).
用户调用此技能时输入的文本即为功能描述。默认你在对话中已获取该内容,除非用户提供的命令为空,否则不要要求用户重复输入。
基于该功能描述,执行以下步骤:
-
生成简洁的分支短名称(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"
-
创建新分支前检查现有分支:a. 首先,拉取所有远程分支以确保获取最新信息:bash
git fetch --all --pruneb. 查找所有来源中与该短名称匹配的最高功能编号:- 远程分支:
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. 创建功能分支和规格目录结构:- 创建并切换到名为的新分支
N+1-<short-name> - 创建规格目录:
specs/N+1-<short-name>/ - 在路径初始化规格文件
specs/N+1-<short-name>/spec.md
重要提示:- 必须检查三个来源(远程分支、本地分支、规格目录)以找到最高编号
- 仅匹配与短名称完全符合的分支/目录
- 如果未找到任何匹配该短名称的分支/目录,从编号1开始
- 每个功能只能创建一个分支
- 远程分支:
-
收集BuildBetter上下文信息(尽最大努力):
- 从规格文件路径推导。
FEATURE_DIR - 如果支持BuildBetter上下文收集,使用功能描述获取客户证据。
- 收集器会生成以下文件:
FEATURE_DIR/buildbetter-context.jsonFEATURE_DIR/buildbetter-context.mdFEATURE_DIR/user-stories.md
- 根据收集器状态处理:
- : 直接使用BuildBetter证据。
ok - : 使用可用证据并保留警告信息。
partial - : 不使用BuildBetter数据继续操作,并在规格假设部分添加说明。
skipped - : 不使用BuildBetter数据继续操作,明确发出警告,并保留已生成的所有产物。
error
- 从规格文件路径推导
-
加载规格模板和BuildBetter产物(若存在),了解所需章节和证据上下文。
-
遵循以下执行流程:
- 解析用户输入中的功能描述 若为空:返回错误信息 "未提供功能描述"
- 从描述和BuildBetter证据中提取核心概念
识别:参与者、动作、数据、约束条件
- 若中有客户原话,直接引用
buildbetter-context.md - 若中有现有用户故事,直接引用
user-stories.md - 若有可用证据ID(),将每个需求/故事关联到一个或多个证据ID
BB-EXTRACTION-*
- 若
- 针对不明确的内容:
- 根据上下文和行业标准做出合理推测
- 仅在以下情况标记:
[NEEDS CLARIFICATION: 具体问题]- 该选择会显著影响功能范围或用户体验
- 存在多种合理解读且各有不同影响
- 无合理默认值
- 限制:最多添加3个标记
[NEEDS CLARIFICATION] - 按影响优先级排序:范围 > 安全/隐私 > 用户体验 > 技术细节
- 填写用户场景与测试章节
若无法确定用户流程:返回错误信息 "无法确定用户场景"
- 优先使用有证据支持的用户旅程
- 生成功能需求 每个需求必须可测试 对未明确说明的细节使用合理默认值(在假设章节记录相关假设)
- 定义成功标准 创建可衡量、与技术无关的结果 包含定量指标(时间、性能、数量)和定性指标(用户满意度、任务完成率) 每个标准必须无需了解实现细节即可验证
- 识别核心实体(若涉及数据)
- 添加证据可追溯注解:
- 每个主要用户故事需包含
Evidence References - 相关需求需添加证据ID
- 若BuildBetter不可用,明确标记假设无证据支持
- 每个主要用户故事需包含
- 返回:SUCCESS(规格已准备好进入规划阶段)
-
使用模板结构将规格内容写入规格文件,用从功能描述和BuildBetter上下文提取的具体内容替换占位符,同时保留章节顺序和标题。
-
规格质量验证:完成初始规格编写后,根据质量标准进行验证:a. 创建规格质量检查表:使用检查表模板结构在生成检查表文件,包含以下验证项:
FEATURE_DIR/checklists/requirements.mdmarkdown# 规格质量检查表: [功能名称] **目的**: 在进入规划阶段前验证规格的完整性和质量 **创建日期**: [日期] **功能**: [链接到spec.md] ## 内容质量 - [ ] 无实现细节(语言、框架、API) - [ ] 聚焦用户价值和业务需求 - [ ] 面向非技术利益相关者编写 - [ ] 所有必填章节已完成 ## 需求完整性 - [ ] 无`[NEEDS CLARIFICATION]`标记残留 - [ ] 需求可测试且无歧义 - [ ] 成功标准可衡量 - [ ] 成功标准与技术无关(无实现细节) - [ ] 所有验收场景已定义 - [ ] 已识别边缘情况 - [ ] 范围界定清晰 - [ ] 已识别依赖关系和假设 ## 功能就绪度 - [ ] 所有功能需求有明确的验收标准 - [ ] 用户场景覆盖主要流程 - [ ] 功能符合成功标准中定义的可衡量结果 - [ ] 无实现细节混入规格内容 ## 备注 - 未完成的项需要更新规格后才能使用bb-clarify或bb-plan技能b. 执行验证检查:对照检查表的每一项审核规格:- 确定每一项是否通过
- 记录发现的具体问题(引用规格相关章节)
c. 处理验证结果:-
若所有项通过: 标记检查表完成,进入步骤8
-
若有项未通过(不含):
[NEEDS CLARIFICATION]- 列出未通过项和具体问题
- 更新规格以解决每个问题
- 重新执行验证直到所有项通过(最多3次迭代)
- 若3次迭代后仍未通过,在检查表备注中记录剩余问题并向用户发出警告
-
若存在标记:
[NEEDS CLARIFICATION]-
从规格中提取所有标记
[NEEDS CLARIFICATION: ...] -
限制检查: 若标记超过3个,仅保留3个最关键的(按范围/安全/用户体验影响排序),其余部分做出合理推测
-
对每个需要澄清的问题(最多3个),按以下格式呈现给用户:markdown
## 问题[N]: [主题] **上下文**: [引用规格相关章节] **需要确认的内容**: `NEEDS CLARIFICATION`标记中的具体问题 **建议答案**: | 选项 | 答案 | 影响 | |--------|--------|--------------| | A | [第一个建议答案] | [该选择对功能的影响] | | B | [第二个建议答案] | [该选择对功能的影响] | | C | [第三个建议答案] | [该选择对功能的影响] | | 自定义 | 提供你的答案 | [说明如何提供自定义输入] | **你的选择**: _[等待用户回复]_ -
关键要求 - 表格格式: 确保markdown表格格式正确:
- 使用一致的间距,竖线对齐
- 每个单元格内容两侧需有空格:而非
| 内容 ||内容| - 表头分隔线至少包含3个短横线:
|--------| - 测试表格在markdown预览中可正常显示
-
按顺序为问题编号(Q1、Q2、Q3 - 最多3个)
-
一次性呈现所有问题后等待用户回复
-
等待用户回复所有问题的选择(例如:"Q1: A, Q2: 自定义 - [详情], Q3: B")
-
将每个标记替换为用户选择或提供的答案,更新规格
[NEEDS CLARIFICATION] -
解决所有澄清问题后重新执行验证
-
d. 更新检查表: 每次验证迭代后,更新检查表文件中的当前通过/未通过状态 -
报告完成情况,包含分支名称、规格文件路径、BuildBetter产物路径、检查表结果,以及进入下一阶段的就绪状态(可使用bb-clarify或bb-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 command.
- 聚焦用户需要什么以及为什么需要。
- 避免涉及如何实现(不提及技术栈、API、代码结构)。
- 面向业务利益相关者编写,而非开发人员。
- 不要在规格中嵌入任何检查表,检查表将通过单独命令生成。
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:
- Make informed guesses: Use context, industry standards, and common patterns to fill gaps
- Document assumptions: Record reasonable defaults in the Assumptions section
- 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
- Prioritize clarifications: scope > security/privacy > user experience > technical details
- Think like a tester: Every vague requirement should fail the "testable and unambiguous" checklist item
- 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: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
根据用户提示创建规格时:
- 做出合理推测: 使用上下文、行业标准和通用模式填补空白
- 记录假设: 在假设章节记录合理默认值
- 限制澄清请求: 最多添加3个标记 - 仅用于以下关键决策:
[NEEDS CLARIFICATION]- 显著影响功能范围或用户体验
- 存在多种合理解读且各有不同影响
- 无合理默认值
- 澄清请求优先级: 范围 > 安全/隐私 > 用户体验 > 技术细节
- 以测试思维思考: 任何模糊的需求都无法通过“可测试且无歧义”的检查项
- 常见需要澄清的领域(仅当无合理默认值时):
- 功能范围和边界(包含/排除特定用例)
- 用户类型和权限(若存在多种冲突解读)
- 安全/合规要求(当涉及法律/财务重大影响时)
合理默认值示例(无需询问):
- 数据保留:符合领域内的行业标准实践
- 性能目标:符合标准Web/移动应用预期,除非另有指定
- 错误处理:显示友好的用户提示并提供适当的回退方案
- 认证方式:Web应用默认使用基于会话或OAuth2的方式
- 集成模式:使用项目适用的模式(Web服务用REST/GraphQL,库用函数调用,工具用CLI参数等)
Success Criteria Guidelines
成功标准指南
Success criteria must be:
- Measurable: Include specific metrics (time, percentage, count, rate)
- Technology-agnostic: No mention of frameworks, languages, databases, or tools
- User-focused: Describe outcomes from user/business perspective, not system internals
- 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)
成功标准必须满足:
- 可衡量: 包含具体指标(时间、百分比、数量、比率)
- 与技术无关: 不提及框架、语言、数据库或工具
- 以用户为中心: 从用户/业务角度描述结果,而非系统内部细节
- 可验证: 无需了解实现细节即可测试/验证
优秀示例:
- "用户可在3分钟内完成结账"
- "系统支持10,000并发用户"
- "95%的搜索请求可在1秒内返回结果"
- "任务完成率提升40%"
不良示例(聚焦实现细节):
- "API响应时间低于200ms"(过于技术化,应使用“用户可立即看到结果”)
- "数据库可处理1000 TPS"(实现细节,应使用面向用户的指标)
- "React组件渲染高效"(框架特定)
- "Redis缓存命中率高于80%"(技术特定)