The /speckit.specify command transforms natural language feature descriptions into structured, implementation-agnostic specifications. This command is the first step in the Spec-Driven Development workflow after establishing project principles with /speckit.constitution (see page 5.2). It creates a new feature branch, initializes the specification directory structure, and generates a requirements document focused on what users need and why, deliberately excluding how to implement.
The command orchestrates three primary operations:
scripts/bash/create-new-feature.sh or scripts/powershell/create-new-feature.ps1 to create a Git branch with pattern NNN-short-name.specify/specs/NNN-short-name/spec.md from templates/spec-template.md.specify/specs/NNN-short-name/checklists/requirements.md and validates specification completenessFor clarifying underspecified areas in an existing specification, see page 5.4. For creating technical implementation plans from specifications, see page 5.5.
Sources: templates/commands/specify.md1-14 README.md96-109 templates/commands/specify.md26-198
The command accepts a natural language feature description as its argument and executes a multi-stage process:
| Stage | Code Entity | Operation |
|---|---|---|
| 1. Keyword Extraction | AI agent | Generates 2-4 word short-name from feature description |
| 2. Collision Detection | git ls-remote, git branch, filesystem | Queries remote branches, local branches, and specs/ directory to find highest NNN |
| 3. Script Invocation | scripts/bash/create-new-feature.sh or scripts/powershell/create-new-feature.ps1 | Executes with --number NNN+1 --short-name "short-name", returns JSON with BRANCH_NAME, SPEC_FILE, FEATURE_DIR keys |
| 4. Specification Generation | AI agent, templates/spec-template.md | Copies template structure to SPEC_FILE and populates sections |
| 5. Quality Validation | AI agent | Creates checklists/requirements.md and validates against 14 checklist items |
| 6. Clarification Workflow | AI agent | Presents max 3 [NEEDS CLARIFICATION] questions with Option A/B/C/Custom table format |
| 7. Completion Report | AI agent | Outputs BRANCH_NAME, SPEC_FILE, checklist pass/fail counts, next command recommendation |
Sources: templates/commands/specify.md26-198 README.md96-109
<old_str>
The command enforces a strict maximum of 3 [NEEDS CLARIFICATION] markers per specification templates/commands/specify.md87
Prioritization hierarchy templates/commands/specify.md88-89 templates/commands/specify.md224:
| Priority | Category | Example Clarifications |
|---|---|---|
| 1 (Highest) | Feature scope and boundaries | "Should search include archived items?" |
| 2 | Security/privacy requirements | "What user data needs encryption at rest?" |
| 3 | User experience impacts | "Should bulk operations be cancelable?" |
| 4 (Lowest) | Technical details | "Preferred authentication flow?" |
Marker insertion criteria templates/commands/specify.md82-86:
Reasonable defaults that do NOT require clarification templates/commands/specify.md231-237:
| Aspect | Default Assumption |
|---|---|
| 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 |
Marker format in spec.md:
Sources: templates/commands/specify.md82-89 templates/commands/specify.md220-237 </old_str> <new_str>
The command invokes platform-specific scripts through YAML frontmatter placeholder substitution defined in templates/commands/specify.md templates/commands/specify.md11-13
Bash invocation:
PowerShell invocation:
The script writes JSON to stdout with three keys:
| JSON Key | Type | Example | Purpose |
|---|---|---|---|
BRANCH_NAME | string | "004-user-auth" | Git branch created and checked out |
SPEC_FILE | string | ".specify/specs/004-user-auth/spec.md" | Absolute or relative path to spec file for AI to populate |
FEATURE_DIR | string | ".specify/specs/004-user-auth" | Feature directory for checklists and artifacts |
Critical constraint: The script must only be executed once per feature templates/commands/specify.md68-69 Re-execution would create duplicate branches.
Argument escaping: For single quotes in feature descriptions like "I'm building a feature", use bash escape syntax 'I'\''m building' or PowerShell double-quotes "I'm building" templates/commands/specify.md72
Sources: templates/commands/specify.md11-13 templates/commands/specify.md59-72
Sources: templates/commands/specify.md76-100 templates/commands/specify.md103-195
The command implements intelligent branch naming with collision detection across three data sources to ensure unique feature numbers.
Short Name Generation Rules templates/commands/specify.md30-40:
add-user-auth, fix-payment-bug)user-authoauth2-api-integrationanalytics-dashboardThis diagram maps the collision detection flow from natural language to Git/filesystem operations:
Key code entities referenced:
git fetch, git ls-remote, git branch, git checkout -b.specify/scripts/bash/create-new-feature.sh, .specify/scripts/powershell/create-new-feature.ps1templates/spec-template.mdBRANCH_NAME, SPEC_FILE, FEATURE_DIRSources: templates/commands/specify.md42-72
The command invokes platform-specific scripts through placeholder substitution:
Bash invocation templates/commands/specify.md12:
scripts/bash/create-new-feature.sh --json "{ARGS}"
PowerShell invocation templates/commands/specify.md13:
scripts/powershell/create-new-feature.ps1 -Json "{ARGS}"
Script responsibilities:
NNN-short-namespecs/NNN-short-name/spec.md from templates/spec-template.mdBRANCH_NAME and SPEC_FILE keysImportant: The script must only be executed once per feature templates/commands/specify.md68
Sources: templates/commands/specify.md12-13 templates/commands/specify.md59-71
The command loads templates/spec-template.md to understand required sections templates/commands/specify.md73 then populates it following strict content guidelines.
Mandatory focus templates/commands/specify.md203-206:
Sources: templates/commands/specify.md76-100
The command enforces a maximum of 3 [NEEDS CLARIFICATION] markers per specification templates/commands/specify.md88
Usage criteria templates/commands/specify.md82-89:
Prioritization hierarchy (when more than 3 clarifications are needed) templates/commands/specify.md89 templates/commands/specify.md224:
| Priority | Category | Example |
|---|---|---|
| 1 | Feature scope and boundaries | "Should search include archived items?" |
| 2 | Security/privacy requirements | "What user data needs encryption at rest?" |
| 3 | User experience impacts | "Should bulk operations be cancelable?" |
| 4 | Technical details | "Preferred authentication flow?" |
The following aspects have reasonable defaults and should NOT trigger [NEEDS CLARIFICATION] markers templates/commands/specify.md232-238:
| Aspect | Default Assumption |
|---|---|
| Data retention | Industry-standard practices for the domain |
| Performance targets | Standard web/mobile app expectations |
| Error handling | User-friendly messages with appropriate fallbacks |
| Authentication method | Session-based or OAuth2 for web apps |
| Integration patterns | RESTful APIs |
In spec.md:
In clarification questions templates/commands/specify.md163-181:
Sources: templates/commands/specify.md82-89 templates/commands/specify.md163-181 templates/commands/specify.md220-238
After generating the initial specification, the command creates FEATURE_DIR/checklists/requirements.md templates/commands/specify.md106-143
Checklist file structure:
| Section | Item Count | Pass Criteria |
|---|---|---|
| Content Quality | 4 | No tech stack mentions, business-focused language, non-technical audience, all mandatory sections present |
| Requirement Completeness | 8 | Zero [NEEDS CLARIFICATION] markers, testable requirements, measurable success criteria, complete scenarios |
| Feature Readiness | 4 | Acceptance criteria defined, primary flows covered, success criteria met, no implementation leaks |
| Total | 16 | All items must pass for spec to be marked ready for /speckit.plan |
Sources: templates/commands/specify.md105-143
Validation outcomes:
| Condition | Action | Next Step |
|---|---|---|
| All items pass | Mark checklist complete | Recommend /speckit.plan |
[NEEDS CLARIFICATION] markers remain | Present questions (max 3) | User resolves → re-validate |
| Non-clarification failures | Update spec (max 3 iterations) | Re-validate or document issues |
| Failures after 3 iterations | Document in checklist Notes | Warn user, mark complete with failures |
Sources: templates/commands/specify.md143-194
When [NEEDS CLARIFICATION] markers remain after initial spec generation, the command presents questions sequentially (max 3 total) templates/commands/specify.md162-191
Presentation workflow:
[NEEDS CLARIFICATION: ...] markers from spec.md## Question N with table of options[NEEDS CLARIFICATION] markers in spec with selected answersCritical formatting rules templates/commands/specify.md183-187:
| Rule | Correct | Incorrect |
|---|---|---|
| Cell spacing | | Content | | |Content| |
| Header separator | |--------| (min 3 dashes) | |--| |
| Pipe alignment | Consistent spacing | Inconsistent spacing |
| Markdown preview | Must render correctly | Broken table rendering |
User response format: "Q1: A, Q2: Custom - User must have edit permission, Q3: B"
Processing steps:
[NEEDS CLARIFICATION] marker in spec.mdchecklists/requirements.md to reflect resolved statusSources: templates/commands/specify.md162-194
Success criteria in spec.md must follow strict validation rules to remain implementation-agnostic templates/commands/specify.md240-247
| Rule | Description | Checklist Item |
|---|---|---|
| Measurable | Include specific metrics (time, percentage, count, rate) | "Success criteria are measurable" |
| Technology-agnostic | No mention of frameworks, languages, databases, or tools | "Success criteria are technology-agnostic (no implementation details)" |
| User-focused | Describe outcomes from user/business perspective | Validated in "Content Quality" section |
| Verifiable | Can be tested without knowing implementation details | "Requirements are testable and unambiguous" |
Valid success criteria templates/commands/specify.md249-254:
Invalid success criteria (implementation details leaked) templates/commands/specify.md256-261:
| Invalid Criterion | Why Invalid | Correct Version |
|---|---|---|
| "API response time is under 200ms" | Mentions API (implementation) | "Users see results instantly" |
| "Database can handle 1000 TPS" | Mentions database (technology) | "System processes 1000 transactions per second" |
| "React components render efficiently" | Mentions React (framework) | "UI updates appear instant to users" |
| "Redis cache hit rate above 80%" | Mentions Redis (technology) | "Data retrieval completes in under 100ms" |
Validation enforcement: The checklists/requirements.md item "Success criteria are technology-agnostic (no implementation details)" templates/commands/specify.md125 enforces these rules during validation.
Sources: templates/commands/specify.md240-261
The command defines handoffs to subsequent workflow commands through YAML frontmatter in templates/commands/specify.md templates/commands/specify.md3-10
| Handoff | Command | Label | Prompt Template | send Flag | Next File Operations |
|---|---|---|---|---|---|
| 1 | /speckit.clarify | "Clarify Spec Requirements" | "Clarify specification requirements" | true | Updates spec.md, replaces [NEEDS CLARIFICATION] |
| 2 | /speckit.plan | "Build Technical Plan" | "Create a plan for the spec. I am building with..." | false | Creates plan.md, data-model.md, contracts/ |
Handoff 1 (send: true): Agent automatically includes spec.md content when invoking /speckit.clarify templates/commands/specify.md10 User does not need to manually provide context.
Handoff 2 (user-initiated): User must provide tech stack details. Agent reads spec.md and memory/constitution.md to generate technical artifacts templates/commands/specify.md4-6
Sources: templates/commands/specify.md3-10
The command relies on JSON output from .specify/scripts/bash/create-new-feature.sh or .specify/scripts/powershell/create-new-feature.ps1 to obtain branch and file paths templates/commands/specify.md69-71
The scripts output JSON to stdout with these keys:
| Key | Type | Example Value | Purpose |
|---|---|---|---|
BRANCH_NAME | string | "001-user-auth" | Git branch created/checked out |
SPEC_FILE | string | ".specify/specs/001-user-auth/spec.md" | Path to specification file for AI to write |
FEATURE_DIR | string | ".specify/specs/001-user-auth" | Feature directory for checklists, artifacts |
Bash script invocation and parsing:
PowerShell script invocation and parsing:
Critical parsing requirements templates/commands/specify.md69-71:
Sources: templates/commands/specify.md69-72
Section handling rules templates/commands/specify.md208-212:
Based on the execution flow, the template includes these sections templates/commands/specify.md73 templates/commands/specify.md89-98:
| Section | Content | Required |
|---|---|---|
| User Scenarios & Testing | User flows and acceptance scenarios | Yes |
| Functional Requirements | Testable, unambiguous requirements | Yes |
| Success Criteria | Measurable, technology-agnostic outcomes | Yes |
| Key Entities | Data objects and relationships | If data involved |
| Assumptions | Documented defaults and context | When guesses made |
| Dependencies | External systems and constraints | If applicable |
| Scope Boundaries | What's included/excluded | Yes |
Sources: templates/commands/specify.md89-98 templates/commands/specify.md208-212
After execution, the command outputs a structured completion report templates/commands/specify.md196
| Component | Example Value | Data Source |
|---|---|---|
| Branch name | 004-user-auth | JSON key BRANCH_NAME from script stdout |
| Spec file path | .specify/specs/004-user-auth/spec.md | JSON key SPEC_FILE from script stdout |
| Checklist path | .specify/specs/004-user-auth/checklists/requirements.md | Generated by validation step |
| Checklist pass/fail | "✓ 14/16 items passed" | Validation iteration output |
| Next command recommendation | "Ready for /speckit.clarify" or "Ready for /speckit.plan" | Based on [NEEDS CLARIFICATION] presence |
✓ Feature specification created successfully
Branch: 004-user-auth
Spec file: .specify/specs/004-user-auth/spec.md
Checklist: .specify/specs/004-user-auth/checklists/requirements.md
Quality Validation:
✓ Content Quality: 4/4 items passed
✓ Requirement Completeness: 6/8 items passed (2 [NEEDS CLARIFICATION] remain)
✓ Feature Readiness: 4/4 items passed
Status: Ready for /speckit.clarify (2 clarification markers remain)
Next steps:
1. Run /speckit.clarify to resolve specification questions
2. Or run /speckit.plan with tech stack details to proceed directly
Next command selection:
[NEEDS CLARIFICATION] markers present → Recommend /speckit.clarify/speckit.planSources: templates/commands/specify.md196 templates/commands/specify.md148-157
The /speckit.specify command creates this directory structure within .specify/:
.specify/
├── specs/
│ └── NNN-short-name/ # Created by create-new-feature.{sh,ps1}
│ ├── spec.md # Populated from templates/spec-template.md
│ └── checklists/ # Created during quality validation
│ └── requirements.md # Generated by validation step
├── templates/
│ └── spec-template.md # Loaded as structure reference
└── scripts/
├── bash/
│ └── create-new-feature.sh # Invoked for bash environments
└── powershell/
└── create-new-feature.ps1 # Invoked for PowerShell environments
| Step | File/Branch Created | Created By | Purpose |
|---|---|---|---|
| 1 | NNN-short-name branch | create-new-feature.{sh,ps1} | Isolate feature work |
| 2 | .specify/specs/NNN-short-name/ | create-new-feature.{sh,ps1} | Feature artifact directory |
| 3 | .specify/specs/NNN-short-name/spec.md | AI agent via template | Specification document |
| 4 | .specify/specs/NNN-short-name/checklists/ | AI agent | Validation checklist directory |
| 5 | .specify/specs/NNN-short-name/checklists/requirements.md | AI agent | Quality validation checklist |
Sources: templates/commands/specify.md11-13 templates/commands/specify.md59-71 templates/commands/specify.md105-107 README.md440-459
The command implements validation gates at key decision points:
Error conditions templates/commands/specify.md78-79 templates/commands/specify.md90-91:
| Error | Trigger Condition | Resolution |
|---|---|---|
| "No feature description provided" | Empty user input after command | User must provide feature description |
| "Cannot determine user scenarios" | No clear user flow extractable from description | User must provide more context about user interactions |
Validation failures templates/commands/specify.md150-157:
Sources: templates/commands/specify.md78-91 templates/commands/specify.md150-157
Refresh this wiki