@cognite/cli 0.5.2 → 0.6.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +118 -33
  2. package/_templates/app/new/config/eslint.config.mjs.ejs.t +99 -0
  3. package/_templates/app/new/config/tsconfig.json.ejs.t +35 -0
  4. package/_templates/app/new/config/tsconfig.node.json.ejs.t +27 -0
  5. package/_templates/app/new/config/vite.config.ts.ejs.t +26 -0
  6. package/_templates/app/new/config/vitest.config.ts.ejs.t +14 -0
  7. package/_templates/app/new/config/vitest.setup.ts.ejs.t +4 -0
  8. package/_templates/app/new/cursor/data-modeling.mdc.ejs.t +1996 -0
  9. package/_templates/app/new/cursor/mcp.json.ejs.t +10 -0
  10. package/_templates/app/new/cursor/rules.mdc.ejs.t +10 -0
  11. package/_templates/app/new/github/ci.yml.ejs.t +36 -0
  12. package/_templates/app/new/prompt.js +49 -0
  13. package/_templates/app/new/root/.npmrc.ejs.t +4 -0
  14. package/_templates/app/new/root/AGENTS.md.ejs.t +215 -0
  15. package/_templates/app/new/root/SPEC.md.ejs.t +77 -0
  16. package/_templates/app/new/root/app.json.ejs.t +22 -0
  17. package/_templates/app/new/root/gitignore.ejs.t +21 -0
  18. package/_templates/app/new/root/index.html.ejs.t +36 -0
  19. package/_templates/app/new/root/package.json.ejs.t +67 -0
  20. package/_templates/app/new/src/App.test.tsx.ejs.t +45 -0
  21. package/_templates/app/new/src/App.tsx.ejs.t +265 -0
  22. package/_templates/app/new/src/lib/utils.ts.ejs.t +9 -0
  23. package/_templates/app/new/src/main.tsx.ejs.t +36 -0
  24. package/_templates/app/new/src/styles.css.ejs.t +12 -0
  25. package/_vendor/spec-kit/.version +4 -0
  26. package/_vendor/spec-kit/README.md +39 -0
  27. package/_vendor/spec-kit/commands/speckit.analyze.md +249 -0
  28. package/_vendor/spec-kit/commands/speckit.checklist.md +361 -0
  29. package/_vendor/spec-kit/commands/speckit.clarify.md +247 -0
  30. package/_vendor/spec-kit/commands/speckit.implement.md +198 -0
  31. package/_vendor/spec-kit/commands/speckit.plan.md +149 -0
  32. package/_vendor/spec-kit/commands/speckit.specify.md +327 -0
  33. package/_vendor/spec-kit/commands/speckit.tasks.md +200 -0
  34. package/_vendor/spec-kit/scripts/bash/check-prerequisites.sh +190 -0
  35. package/_vendor/spec-kit/scripts/bash/common.sh +645 -0
  36. package/_vendor/spec-kit/scripts/bash/setup-plan.sh +75 -0
  37. package/_vendor/spec-kit/templates/checklist-template.md +40 -0
  38. package/_vendor/spec-kit/templates/plan-template.md +104 -0
  39. package/_vendor/spec-kit/templates/spec-template.md +128 -0
  40. package/_vendor/spec-kit/templates/tasks-template.md +251 -0
  41. package/dist/chunk-GFMJ4MJZ.js +8 -0
  42. package/dist/cli/cli.js +347 -0
  43. package/dist/skills-4R3OUI44.js +2 -0
  44. package/package.json +25 -17
  45. package/index.js +0 -116
  46. package/operations.js +0 -113
@@ -0,0 +1,198 @@
1
+ ---
2
+ description: Execute the implementation plan by processing and executing all tasks defined in tasks.md
3
+ ---
4
+
5
+ ## User Input
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ You **MUST** consider the user input before proceeding (if not empty).
12
+
13
+ ## Pre-Execution Checks
14
+
15
+ **Check for extension hooks (before implementation)**:
16
+ - Check if `.specify/extensions.yml` exists in the project root.
17
+ - If it exists, read it and look for entries under the `hooks.before_implement` key
18
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
19
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
20
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
21
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
22
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
23
+ - For each executable hook, output the following based on its `optional` flag:
24
+ - **Optional hook** (`optional: true`):
25
+ ```
26
+ ## Extension Hooks
27
+
28
+ **Optional Pre-Hook**: {extension}
29
+ Command: `/{command}`
30
+ Description: {description}
31
+
32
+ Prompt: {prompt}
33
+ To execute: `/{command}`
34
+ ```
35
+ - **Mandatory hook** (`optional: false`):
36
+ ```
37
+ ## Extension Hooks
38
+
39
+ **Automatic Pre-Hook**: {extension}
40
+ Executing: `/{command}`
41
+ EXECUTE_COMMAND: {command}
42
+
43
+ Wait for the result of the hook command before proceeding to the Outline.
44
+ ```
45
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
46
+
47
+ ## Outline
48
+
49
+ 1. Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. 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").
50
+
51
+ 2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
52
+ - Scan all checklist files in the checklists/ directory
53
+ - For each checklist, count:
54
+ - Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
55
+ - Completed items: Lines matching `- [X]` or `- [x]`
56
+ - Incomplete items: Lines matching `- [ ]`
57
+ - Create a status table:
58
+
59
+ ```text
60
+ | Checklist | Total | Completed | Incomplete | Status |
61
+ |-----------|-------|-----------|------------|--------|
62
+ | ux.md | 12 | 12 | 0 | ✓ PASS |
63
+ | test.md | 8 | 5 | 3 | ✗ FAIL |
64
+ | security.md | 6 | 6 | 0 | ✓ PASS |
65
+ ```
66
+
67
+ - Calculate overall status:
68
+ - **PASS**: All checklists have 0 incomplete items
69
+ - **FAIL**: One or more checklists have incomplete items
70
+
71
+ - **If any checklist is incomplete**:
72
+ - Display the table with incomplete item counts
73
+ - **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
74
+ - Wait for user response before continuing
75
+ - If user says "no" or "wait" or "stop", halt execution
76
+ - If user says "yes" or "proceed" or "continue", proceed to step 3
77
+
78
+ - **If all checklists are complete**:
79
+ - Display the table showing all checklists passed
80
+ - Automatically proceed to step 3
81
+
82
+ 3. Load and analyze the implementation context:
83
+ - **REQUIRED**: Read tasks.md for the complete task list and execution plan
84
+ - **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
85
+ - **IF EXISTS**: Read data-model.md for entities and relationships
86
+ - **IF EXISTS**: Read contracts/ for API specifications and test requirements
87
+ - **IF EXISTS**: Read research.md for technical decisions and constraints
88
+ - **IF EXISTS**: Read quickstart.md for integration scenarios
89
+
90
+ 4. **Project Setup Verification**:
91
+ - **REQUIRED**: Create/verify ignore files based on actual project setup:
92
+
93
+ **Detection & Creation Logic**:
94
+ - Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
95
+
96
+ ```sh
97
+ git rev-parse --git-dir 2>/dev/null
98
+ ```
99
+
100
+ - Check if Dockerfile* exists or Docker in plan.md → create/verify .dockerignore
101
+ - Check if .eslintrc* exists → create/verify .eslintignore
102
+ - Check if eslint.config.* exists → ensure the config's `ignores` entries cover required patterns
103
+ - Check if .prettierrc* exists → create/verify .prettierignore
104
+ - Check if .npmrc or package.json exists → create/verify .npmignore (if publishing)
105
+ - Check if terraform files (*.tf) exist → create/verify .terraformignore
106
+ - Check if .helmignore needed (helm charts present) → create/verify .helmignore
107
+
108
+ **If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
109
+ **If ignore file missing**: Create with full pattern set for detected technology
110
+
111
+ **Common Patterns by Technology** (from plan.md tech stack):
112
+ - **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
113
+ - **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
114
+ - **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
115
+ - **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
116
+ - **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
117
+ - **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
118
+ - **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
119
+ - **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
120
+ - **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
121
+ - **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
122
+ - **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `*.dll`, `autom4te.cache/`, `config.status`, `config.log`, `.idea/`, `*.log`, `.env*`
123
+ - **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
124
+ - **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
125
+ - **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
126
+
127
+ **Tool-Specific Patterns**:
128
+ - **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
129
+ - **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
130
+ - **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
131
+ - **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
132
+ - **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
133
+
134
+ 5. Parse tasks.md structure and extract:
135
+ - **Task phases**: Setup, Tests, Core, Integration, Polish
136
+ - **Task dependencies**: Sequential vs parallel execution rules
137
+ - **Task details**: ID, description, file paths, parallel markers [P]
138
+ - **Execution flow**: Order and dependency requirements
139
+
140
+ 6. Execute implementation following the task plan:
141
+ - **Phase-by-phase execution**: Complete each phase before moving to the next
142
+ - **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
143
+ - **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
144
+ - **File-based coordination**: Tasks affecting the same files must run sequentially
145
+ - **Validation checkpoints**: Verify each phase completion before proceeding
146
+
147
+ 7. Implementation execution rules:
148
+ - **Setup first**: Initialize project structure, dependencies, configuration
149
+ - **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
150
+ - **Core development**: Implement models, services, CLI commands, endpoints
151
+ - **Integration work**: Database connections, middleware, logging, external services
152
+ - **Polish and validation**: Unit tests, performance optimization, documentation
153
+
154
+ 8. Progress tracking and error handling:
155
+ - Report progress after each completed task
156
+ - Halt execution if any non-parallel task fails
157
+ - For parallel tasks [P], continue with successful tasks, report failed ones
158
+ - Provide clear error messages with context for debugging
159
+ - Suggest next steps if implementation cannot proceed
160
+ - **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
161
+
162
+ 9. Completion validation:
163
+ - Verify all required tasks are completed
164
+ - Check that implemented features match the original specification
165
+ - Validate that tests pass and coverage meets requirements
166
+ - Confirm the implementation follows the technical plan
167
+ - Report final status with summary of completed work
168
+
169
+ Note: This command assumes a complete task breakdown exists in tasks.md. If tasks are incomplete or missing, suggest running `/speckit.tasks` first to regenerate the task list.
170
+
171
+ 10. **Check for extension hooks**: After completion validation, check if `.specify/extensions.yml` exists in the project root.
172
+ - If it exists, read it and look for entries under the `hooks.after_implement` key
173
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
174
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
175
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
176
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
177
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
178
+ - For each executable hook, output the following based on its `optional` flag:
179
+ - **Optional hook** (`optional: true`):
180
+ ```
181
+ ## Extension Hooks
182
+
183
+ **Optional Hook**: {extension}
184
+ Command: `/{command}`
185
+ Description: {description}
186
+
187
+ Prompt: {prompt}
188
+ To execute: `/{command}`
189
+ ```
190
+ - **Mandatory hook** (`optional: false`):
191
+ ```
192
+ ## Extension Hooks
193
+
194
+ **Automatic Hook**: {extension}
195
+ Executing: `/{command}`
196
+ EXECUTE_COMMAND: {command}
197
+ ```
198
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
@@ -0,0 +1,149 @@
1
+ ---
2
+ description: Execute the implementation planning workflow using the plan template to generate design artifacts.
3
+ handoffs:
4
+ - label: Create Tasks
5
+ agent: speckit.tasks
6
+ prompt: Break the plan into tasks
7
+ send: true
8
+ - label: Create Checklist
9
+ agent: speckit.checklist
10
+ prompt: Create a checklist for the following domain...
11
+ ---
12
+
13
+ ## User Input
14
+
15
+ ```text
16
+ $ARGUMENTS
17
+ ```
18
+
19
+ You **MUST** consider the user input before proceeding (if not empty).
20
+
21
+ ## Pre-Execution Checks
22
+
23
+ **Check for extension hooks (before planning)**:
24
+ - Check if `.specify/extensions.yml` exists in the project root.
25
+ - If it exists, read it and look for entries under the `hooks.before_plan` key
26
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
27
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
28
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
29
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
30
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
31
+ - For each executable hook, output the following based on its `optional` flag:
32
+ - **Optional hook** (`optional: true`):
33
+ ```
34
+ ## Extension Hooks
35
+
36
+ **Optional Pre-Hook**: {extension}
37
+ Command: `/{command}`
38
+ Description: {description}
39
+
40
+ Prompt: {prompt}
41
+ To execute: `/{command}`
42
+ ```
43
+ - **Mandatory hook** (`optional: false`):
44
+ ```
45
+ ## Extension Hooks
46
+
47
+ **Automatic Pre-Hook**: {extension}
48
+ Executing: `/{command}`
49
+ EXECUTE_COMMAND: {command}
50
+
51
+ Wait for the result of the hook command before proceeding to the Outline.
52
+ ```
53
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
54
+
55
+ ## Outline
56
+
57
+ 1. **Setup**: Run `.specify/scripts/bash/setup-plan.sh --json` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. 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").
58
+
59
+ 2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied).
60
+
61
+ 3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
62
+ - Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
63
+ - Fill Constitution Check section from constitution
64
+ - Evaluate gates (ERROR if violations unjustified)
65
+ - Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
66
+ - Phase 1: Generate data-model.md, contracts/, quickstart.md
67
+ - Phase 1: Update agent context by running the agent script
68
+ - Re-evaluate Constitution Check post-design
69
+
70
+ 4. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
71
+
72
+ 5. **Check for extension hooks**: After reporting, check if `.specify/extensions.yml` exists in the project root.
73
+ - If it exists, read it and look for entries under the `hooks.after_plan` key
74
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
75
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
76
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
77
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
78
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
79
+ - For each executable hook, output the following based on its `optional` flag:
80
+ - **Optional hook** (`optional: true`):
81
+ ```
82
+ ## Extension Hooks
83
+
84
+ **Optional Hook**: {extension}
85
+ Command: `/{command}`
86
+ Description: {description}
87
+
88
+ Prompt: {prompt}
89
+ To execute: `/{command}`
90
+ ```
91
+ - **Mandatory hook** (`optional: false`):
92
+ ```
93
+ ## Extension Hooks
94
+
95
+ **Automatic Hook**: {extension}
96
+ Executing: `/{command}`
97
+ EXECUTE_COMMAND: {command}
98
+ ```
99
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
100
+
101
+ ## Phases
102
+
103
+ ### Phase 0: Outline & Research
104
+
105
+ 1. **Extract unknowns from Technical Context** above:
106
+ - For each NEEDS CLARIFICATION → research task
107
+ - For each dependency → best practices task
108
+ - For each integration → patterns task
109
+
110
+ 2. **Generate and dispatch research agents**:
111
+
112
+ ```text
113
+ For each unknown in Technical Context:
114
+ Task: "Research {unknown} for {feature context}"
115
+ For each technology choice:
116
+ Task: "Find best practices for {tech} in {domain}"
117
+ ```
118
+
119
+ 3. **Consolidate findings** in `research.md` using format:
120
+ - Decision: [what was chosen]
121
+ - Rationale: [why chosen]
122
+ - Alternatives considered: [what else evaluated]
123
+
124
+ **Output**: research.md with all NEEDS CLARIFICATION resolved
125
+
126
+ ### Phase 1: Design & Contracts
127
+
128
+ **Prerequisites:** `research.md` complete
129
+
130
+ 1. **Extract entities from feature spec** → `data-model.md`:
131
+ - Entity name, fields, relationships
132
+ - Validation rules from requirements
133
+ - State transitions if applicable
134
+
135
+ 2. **Define interface contracts** (if project has external interfaces) → `/contracts/`:
136
+ - Identify what interfaces the project exposes to users or other systems
137
+ - Document the contract format appropriate for the project type
138
+ - Examples: public APIs for libraries, command schemas for CLI tools, endpoints for web services, grammars for parsers, UI contracts for applications
139
+ - Skip if project is purely internal (build scripts, one-off tools, etc.)
140
+
141
+ 3. **Agent context update**:
142
+ - Update the plan reference between the `<!-- SPECKIT START -->` and `<!-- SPECKIT END -->` markers in `AGENTS.md` to point to the plan file created in step 1 (the IMPL_PLAN path)
143
+
144
+ **Output**: data-model.md, /contracts/*, quickstart.md, updated agent context file
145
+
146
+ ## Key rules
147
+
148
+ - Use absolute paths for filesystem operations; use project-relative paths for references in documentation and agent context files
149
+ - ERROR on gate failures or unresolved clarifications
@@ -0,0 +1,327 @@
1
+ ---
2
+ description: Create or update the feature specification from a natural language feature description.
3
+ handoffs:
4
+ - label: Build Technical Plan
5
+ agent: speckit.plan
6
+ prompt: Create a plan for the spec. I am building with...
7
+ - label: Clarify Spec Requirements
8
+ agent: speckit.clarify
9
+ prompt: Clarify specification requirements
10
+ send: true
11
+ ---
12
+
13
+ ## User Input
14
+
15
+ ```text
16
+ $ARGUMENTS
17
+ ```
18
+
19
+ You **MUST** consider the user input before proceeding (if not empty).
20
+
21
+ ## Pre-Execution Checks
22
+
23
+ **Check for extension hooks (before specification)**:
24
+ - Check if `.specify/extensions.yml` exists in the project root.
25
+ - If it exists, read it and look for entries under the `hooks.before_specify` key
26
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
27
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
28
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
29
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
30
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
31
+ - For each executable hook, output the following based on its `optional` flag:
32
+ - **Optional hook** (`optional: true`):
33
+ ```
34
+ ## Extension Hooks
35
+
36
+ **Optional Pre-Hook**: {extension}
37
+ Command: `/{command}`
38
+ Description: {description}
39
+
40
+ Prompt: {prompt}
41
+ To execute: `/{command}`
42
+ ```
43
+ - **Mandatory hook** (`optional: false`):
44
+ ```
45
+ ## Extension Hooks
46
+
47
+ **Automatic Pre-Hook**: {extension}
48
+ Executing: `/{command}`
49
+ EXECUTE_COMMAND: {command}
50
+
51
+ Wait for the result of the hook command before proceeding to the Outline.
52
+ ```
53
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
54
+
55
+ ## Outline
56
+
57
+ The text the user typed after `/speckit.specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `$ARGUMENTS` appears literally below. Do not ask the user to repeat it unless they provided an empty command.
58
+
59
+ Given that feature description, do this:
60
+
61
+ 1. **Generate a concise short name** (2-4 words) for the feature:
62
+ - Analyze the feature description and extract the most meaningful keywords
63
+ - Create a 2-4 word short name that captures the essence of the feature
64
+ - Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
65
+ - Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
66
+ - Keep it concise but descriptive enough to understand the feature at a glance
67
+ - Examples:
68
+ - "I want to add user authentication" → "user-auth"
69
+ - "Implement OAuth2 integration for the API" → "oauth2-api-integration"
70
+ - "Create a dashboard for analytics" → "analytics-dashboard"
71
+ - "Fix payment processing timeout bug" → "fix-payment-timeout"
72
+
73
+ 2. **Branch creation** (optional, via hook):
74
+
75
+ If a `before_specify` hook ran successfully in the Pre-Execution Checks above, it will have created/switched to a git branch and output JSON containing `BRANCH_NAME` and `FEATURE_NUM`. Note these values for reference, but the branch name does **not** dictate the spec directory name.
76
+
77
+ If the user explicitly provided `GIT_BRANCH_NAME`, pass it through to the hook so the branch script uses the exact value as the branch name (bypassing all prefix/suffix generation).
78
+
79
+ 3. **Create the spec feature directory**:
80
+
81
+ Specs live under the default `specs/` directory unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
82
+
83
+ **Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
84
+ 1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
85
+ 2. Otherwise, auto-generate it under `specs/`:
86
+ - Check `.specify/init-options.json` for `branch_numbering`
87
+ - If `"timestamp"`: prefix is `YYYYMMDD-HHMMSS` (current timestamp)
88
+ - If `"sequential"` or absent: prefix is `NNN` (next available 3-digit number after scanning existing directories in `specs/`)
89
+ - Construct the directory name: `<prefix>-<short-name>` (e.g., `003-user-auth` or `20260319-143022-user-auth`)
90
+ - Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<directory-name>`
91
+
92
+ **Create the directory and spec file**:
93
+ - `mkdir -p SPECIFY_FEATURE_DIRECTORY`
94
+ - Copy `.specify/templates/spec-template.md` to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
95
+ - Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
96
+ - Persist the resolved path to `.specify/feature.json`:
97
+ ```json
98
+ {
99
+ "feature_directory": "<resolved feature dir>"
100
+ }
101
+ ```
102
+ Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
103
+ This allows downstream commands (`/speckit.plan`, `/speckit.tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
104
+
105
+ **IMPORTANT**:
106
+ - You must only create one feature per `/speckit.specify` invocation
107
+ - The spec directory name and the git branch name are independent — they may be the same but that is the user's choice
108
+ - The spec directory and file are always created by this command, never by the hook
109
+
110
+ 4. Load `.specify/templates/spec-template.md` to understand required sections.
111
+
112
+ 5. Follow this execution flow:
113
+ 1. Parse user description from arguments
114
+ If empty: ERROR "No feature description provided"
115
+ 2. Extract key concepts from description
116
+ Identify: actors, actions, data, constraints
117
+ 3. For unclear aspects:
118
+ - Make informed guesses based on context and industry standards
119
+ - Only mark with [NEEDS CLARIFICATION: specific question] if:
120
+ - The choice significantly impacts feature scope or user experience
121
+ - Multiple reasonable interpretations exist with different implications
122
+ - No reasonable default exists
123
+ - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
124
+ - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
125
+ 4. Fill User Scenarios & Testing section
126
+ If no clear user flow: ERROR "Cannot determine user scenarios"
127
+ 5. Generate Functional Requirements
128
+ Each requirement must be testable
129
+ Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
130
+ 6. Define Success Criteria
131
+ Create measurable, technology-agnostic outcomes
132
+ Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
133
+ Each criterion must be verifiable without implementation details
134
+ 7. Identify Key Entities (if data involved)
135
+ 8. Return: SUCCESS (spec ready for planning)
136
+
137
+ 6. 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.
138
+
139
+ 7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
140
+
141
+ a. **Create Spec Quality Checklist**: Generate a checklist file at `SPECIFY_FEATURE_DIRECTORY/checklists/requirements.md` using the checklist template structure with these validation items:
142
+
143
+ ```markdown
144
+ # Specification Quality Checklist: [FEATURE NAME]
145
+
146
+ **Purpose**: Validate specification completeness and quality before proceeding to planning
147
+ **Created**: [DATE]
148
+ **Feature**: [Link to spec.md]
149
+
150
+ ## Content Quality
151
+
152
+ - [ ] No implementation details (languages, frameworks, APIs)
153
+ - [ ] Focused on user value and business needs
154
+ - [ ] Written for non-technical stakeholders
155
+ - [ ] All mandatory sections completed
156
+
157
+ ## Requirement Completeness
158
+
159
+ - [ ] No [NEEDS CLARIFICATION] markers remain
160
+ - [ ] Requirements are testable and unambiguous
161
+ - [ ] Success criteria are measurable
162
+ - [ ] Success criteria are technology-agnostic (no implementation details)
163
+ - [ ] All acceptance scenarios are defined
164
+ - [ ] Edge cases are identified
165
+ - [ ] Scope is clearly bounded
166
+ - [ ] Dependencies and assumptions identified
167
+
168
+ ## Feature Readiness
169
+
170
+ - [ ] All functional requirements have clear acceptance criteria
171
+ - [ ] User scenarios cover primary flows
172
+ - [ ] Feature meets measurable outcomes defined in Success Criteria
173
+ - [ ] No implementation details leak into specification
174
+
175
+ ## Notes
176
+
177
+ - Items marked incomplete require spec updates before `/speckit.clarify` or `/speckit.plan`
178
+ ```
179
+
180
+ b. **Run Validation Check**: Review the spec against each checklist item:
181
+ - For each item, determine if it passes or fails
182
+ - Document specific issues found (quote relevant spec sections)
183
+
184
+ c. **Handle Validation Results**:
185
+
186
+ - **If all items pass**: Mark checklist complete and proceed to step 7
187
+
188
+ - **If items fail (excluding [NEEDS CLARIFICATION])**:
189
+ 1. List the failing items and specific issues
190
+ 2. Update the spec to address each issue
191
+ 3. Re-run validation until all items pass (max 3 iterations)
192
+ 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
193
+
194
+ - **If [NEEDS CLARIFICATION] markers remain**:
195
+ 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
196
+ 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
197
+ 3. For each clarification needed (max 3), present options to user in this format:
198
+
199
+ ```markdown
200
+ ## Question [N]: [Topic]
201
+
202
+ **Context**: [Quote relevant spec section]
203
+
204
+ **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
205
+
206
+ **Suggested Answers**:
207
+
208
+ | Option | Answer | Implications |
209
+ |--------|--------|--------------|
210
+ | A | [First suggested answer] | [What this means for the feature] |
211
+ | B | [Second suggested answer] | [What this means for the feature] |
212
+ | C | [Third suggested answer] | [What this means for the feature] |
213
+ | Custom | Provide your own answer | [Explain how to provide custom input] |
214
+
215
+ **Your choice**: _[Wait for user response]_
216
+ ```
217
+
218
+ 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
219
+ - Use consistent spacing with pipes aligned
220
+ - Each cell should have spaces around content: `| Content |` not `|Content|`
221
+ - Header separator must have at least 3 dashes: `|--------|`
222
+ - Test that the table renders correctly in markdown preview
223
+ 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
224
+ 6. Present all questions together before waiting for responses
225
+ 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
226
+ 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
227
+ 9. Re-run validation after all clarifications are resolved
228
+
229
+ d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
230
+
231
+ 8. **Report completion** to the user with:
232
+ - `SPECIFY_FEATURE_DIRECTORY` — the feature directory path
233
+ - `SPEC_FILE` — the spec file path
234
+ - Checklist results summary
235
+ - Readiness for the next phase (`/speckit.clarify` or `/speckit.plan`)
236
+
237
+ 9. **Check for extension hooks**: After reporting completion, check if `.specify/extensions.yml` exists in the project root.
238
+ - If it exists, read it and look for entries under the `hooks.after_specify` key
239
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
240
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
241
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
242
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
243
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
244
+ - For each executable hook, output the following based on its `optional` flag:
245
+ - **Optional hook** (`optional: true`):
246
+ ```
247
+ ## Extension Hooks
248
+
249
+ **Optional Hook**: {extension}
250
+ Command: `/{command}`
251
+ Description: {description}
252
+
253
+ Prompt: {prompt}
254
+ To execute: `/{command}`
255
+ ```
256
+ - **Mandatory hook** (`optional: false`):
257
+ ```
258
+ ## Extension Hooks
259
+
260
+ **Automatic Hook**: {extension}
261
+ Executing: `/{command}`
262
+ EXECUTE_COMMAND: {command}
263
+ ```
264
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
265
+
266
+ **NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
267
+
268
+ ## Quick Guidelines
269
+
270
+ - Focus on **WHAT** users need and **WHY**.
271
+ - Avoid HOW to implement (no tech stack, APIs, code structure).
272
+ - Written for business stakeholders, not developers.
273
+ - DO NOT create any checklists that are embedded in the spec. That will be a separate command.
274
+
275
+ ### Section Requirements
276
+
277
+ - **Mandatory sections**: Must be completed for every feature
278
+ - **Optional sections**: Include only when relevant to the feature
279
+ - When a section doesn't apply, remove it entirely (don't leave as "N/A")
280
+
281
+ ### For AI Generation
282
+
283
+ When creating this spec from a user prompt:
284
+
285
+ 1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
286
+ 2. **Document assumptions**: Record reasonable defaults in the Assumptions section
287
+ 3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
288
+ - Significantly impact feature scope or user experience
289
+ - Have multiple reasonable interpretations with different implications
290
+ - Lack any reasonable default
291
+ 4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
292
+ 5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
293
+ 6. **Common areas needing clarification** (only if no reasonable default exists):
294
+ - Feature scope and boundaries (include/exclude specific use cases)
295
+ - User types and permissions (if multiple conflicting interpretations possible)
296
+ - Security/compliance requirements (when legally/financially significant)
297
+
298
+ **Examples of reasonable defaults** (don't ask about these):
299
+
300
+ - Data retention: Industry-standard practices for the domain
301
+ - Performance targets: Standard web/mobile app expectations unless specified
302
+ - Error handling: User-friendly messages with appropriate fallbacks
303
+ - Authentication method: Standard session-based or OAuth2 for web apps
304
+ - Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
305
+
306
+ ### Success Criteria Guidelines
307
+
308
+ Success criteria must be:
309
+
310
+ 1. **Measurable**: Include specific metrics (time, percentage, count, rate)
311
+ 2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
312
+ 3. **User-focused**: Describe outcomes from user/business perspective, not system internals
313
+ 4. **Verifiable**: Can be tested/validated without knowing implementation details
314
+
315
+ **Good examples**:
316
+
317
+ - "Users can complete checkout in under 3 minutes"
318
+ - "System supports 10,000 concurrent users"
319
+ - "95% of searches return results in under 1 second"
320
+ - "Task completion rate improves by 40%"
321
+
322
+ **Bad examples** (implementation-focused):
323
+
324
+ - "API response time is under 200ms" (too technical, use "Users see results instantly")
325
+ - "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
326
+ - "React components render efficiently" (framework-specific)
327
+ - "Redis cache hit rate above 80%" (technology-specific)