The text the user types after the trigger word in the trigger message
is the feature description. Assume this feature description is always available in this conversation, i.e.,
. Do not ask the user to repeat unless they provided an empty command.
-
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 verb-noun format whenever possible (e.g., "add-user-auth", "fix-payment-bug")
- Retain technical terms and abbreviations (OAuth2, API, JWT, etc.)
- Keep it concise yet descriptive enough to understand the feature at a glance
- Examples:
- "I want to add user authentication" → "user-auth"
- "Implement OAuth2 integration for API" → "oauth2-api-integration"
- "Create analytics dashboard" → "analytics-dashboard"
- "Fix payment processing timeout error" → "fix-payment-timeout"
-
Check existing branches before creating a new branch:
a. First fetch all remote branches to ensure you have the latest information:
b. Find the highest feature number with the short name across all sources:
- 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>$'
- Specification directories: Check directories matching
specs/[0-9]+-<short-name>
c. Determine the next available number:
- Extract all numbers from all three sources
- Find the largest number N
- Use N+1 for the new branch
d. Run the script
create-new-feature.ps1 -Json "$ARGUMENTS"
using the calculated number and short name:
- Pass and
--short-name "your-short-name"
along with the feature description
- Bash example:
create-new-feature.sh -Json "$ARGUMENTS" --json --number 5 --short-name "user-auth" "Add user authentication"
- PowerShell example:
create-new-feature.ps1 -Json "$ARGUMENTS" -Json -Number 5 -ShortName "user-auth" "Add user authentication"
Important:
- Check all three sources (remote branches, local branches, specification directories) to find the highest number
- Only match branches/directories with the exact short name pattern
- If no existing branches/directories with this short name are found, start from number 1
- Run this script only once per feature
- JSON is provided as output in the terminal - always refer to it for the actual content you are looking for
- The JSON output will include BRANCH_NAME and SPEC_FILE path
- For single quotes in arguments like "I'm Groot", use escape syntax: e.g., 'I'''m Groot' (or use double quotes if possible: "I'm Groot")
-
Load
.specify/templates/spec-template.md
to understand the required sections.
-
Follow this execution flow:
- Parse the user description from the input
If empty: Error "No feature description provided"
- Extract key concepts from the description
Identify: Actors, Actions, Data, Constraints
- For unclear aspects:
- Make educated guesses based on context and industry standards
- Only mark [Needs clarification: specific question] if:
- The choice significantly impacts feature scope or user experience
- There are multiple reasonable interpretations with different implications
- No reasonable default exists
- Limit: Maximum 3 [Needs clarification] marks total
- Prioritize by impact: Scope > Security/Privacy > User Experience > Technical Details
- Fill in the User Scenarios & Testing section
If no clear user flow: Error "Unable to determine user scenarios"
- Generate functional requirements
Each requirement must be testable
Use reasonable defaults for unspecified details (document assumptions in the Assumptions section)
- Define success criteria
Create measurable, technology-agnostic results
Include quantitative metrics (time, performance, quantity) and qualitative measures (user satisfaction, task completion rate)
Each criterion must be verifiable without implementation details
- Identify key entities (if data is involved)
- Return: Success (Specification is ready for planning)
-
Write the specification to SPEC_FILE using the template structure, replacing placeholders with specific details derived from the feature description (arguments), while maintaining the section order and titles unchanged.
-
Specification Quality Verification: After writing the initial specification, verify it against quality standards:
a.
Create Specification Quality Checklist: Generate a checklist file in
FEATURE_DIR/checklists/requirements.md
using the checklist template structure, refer to:
assets/quality-checklist-template.md
b. Run Verification Checks: Review the specification against each checklist item:
- For each item, determine if it passes or fails
- Record specific issues found (reference relevant specification sections)
c. Handle Verification Results:
-
If all items pass: Mark the checklist as complete and proceed to step 6
-
If any items fail (excluding [Needs clarification]):
- List the failed items and specific issues
- Update the specification to address each issue
- Re-run verification until all items pass (maximum 3 iterations)
- If still failing after 3 iterations, record remaining issues in the checklist comments and issue a warning to the user
-
If [Needs clarification] marks exist:
-
Extract all [Needs clarification: ...] marks from the specification
-
Limit Check: If there are more than 3 marks, only keep the top 3 most important ones by scope/security/user experience impact, and make educated guesses for the rest
-
For each clarification needed (maximum 3), present options to the user by referring to assets/clarification-template.md
-
Critical - Table Formatting: Ensure markdown tables are correctly formatted:
- Use consistent spacing, aligned pipes
- Each cell should have spaces around content: instead of
- Header separators must have at least 3 dashes:
- Test that tables render correctly in markdown preview
-
Number the questions in order (Q1, Q2, Q3 - maximum 3 total)
-
Present all questions together before waiting for a response
-
Wait for the user's response with their choices for all questions (e.g., "Q1: A, Q2: Custom - [Details], Q3: B")
-
Update the specification by replacing each [Needs clarification] mark with the user's selected or provided answer
-
Re-run verification after all clarifications are resolved
d. Update Checklist: After each verification iteration, update the checklist file with the current pass/fail status
-
Report completion status, including branch name, specification file path, checklist results, and readiness for the next phase (
or
).
-
"API response time is less than 200ms" (too technical, should use "Users see results instantly")
-
"Database can handle 1000 TPS" (implementation detail, should use user-centric metrics)
-
"React components render efficiently" (framework-specific)
-
"Redis cache hit rate is higher than 80%" (technology-specific)