Templates: If you need the template files referenced below (spec-template.md, plan-template.md, etc.), they are available in the BB-Skills repository at templates/. If installed locally, check ~/.bb-skills/templates/ or the project's templates/ directory.
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
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:
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. 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
Collect BuildBetter context (best-effort):
- Derive
FEATURE_DIR from the spec file path.
- If BuildBetter context collection is available, run it to gather customer evidence using the feature description.
- The collector writes:
FEATURE_DIR/buildbetter-context.json
FEATURE_DIR/buildbetter-context.md
FEATURE_DIR/user-stories.md
- Handle collector status:
ok: Use BuildBetter evidence directly.
partial: Use available evidence and preserve warnings.
skipped: Continue without BuildBetter data and add a note in spec assumptions.
error: Continue without BuildBetter data, warn explicitly, and preserve any generated artifacts.
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
buildbetter-context.md when available
- Pull existing stories from
user-stories.md when available
- Track each requirement/story to one or more evidence IDs (
BB-EXTRACTION-*) when available
- 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
- 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 at FEATURE_DIR/checklists/requirements.md using the checklist template structure with these validation items:
# 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 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 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:
## 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:
| Content | not |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).
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.
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")
For AI Generation
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.)
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)
1---2name: specify3description: Create or update the feature specification from a natural language feature description.4---56> **Templates:** If you need the template files referenced below (spec-template.md, plan-template.md, etc.), they are available in the BB-Skills repository at `templates/`. If installed locally, check `~/.bb-skills/templates/` or the project's `templates/` directory.78## User Input910```text11$ARGUMENTS12```1314You **MUST** consider the user input before proceeding (if not empty).1516## Outline1718The 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.1920Given that feature description, do this:21221. **Generate a concise short name** (2-4 words) for the branch:23 - Analyze the feature description and extract the most meaningful keywords24 - Create a 2-4 word short name that captures the essence of the feature25 - Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")26 - Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)27 - Keep it concise but descriptive enough to understand the feature at a glance28 - Examples:29 - "I want to add user authentication" -> "user-auth"30 - "Implement OAuth2 integration for the API" -> "oauth2-api-integration"31 - "Create a dashboard for analytics" -> "analytics-dashboard"32 - "Fix payment processing timeout bug" -> "fix-payment-timeout"33342. **Check for existing branches before creating new one**:3536 a. First, fetch all remote branches to ensure we have the latest information:3738 ```bash39 git fetch --all --prune40 ```4142 b. Find the highest feature number across all sources for the short-name:43 - Remote branches: `git ls-remote --heads origin | grep -E 'refs/heads/[0-9]+-<short-name>$'`44 - Local branches: `git branch | grep -E '^[* ]*[0-9]+-<short-name>$'`45 - Specs directories: Check for directories matching `specs/[0-9]+-<short-name>`4647 c. Determine the next available number:48 - Extract all numbers from all three sources49 - Find the highest number N50 - Use N+1 for the new branch number5152 d. Create the feature branch and spec directory structure:53 - Create and checkout a new branch named `N+1-<short-name>`54 - Create the specs directory: `specs/N+1-<short-name>/`55 - Initialize the spec file at `specs/N+1-<short-name>/spec.md`5657 **IMPORTANT**:58 - Check all three sources (remote branches, local branches, specs directories) to find the highest number59 - Only match branches/directories with the exact short-name pattern60 - If no existing branches/directories found with this short-name, start with number 161 - You must only create one branch per feature62633. **Collect BuildBetter context (best-effort)**:64 - Derive `FEATURE_DIR` from the spec file path.65 - If BuildBetter context collection is available, run it to gather customer evidence using the feature description.66 - The collector writes:67 - `FEATURE_DIR/buildbetter-context.json`68 - `FEATURE_DIR/buildbetter-context.md`69 - `FEATURE_DIR/user-stories.md`70 - Handle collector status:71 - `ok`: Use BuildBetter evidence directly.72 - `partial`: Use available evidence and preserve warnings.73 - `skipped`: Continue without BuildBetter data and add a note in spec assumptions.74 - `error`: Continue without BuildBetter data, warn explicitly, and preserve any generated artifacts.75764. Load the spec template and BuildBetter artifacts (if present) to understand required sections and evidence context.77785. Follow this execution flow:7980 1. Parse user description from Input81 If empty: ERROR "No feature description provided"82 2. Extract key concepts from description and BuildBetter evidence83 Identify: actors, actions, data, constraints84 - Pull exact customer quotes from `buildbetter-context.md` when available85 - Pull existing stories from `user-stories.md` when available86 - Track each requirement/story to one or more evidence IDs (`BB-EXTRACTION-*`) when available87 3. For unclear aspects:88 - Make informed guesses based on context and industry standards89 - Only mark with [NEEDS CLARIFICATION: specific question] if:90 - The choice significantly impacts feature scope or user experience91 - Multiple reasonable interpretations exist with different implications92 - No reasonable default exists93 - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**94 - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details95 4. Fill User Scenarios & Testing section96 If no clear user flow: ERROR "Cannot determine user scenarios"97 - Prioritize evidence-backed user journeys first98 5. Generate Functional Requirements99 Each requirement must be testable100 Use reasonable defaults for unspecified details (document assumptions in Assumptions section)101 6. Define Success Criteria102 Create measurable, technology-agnostic outcomes103 Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)104 Each criterion must be verifiable without implementation details105 7. Identify Key Entities (if data involved)106 8. Add evidence traceability annotations:107 - Each major user story includes `Evidence References`108 - Requirements include evidence IDs where relevant109 - If BuildBetter unavailable, explicitly mark assumptions as non-evidence-backed110 9. Return: SUCCESS (spec ready for planning)1111126. 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.1131147. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:115116 a. **Create Spec Quality Checklist**: Generate a checklist file at `FEATURE_DIR/checklists/requirements.md` using the checklist template structure with these validation items:117118 ```markdown119 # Specification Quality Checklist: [FEATURE NAME]120 121 **Purpose**: Validate specification completeness and quality before proceeding to planning122 **Created**: [DATE]123 **Feature**: [Link to spec.md]124 125 ## Content Quality126 127 - [ ] No implementation details (languages, frameworks, APIs)128 - [ ] Focused on user value and business needs129 - [ ] Written for non-technical stakeholders130 - [ ] All mandatory sections completed131 132 ## Requirement Completeness133 134 - [ ] No [NEEDS CLARIFICATION] markers remain135 - [ ] Requirements are testable and unambiguous136 - [ ] Success criteria are measurable137 - [ ] Success criteria are technology-agnostic (no implementation details)138 - [ ] All acceptance scenarios are defined139 - [ ] Edge cases are identified140 - [ ] Scope is clearly bounded141 - [ ] Dependencies and assumptions identified142 143 ## Feature Readiness144 145 - [ ] All functional requirements have clear acceptance criteria146 - [ ] User scenarios cover primary flows147 - [ ] Feature meets measurable outcomes defined in Success Criteria148 - [ ] No implementation details leak into specification149 150 ## Notes151 152 - Items marked incomplete require spec updates before using the bb-clarify or bb-plan skills153 ```154155 b. **Run Validation Check**: Review the spec against each checklist item:156 - For each item, determine if it passes or fails157 - Document specific issues found (quote relevant spec sections)158159 c. **Handle Validation Results**:160161 - **If all items pass**: Mark checklist complete and proceed to step 8162163 - **If items fail (excluding [NEEDS CLARIFICATION])**:164 1. List the failing items and specific issues165 2. Update the spec to address each issue166 3. Re-run validation until all items pass (max 3 iterations)167 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user168169 - **If [NEEDS CLARIFICATION] markers remain**:170 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec171 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 rest172 3. For each clarification needed (max 3), present options to user in this format:173174 ```markdown175 ## Question [N]: [Topic]176 177 **Context**: [Quote relevant spec section]178 179 **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]180 181 **Suggested Answers**:182 183 | Option | Answer | Implications |184 |--------|--------|--------------|185 | A | [First suggested answer] | [What this means for the feature] |186 | B | [Second suggested answer] | [What this means for the feature] |187 | C | [Third suggested answer] | [What this means for the feature] |188 | Custom | Provide your own answer | [Explain how to provide custom input] |189 190 **Your choice**: _[Wait for user response]_191 ```192193 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:194 - Use consistent spacing with pipes aligned195 - Each cell should have spaces around content: `| Content |` not `|Content|`196 - Header separator must have at least 3 dashes: `|--------|`197 - Test that the table renders correctly in markdown preview198 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)199 6. Present all questions together before waiting for responses200 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")201 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer202 9. Re-run validation after all clarifications are resolved203204 d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status2052068. 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).207208## General Guidelines209210## Quick Guidelines211212- Focus on **WHAT** users need and **WHY**.213- Avoid HOW to implement (no tech stack, APIs, code structure).214- Written for business stakeholders, not developers.215- DO NOT create any checklists that are embedded in the spec. That will be a separate command.216217### Section Requirements218219- **Mandatory sections**: Must be completed for every feature220- **Optional sections**: Include only when relevant to the feature221- When a section doesn't apply, remove it entirely (don't leave as "N/A")222223### For AI Generation224225When creating this spec from a user prompt:2262271. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps2282. **Document assumptions**: Record reasonable defaults in the Assumptions section2293. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:230 - Significantly impact feature scope or user experience231 - Have multiple reasonable interpretations with different implications232 - Lack any reasonable default2334. **Prioritize clarifications**: scope > security/privacy > user experience > technical details2345. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item2356. **Common areas needing clarification** (only if no reasonable default exists):236 - Feature scope and boundaries (include/exclude specific use cases)237 - User types and permissions (if multiple conflicting interpretations possible)238 - Security/compliance requirements (when legally/financially significant)239240**Examples of reasonable defaults** (don't ask about these):241242- Data retention: Industry-standard practices for the domain243- Performance targets: Standard web/mobile app expectations unless specified244- Error handling: User-friendly messages with appropriate fallbacks245- Authentication method: Standard session-based or OAuth2 for web apps246- Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)247248### Success Criteria Guidelines249250Success criteria must be:2512521. **Measurable**: Include specific metrics (time, percentage, count, rate)2532. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools2543. **User-focused**: Describe outcomes from user/business perspective, not system internals2554. **Verifiable**: Can be tested/validated without knowing implementation details256257**Good examples**:258259- "Users can complete checkout in under 3 minutes"260- "System supports 10,000 concurrent users"261- "95% of searches return results in under 1 second"262- "Task completion rate improves by 40%"263264**Bad examples** (implementation-focused):265266- "API response time is under 200ms" (too technical, use "Users see results instantly")267- "Database can handle 1000 TPS" (implementation detail, use user-facing metric)268- "React components render efficiently" (framework-specific)269- "Redis cache hit rate above 80%" (technology-specific)