harryagasi commited on
Commit Β·
30cd0c9
1
Parent(s): 60222c1
feat: implement dual-backend analysis workspace UX
Browse files- add Home, Knowledge, and Analysis Agent primary navigation
- promote Knowledge setup into a first-class workspace page
- wire Golang orchestration flows for auth, knowledge, analysis, and messages
- wire Python agentic flows for chat, Help, reports, and traceability
- move AI traceability into collapsible answer-level sections
- add collapsible report sidebar with version preview
- add backend diagnostics and clearer blocker/error states
- update spec-kit tasks and quickstart validation notes
This view is limited to 50 files because it contains too many changes. Β See raw diff
- .agents/skills/speckit-analyze/SKILL.md +255 -0
- .agents/skills/speckit-checklist/SKILL.md +367 -0
- .agents/skills/speckit-clarify/SKILL.md +249 -0
- .agents/skills/speckit-constitution/SKILL.md +152 -0
- .agents/skills/speckit-implement/SKILL.md +205 -0
- .agents/skills/speckit-plan/SKILL.md +147 -0
- .agents/skills/speckit-specify/SKILL.md +325 -0
- .agents/skills/speckit-tasks/SKILL.md +197 -0
- .agents/skills/speckit-taskstoissues/SKILL.md +101 -0
- .claude/skills/speckit-analyze/SKILL.md +260 -0
- .claude/skills/speckit-checklist/SKILL.md +372 -0
- .claude/skills/speckit-clarify/SKILL.md +254 -0
- .claude/skills/speckit-constitution/SKILL.md +157 -0
- .claude/skills/speckit-git-commit/SKILL.md +53 -0
- .claude/skills/speckit-git-feature/SKILL.md +72 -0
- .claude/skills/speckit-git-initialize/SKILL.md +54 -0
- .claude/skills/speckit-git-remote/SKILL.md +50 -0
- .claude/skills/speckit-git-validate/SKILL.md +54 -0
- .claude/skills/speckit-implement/SKILL.md +210 -0
- .claude/skills/speckit-plan/SKILL.md +152 -0
- .claude/skills/speckit-specify/SKILL.md +330 -0
- .claude/skills/speckit-tasks/SKILL.md +202 -0
- .claude/skills/speckit-taskstoissues/SKILL.md +106 -0
- .gitignore +2 -1
- .specify/extensions.yml +149 -0
- .specify/extensions/.registry +23 -0
- .specify/extensions/git/README.md +100 -0
- .specify/extensions/git/commands/speckit.git.commit.md +48 -0
- .specify/extensions/git/commands/speckit.git.feature.md +67 -0
- .specify/extensions/git/commands/speckit.git.initialize.md +49 -0
- .specify/extensions/git/commands/speckit.git.remote.md +45 -0
- .specify/extensions/git/commands/speckit.git.validate.md +49 -0
- .specify/extensions/git/config-template.yml +62 -0
- .specify/extensions/git/extension.yml +140 -0
- .specify/extensions/git/git-config.yml +62 -0
- .specify/extensions/git/scripts/bash/auto-commit.sh +140 -0
- .specify/extensions/git/scripts/bash/create-new-feature.sh +453 -0
- .specify/extensions/git/scripts/bash/git-common.sh +54 -0
- .specify/extensions/git/scripts/bash/initialize-repo.sh +54 -0
- .specify/extensions/git/scripts/powershell/auto-commit.ps1 +169 -0
- .specify/extensions/git/scripts/powershell/create-new-feature.ps1 +403 -0
- .specify/extensions/git/scripts/powershell/git-common.ps1 +51 -0
- .specify/extensions/git/scripts/powershell/initialize-repo.ps1 +69 -0
- .specify/feature.json +3 -0
- .specify/init-options.json +10 -0
- .specify/integration.json +15 -0
- .specify/integrations/claude.manifest.json +16 -0
- .specify/integrations/codex.manifest.json +16 -0
- .specify/integrations/speckit.manifest.json +17 -0
- .specify/memory/constitution.md +50 -0
.agents/skills/speckit-analyze/SKILL.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-analyze"
|
| 3 |
+
description: "Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/analyze.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before analysis)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_analyze` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Goal.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Goal
|
| 54 |
+
|
| 55 |
+
Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/speckit-tasks` has successfully produced a complete `tasks.md`.
|
| 56 |
+
|
| 57 |
+
## Operating Constraints
|
| 58 |
+
|
| 59 |
+
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
|
| 60 |
+
|
| 61 |
+
**Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasksβnot dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/speckit-analyze`.
|
| 62 |
+
|
| 63 |
+
## Execution Steps
|
| 64 |
+
|
| 65 |
+
### 1. Initialize Analysis Context
|
| 66 |
+
|
| 67 |
+
Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
|
| 68 |
+
|
| 69 |
+
- SPEC = FEATURE_DIR/spec.md
|
| 70 |
+
- PLAN = FEATURE_DIR/plan.md
|
| 71 |
+
- TASKS = FEATURE_DIR/tasks.md
|
| 72 |
+
|
| 73 |
+
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
|
| 74 |
+
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").
|
| 75 |
+
|
| 76 |
+
### 2. Load Artifacts (Progressive Disclosure)
|
| 77 |
+
|
| 78 |
+
Load only the minimal necessary context from each artifact:
|
| 79 |
+
|
| 80 |
+
**From spec.md:**
|
| 81 |
+
|
| 82 |
+
- Overview/Context
|
| 83 |
+
- Functional Requirements
|
| 84 |
+
- Success Criteria (measurable outcomes β e.g., performance, security, availability, user success, business impact)
|
| 85 |
+
- User Stories
|
| 86 |
+
- Edge Cases (if present)
|
| 87 |
+
|
| 88 |
+
**From plan.md:**
|
| 89 |
+
|
| 90 |
+
- Architecture/stack choices
|
| 91 |
+
- Data Model references
|
| 92 |
+
- Phases
|
| 93 |
+
- Technical constraints
|
| 94 |
+
|
| 95 |
+
**From tasks.md:**
|
| 96 |
+
|
| 97 |
+
- Task IDs
|
| 98 |
+
- Descriptions
|
| 99 |
+
- Phase grouping
|
| 100 |
+
- Parallel markers [P]
|
| 101 |
+
- Referenced file paths
|
| 102 |
+
|
| 103 |
+
**From constitution:**
|
| 104 |
+
|
| 105 |
+
- Load `.specify/memory/constitution.md` for principle validation
|
| 106 |
+
|
| 107 |
+
### 3. Build Semantic Models
|
| 108 |
+
|
| 109 |
+
Create internal representations (do not include raw artifacts in output):
|
| 110 |
+
|
| 111 |
+
- **Requirements inventory**: For each Functional Requirement (FR-###) and Success Criterion (SC-###), record a stable key. Use the explicit FR-/SC- identifier as the primary key when present, and optionally also derive an imperative-phrase slug for readability (e.g., "User can upload file" β `user-can-upload-file`). Include only Success Criteria items that require buildable work (e.g., load-testing infrastructure, security audit tooling), and exclude post-launch outcome metrics and business KPIs (e.g., "Reduce support tickets by 50%").
|
| 112 |
+
- **User story/action inventory**: Discrete user actions with acceptance criteria
|
| 113 |
+
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
|
| 114 |
+
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
|
| 115 |
+
|
| 116 |
+
### 4. Detection Passes (Token-Efficient Analysis)
|
| 117 |
+
|
| 118 |
+
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
|
| 119 |
+
|
| 120 |
+
#### A. Duplication Detection
|
| 121 |
+
|
| 122 |
+
- Identify near-duplicate requirements
|
| 123 |
+
- Mark lower-quality phrasing for consolidation
|
| 124 |
+
|
| 125 |
+
#### B. Ambiguity Detection
|
| 126 |
+
|
| 127 |
+
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
|
| 128 |
+
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
|
| 129 |
+
|
| 130 |
+
#### C. Underspecification
|
| 131 |
+
|
| 132 |
+
- Requirements with verbs but missing object or measurable outcome
|
| 133 |
+
- User stories missing acceptance criteria alignment
|
| 134 |
+
- Tasks referencing files or components not defined in spec/plan
|
| 135 |
+
|
| 136 |
+
#### D. Constitution Alignment
|
| 137 |
+
|
| 138 |
+
- Any requirement or plan element conflicting with a MUST principle
|
| 139 |
+
- Missing mandated sections or quality gates from constitution
|
| 140 |
+
|
| 141 |
+
#### E. Coverage Gaps
|
| 142 |
+
|
| 143 |
+
- Requirements with zero associated tasks
|
| 144 |
+
- Tasks with no mapped requirement/story
|
| 145 |
+
- Success Criteria requiring buildable work (performance, security, availability) not reflected in tasks
|
| 146 |
+
|
| 147 |
+
#### F. Inconsistency
|
| 148 |
+
|
| 149 |
+
- Terminology drift (same concept named differently across files)
|
| 150 |
+
- Data entities referenced in plan but absent in spec (or vice versa)
|
| 151 |
+
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
|
| 152 |
+
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
|
| 153 |
+
|
| 154 |
+
### 5. Severity Assignment
|
| 155 |
+
|
| 156 |
+
Use this heuristic to prioritize findings:
|
| 157 |
+
|
| 158 |
+
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
|
| 159 |
+
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
|
| 160 |
+
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
|
| 161 |
+
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
|
| 162 |
+
|
| 163 |
+
### 6. Produce Compact Analysis Report
|
| 164 |
+
|
| 165 |
+
Output a Markdown report (no file writes) with the following structure:
|
| 166 |
+
|
| 167 |
+
## Specification Analysis Report
|
| 168 |
+
|
| 169 |
+
| ID | Category | Severity | Location(s) | Summary | Recommendation |
|
| 170 |
+
|----|----------|----------|-------------|---------|----------------|
|
| 171 |
+
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
|
| 172 |
+
|
| 173 |
+
(Add one row per finding; generate stable IDs prefixed by category initial.)
|
| 174 |
+
|
| 175 |
+
**Coverage Summary Table:**
|
| 176 |
+
|
| 177 |
+
| Requirement Key | Has Task? | Task IDs | Notes |
|
| 178 |
+
|-----------------|-----------|----------|-------|
|
| 179 |
+
|
| 180 |
+
**Constitution Alignment Issues:** (if any)
|
| 181 |
+
|
| 182 |
+
**Unmapped Tasks:** (if any)
|
| 183 |
+
|
| 184 |
+
**Metrics:**
|
| 185 |
+
|
| 186 |
+
- Total Requirements
|
| 187 |
+
- Total Tasks
|
| 188 |
+
- Coverage % (requirements with >=1 task)
|
| 189 |
+
- Ambiguity Count
|
| 190 |
+
- Duplication Count
|
| 191 |
+
- Critical Issues Count
|
| 192 |
+
|
| 193 |
+
### 7. Provide Next Actions
|
| 194 |
+
|
| 195 |
+
At end of report, output a concise Next Actions block:
|
| 196 |
+
|
| 197 |
+
- If CRITICAL issues exist: Recommend resolving before `/speckit-implement`
|
| 198 |
+
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
|
| 199 |
+
- Provide explicit command suggestions: e.g., "Run /speckit-specify with refinement", "Run /speckit-plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
|
| 200 |
+
|
| 201 |
+
### 8. Offer Remediation
|
| 202 |
+
|
| 203 |
+
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
|
| 204 |
+
|
| 205 |
+
### 9. Check for extension hooks
|
| 206 |
+
|
| 207 |
+
After reporting, check if `.specify/extensions.yml` exists in the project root.
|
| 208 |
+
- If it exists, read it and look for entries under the `hooks.after_analyze` key
|
| 209 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 210 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 211 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 212 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 213 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 214 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 215 |
+
- **Optional hook** (`optional: true`):
|
| 216 |
+
```
|
| 217 |
+
## Extension Hooks
|
| 218 |
+
|
| 219 |
+
**Optional Hook**: {extension}
|
| 220 |
+
Command: `/{command}`
|
| 221 |
+
Description: {description}
|
| 222 |
+
|
| 223 |
+
Prompt: {prompt}
|
| 224 |
+
To execute: `/{command}`
|
| 225 |
+
```
|
| 226 |
+
- **Mandatory hook** (`optional: false`):
|
| 227 |
+
```
|
| 228 |
+
## Extension Hooks
|
| 229 |
+
|
| 230 |
+
**Automatic Hook**: {extension}
|
| 231 |
+
Executing: `/{command}`
|
| 232 |
+
EXECUTE_COMMAND: {command}
|
| 233 |
+
```
|
| 234 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 235 |
+
|
| 236 |
+
## Operating Principles
|
| 237 |
+
|
| 238 |
+
### Context Efficiency
|
| 239 |
+
|
| 240 |
+
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
|
| 241 |
+
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
|
| 242 |
+
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
|
| 243 |
+
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
|
| 244 |
+
|
| 245 |
+
### Analysis Guidelines
|
| 246 |
+
|
| 247 |
+
- **NEVER modify files** (this is read-only analysis)
|
| 248 |
+
- **NEVER hallucinate missing sections** (if absent, report them accurately)
|
| 249 |
+
- **Prioritize constitution violations** (these are always CRITICAL)
|
| 250 |
+
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
|
| 251 |
+
- **Report zero issues gracefully** (emit success report with coverage statistics)
|
| 252 |
+
|
| 253 |
+
## Context
|
| 254 |
+
|
| 255 |
+
$ARGUMENTS
|
.agents/skills/speckit-checklist/SKILL.md
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-checklist"
|
| 3 |
+
description: "Generate a custom checklist for the current feature based on user requirements."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/checklist.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## Checklist Purpose: "Unit Tests for English"
|
| 12 |
+
|
| 13 |
+
**CRITICAL CONCEPT**: Checklists are **UNIT TESTS FOR REQUIREMENTS WRITING** - they validate the quality, clarity, and completeness of requirements in a given domain.
|
| 14 |
+
|
| 15 |
+
**NOT for verification/testing**:
|
| 16 |
+
|
| 17 |
+
- β NOT "Verify the button clicks correctly"
|
| 18 |
+
- β NOT "Test error handling works"
|
| 19 |
+
- β NOT "Confirm the API returns 200"
|
| 20 |
+
- β NOT checking if code/implementation matches the spec
|
| 21 |
+
|
| 22 |
+
**FOR requirements quality validation**:
|
| 23 |
+
|
| 24 |
+
- β
"Are visual hierarchy requirements defined for all card types?" (completeness)
|
| 25 |
+
- β
"Is 'prominent display' quantified with specific sizing/positioning?" (clarity)
|
| 26 |
+
- β
"Are hover state requirements consistent across all interactive elements?" (consistency)
|
| 27 |
+
- β
"Are accessibility requirements defined for keyboard navigation?" (coverage)
|
| 28 |
+
- β
"Does the spec define what happens when logo image fails to load?" (edge cases)
|
| 29 |
+
|
| 30 |
+
**Metaphor**: If your spec is code written in English, the checklist is its unit test suite. You're testing whether the requirements are well-written, complete, unambiguous, and ready for implementation - NOT whether the implementation works.
|
| 31 |
+
|
| 32 |
+
## User Input
|
| 33 |
+
|
| 34 |
+
```text
|
| 35 |
+
$ARGUMENTS
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 39 |
+
|
| 40 |
+
## Pre-Execution Checks
|
| 41 |
+
|
| 42 |
+
**Check for extension hooks (before checklist generation)**:
|
| 43 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 44 |
+
- If it exists, read it and look for entries under the `hooks.before_checklist` key
|
| 45 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 46 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 47 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 48 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 49 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 50 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 51 |
+
- **Optional hook** (`optional: true`):
|
| 52 |
+
```
|
| 53 |
+
## Extension Hooks
|
| 54 |
+
|
| 55 |
+
**Optional Pre-Hook**: {extension}
|
| 56 |
+
Command: `/{command}`
|
| 57 |
+
Description: {description}
|
| 58 |
+
|
| 59 |
+
Prompt: {prompt}
|
| 60 |
+
To execute: `/{command}`
|
| 61 |
+
```
|
| 62 |
+
- **Mandatory hook** (`optional: false`):
|
| 63 |
+
```
|
| 64 |
+
## Extension Hooks
|
| 65 |
+
|
| 66 |
+
**Automatic Pre-Hook**: {extension}
|
| 67 |
+
Executing: `/{command}`
|
| 68 |
+
EXECUTE_COMMAND: {command}
|
| 69 |
+
|
| 70 |
+
Wait for the result of the hook command before proceeding to the Execution Steps.
|
| 71 |
+
```
|
| 72 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 73 |
+
|
| 74 |
+
## Execution Steps
|
| 75 |
+
|
| 76 |
+
1. **Setup**: Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list.
|
| 77 |
+
- All file paths must be absolute.
|
| 78 |
+
- 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").
|
| 79 |
+
|
| 80 |
+
2. **Clarify intent (dynamic)**: Derive up to THREE initial contextual clarifying questions (no pre-baked catalog). They MUST:
|
| 81 |
+
- Be generated from the user's phrasing + extracted signals from spec/plan/tasks
|
| 82 |
+
- Only ask about information that materially changes checklist content
|
| 83 |
+
- Be skipped individually if already unambiguous in `$ARGUMENTS`
|
| 84 |
+
- Prefer precision over breadth
|
| 85 |
+
|
| 86 |
+
Generation algorithm:
|
| 87 |
+
1. Extract signals: feature domain keywords (e.g., auth, latency, UX, API), risk indicators ("critical", "must", "compliance"), stakeholder hints ("QA", "review", "security team"), and explicit deliverables ("a11y", "rollback", "contracts").
|
| 88 |
+
2. Cluster signals into candidate focus areas (max 4) ranked by relevance.
|
| 89 |
+
3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit.
|
| 90 |
+
4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria.
|
| 91 |
+
5. Formulate questions chosen from these archetypes:
|
| 92 |
+
- Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?")
|
| 93 |
+
- Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?")
|
| 94 |
+
- Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?")
|
| 95 |
+
- Audience framing (e.g., "Will this be used by the author only or peers during PR review?")
|
| 96 |
+
- Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?")
|
| 97 |
+
- Scenario class gap (e.g., "No recovery flows detectedβare rollback / partial failure paths in scope?")
|
| 98 |
+
|
| 99 |
+
Question formatting rules:
|
| 100 |
+
- If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters
|
| 101 |
+
- Limit to AβE options maximum; omit table if a free-form answer is clearer
|
| 102 |
+
- Never ask the user to restate what they already said
|
| 103 |
+
- Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope."
|
| 104 |
+
|
| 105 |
+
Defaults when interaction impossible:
|
| 106 |
+
- Depth: Standard
|
| 107 |
+
- Audience: Reviewer (PR) if code-related; Author otherwise
|
| 108 |
+
- Focus: Top 2 relevance clusters
|
| 109 |
+
|
| 110 |
+
Output the questions (label Q1/Q2/Q3). After answers: if β₯2 scenario classes (Alternate / Exception / Recovery / Non-Functional domain) remain unclear, you MAY ask up to TWO more targeted followβups (Q4/Q5) with a one-line justification each (e.g., "Unresolved recovery path risk"). Do not exceed five total questions. Skip escalation if user explicitly declines more.
|
| 111 |
+
|
| 112 |
+
3. **Understand user request**: Combine `$ARGUMENTS` + clarifying answers:
|
| 113 |
+
- Derive checklist theme (e.g., security, review, deploy, ux)
|
| 114 |
+
- Consolidate explicit must-have items mentioned by user
|
| 115 |
+
- Map focus selections to category scaffolding
|
| 116 |
+
- Infer any missing context from spec/plan/tasks (do NOT hallucinate)
|
| 117 |
+
|
| 118 |
+
4. **Load feature context**: Read from FEATURE_DIR:
|
| 119 |
+
- spec.md: Feature requirements and scope
|
| 120 |
+
- plan.md (if exists): Technical details, dependencies
|
| 121 |
+
- tasks.md (if exists): Implementation tasks
|
| 122 |
+
|
| 123 |
+
**Context Loading Strategy**:
|
| 124 |
+
- Load only necessary portions relevant to active focus areas (avoid full-file dumping)
|
| 125 |
+
- Prefer summarizing long sections into concise scenario/requirement bullets
|
| 126 |
+
- Use progressive disclosure: add follow-on retrieval only if gaps detected
|
| 127 |
+
- If source docs are large, generate interim summary items instead of embedding raw text
|
| 128 |
+
|
| 129 |
+
5. **Generate checklist** - Create "Unit Tests for Requirements":
|
| 130 |
+
- Create `FEATURE_DIR/checklists/` directory if it doesn't exist
|
| 131 |
+
- Generate unique checklist filename:
|
| 132 |
+
- Use short, descriptive name based on domain (e.g., `ux.md`, `api.md`, `security.md`)
|
| 133 |
+
- Format: `[domain].md`
|
| 134 |
+
- File handling behavior:
|
| 135 |
+
- If file does NOT exist: Create new file and number items starting from CHK001
|
| 136 |
+
- If file exists: Append new items to existing file, continuing from the last CHK ID (e.g., if last item is CHK015, start new items at CHK016)
|
| 137 |
+
- Never delete or replace existing checklist content - always preserve and append
|
| 138 |
+
|
| 139 |
+
**CORE PRINCIPLE - Test the Requirements, Not the Implementation**:
|
| 140 |
+
Every checklist item MUST evaluate the REQUIREMENTS THEMSELVES for:
|
| 141 |
+
- **Completeness**: Are all necessary requirements present?
|
| 142 |
+
- **Clarity**: Are requirements unambiguous and specific?
|
| 143 |
+
- **Consistency**: Do requirements align with each other?
|
| 144 |
+
- **Measurability**: Can requirements be objectively verified?
|
| 145 |
+
- **Coverage**: Are all scenarios/edge cases addressed?
|
| 146 |
+
|
| 147 |
+
**Category Structure** - Group items by requirement quality dimensions:
|
| 148 |
+
- **Requirement Completeness** (Are all necessary requirements documented?)
|
| 149 |
+
- **Requirement Clarity** (Are requirements specific and unambiguous?)
|
| 150 |
+
- **Requirement Consistency** (Do requirements align without conflicts?)
|
| 151 |
+
- **Acceptance Criteria Quality** (Are success criteria measurable?)
|
| 152 |
+
- **Scenario Coverage** (Are all flows/cases addressed?)
|
| 153 |
+
- **Edge Case Coverage** (Are boundary conditions defined?)
|
| 154 |
+
- **Non-Functional Requirements** (Performance, Security, Accessibility, etc. - are they specified?)
|
| 155 |
+
- **Dependencies & Assumptions** (Are they documented and validated?)
|
| 156 |
+
- **Ambiguities & Conflicts** (What needs clarification?)
|
| 157 |
+
|
| 158 |
+
**HOW TO WRITE CHECKLIST ITEMS - "Unit Tests for English"**:
|
| 159 |
+
|
| 160 |
+
β **WRONG** (Testing implementation):
|
| 161 |
+
- "Verify landing page displays 3 episode cards"
|
| 162 |
+
- "Test hover states work on desktop"
|
| 163 |
+
- "Confirm logo click navigates home"
|
| 164 |
+
|
| 165 |
+
β
**CORRECT** (Testing requirements quality):
|
| 166 |
+
- "Are the exact number and layout of featured episodes specified?" [Completeness]
|
| 167 |
+
- "Is 'prominent display' quantified with specific sizing/positioning?" [Clarity]
|
| 168 |
+
- "Are hover state requirements consistent across all interactive elements?" [Consistency]
|
| 169 |
+
- "Are keyboard navigation requirements defined for all interactive UI?" [Coverage]
|
| 170 |
+
- "Is the fallback behavior specified when logo image fails to load?" [Edge Cases]
|
| 171 |
+
- "Are loading states defined for asynchronous episode data?" [Completeness]
|
| 172 |
+
- "Does the spec define visual hierarchy for competing UI elements?" [Clarity]
|
| 173 |
+
|
| 174 |
+
**ITEM STRUCTURE**:
|
| 175 |
+
Each item should follow this pattern:
|
| 176 |
+
- Question format asking about requirement quality
|
| 177 |
+
- Focus on what's WRITTEN (or not written) in the spec/plan
|
| 178 |
+
- Include quality dimension in brackets [Completeness/Clarity/Consistency/etc.]
|
| 179 |
+
- Reference spec section `[Spec Β§X.Y]` when checking existing requirements
|
| 180 |
+
- Use `[Gap]` marker when checking for missing requirements
|
| 181 |
+
|
| 182 |
+
**EXAMPLES BY QUALITY DIMENSION**:
|
| 183 |
+
|
| 184 |
+
Completeness:
|
| 185 |
+
- "Are error handling requirements defined for all API failure modes? [Gap]"
|
| 186 |
+
- "Are accessibility requirements specified for all interactive elements? [Completeness]"
|
| 187 |
+
- "Are mobile breakpoint requirements defined for responsive layouts? [Gap]"
|
| 188 |
+
|
| 189 |
+
Clarity:
|
| 190 |
+
- "Is 'fast loading' quantified with specific timing thresholds? [Clarity, Spec Β§NFR-2]"
|
| 191 |
+
- "Are 'related episodes' selection criteria explicitly defined? [Clarity, Spec Β§FR-5]"
|
| 192 |
+
- "Is 'prominent' defined with measurable visual properties? [Ambiguity, Spec Β§FR-4]"
|
| 193 |
+
|
| 194 |
+
Consistency:
|
| 195 |
+
- "Do navigation requirements align across all pages? [Consistency, Spec Β§FR-10]"
|
| 196 |
+
- "Are card component requirements consistent between landing and detail pages? [Consistency]"
|
| 197 |
+
|
| 198 |
+
Coverage:
|
| 199 |
+
- "Are requirements defined for zero-state scenarios (no episodes)? [Coverage, Edge Case]"
|
| 200 |
+
- "Are concurrent user interaction scenarios addressed? [Coverage, Gap]"
|
| 201 |
+
- "Are requirements specified for partial data loading failures? [Coverage, Exception Flow]"
|
| 202 |
+
|
| 203 |
+
Measurability:
|
| 204 |
+
- "Are visual hierarchy requirements measurable/testable? [Acceptance Criteria, Spec Β§FR-1]"
|
| 205 |
+
- "Can 'balanced visual weight' be objectively verified? [Measurability, Spec Β§FR-2]"
|
| 206 |
+
|
| 207 |
+
**Scenario Classification & Coverage** (Requirements Quality Focus):
|
| 208 |
+
- Check if requirements exist for: Primary, Alternate, Exception/Error, Recovery, Non-Functional scenarios
|
| 209 |
+
- For each scenario class, ask: "Are [scenario type] requirements complete, clear, and consistent?"
|
| 210 |
+
- If scenario class missing: "Are [scenario type] requirements intentionally excluded or missing? [Gap]"
|
| 211 |
+
- Include resilience/rollback when state mutation occurs: "Are rollback requirements defined for migration failures? [Gap]"
|
| 212 |
+
|
| 213 |
+
**Traceability Requirements**:
|
| 214 |
+
- MINIMUM: β₯80% of items MUST include at least one traceability reference
|
| 215 |
+
- Each item should reference: spec section `[Spec Β§X.Y]`, or use markers: `[Gap]`, `[Ambiguity]`, `[Conflict]`, `[Assumption]`
|
| 216 |
+
- If no ID system exists: "Is a requirement & acceptance criteria ID scheme established? [Traceability]"
|
| 217 |
+
|
| 218 |
+
**Surface & Resolve Issues** (Requirements Quality Problems):
|
| 219 |
+
Ask questions about the requirements themselves:
|
| 220 |
+
- Ambiguities: "Is the term 'fast' quantified with specific metrics? [Ambiguity, Spec Β§NFR-1]"
|
| 221 |
+
- Conflicts: "Do navigation requirements conflict between Β§FR-10 and Β§FR-10a? [Conflict]"
|
| 222 |
+
- Assumptions: "Is the assumption of 'always available podcast API' validated? [Assumption]"
|
| 223 |
+
- Dependencies: "Are external podcast API requirements documented? [Dependency, Gap]"
|
| 224 |
+
- Missing definitions: "Is 'visual hierarchy' defined with measurable criteria? [Gap]"
|
| 225 |
+
|
| 226 |
+
**Content Consolidation**:
|
| 227 |
+
- Soft cap: If raw candidate items > 40, prioritize by risk/impact
|
| 228 |
+
- Merge near-duplicates checking the same requirement aspect
|
| 229 |
+
- If >5 low-impact edge cases, create one item: "Are edge cases X, Y, Z addressed in requirements? [Coverage]"
|
| 230 |
+
|
| 231 |
+
**π« ABSOLUTELY PROHIBITED** - These make it an implementation test, not a requirements test:
|
| 232 |
+
- β Any item starting with "Verify", "Test", "Confirm", "Check" + implementation behavior
|
| 233 |
+
- β References to code execution, user actions, system behavior
|
| 234 |
+
- β "Displays correctly", "works properly", "functions as expected"
|
| 235 |
+
- β "Click", "navigate", "render", "load", "execute"
|
| 236 |
+
- β Test cases, test plans, QA procedures
|
| 237 |
+
- β Implementation details (frameworks, APIs, algorithms)
|
| 238 |
+
|
| 239 |
+
**β
REQUIRED PATTERNS** - These test requirements quality:
|
| 240 |
+
- β
"Are [requirement type] defined/specified/documented for [scenario]?"
|
| 241 |
+
- β
"Is [vague term] quantified/clarified with specific criteria?"
|
| 242 |
+
- β
"Are requirements consistent between [section A] and [section B]?"
|
| 243 |
+
- β
"Can [requirement] be objectively measured/verified?"
|
| 244 |
+
- β
"Are [edge cases/scenarios] addressed in requirements?"
|
| 245 |
+
- β
"Does the spec define [missing aspect]?"
|
| 246 |
+
|
| 247 |
+
6. **Structure Reference**: Generate the checklist following the canonical template in `.specify/templates/checklist-template.md` for title, meta section, category headings, and ID formatting. If template is unavailable, use: H1 title, purpose/created meta lines, `##` category sections containing `- [ ] CHK### <requirement item>` lines with globally incrementing IDs starting at CHK001.
|
| 248 |
+
|
| 249 |
+
7. **Report**: Output full path to checklist file, item count, and summarize whether the run created a new file or appended to an existing one. Summarize:
|
| 250 |
+
- Focus areas selected
|
| 251 |
+
- Depth level
|
| 252 |
+
- Actor/timing
|
| 253 |
+
- Any explicit user-specified must-have items incorporated
|
| 254 |
+
|
| 255 |
+
**Important**: Each `/speckit-checklist` command invocation uses a short, descriptive checklist filename and either creates a new file or appends to an existing one. This allows:
|
| 256 |
+
|
| 257 |
+
- Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`)
|
| 258 |
+
- Simple, memorable filenames that indicate checklist purpose
|
| 259 |
+
- Easy identification and navigation in the `checklists/` folder
|
| 260 |
+
|
| 261 |
+
To avoid clutter, use descriptive types and clean up obsolete checklists when done.
|
| 262 |
+
|
| 263 |
+
## Example Checklist Types & Sample Items
|
| 264 |
+
|
| 265 |
+
**UX Requirements Quality:** `ux.md`
|
| 266 |
+
|
| 267 |
+
Sample items (testing the requirements, NOT the implementation):
|
| 268 |
+
|
| 269 |
+
- "Are visual hierarchy requirements defined with measurable criteria? [Clarity, Spec Β§FR-1]"
|
| 270 |
+
- "Is the number and positioning of UI elements explicitly specified? [Completeness, Spec Β§FR-1]"
|
| 271 |
+
- "Are interaction state requirements (hover, focus, active) consistently defined? [Consistency]"
|
| 272 |
+
- "Are accessibility requirements specified for all interactive elements? [Coverage, Gap]"
|
| 273 |
+
- "Is fallback behavior defined when images fail to load? [Edge Case, Gap]"
|
| 274 |
+
- "Can 'prominent display' be objectively measured? [Measurability, Spec Β§FR-4]"
|
| 275 |
+
|
| 276 |
+
**API Requirements Quality:** `api.md`
|
| 277 |
+
|
| 278 |
+
Sample items:
|
| 279 |
+
|
| 280 |
+
- "Are error response formats specified for all failure scenarios? [Completeness]"
|
| 281 |
+
- "Are rate limiting requirements quantified with specific thresholds? [Clarity]"
|
| 282 |
+
- "Are authentication requirements consistent across all endpoints? [Consistency]"
|
| 283 |
+
- "Are retry/timeout requirements defined for external dependencies? [Coverage, Gap]"
|
| 284 |
+
- "Is versioning strategy documented in requirements? [Gap]"
|
| 285 |
+
|
| 286 |
+
**Performance Requirements Quality:** `performance.md`
|
| 287 |
+
|
| 288 |
+
Sample items:
|
| 289 |
+
|
| 290 |
+
- "Are performance requirements quantified with specific metrics? [Clarity]"
|
| 291 |
+
- "Are performance targets defined for all critical user journeys? [Coverage]"
|
| 292 |
+
- "Are performance requirements under different load conditions specified? [Completeness]"
|
| 293 |
+
- "Can performance requirements be objectively measured? [Measurability]"
|
| 294 |
+
- "Are degradation requirements defined for high-load scenarios? [Edge Case, Gap]"
|
| 295 |
+
|
| 296 |
+
**Security Requirements Quality:** `security.md`
|
| 297 |
+
|
| 298 |
+
Sample items:
|
| 299 |
+
|
| 300 |
+
- "Are authentication requirements specified for all protected resources? [Coverage]"
|
| 301 |
+
- "Are data protection requirements defined for sensitive information? [Completeness]"
|
| 302 |
+
- "Is the threat model documented and requirements aligned to it? [Traceability]"
|
| 303 |
+
- "Are security requirements consistent with compliance obligations? [Consistency]"
|
| 304 |
+
- "Are security failure/breach response requirements defined? [Gap, Exception Flow]"
|
| 305 |
+
|
| 306 |
+
## Anti-Examples: What NOT To Do
|
| 307 |
+
|
| 308 |
+
**β WRONG - These test implementation, not requirements:**
|
| 309 |
+
|
| 310 |
+
```markdown
|
| 311 |
+
- [ ] CHK001 - Verify landing page displays 3 episode cards [Spec Β§FR-001]
|
| 312 |
+
- [ ] CHK002 - Test hover states work correctly on desktop [Spec Β§FR-003]
|
| 313 |
+
- [ ] CHK003 - Confirm logo click navigates to home page [Spec Β§FR-010]
|
| 314 |
+
- [ ] CHK004 - Check that related episodes section shows 3-5 items [Spec Β§FR-005]
|
| 315 |
+
```
|
| 316 |
+
|
| 317 |
+
**β
CORRECT - These test requirements quality:**
|
| 318 |
+
|
| 319 |
+
```markdown
|
| 320 |
+
- [ ] CHK001 - Are the number and layout of featured episodes explicitly specified? [Completeness, Spec Β§FR-001]
|
| 321 |
+
- [ ] CHK002 - Are hover state requirements consistently defined for all interactive elements? [Consistency, Spec Β§FR-003]
|
| 322 |
+
- [ ] CHK003 - Are navigation requirements clear for all clickable brand elements? [Clarity, Spec Β§FR-010]
|
| 323 |
+
- [ ] CHK004 - Is the selection criteria for related episodes documented? [Gap, Spec Β§FR-005]
|
| 324 |
+
- [ ] CHK005 - Are loading state requirements defined for asynchronous episode data? [Gap]
|
| 325 |
+
- [ ] CHK006 - Can "visual hierarchy" requirements be objectively measured? [Measurability, Spec Β§FR-001]
|
| 326 |
+
```
|
| 327 |
+
|
| 328 |
+
**Key Differences:**
|
| 329 |
+
|
| 330 |
+
- Wrong: Tests if the system works correctly
|
| 331 |
+
- Correct: Tests if the requirements are written correctly
|
| 332 |
+
- Wrong: Verification of behavior
|
| 333 |
+
- Correct: Validation of requirement quality
|
| 334 |
+
- Wrong: "Does it do X?"
|
| 335 |
+
- Correct: "Is X clearly specified?"
|
| 336 |
+
|
| 337 |
+
## Post-Execution Checks
|
| 338 |
+
|
| 339 |
+
**Check for extension hooks (after checklist generation)**:
|
| 340 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 341 |
+
- If it exists, read it and look for entries under the `hooks.after_checklist` key
|
| 342 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 343 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 344 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 345 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 346 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 347 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 348 |
+
- **Optional hook** (`optional: true`):
|
| 349 |
+
```
|
| 350 |
+
## Extension Hooks
|
| 351 |
+
|
| 352 |
+
**Optional Hook**: {extension}
|
| 353 |
+
Command: `/{command}`
|
| 354 |
+
Description: {description}
|
| 355 |
+
|
| 356 |
+
Prompt: {prompt}
|
| 357 |
+
To execute: `/{command}`
|
| 358 |
+
```
|
| 359 |
+
- **Mandatory hook** (`optional: false`):
|
| 360 |
+
```
|
| 361 |
+
## Extension Hooks
|
| 362 |
+
|
| 363 |
+
**Automatic Hook**: {extension}
|
| 364 |
+
Executing: `/{command}`
|
| 365 |
+
EXECUTE_COMMAND: {command}
|
| 366 |
+
```
|
| 367 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.agents/skills/speckit-clarify/SKILL.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-clarify"
|
| 3 |
+
description: "Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/clarify.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before clarification)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_clarify` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Outline
|
| 54 |
+
|
| 55 |
+
Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
|
| 56 |
+
|
| 57 |
+
Note: This clarification workflow is expected to run (and be completed) BEFORE invoking `/speckit-plan`. If the user explicitly states they are skipping clarification (e.g., exploratory spike), you may proceed, but must warn that downstream rework risk increases.
|
| 58 |
+
|
| 59 |
+
Execution steps:
|
| 60 |
+
|
| 61 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly` from repo root **once** (combined `--json --paths-only` mode / `-Json -PathsOnly`). Parse minimal JSON payload fields:
|
| 62 |
+
- `FEATURE_DIR`
|
| 63 |
+
- `FEATURE_SPEC`
|
| 64 |
+
- (Optionally capture `IMPL_PLAN`, `TASKS` for future chained flows.)
|
| 65 |
+
- If JSON parsing fails, abort and instruct user to re-run `/speckit-specify` or verify feature branch environment.
|
| 66 |
+
- 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").
|
| 67 |
+
|
| 68 |
+
2. Load the current spec file. Perform a structured ambiguity & coverage scan using this taxonomy. For each category, mark status: Clear / Partial / Missing. Produce an internal coverage map used for prioritization (do not output raw map unless no questions will be asked).
|
| 69 |
+
|
| 70 |
+
Functional Scope & Behavior:
|
| 71 |
+
- Core user goals & success criteria
|
| 72 |
+
- Explicit out-of-scope declarations
|
| 73 |
+
- User roles / personas differentiation
|
| 74 |
+
|
| 75 |
+
Domain & Data Model:
|
| 76 |
+
- Entities, attributes, relationships
|
| 77 |
+
- Identity & uniqueness rules
|
| 78 |
+
- Lifecycle/state transitions
|
| 79 |
+
- Data volume / scale assumptions
|
| 80 |
+
|
| 81 |
+
Interaction & UX Flow:
|
| 82 |
+
- Critical user journeys / sequences
|
| 83 |
+
- Error/empty/loading states
|
| 84 |
+
- Accessibility or localization notes
|
| 85 |
+
|
| 86 |
+
Non-Functional Quality Attributes:
|
| 87 |
+
- Performance (latency, throughput targets)
|
| 88 |
+
- Scalability (horizontal/vertical, limits)
|
| 89 |
+
- Reliability & availability (uptime, recovery expectations)
|
| 90 |
+
- Observability (logging, metrics, tracing signals)
|
| 91 |
+
- Security & privacy (authN/Z, data protection, threat assumptions)
|
| 92 |
+
- Compliance / regulatory constraints (if any)
|
| 93 |
+
|
| 94 |
+
Integration & External Dependencies:
|
| 95 |
+
- External services/APIs and failure modes
|
| 96 |
+
- Data import/export formats
|
| 97 |
+
- Protocol/versioning assumptions
|
| 98 |
+
|
| 99 |
+
Edge Cases & Failure Handling:
|
| 100 |
+
- Negative scenarios
|
| 101 |
+
- Rate limiting / throttling
|
| 102 |
+
- Conflict resolution (e.g., concurrent edits)
|
| 103 |
+
|
| 104 |
+
Constraints & Tradeoffs:
|
| 105 |
+
- Technical constraints (language, storage, hosting)
|
| 106 |
+
- Explicit tradeoffs or rejected alternatives
|
| 107 |
+
|
| 108 |
+
Terminology & Consistency:
|
| 109 |
+
- Canonical glossary terms
|
| 110 |
+
- Avoided synonyms / deprecated terms
|
| 111 |
+
|
| 112 |
+
Completion Signals:
|
| 113 |
+
- Acceptance criteria testability
|
| 114 |
+
- Measurable Definition of Done style indicators
|
| 115 |
+
|
| 116 |
+
Misc / Placeholders:
|
| 117 |
+
- TODO markers / unresolved decisions
|
| 118 |
+
- Ambiguous adjectives ("robust", "intuitive") lacking quantification
|
| 119 |
+
|
| 120 |
+
For each category with Partial or Missing status, add a candidate question opportunity unless:
|
| 121 |
+
- Clarification would not materially change implementation or validation strategy
|
| 122 |
+
- Information is better deferred to planning phase (note internally)
|
| 123 |
+
|
| 124 |
+
3. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints:
|
| 125 |
+
- Maximum of 5 total questions across the whole session.
|
| 126 |
+
- Each question must be answerable with EITHER:
|
| 127 |
+
- A short multipleβchoice selection (2β5 distinct, mutually exclusive options), OR
|
| 128 |
+
- A one-word / shortβphrase answer (explicitly constrain: "Answer in <=5 words").
|
| 129 |
+
- Only include questions whose answers materially impact architecture, data modeling, task decomposition, test design, UX behavior, operational readiness, or compliance validation.
|
| 130 |
+
- Ensure category coverage balance: attempt to cover the highest impact unresolved categories first; avoid asking two low-impact questions when a single high-impact area (e.g., security posture) is unresolved.
|
| 131 |
+
- Exclude questions already answered, trivial stylistic preferences, or plan-level execution details (unless blocking correctness).
|
| 132 |
+
- Favor clarifications that reduce downstream rework risk or prevent misaligned acceptance tests.
|
| 133 |
+
- If more than 5 categories remain unresolved, select the top 5 by (Impact * Uncertainty) heuristic.
|
| 134 |
+
|
| 135 |
+
4. Sequential questioning loop (interactive):
|
| 136 |
+
- Present EXACTLY ONE question at a time.
|
| 137 |
+
- For multipleβchoice questions:
|
| 138 |
+
- **Analyze all options** and determine the **most suitable option** based on:
|
| 139 |
+
- Best practices for the project type
|
| 140 |
+
- Common patterns in similar implementations
|
| 141 |
+
- Risk reduction (security, performance, maintainability)
|
| 142 |
+
- Alignment with any explicit project goals or constraints visible in the spec
|
| 143 |
+
- Present your **recommended option prominently** at the top with clear reasoning (1-2 sentences explaining why this is the best choice).
|
| 144 |
+
- Format as: `**Recommended:** Option [X] - <reasoning>`
|
| 145 |
+
- Then render all options as a Markdown table:
|
| 146 |
+
|
| 147 |
+
| Option | Description |
|
| 148 |
+
|--------|-------------|
|
| 149 |
+
| A | <Option A description> |
|
| 150 |
+
| B | <Option B description> |
|
| 151 |
+
| C | <Option C description> (add D/E as needed up to 5) |
|
| 152 |
+
| Short | Provide a different short answer (<=5 words) (Include only if free-form alternative is appropriate) |
|
| 153 |
+
|
| 154 |
+
- After the table, add: `You can reply with the option letter (e.g., "A"), accept the recommendation by saying "yes" or "recommended", or provide your own short answer.`
|
| 155 |
+
- For shortβanswer style (no meaningful discrete options):
|
| 156 |
+
- Provide your **suggested answer** based on best practices and context.
|
| 157 |
+
- Format as: `**Suggested:** <your proposed answer> - <brief reasoning>`
|
| 158 |
+
- Then output: `Format: Short answer (<=5 words). You can accept the suggestion by saying "yes" or "suggested", or provide your own answer.`
|
| 159 |
+
- After the user answers:
|
| 160 |
+
- If the user replies with "yes", "recommended", or "suggested", use your previously stated recommendation/suggestion as the answer.
|
| 161 |
+
- Otherwise, validate the answer maps to one option or fits the <=5 word constraint.
|
| 162 |
+
- If ambiguous, ask for a quick disambiguation (count still belongs to same question; do not advance).
|
| 163 |
+
- Once satisfactory, record it in working memory (do not yet write to disk) and move to the next queued question.
|
| 164 |
+
- Stop asking further questions when:
|
| 165 |
+
- All critical ambiguities resolved early (remaining queued items become unnecessary), OR
|
| 166 |
+
- User signals completion ("done", "good", "no more"), OR
|
| 167 |
+
- You reach 5 asked questions.
|
| 168 |
+
- Never reveal future queued questions in advance.
|
| 169 |
+
- If no valid questions exist at start, immediately report no critical ambiguities.
|
| 170 |
+
|
| 171 |
+
5. Integration after EACH accepted answer (incremental update approach):
|
| 172 |
+
- Maintain in-memory representation of the spec (loaded once at start) plus the raw file contents.
|
| 173 |
+
- For the first integrated answer in this session:
|
| 174 |
+
- Ensure a `## Clarifications` section exists (create it just after the highest-level contextual/overview section per the spec template if missing).
|
| 175 |
+
- Under it, create (if not present) a `### Session YYYY-MM-DD` subheading for today.
|
| 176 |
+
- Append a bullet line immediately after acceptance: `- Q: <question> β A: <final answer>`.
|
| 177 |
+
- Then immediately apply the clarification to the most appropriate section(s):
|
| 178 |
+
- Functional ambiguity β Update or add a bullet in Functional Requirements.
|
| 179 |
+
- User interaction / actor distinction β Update User Stories or Actors subsection (if present) with clarified role, constraint, or scenario.
|
| 180 |
+
- Data shape / entities β Update Data Model (add fields, types, relationships) preserving ordering; note added constraints succinctly.
|
| 181 |
+
- Non-functional constraint β Add/modify measurable criteria in Success Criteria > Measurable Outcomes (convert vague adjective to metric or explicit target).
|
| 182 |
+
- Edge case / negative flow β Add a new bullet under Edge Cases / Error Handling (or create such subsection if template provides placeholder for it).
|
| 183 |
+
- Terminology conflict β Normalize term across spec; retain original only if necessary by adding `(formerly referred to as "X")` once.
|
| 184 |
+
- If the clarification invalidates an earlier ambiguous statement, replace that statement instead of duplicating; leave no obsolete contradictory text.
|
| 185 |
+
- Save the spec file AFTER each integration to minimize risk of context loss (atomic overwrite).
|
| 186 |
+
- Preserve formatting: do not reorder unrelated sections; keep heading hierarchy intact.
|
| 187 |
+
- Keep each inserted clarification minimal and testable (avoid narrative drift).
|
| 188 |
+
|
| 189 |
+
6. Validation (performed after EACH write plus final pass):
|
| 190 |
+
- Clarifications session contains exactly one bullet per accepted answer (no duplicates).
|
| 191 |
+
- Total asked (accepted) questions β€ 5.
|
| 192 |
+
- Updated sections contain no lingering vague placeholders the new answer was meant to resolve.
|
| 193 |
+
- No contradictory earlier statement remains (scan for now-invalid alternative choices removed).
|
| 194 |
+
- Markdown structure valid; only allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD`.
|
| 195 |
+
- Terminology consistency: same canonical term used across all updated sections.
|
| 196 |
+
|
| 197 |
+
7. Write the updated spec back to `FEATURE_SPEC`.
|
| 198 |
+
|
| 199 |
+
8. Report completion (after questioning loop ends or early termination):
|
| 200 |
+
- Number of questions asked & answered.
|
| 201 |
+
- Path to updated spec.
|
| 202 |
+
- Sections touched (list names).
|
| 203 |
+
- Coverage summary table listing each taxonomy category with Status: Resolved (was Partial/Missing and addressed), Deferred (exceeds question quota or better suited for planning), Clear (already sufficient), Outstanding (still Partial/Missing but low impact).
|
| 204 |
+
- If any Outstanding or Deferred remain, recommend whether to proceed to `/speckit-plan` or run `/speckit-clarify` again later post-plan.
|
| 205 |
+
- Suggested next command.
|
| 206 |
+
|
| 207 |
+
Behavior rules:
|
| 208 |
+
|
| 209 |
+
- If no meaningful ambiguities found (or all potential questions would be low-impact), respond: "No critical ambiguities detected worth formal clarification." and suggest proceeding.
|
| 210 |
+
- If spec file missing, instruct user to run `/speckit-specify` first (do not create a new spec here).
|
| 211 |
+
- Never exceed 5 total asked questions (clarification retries for a single question do not count as new questions).
|
| 212 |
+
- Avoid speculative tech stack questions unless the absence blocks functional clarity.
|
| 213 |
+
- Respect user early termination signals ("stop", "done", "proceed").
|
| 214 |
+
- If no questions asked due to full coverage, output a compact coverage summary (all categories Clear) then suggest advancing.
|
| 215 |
+
- If quota reached with unresolved high-impact categories remaining, explicitly flag them under Deferred with rationale.
|
| 216 |
+
|
| 217 |
+
Context for prioritization: $ARGUMENTS
|
| 218 |
+
|
| 219 |
+
## Post-Execution Checks
|
| 220 |
+
|
| 221 |
+
**Check for extension hooks (after clarification)**:
|
| 222 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 223 |
+
- If it exists, read it and look for entries under the `hooks.after_clarify` key
|
| 224 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 225 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 226 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 227 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 228 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 229 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 230 |
+
- **Optional hook** (`optional: true`):
|
| 231 |
+
```
|
| 232 |
+
## Extension Hooks
|
| 233 |
+
|
| 234 |
+
**Optional Hook**: {extension}
|
| 235 |
+
Command: `/{command}`
|
| 236 |
+
Description: {description}
|
| 237 |
+
|
| 238 |
+
Prompt: {prompt}
|
| 239 |
+
To execute: `/{command}`
|
| 240 |
+
```
|
| 241 |
+
- **Mandatory hook** (`optional: false`):
|
| 242 |
+
```
|
| 243 |
+
## Extension Hooks
|
| 244 |
+
|
| 245 |
+
**Automatic Hook**: {extension}
|
| 246 |
+
Executing: `/{command}`
|
| 247 |
+
EXECUTE_COMMAND: {command}
|
| 248 |
+
```
|
| 249 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.agents/skills/speckit-constitution/SKILL.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-constitution"
|
| 3 |
+
description: "Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/constitution.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before constitution update)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_constitution` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Outline
|
| 54 |
+
|
| 55 |
+
You are updating the project constitution at `.specify/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
|
| 56 |
+
|
| 57 |
+
**Note**: If `.specify/memory/constitution.md` does not exist yet, it should have been initialized from `.specify/templates/constitution-template.md` during project setup. If it's missing, copy the template first.
|
| 58 |
+
|
| 59 |
+
Follow this execution flow:
|
| 60 |
+
|
| 61 |
+
1. Load the existing constitution at `.specify/memory/constitution.md`.
|
| 62 |
+
- Identify every placeholder token of the form `[ALL_CAPS_IDENTIFIER]`.
|
| 63 |
+
**IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
|
| 64 |
+
|
| 65 |
+
2. Collect/derive values for placeholders:
|
| 66 |
+
- If user input (conversation) supplies a value, use it.
|
| 67 |
+
- Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded).
|
| 68 |
+
- For governance dates: `RATIFICATION_DATE` is the original adoption date (if unknown ask or mark TODO), `LAST_AMENDED_DATE` is today if changes are made, otherwise keep previous.
|
| 69 |
+
- `CONSTITUTION_VERSION` must increment according to semantic versioning rules:
|
| 70 |
+
- MAJOR: Backward incompatible governance/principle removals or redefinitions.
|
| 71 |
+
- MINOR: New principle/section added or materially expanded guidance.
|
| 72 |
+
- PATCH: Clarifications, wording, typo fixes, non-semantic refinements.
|
| 73 |
+
- If version bump type ambiguous, propose reasoning before finalizing.
|
| 74 |
+
|
| 75 |
+
3. Draft the updated constitution content:
|
| 76 |
+
- Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yetβexplicitly justify any left).
|
| 77 |
+
- Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance.
|
| 78 |
+
- Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing nonβnegotiable rules, explicit rationale if not obvious.
|
| 79 |
+
- Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations.
|
| 80 |
+
|
| 81 |
+
4. Consistency propagation checklist (convert prior checklist into active validations):
|
| 82 |
+
- Read `.specify/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
|
| 83 |
+
- Read `.specify/templates/spec-template.md` for scope/requirements alignmentβupdate if constitution adds/removes mandatory sections or constraints.
|
| 84 |
+
- Read `.specify/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
|
| 85 |
+
- Read each command file in `.specify/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
|
| 86 |
+
- Read any runtime guidance docs (e.g., `README.md`, `docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed.
|
| 87 |
+
|
| 88 |
+
5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
|
| 89 |
+
- Version change: old β new
|
| 90 |
+
- List of modified principles (old title β new title if renamed)
|
| 91 |
+
- Added sections
|
| 92 |
+
- Removed sections
|
| 93 |
+
- Templates requiring updates (β
updated / β pending) with file paths
|
| 94 |
+
- Follow-up TODOs if any placeholders intentionally deferred.
|
| 95 |
+
|
| 96 |
+
6. Validation before final output:
|
| 97 |
+
- No remaining unexplained bracket tokens.
|
| 98 |
+
- Version line matches report.
|
| 99 |
+
- Dates ISO format YYYY-MM-DD.
|
| 100 |
+
- Principles are declarative, testable, and free of vague language ("should" β replace with MUST/SHOULD rationale where appropriate).
|
| 101 |
+
|
| 102 |
+
7. Write the completed constitution back to `.specify/memory/constitution.md` (overwrite).
|
| 103 |
+
|
| 104 |
+
8. Output a final summary to the user with:
|
| 105 |
+
- New version and bump rationale.
|
| 106 |
+
- Any files flagged for manual follow-up.
|
| 107 |
+
- Suggested commit message (e.g., `docs: amend constitution to vX.Y.Z (principle additions + governance update)`).
|
| 108 |
+
|
| 109 |
+
Formatting & Style Requirements:
|
| 110 |
+
|
| 111 |
+
- Use Markdown headings exactly as in the template (do not demote/promote levels).
|
| 112 |
+
- Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks.
|
| 113 |
+
- Keep a single blank line between sections.
|
| 114 |
+
- Avoid trailing whitespace.
|
| 115 |
+
|
| 116 |
+
If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps.
|
| 117 |
+
|
| 118 |
+
If critical info missing (e.g., ratification date truly unknown), insert `TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items.
|
| 119 |
+
|
| 120 |
+
Do not create a new template; always operate on the existing `.specify/memory/constitution.md` file.
|
| 121 |
+
|
| 122 |
+
## Post-Execution Checks
|
| 123 |
+
|
| 124 |
+
**Check for extension hooks (after constitution update)**:
|
| 125 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 126 |
+
- If it exists, read it and look for entries under the `hooks.after_constitution` key
|
| 127 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 128 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 129 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 130 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 131 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 132 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 133 |
+
- **Optional hook** (`optional: true`):
|
| 134 |
+
```
|
| 135 |
+
## Extension Hooks
|
| 136 |
+
|
| 137 |
+
**Optional Hook**: {extension}
|
| 138 |
+
Command: `/{command}`
|
| 139 |
+
Description: {description}
|
| 140 |
+
|
| 141 |
+
Prompt: {prompt}
|
| 142 |
+
To execute: `/{command}`
|
| 143 |
+
```
|
| 144 |
+
- **Mandatory hook** (`optional: false`):
|
| 145 |
+
```
|
| 146 |
+
## Extension Hooks
|
| 147 |
+
|
| 148 |
+
**Automatic Hook**: {extension}
|
| 149 |
+
Executing: `/{command}`
|
| 150 |
+
EXECUTE_COMMAND: {command}
|
| 151 |
+
```
|
| 152 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.agents/skills/speckit-implement/SKILL.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-implement"
|
| 3 |
+
description: "Execute the implementation plan by processing and executing all tasks defined in tasks.md"
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/implement.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before implementation)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_implement` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Outline
|
| 54 |
+
|
| 55 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` 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").
|
| 56 |
+
|
| 57 |
+
2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
|
| 58 |
+
- Scan all checklist files in the checklists/ directory
|
| 59 |
+
- For each checklist, count:
|
| 60 |
+
- Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
|
| 61 |
+
- Completed items: Lines matching `- [X]` or `- [x]`
|
| 62 |
+
- Incomplete items: Lines matching `- [ ]`
|
| 63 |
+
- Create a status table:
|
| 64 |
+
|
| 65 |
+
```text
|
| 66 |
+
| Checklist | Total | Completed | Incomplete | Status |
|
| 67 |
+
|-----------|-------|-----------|------------|--------|
|
| 68 |
+
| ux.md | 12 | 12 | 0 | β PASS |
|
| 69 |
+
| test.md | 8 | 5 | 3 | β FAIL |
|
| 70 |
+
| security.md | 6 | 6 | 0 | β PASS |
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
- Calculate overall status:
|
| 74 |
+
- **PASS**: All checklists have 0 incomplete items
|
| 75 |
+
- **FAIL**: One or more checklists have incomplete items
|
| 76 |
+
|
| 77 |
+
- **If any checklist is incomplete**:
|
| 78 |
+
- Display the table with incomplete item counts
|
| 79 |
+
- **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
|
| 80 |
+
- Wait for user response before continuing
|
| 81 |
+
- If user says "no" or "wait" or "stop", halt execution
|
| 82 |
+
- If user says "yes" or "proceed" or "continue", proceed to step 3
|
| 83 |
+
|
| 84 |
+
- **If all checklists are complete**:
|
| 85 |
+
- Display the table showing all checklists passed
|
| 86 |
+
- Automatically proceed to step 3
|
| 87 |
+
|
| 88 |
+
3. Load and analyze the implementation context:
|
| 89 |
+
- **REQUIRED**: Read tasks.md for the complete task list and execution plan
|
| 90 |
+
- **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
|
| 91 |
+
- **IF EXISTS**: Read data-model.md for entities and relationships
|
| 92 |
+
- **IF EXISTS**: Read contracts/ for API specifications and test requirements
|
| 93 |
+
- **IF EXISTS**: Read research.md for technical decisions and constraints
|
| 94 |
+
- **IF EXISTS**: Read .specify/memory/constitution.md for governance constraints
|
| 95 |
+
- **IF EXISTS**: Read quickstart.md for integration scenarios
|
| 96 |
+
|
| 97 |
+
4. **Project Setup Verification**:
|
| 98 |
+
- **REQUIRED**: Create/verify ignore files based on actual project setup:
|
| 99 |
+
|
| 100 |
+
**Detection & Creation Logic**:
|
| 101 |
+
- Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
|
| 102 |
+
|
| 103 |
+
```sh
|
| 104 |
+
git rev-parse --git-dir 2>/dev/null
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
- Check if Dockerfile* exists or Docker in plan.md β create/verify .dockerignore
|
| 108 |
+
- Check if .eslintrc* exists β create/verify .eslintignore
|
| 109 |
+
- Check if eslint.config.* exists β ensure the config's `ignores` entries cover required patterns
|
| 110 |
+
- Check if .prettierrc* exists β create/verify .prettierignore
|
| 111 |
+
- Check if .npmrc or package.json exists β create/verify .npmignore (if publishing)
|
| 112 |
+
- Check if terraform files (*.tf) exist β create/verify .terraformignore
|
| 113 |
+
- Check if .helmignore needed (helm charts present) β create/verify .helmignore
|
| 114 |
+
|
| 115 |
+
**If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
|
| 116 |
+
**If ignore file missing**: Create with full pattern set for detected technology
|
| 117 |
+
|
| 118 |
+
**Common Patterns by Technology** (from plan.md tech stack):
|
| 119 |
+
- **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
|
| 120 |
+
- **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
|
| 121 |
+
- **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
|
| 122 |
+
- **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
|
| 123 |
+
- **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
|
| 124 |
+
- **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
|
| 125 |
+
- **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
|
| 126 |
+
- **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
|
| 127 |
+
- **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
|
| 128 |
+
- **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
|
| 129 |
+
- **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `*.dll`, `autom4te.cache/`, `config.status`, `config.log`, `.idea/`, `*.log`, `.env*`
|
| 130 |
+
- **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
|
| 131 |
+
- **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
|
| 132 |
+
- **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
|
| 133 |
+
|
| 134 |
+
**Tool-Specific Patterns**:
|
| 135 |
+
- **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
|
| 136 |
+
- **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
|
| 137 |
+
- **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
|
| 138 |
+
- **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
|
| 139 |
+
- **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
|
| 140 |
+
|
| 141 |
+
5. Parse tasks.md structure and extract:
|
| 142 |
+
- **Task phases**: Setup, Tests, Core, Integration, Polish
|
| 143 |
+
- **Task dependencies**: Sequential vs parallel execution rules
|
| 144 |
+
- **Task details**: ID, description, file paths, parallel markers [P]
|
| 145 |
+
- **Execution flow**: Order and dependency requirements
|
| 146 |
+
|
| 147 |
+
6. Execute implementation following the task plan:
|
| 148 |
+
- **Phase-by-phase execution**: Complete each phase before moving to the next
|
| 149 |
+
- **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
|
| 150 |
+
- **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
|
| 151 |
+
- **File-based coordination**: Tasks affecting the same files must run sequentially
|
| 152 |
+
- **Validation checkpoints**: Verify each phase completion before proceeding
|
| 153 |
+
|
| 154 |
+
7. Implementation execution rules:
|
| 155 |
+
- **Setup first**: Initialize project structure, dependencies, configuration
|
| 156 |
+
- **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
|
| 157 |
+
- **Core development**: Implement models, services, CLI commands, endpoints
|
| 158 |
+
- **Integration work**: Database connections, middleware, logging, external services
|
| 159 |
+
- **Polish and validation**: Unit tests, performance optimization, documentation
|
| 160 |
+
|
| 161 |
+
8. Progress tracking and error handling:
|
| 162 |
+
- Report progress after each completed task
|
| 163 |
+
- Halt execution if any non-parallel task fails
|
| 164 |
+
- For parallel tasks [P], continue with successful tasks, report failed ones
|
| 165 |
+
- Provide clear error messages with context for debugging
|
| 166 |
+
- Suggest next steps if implementation cannot proceed
|
| 167 |
+
- **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
|
| 168 |
+
|
| 169 |
+
9. Completion validation:
|
| 170 |
+
- Verify all required tasks are completed
|
| 171 |
+
- Check that implemented features match the original specification
|
| 172 |
+
- Validate that tests pass and coverage meets requirements
|
| 173 |
+
- Confirm the implementation follows the technical plan
|
| 174 |
+
- Report final status with summary of completed work
|
| 175 |
+
|
| 176 |
+
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.
|
| 177 |
+
|
| 178 |
+
10. **Check for extension hooks**: After completion validation, check if `.specify/extensions.yml` exists in the project root.
|
| 179 |
+
- If it exists, read it and look for entries under the `hooks.after_implement` key
|
| 180 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 181 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 182 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 183 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 184 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 185 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 186 |
+
- **Optional hook** (`optional: true`):
|
| 187 |
+
```
|
| 188 |
+
## Extension Hooks
|
| 189 |
+
|
| 190 |
+
**Optional Hook**: {extension}
|
| 191 |
+
Command: `/{command}`
|
| 192 |
+
Description: {description}
|
| 193 |
+
|
| 194 |
+
Prompt: {prompt}
|
| 195 |
+
To execute: `/{command}`
|
| 196 |
+
```
|
| 197 |
+
- **Mandatory hook** (`optional: false`):
|
| 198 |
+
```
|
| 199 |
+
## Extension Hooks
|
| 200 |
+
|
| 201 |
+
**Automatic Hook**: {extension}
|
| 202 |
+
Executing: `/{command}`
|
| 203 |
+
EXECUTE_COMMAND: {command}
|
| 204 |
+
```
|
| 205 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.agents/skills/speckit-plan/SKILL.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-plan"
|
| 3 |
+
description: "Execute the implementation planning workflow using the plan template to generate design artifacts."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/plan.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before planning)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_plan` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Outline
|
| 54 |
+
|
| 55 |
+
1. **Setup**: Run `.specify/scripts/powershell/setup-plan.ps1 -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").
|
| 56 |
+
|
| 57 |
+
2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied).
|
| 58 |
+
|
| 59 |
+
3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
|
| 60 |
+
- Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
|
| 61 |
+
- Fill Constitution Check section from constitution
|
| 62 |
+
- Evaluate gates (ERROR if violations unjustified)
|
| 63 |
+
- Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
|
| 64 |
+
- Phase 1: Generate data-model.md, contracts/, quickstart.md
|
| 65 |
+
- Phase 1: Update agent context by running the agent script
|
| 66 |
+
- Re-evaluate Constitution Check post-design
|
| 67 |
+
|
| 68 |
+
4. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
|
| 69 |
+
|
| 70 |
+
5. **Check for extension hooks**: After reporting, check if `.specify/extensions.yml` exists in the project root.
|
| 71 |
+
- If it exists, read it and look for entries under the `hooks.after_plan` key
|
| 72 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 73 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 74 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 75 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 76 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 77 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 78 |
+
- **Optional hook** (`optional: true`):
|
| 79 |
+
```
|
| 80 |
+
## Extension Hooks
|
| 81 |
+
|
| 82 |
+
**Optional Hook**: {extension}
|
| 83 |
+
Command: `/{command}`
|
| 84 |
+
Description: {description}
|
| 85 |
+
|
| 86 |
+
Prompt: {prompt}
|
| 87 |
+
To execute: `/{command}`
|
| 88 |
+
```
|
| 89 |
+
- **Mandatory hook** (`optional: false`):
|
| 90 |
+
```
|
| 91 |
+
## Extension Hooks
|
| 92 |
+
|
| 93 |
+
**Automatic Hook**: {extension}
|
| 94 |
+
Executing: `/{command}`
|
| 95 |
+
EXECUTE_COMMAND: {command}
|
| 96 |
+
```
|
| 97 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 98 |
+
|
| 99 |
+
## Phases
|
| 100 |
+
|
| 101 |
+
### Phase 0: Outline & Research
|
| 102 |
+
|
| 103 |
+
1. **Extract unknowns from Technical Context** above:
|
| 104 |
+
- For each NEEDS CLARIFICATION β research task
|
| 105 |
+
- For each dependency β best practices task
|
| 106 |
+
- For each integration β patterns task
|
| 107 |
+
|
| 108 |
+
2. **Generate and dispatch research agents**:
|
| 109 |
+
|
| 110 |
+
```text
|
| 111 |
+
For each unknown in Technical Context:
|
| 112 |
+
Task: "Research {unknown} for {feature context}"
|
| 113 |
+
For each technology choice:
|
| 114 |
+
Task: "Find best practices for {tech} in {domain}"
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
3. **Consolidate findings** in `research.md` using format:
|
| 118 |
+
- Decision: [what was chosen]
|
| 119 |
+
- Rationale: [why chosen]
|
| 120 |
+
- Alternatives considered: [what else evaluated]
|
| 121 |
+
|
| 122 |
+
**Output**: research.md with all NEEDS CLARIFICATION resolved
|
| 123 |
+
|
| 124 |
+
### Phase 1: Design & Contracts
|
| 125 |
+
|
| 126 |
+
**Prerequisites:** `research.md` complete
|
| 127 |
+
|
| 128 |
+
1. **Extract entities from feature spec** β `data-model.md`:
|
| 129 |
+
- Entity name, fields, relationships
|
| 130 |
+
- Validation rules from requirements
|
| 131 |
+
- State transitions if applicable
|
| 132 |
+
|
| 133 |
+
2. **Define interface contracts** (if project has external interfaces) β `/contracts/`:
|
| 134 |
+
- Identify what interfaces the project exposes to users or other systems
|
| 135 |
+
- Document the contract format appropriate for the project type
|
| 136 |
+
- Examples: public APIs for libraries, command schemas for CLI tools, endpoints for web services, grammars for parsers, UI contracts for applications
|
| 137 |
+
- Skip if project is purely internal (build scripts, one-off tools, etc.)
|
| 138 |
+
|
| 139 |
+
3. **Agent context update**:
|
| 140 |
+
- 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)
|
| 141 |
+
|
| 142 |
+
**Output**: data-model.md, /contracts/*, quickstart.md, updated agent context file
|
| 143 |
+
|
| 144 |
+
## Key rules
|
| 145 |
+
|
| 146 |
+
- Use absolute paths for filesystem operations; use project-relative paths for references in documentation and agent context files
|
| 147 |
+
- ERROR on gate failures or unresolved clarifications
|
.agents/skills/speckit-specify/SKILL.md
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-specify"
|
| 3 |
+
description: "Create or update the feature specification from a natural language feature description."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/specify.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before specification)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_specify` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Outline
|
| 54 |
+
|
| 55 |
+
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.
|
| 56 |
+
|
| 57 |
+
Given that feature description, do this:
|
| 58 |
+
|
| 59 |
+
1. **Generate a concise short name** (2-4 words) for the feature:
|
| 60 |
+
- Analyze the feature description and extract the most meaningful keywords
|
| 61 |
+
- Create a 2-4 word short name that captures the essence of the feature
|
| 62 |
+
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
| 63 |
+
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
| 64 |
+
- Keep it concise but descriptive enough to understand the feature at a glance
|
| 65 |
+
- Examples:
|
| 66 |
+
- "I want to add user authentication" β "user-auth"
|
| 67 |
+
- "Implement OAuth2 integration for the API" β "oauth2-api-integration"
|
| 68 |
+
- "Create a dashboard for analytics" β "analytics-dashboard"
|
| 69 |
+
- "Fix payment processing timeout bug" β "fix-payment-timeout"
|
| 70 |
+
|
| 71 |
+
2. **Branch creation** (optional, via hook):
|
| 72 |
+
|
| 73 |
+
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.
|
| 74 |
+
|
| 75 |
+
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).
|
| 76 |
+
|
| 77 |
+
3. **Create the spec feature directory**:
|
| 78 |
+
|
| 79 |
+
Specs live under the default `specs/` directory unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
|
| 80 |
+
|
| 81 |
+
**Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
|
| 82 |
+
1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
|
| 83 |
+
2. Otherwise, auto-generate it under `specs/`:
|
| 84 |
+
- Check `.specify/init-options.json` for `branch_numbering`
|
| 85 |
+
- If `"timestamp"`: prefix is `YYYYMMDD-HHMMSS` (current timestamp)
|
| 86 |
+
- If `"sequential"` or absent: prefix is `NNN` (next available 3-digit number after scanning existing directories in `specs/`)
|
| 87 |
+
- Construct the directory name: `<prefix>-<short-name>` (e.g., `003-user-auth` or `20260319-143022-user-auth`)
|
| 88 |
+
- Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<directory-name>`
|
| 89 |
+
|
| 90 |
+
**Create the directory and spec file**:
|
| 91 |
+
- `mkdir -p SPECIFY_FEATURE_DIRECTORY`
|
| 92 |
+
- Copy `.specify/templates/spec-template.md` to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
|
| 93 |
+
- Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
|
| 94 |
+
- Persist the resolved path to `.specify/feature.json`:
|
| 95 |
+
```json
|
| 96 |
+
{
|
| 97 |
+
"feature_directory": "<resolved feature dir>"
|
| 98 |
+
}
|
| 99 |
+
```
|
| 100 |
+
Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
|
| 101 |
+
This allows downstream commands (`/speckit-plan`, `/speckit-tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
|
| 102 |
+
|
| 103 |
+
**IMPORTANT**:
|
| 104 |
+
- You must only create one feature per `/speckit-specify` invocation
|
| 105 |
+
- The spec directory name and the git branch name are independent β they may be the same but that is the user's choice
|
| 106 |
+
- The spec directory and file are always created by this command, never by the hook
|
| 107 |
+
|
| 108 |
+
4. Load `.specify/templates/spec-template.md` to understand required sections.
|
| 109 |
+
|
| 110 |
+
5. Follow this execution flow:
|
| 111 |
+
1. Parse user description from arguments
|
| 112 |
+
If empty: ERROR "No feature description provided"
|
| 113 |
+
2. Extract key concepts from description
|
| 114 |
+
Identify: actors, actions, data, constraints
|
| 115 |
+
3. For unclear aspects:
|
| 116 |
+
- Make informed guesses based on context and industry standards
|
| 117 |
+
- Only mark with [NEEDS CLARIFICATION: specific question] if:
|
| 118 |
+
- The choice significantly impacts feature scope or user experience
|
| 119 |
+
- Multiple reasonable interpretations exist with different implications
|
| 120 |
+
- No reasonable default exists
|
| 121 |
+
- **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
|
| 122 |
+
- Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
|
| 123 |
+
4. Fill User Scenarios & Testing section
|
| 124 |
+
If no clear user flow: ERROR "Cannot determine user scenarios"
|
| 125 |
+
5. Generate Functional Requirements
|
| 126 |
+
Each requirement must be testable
|
| 127 |
+
Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
|
| 128 |
+
6. Define Success Criteria
|
| 129 |
+
Create measurable, technology-agnostic outcomes
|
| 130 |
+
Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
|
| 131 |
+
Each criterion must be verifiable without implementation details
|
| 132 |
+
7. Identify Key Entities (if data involved)
|
| 133 |
+
8. Return: SUCCESS (spec ready for planning)
|
| 134 |
+
|
| 135 |
+
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.
|
| 136 |
+
|
| 137 |
+
7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
|
| 138 |
+
|
| 139 |
+
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:
|
| 140 |
+
|
| 141 |
+
```markdown
|
| 142 |
+
# Specification Quality Checklist: [FEATURE NAME]
|
| 143 |
+
|
| 144 |
+
**Purpose**: Validate specification completeness and quality before proceeding to planning
|
| 145 |
+
**Created**: [DATE]
|
| 146 |
+
**Feature**: [Link to spec.md]
|
| 147 |
+
|
| 148 |
+
## Content Quality
|
| 149 |
+
|
| 150 |
+
- [ ] No implementation details (languages, frameworks, APIs)
|
| 151 |
+
- [ ] Focused on user value and business needs
|
| 152 |
+
- [ ] Written for non-technical stakeholders
|
| 153 |
+
- [ ] All mandatory sections completed
|
| 154 |
+
|
| 155 |
+
## Requirement Completeness
|
| 156 |
+
|
| 157 |
+
- [ ] No [NEEDS CLARIFICATION] markers remain
|
| 158 |
+
- [ ] Requirements are testable and unambiguous
|
| 159 |
+
- [ ] Success criteria are measurable
|
| 160 |
+
- [ ] Success criteria are technology-agnostic (no implementation details)
|
| 161 |
+
- [ ] All acceptance scenarios are defined
|
| 162 |
+
- [ ] Edge cases are identified
|
| 163 |
+
- [ ] Scope is clearly bounded
|
| 164 |
+
- [ ] Dependencies and assumptions identified
|
| 165 |
+
|
| 166 |
+
## Feature Readiness
|
| 167 |
+
|
| 168 |
+
- [ ] All functional requirements have clear acceptance criteria
|
| 169 |
+
- [ ] User scenarios cover primary flows
|
| 170 |
+
- [ ] Feature meets measurable outcomes defined in Success Criteria
|
| 171 |
+
- [ ] No implementation details leak into specification
|
| 172 |
+
|
| 173 |
+
## Notes
|
| 174 |
+
|
| 175 |
+
- Items marked incomplete require spec updates before `/speckit-clarify` or `/speckit-plan`
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
b. **Run Validation Check**: Review the spec against each checklist item:
|
| 179 |
+
- For each item, determine if it passes or fails
|
| 180 |
+
- Document specific issues found (quote relevant spec sections)
|
| 181 |
+
|
| 182 |
+
c. **Handle Validation Results**:
|
| 183 |
+
|
| 184 |
+
- **If all items pass**: Mark checklist complete and proceed to step 8
|
| 185 |
+
|
| 186 |
+
- **If items fail (excluding [NEEDS CLARIFICATION])**:
|
| 187 |
+
1. List the failing items and specific issues
|
| 188 |
+
2. Update the spec to address each issue
|
| 189 |
+
3. Re-run validation until all items pass (max 3 iterations)
|
| 190 |
+
4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
|
| 191 |
+
|
| 192 |
+
- **If [NEEDS CLARIFICATION] markers remain**:
|
| 193 |
+
1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
|
| 194 |
+
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
|
| 195 |
+
3. For each clarification needed (max 3), present options to user in this format:
|
| 196 |
+
|
| 197 |
+
```markdown
|
| 198 |
+
## Question [N]: [Topic]
|
| 199 |
+
|
| 200 |
+
**Context**: [Quote relevant spec section]
|
| 201 |
+
|
| 202 |
+
**What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
|
| 203 |
+
|
| 204 |
+
**Suggested Answers**:
|
| 205 |
+
|
| 206 |
+
| Option | Answer | Implications |
|
| 207 |
+
|--------|--------|--------------|
|
| 208 |
+
| A | [First suggested answer] | [What this means for the feature] |
|
| 209 |
+
| B | [Second suggested answer] | [What this means for the feature] |
|
| 210 |
+
| C | [Third suggested answer] | [What this means for the feature] |
|
| 211 |
+
| Custom | Provide your own answer | [Explain how to provide custom input] |
|
| 212 |
+
|
| 213 |
+
**Your choice**: _[Wait for user response]_
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
|
| 217 |
+
- Use consistent spacing with pipes aligned
|
| 218 |
+
- Each cell should have spaces around content: `| Content |` not `|Content|`
|
| 219 |
+
- Header separator must have at least 3 dashes: `|--------|`
|
| 220 |
+
- Test that the table renders correctly in markdown preview
|
| 221 |
+
5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
|
| 222 |
+
6. Present all questions together before waiting for responses
|
| 223 |
+
7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
|
| 224 |
+
8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
|
| 225 |
+
9. Re-run validation after all clarifications are resolved
|
| 226 |
+
|
| 227 |
+
d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
|
| 228 |
+
|
| 229 |
+
8. **Report completion** to the user with:
|
| 230 |
+
- `SPECIFY_FEATURE_DIRECTORY` β the feature directory path
|
| 231 |
+
- `SPEC_FILE` β the spec file path
|
| 232 |
+
- Checklist results summary
|
| 233 |
+
- Readiness for the next phase (`/speckit-clarify` or `/speckit-plan`)
|
| 234 |
+
|
| 235 |
+
9. **Check for extension hooks**: After reporting completion, check if `.specify/extensions.yml` exists in the project root.
|
| 236 |
+
- If it exists, read it and look for entries under the `hooks.after_specify` key
|
| 237 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 238 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 239 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 240 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 241 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 242 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 243 |
+
- **Optional hook** (`optional: true`):
|
| 244 |
+
```
|
| 245 |
+
## Extension Hooks
|
| 246 |
+
|
| 247 |
+
**Optional Hook**: {extension}
|
| 248 |
+
Command: `/{command}`
|
| 249 |
+
Description: {description}
|
| 250 |
+
|
| 251 |
+
Prompt: {prompt}
|
| 252 |
+
To execute: `/{command}`
|
| 253 |
+
```
|
| 254 |
+
- **Mandatory hook** (`optional: false`):
|
| 255 |
+
```
|
| 256 |
+
## Extension Hooks
|
| 257 |
+
|
| 258 |
+
**Automatic Hook**: {extension}
|
| 259 |
+
Executing: `/{command}`
|
| 260 |
+
EXECUTE_COMMAND: {command}
|
| 261 |
+
```
|
| 262 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 263 |
+
|
| 264 |
+
**NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
|
| 265 |
+
|
| 266 |
+
## Quick Guidelines
|
| 267 |
+
|
| 268 |
+
- Focus on **WHAT** users need and **WHY**.
|
| 269 |
+
- Avoid HOW to implement (no tech stack, APIs, code structure).
|
| 270 |
+
- Written for business stakeholders, not developers.
|
| 271 |
+
- DO NOT create any checklists that are embedded in the spec. That will be a separate command.
|
| 272 |
+
|
| 273 |
+
### Section Requirements
|
| 274 |
+
|
| 275 |
+
- **Mandatory sections**: Must be completed for every feature
|
| 276 |
+
- **Optional sections**: Include only when relevant to the feature
|
| 277 |
+
- When a section doesn't apply, remove it entirely (don't leave as "N/A")
|
| 278 |
+
|
| 279 |
+
### For AI Generation
|
| 280 |
+
|
| 281 |
+
When creating this spec from a user prompt:
|
| 282 |
+
|
| 283 |
+
1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
|
| 284 |
+
2. **Document assumptions**: Record reasonable defaults in the Assumptions section
|
| 285 |
+
3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
|
| 286 |
+
- Significantly impact feature scope or user experience
|
| 287 |
+
- Have multiple reasonable interpretations with different implications
|
| 288 |
+
- Lack any reasonable default
|
| 289 |
+
4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
|
| 290 |
+
5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
|
| 291 |
+
6. **Common areas needing clarification** (only if no reasonable default exists):
|
| 292 |
+
- Feature scope and boundaries (include/exclude specific use cases)
|
| 293 |
+
- User types and permissions (if multiple conflicting interpretations possible)
|
| 294 |
+
- Security/compliance requirements (when legally/financially significant)
|
| 295 |
+
|
| 296 |
+
**Examples of reasonable defaults** (don't ask about these):
|
| 297 |
+
|
| 298 |
+
- Data retention: Industry-standard practices for the domain
|
| 299 |
+
- Performance targets: Standard web/mobile app expectations unless specified
|
| 300 |
+
- Error handling: User-friendly messages with appropriate fallbacks
|
| 301 |
+
- Authentication method: Standard session-based or OAuth2 for web apps
|
| 302 |
+
- Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
|
| 303 |
+
|
| 304 |
+
### Success Criteria Guidelines
|
| 305 |
+
|
| 306 |
+
Success criteria must be:
|
| 307 |
+
|
| 308 |
+
1. **Measurable**: Include specific metrics (time, percentage, count, rate)
|
| 309 |
+
2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
|
| 310 |
+
3. **User-focused**: Describe outcomes from user/business perspective, not system internals
|
| 311 |
+
4. **Verifiable**: Can be tested/validated without knowing implementation details
|
| 312 |
+
|
| 313 |
+
**Good examples**:
|
| 314 |
+
|
| 315 |
+
- "Users can complete checkout in under 3 minutes"
|
| 316 |
+
- "System supports 10,000 concurrent users"
|
| 317 |
+
- "95% of searches return results in under 1 second"
|
| 318 |
+
- "Task completion rate improves by 40%"
|
| 319 |
+
|
| 320 |
+
**Bad examples** (implementation-focused):
|
| 321 |
+
|
| 322 |
+
- "API response time is under 200ms" (too technical, use "Users see results instantly")
|
| 323 |
+
- "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
|
| 324 |
+
- "React components render efficiently" (framework-specific)
|
| 325 |
+
- "Redis cache hit rate above 80%" (technology-specific)
|
.agents/skills/speckit-tasks/SKILL.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-tasks"
|
| 3 |
+
description: "Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/tasks.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before tasks generation)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_tasks` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Outline
|
| 54 |
+
|
| 55 |
+
1. **Setup**: Run `.specify/scripts/powershell/setup-tasks.ps1 -Json` from repo root and parse FEATURE_DIR, TASKS_TEMPLATE, and AVAILABLE_DOCS list. `FEATURE_DIR` and `TASKS_TEMPLATE` must be absolute paths when provided. `AVAILABLE_DOCS` is a list of document names/relative paths available under `FEATURE_DIR` (for example `research.md` or `contracts/`). 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").
|
| 56 |
+
|
| 57 |
+
2. **Load design documents**: Read from FEATURE_DIR:
|
| 58 |
+
- **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
|
| 59 |
+
- **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
|
| 60 |
+
- Note: Not all projects have all documents. Generate tasks based on what's available.
|
| 61 |
+
|
| 62 |
+
3. **Execute task generation workflow**:
|
| 63 |
+
- Load plan.md and extract tech stack, libraries, project structure
|
| 64 |
+
- Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
|
| 65 |
+
- If data-model.md exists: Extract entities and map to user stories
|
| 66 |
+
- If contracts/ exists: Map interface contracts to user stories
|
| 67 |
+
- If research.md exists: Extract decisions for setup tasks
|
| 68 |
+
- Generate tasks organized by user story (see Task Generation Rules below)
|
| 69 |
+
- Generate dependency graph showing user story completion order
|
| 70 |
+
- Create parallel execution examples per user story
|
| 71 |
+
- Validate task completeness (each user story has all needed tasks, independently testable)
|
| 72 |
+
|
| 73 |
+
4. **Generate tasks.md**: Read the tasks template from TASKS_TEMPLATE (from the JSON output above) and use it as structure. If TASKS_TEMPLATE is empty, fall back to `.specify/templates/tasks-template.md`. Fill with:
|
| 74 |
+
- Correct feature name from plan.md
|
| 75 |
+
- Phase 1: Setup tasks (project initialization)
|
| 76 |
+
- Phase 2: Foundational tasks (blocking prerequisites for all user stories)
|
| 77 |
+
- Phase 3+: One phase per user story (in priority order from spec.md)
|
| 78 |
+
- Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
|
| 79 |
+
- Final Phase: Polish & cross-cutting concerns
|
| 80 |
+
- All tasks must follow the strict checklist format (see Task Generation Rules below)
|
| 81 |
+
- Clear file paths for each task
|
| 82 |
+
- Dependencies section showing story completion order
|
| 83 |
+
- Parallel execution examples per story
|
| 84 |
+
- Implementation strategy section (MVP first, incremental delivery)
|
| 85 |
+
|
| 86 |
+
5. **Report**: Output path to generated tasks.md and summary:
|
| 87 |
+
- Total task count
|
| 88 |
+
- Task count per user story
|
| 89 |
+
- Parallel opportunities identified
|
| 90 |
+
- Independent test criteria for each story
|
| 91 |
+
- Suggested MVP scope (typically just User Story 1)
|
| 92 |
+
- Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
|
| 93 |
+
|
| 94 |
+
6. **Check for extension hooks**: After tasks.md is generated, check if `.specify/extensions.yml` exists in the project root.
|
| 95 |
+
- If it exists, read it and look for entries under the `hooks.after_tasks` key
|
| 96 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 97 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 98 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 99 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 100 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 101 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 102 |
+
- **Optional hook** (`optional: true`):
|
| 103 |
+
```
|
| 104 |
+
## Extension Hooks
|
| 105 |
+
|
| 106 |
+
**Optional Hook**: {extension}
|
| 107 |
+
Command: `/{command}`
|
| 108 |
+
Description: {description}
|
| 109 |
+
|
| 110 |
+
Prompt: {prompt}
|
| 111 |
+
To execute: `/{command}`
|
| 112 |
+
```
|
| 113 |
+
- **Mandatory hook** (`optional: false`):
|
| 114 |
+
```
|
| 115 |
+
## Extension Hooks
|
| 116 |
+
|
| 117 |
+
**Automatic Hook**: {extension}
|
| 118 |
+
Executing: `/{command}`
|
| 119 |
+
EXECUTE_COMMAND: {command}
|
| 120 |
+
```
|
| 121 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 122 |
+
|
| 123 |
+
Context for task generation: $ARGUMENTS
|
| 124 |
+
|
| 125 |
+
The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
|
| 126 |
+
|
| 127 |
+
## Task Generation Rules
|
| 128 |
+
|
| 129 |
+
**CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
|
| 130 |
+
|
| 131 |
+
**Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
|
| 132 |
+
|
| 133 |
+
### Checklist Format (REQUIRED)
|
| 134 |
+
|
| 135 |
+
Every task MUST strictly follow this format:
|
| 136 |
+
|
| 137 |
+
```text
|
| 138 |
+
- [ ] [TaskID] [P?] [Story?] Description with file path
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
**Format Components**:
|
| 142 |
+
|
| 143 |
+
1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
|
| 144 |
+
2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
|
| 145 |
+
3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
|
| 146 |
+
4. **[Story] label**: REQUIRED for user story phase tasks only
|
| 147 |
+
- Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
|
| 148 |
+
- Setup phase: NO story label
|
| 149 |
+
- Foundational phase: NO story label
|
| 150 |
+
- User Story phases: MUST have story label
|
| 151 |
+
- Polish phase: NO story label
|
| 152 |
+
5. **Description**: Clear action with exact file path
|
| 153 |
+
|
| 154 |
+
**Examples**:
|
| 155 |
+
|
| 156 |
+
- β
CORRECT: `- [ ] T001 Create project structure per implementation plan`
|
| 157 |
+
- β
CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
|
| 158 |
+
- β
CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
|
| 159 |
+
- β
CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
|
| 160 |
+
- β WRONG: `- [ ] Create User model` (missing ID and Story label)
|
| 161 |
+
- β WRONG: `T001 [US1] Create model` (missing checkbox)
|
| 162 |
+
- β WRONG: `- [ ] [US1] Create User model` (missing Task ID)
|
| 163 |
+
- β WRONG: `- [ ] T001 [US1] Create model` (missing file path)
|
| 164 |
+
|
| 165 |
+
### Task Organization
|
| 166 |
+
|
| 167 |
+
1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
|
| 168 |
+
- Each user story (P1, P2, P3...) gets its own phase
|
| 169 |
+
- Map all related components to their story:
|
| 170 |
+
- Models needed for that story
|
| 171 |
+
- Services needed for that story
|
| 172 |
+
- Interfaces/UI needed for that story
|
| 173 |
+
- If tests requested: Tests specific to that story
|
| 174 |
+
- Mark story dependencies (most stories should be independent)
|
| 175 |
+
|
| 176 |
+
2. **From Contracts**:
|
| 177 |
+
- Map each interface contract β to the user story it serves
|
| 178 |
+
- If tests requested: Each interface contract β contract test task [P] before implementation in that story's phase
|
| 179 |
+
|
| 180 |
+
3. **From Data Model**:
|
| 181 |
+
- Map each entity to the user story(ies) that need it
|
| 182 |
+
- If entity serves multiple stories: Put in earliest story or Setup phase
|
| 183 |
+
- Relationships β service layer tasks in appropriate story phase
|
| 184 |
+
|
| 185 |
+
4. **From Setup/Infrastructure**:
|
| 186 |
+
- Shared infrastructure β Setup phase (Phase 1)
|
| 187 |
+
- Foundational/blocking tasks β Foundational phase (Phase 2)
|
| 188 |
+
- Story-specific setup β within that story's phase
|
| 189 |
+
|
| 190 |
+
### Phase Structure
|
| 191 |
+
|
| 192 |
+
- **Phase 1**: Setup (project initialization)
|
| 193 |
+
- **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
|
| 194 |
+
- **Phase 3+**: User Stories in priority order (P1, P2, P3...)
|
| 195 |
+
- Within each story: Tests (if requested) β Models β Services β Endpoints β Integration
|
| 196 |
+
- Each phase should be a complete, independently testable increment
|
| 197 |
+
- **Final Phase**: Polish & Cross-Cutting Concerns
|
.agents/skills/speckit-taskstoissues/SKILL.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-taskstoissues"
|
| 3 |
+
description: "Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts."
|
| 4 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 5 |
+
metadata:
|
| 6 |
+
author: "github-spec-kit"
|
| 7 |
+
source: "templates/commands/taskstoissues.md"
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## User Input
|
| 12 |
+
|
| 13 |
+
```text
|
| 14 |
+
$ARGUMENTS
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 18 |
+
|
| 19 |
+
## Pre-Execution Checks
|
| 20 |
+
|
| 21 |
+
**Check for extension hooks (before tasks-to-issues conversion)**:
|
| 22 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 23 |
+
- If it exists, read it and look for entries under the `hooks.before_taskstoissues` key
|
| 24 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 25 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 26 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 27 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 28 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 29 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 30 |
+
- **Optional hook** (`optional: true`):
|
| 31 |
+
```
|
| 32 |
+
## Extension Hooks
|
| 33 |
+
|
| 34 |
+
**Optional Pre-Hook**: {extension}
|
| 35 |
+
Command: `/{command}`
|
| 36 |
+
Description: {description}
|
| 37 |
+
|
| 38 |
+
Prompt: {prompt}
|
| 39 |
+
To execute: `/{command}`
|
| 40 |
+
```
|
| 41 |
+
- **Mandatory hook** (`optional: false`):
|
| 42 |
+
```
|
| 43 |
+
## Extension Hooks
|
| 44 |
+
|
| 45 |
+
**Automatic Pre-Hook**: {extension}
|
| 46 |
+
Executing: `/{command}`
|
| 47 |
+
EXECUTE_COMMAND: {command}
|
| 48 |
+
|
| 49 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 50 |
+
```
|
| 51 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 52 |
+
|
| 53 |
+
## Outline
|
| 54 |
+
|
| 55 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` 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").
|
| 56 |
+
1. From the executed script, extract the path to **tasks**.
|
| 57 |
+
1. Get the Git remote by running:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
git config --get remote.origin.url
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
> [!CAUTION]
|
| 64 |
+
> ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
|
| 65 |
+
|
| 66 |
+
1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote.
|
| 67 |
+
|
| 68 |
+
> [!CAUTION]
|
| 69 |
+
> UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
|
| 70 |
+
|
| 71 |
+
## Post-Execution Checks
|
| 72 |
+
|
| 73 |
+
**Check for extension hooks (after tasks-to-issues conversion)**:
|
| 74 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 75 |
+
- If it exists, read it and look for entries under the `hooks.after_taskstoissues` key
|
| 76 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 77 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 78 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 79 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 80 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 81 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 82 |
+
- **Optional hook** (`optional: true`):
|
| 83 |
+
```
|
| 84 |
+
## Extension Hooks
|
| 85 |
+
|
| 86 |
+
**Optional Hook**: {extension}
|
| 87 |
+
Command: `/{command}`
|
| 88 |
+
Description: {description}
|
| 89 |
+
|
| 90 |
+
Prompt: {prompt}
|
| 91 |
+
To execute: `/{command}`
|
| 92 |
+
```
|
| 93 |
+
- **Mandatory hook** (`optional: false`):
|
| 94 |
+
```
|
| 95 |
+
## Extension Hooks
|
| 96 |
+
|
| 97 |
+
**Automatic Hook**: {extension}
|
| 98 |
+
Executing: `/{command}`
|
| 99 |
+
EXECUTE_COMMAND: {command}
|
| 100 |
+
```
|
| 101 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.claude/skills/speckit-analyze/SKILL.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-analyze"
|
| 3 |
+
description: "Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation."
|
| 4 |
+
argument-hint: "Optional focus areas for analysis"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/analyze.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before analysis)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_analyze` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Goal.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Goal
|
| 58 |
+
|
| 59 |
+
Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/speckit-tasks` has successfully produced a complete `tasks.md`.
|
| 60 |
+
|
| 61 |
+
## Operating Constraints
|
| 62 |
+
|
| 63 |
+
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
|
| 64 |
+
|
| 65 |
+
**Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasksβnot dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/speckit-analyze`.
|
| 66 |
+
|
| 67 |
+
## Execution Steps
|
| 68 |
+
|
| 69 |
+
### 1. Initialize Analysis Context
|
| 70 |
+
|
| 71 |
+
Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
|
| 72 |
+
|
| 73 |
+
- SPEC = FEATURE_DIR/spec.md
|
| 74 |
+
- PLAN = FEATURE_DIR/plan.md
|
| 75 |
+
- TASKS = FEATURE_DIR/tasks.md
|
| 76 |
+
|
| 77 |
+
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
|
| 78 |
+
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").
|
| 79 |
+
|
| 80 |
+
### 2. Load Artifacts (Progressive Disclosure)
|
| 81 |
+
|
| 82 |
+
Load only the minimal necessary context from each artifact:
|
| 83 |
+
|
| 84 |
+
**From spec.md:**
|
| 85 |
+
|
| 86 |
+
- Overview/Context
|
| 87 |
+
- Functional Requirements
|
| 88 |
+
- Success Criteria (measurable outcomes β e.g., performance, security, availability, user success, business impact)
|
| 89 |
+
- User Stories
|
| 90 |
+
- Edge Cases (if present)
|
| 91 |
+
|
| 92 |
+
**From plan.md:**
|
| 93 |
+
|
| 94 |
+
- Architecture/stack choices
|
| 95 |
+
- Data Model references
|
| 96 |
+
- Phases
|
| 97 |
+
- Technical constraints
|
| 98 |
+
|
| 99 |
+
**From tasks.md:**
|
| 100 |
+
|
| 101 |
+
- Task IDs
|
| 102 |
+
- Descriptions
|
| 103 |
+
- Phase grouping
|
| 104 |
+
- Parallel markers [P]
|
| 105 |
+
- Referenced file paths
|
| 106 |
+
|
| 107 |
+
**From constitution:**
|
| 108 |
+
|
| 109 |
+
- Load `.specify/memory/constitution.md` for principle validation
|
| 110 |
+
|
| 111 |
+
### 3. Build Semantic Models
|
| 112 |
+
|
| 113 |
+
Create internal representations (do not include raw artifacts in output):
|
| 114 |
+
|
| 115 |
+
- **Requirements inventory**: For each Functional Requirement (FR-###) and Success Criterion (SC-###), record a stable key. Use the explicit FR-/SC- identifier as the primary key when present, and optionally also derive an imperative-phrase slug for readability (e.g., "User can upload file" β `user-can-upload-file`). Include only Success Criteria items that require buildable work (e.g., load-testing infrastructure, security audit tooling), and exclude post-launch outcome metrics and business KPIs (e.g., "Reduce support tickets by 50%").
|
| 116 |
+
- **User story/action inventory**: Discrete user actions with acceptance criteria
|
| 117 |
+
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
|
| 118 |
+
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
|
| 119 |
+
|
| 120 |
+
### 4. Detection Passes (Token-Efficient Analysis)
|
| 121 |
+
|
| 122 |
+
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
|
| 123 |
+
|
| 124 |
+
#### A. Duplication Detection
|
| 125 |
+
|
| 126 |
+
- Identify near-duplicate requirements
|
| 127 |
+
- Mark lower-quality phrasing for consolidation
|
| 128 |
+
|
| 129 |
+
#### B. Ambiguity Detection
|
| 130 |
+
|
| 131 |
+
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
|
| 132 |
+
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
|
| 133 |
+
|
| 134 |
+
#### C. Underspecification
|
| 135 |
+
|
| 136 |
+
- Requirements with verbs but missing object or measurable outcome
|
| 137 |
+
- User stories missing acceptance criteria alignment
|
| 138 |
+
- Tasks referencing files or components not defined in spec/plan
|
| 139 |
+
|
| 140 |
+
#### D. Constitution Alignment
|
| 141 |
+
|
| 142 |
+
- Any requirement or plan element conflicting with a MUST principle
|
| 143 |
+
- Missing mandated sections or quality gates from constitution
|
| 144 |
+
|
| 145 |
+
#### E. Coverage Gaps
|
| 146 |
+
|
| 147 |
+
- Requirements with zero associated tasks
|
| 148 |
+
- Tasks with no mapped requirement/story
|
| 149 |
+
- Success Criteria requiring buildable work (performance, security, availability) not reflected in tasks
|
| 150 |
+
|
| 151 |
+
#### F. Inconsistency
|
| 152 |
+
|
| 153 |
+
- Terminology drift (same concept named differently across files)
|
| 154 |
+
- Data entities referenced in plan but absent in spec (or vice versa)
|
| 155 |
+
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
|
| 156 |
+
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
|
| 157 |
+
|
| 158 |
+
### 5. Severity Assignment
|
| 159 |
+
|
| 160 |
+
Use this heuristic to prioritize findings:
|
| 161 |
+
|
| 162 |
+
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
|
| 163 |
+
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
|
| 164 |
+
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
|
| 165 |
+
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
|
| 166 |
+
|
| 167 |
+
### 6. Produce Compact Analysis Report
|
| 168 |
+
|
| 169 |
+
Output a Markdown report (no file writes) with the following structure:
|
| 170 |
+
|
| 171 |
+
## Specification Analysis Report
|
| 172 |
+
|
| 173 |
+
| ID | Category | Severity | Location(s) | Summary | Recommendation |
|
| 174 |
+
|----|----------|----------|-------------|---------|----------------|
|
| 175 |
+
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
|
| 176 |
+
|
| 177 |
+
(Add one row per finding; generate stable IDs prefixed by category initial.)
|
| 178 |
+
|
| 179 |
+
**Coverage Summary Table:**
|
| 180 |
+
|
| 181 |
+
| Requirement Key | Has Task? | Task IDs | Notes |
|
| 182 |
+
|-----------------|-----------|----------|-------|
|
| 183 |
+
|
| 184 |
+
**Constitution Alignment Issues:** (if any)
|
| 185 |
+
|
| 186 |
+
**Unmapped Tasks:** (if any)
|
| 187 |
+
|
| 188 |
+
**Metrics:**
|
| 189 |
+
|
| 190 |
+
- Total Requirements
|
| 191 |
+
- Total Tasks
|
| 192 |
+
- Coverage % (requirements with >=1 task)
|
| 193 |
+
- Ambiguity Count
|
| 194 |
+
- Duplication Count
|
| 195 |
+
- Critical Issues Count
|
| 196 |
+
|
| 197 |
+
### 7. Provide Next Actions
|
| 198 |
+
|
| 199 |
+
At end of report, output a concise Next Actions block:
|
| 200 |
+
|
| 201 |
+
- If CRITICAL issues exist: Recommend resolving before `/speckit-implement`
|
| 202 |
+
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
|
| 203 |
+
- Provide explicit command suggestions: e.g., "Run /speckit-specify with refinement", "Run /speckit-plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
|
| 204 |
+
|
| 205 |
+
### 8. Offer Remediation
|
| 206 |
+
|
| 207 |
+
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
|
| 208 |
+
|
| 209 |
+
### 9. Check for extension hooks
|
| 210 |
+
|
| 211 |
+
After reporting, check if `.specify/extensions.yml` exists in the project root.
|
| 212 |
+
- If it exists, read it and look for entries under the `hooks.after_analyze` key
|
| 213 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 214 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 215 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 216 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 217 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 218 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 219 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 220 |
+
- **Optional hook** (`optional: true`):
|
| 221 |
+
```
|
| 222 |
+
## Extension Hooks
|
| 223 |
+
|
| 224 |
+
**Optional Hook**: {extension}
|
| 225 |
+
Command: `/{command}`
|
| 226 |
+
Description: {description}
|
| 227 |
+
|
| 228 |
+
Prompt: {prompt}
|
| 229 |
+
To execute: `/{command}`
|
| 230 |
+
```
|
| 231 |
+
- **Mandatory hook** (`optional: false`):
|
| 232 |
+
```
|
| 233 |
+
## Extension Hooks
|
| 234 |
+
|
| 235 |
+
**Automatic Hook**: {extension}
|
| 236 |
+
Executing: `/{command}`
|
| 237 |
+
EXECUTE_COMMAND: {command}
|
| 238 |
+
```
|
| 239 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 240 |
+
|
| 241 |
+
## Operating Principles
|
| 242 |
+
|
| 243 |
+
### Context Efficiency
|
| 244 |
+
|
| 245 |
+
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
|
| 246 |
+
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
|
| 247 |
+
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
|
| 248 |
+
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
|
| 249 |
+
|
| 250 |
+
### Analysis Guidelines
|
| 251 |
+
|
| 252 |
+
- **NEVER modify files** (this is read-only analysis)
|
| 253 |
+
- **NEVER hallucinate missing sections** (if absent, report them accurately)
|
| 254 |
+
- **Prioritize constitution violations** (these are always CRITICAL)
|
| 255 |
+
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
|
| 256 |
+
- **Report zero issues gracefully** (emit success report with coverage statistics)
|
| 257 |
+
|
| 258 |
+
## Context
|
| 259 |
+
|
| 260 |
+
$ARGUMENTS
|
.claude/skills/speckit-checklist/SKILL.md
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-checklist"
|
| 3 |
+
description: "Generate a custom checklist for the current feature based on user requirements."
|
| 4 |
+
argument-hint: "Domain or focus area for the checklist"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/checklist.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## Checklist Purpose: "Unit Tests for English"
|
| 15 |
+
|
| 16 |
+
**CRITICAL CONCEPT**: Checklists are **UNIT TESTS FOR REQUIREMENTS WRITING** - they validate the quality, clarity, and completeness of requirements in a given domain.
|
| 17 |
+
|
| 18 |
+
**NOT for verification/testing**:
|
| 19 |
+
|
| 20 |
+
- β NOT "Verify the button clicks correctly"
|
| 21 |
+
- β NOT "Test error handling works"
|
| 22 |
+
- β NOT "Confirm the API returns 200"
|
| 23 |
+
- β NOT checking if code/implementation matches the spec
|
| 24 |
+
|
| 25 |
+
**FOR requirements quality validation**:
|
| 26 |
+
|
| 27 |
+
- β
"Are visual hierarchy requirements defined for all card types?" (completeness)
|
| 28 |
+
- β
"Is 'prominent display' quantified with specific sizing/positioning?" (clarity)
|
| 29 |
+
- β
"Are hover state requirements consistent across all interactive elements?" (consistency)
|
| 30 |
+
- β
"Are accessibility requirements defined for keyboard navigation?" (coverage)
|
| 31 |
+
- β
"Does the spec define what happens when logo image fails to load?" (edge cases)
|
| 32 |
+
|
| 33 |
+
**Metaphor**: If your spec is code written in English, the checklist is its unit test suite. You're testing whether the requirements are well-written, complete, unambiguous, and ready for implementation - NOT whether the implementation works.
|
| 34 |
+
|
| 35 |
+
## User Input
|
| 36 |
+
|
| 37 |
+
```text
|
| 38 |
+
$ARGUMENTS
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 42 |
+
|
| 43 |
+
## Pre-Execution Checks
|
| 44 |
+
|
| 45 |
+
**Check for extension hooks (before checklist generation)**:
|
| 46 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 47 |
+
- If it exists, read it and look for entries under the `hooks.before_checklist` key
|
| 48 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 49 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 50 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 51 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 52 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 53 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 54 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 55 |
+
- **Optional hook** (`optional: true`):
|
| 56 |
+
```
|
| 57 |
+
## Extension Hooks
|
| 58 |
+
|
| 59 |
+
**Optional Pre-Hook**: {extension}
|
| 60 |
+
Command: `/{command}`
|
| 61 |
+
Description: {description}
|
| 62 |
+
|
| 63 |
+
Prompt: {prompt}
|
| 64 |
+
To execute: `/{command}`
|
| 65 |
+
```
|
| 66 |
+
- **Mandatory hook** (`optional: false`):
|
| 67 |
+
```
|
| 68 |
+
## Extension Hooks
|
| 69 |
+
|
| 70 |
+
**Automatic Pre-Hook**: {extension}
|
| 71 |
+
Executing: `/{command}`
|
| 72 |
+
EXECUTE_COMMAND: {command}
|
| 73 |
+
|
| 74 |
+
Wait for the result of the hook command before proceeding to the Execution Steps.
|
| 75 |
+
```
|
| 76 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 77 |
+
|
| 78 |
+
## Execution Steps
|
| 79 |
+
|
| 80 |
+
1. **Setup**: Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list.
|
| 81 |
+
- All file paths must be absolute.
|
| 82 |
+
- 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").
|
| 83 |
+
|
| 84 |
+
2. **Clarify intent (dynamic)**: Derive up to THREE initial contextual clarifying questions (no pre-baked catalog). They MUST:
|
| 85 |
+
- Be generated from the user's phrasing + extracted signals from spec/plan/tasks
|
| 86 |
+
- Only ask about information that materially changes checklist content
|
| 87 |
+
- Be skipped individually if already unambiguous in `$ARGUMENTS`
|
| 88 |
+
- Prefer precision over breadth
|
| 89 |
+
|
| 90 |
+
Generation algorithm:
|
| 91 |
+
1. Extract signals: feature domain keywords (e.g., auth, latency, UX, API), risk indicators ("critical", "must", "compliance"), stakeholder hints ("QA", "review", "security team"), and explicit deliverables ("a11y", "rollback", "contracts").
|
| 92 |
+
2. Cluster signals into candidate focus areas (max 4) ranked by relevance.
|
| 93 |
+
3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit.
|
| 94 |
+
4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria.
|
| 95 |
+
5. Formulate questions chosen from these archetypes:
|
| 96 |
+
- Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?")
|
| 97 |
+
- Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?")
|
| 98 |
+
- Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?")
|
| 99 |
+
- Audience framing (e.g., "Will this be used by the author only or peers during PR review?")
|
| 100 |
+
- Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?")
|
| 101 |
+
- Scenario class gap (e.g., "No recovery flows detectedβare rollback / partial failure paths in scope?")
|
| 102 |
+
|
| 103 |
+
Question formatting rules:
|
| 104 |
+
- If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters
|
| 105 |
+
- Limit to AβE options maximum; omit table if a free-form answer is clearer
|
| 106 |
+
- Never ask the user to restate what they already said
|
| 107 |
+
- Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope."
|
| 108 |
+
|
| 109 |
+
Defaults when interaction impossible:
|
| 110 |
+
- Depth: Standard
|
| 111 |
+
- Audience: Reviewer (PR) if code-related; Author otherwise
|
| 112 |
+
- Focus: Top 2 relevance clusters
|
| 113 |
+
|
| 114 |
+
Output the questions (label Q1/Q2/Q3). After answers: if β₯2 scenario classes (Alternate / Exception / Recovery / Non-Functional domain) remain unclear, you MAY ask up to TWO more targeted followβups (Q4/Q5) with a one-line justification each (e.g., "Unresolved recovery path risk"). Do not exceed five total questions. Skip escalation if user explicitly declines more.
|
| 115 |
+
|
| 116 |
+
3. **Understand user request**: Combine `$ARGUMENTS` + clarifying answers:
|
| 117 |
+
- Derive checklist theme (e.g., security, review, deploy, ux)
|
| 118 |
+
- Consolidate explicit must-have items mentioned by user
|
| 119 |
+
- Map focus selections to category scaffolding
|
| 120 |
+
- Infer any missing context from spec/plan/tasks (do NOT hallucinate)
|
| 121 |
+
|
| 122 |
+
4. **Load feature context**: Read from FEATURE_DIR:
|
| 123 |
+
- spec.md: Feature requirements and scope
|
| 124 |
+
- plan.md (if exists): Technical details, dependencies
|
| 125 |
+
- tasks.md (if exists): Implementation tasks
|
| 126 |
+
|
| 127 |
+
**Context Loading Strategy**:
|
| 128 |
+
- Load only necessary portions relevant to active focus areas (avoid full-file dumping)
|
| 129 |
+
- Prefer summarizing long sections into concise scenario/requirement bullets
|
| 130 |
+
- Use progressive disclosure: add follow-on retrieval only if gaps detected
|
| 131 |
+
- If source docs are large, generate interim summary items instead of embedding raw text
|
| 132 |
+
|
| 133 |
+
5. **Generate checklist** - Create "Unit Tests for Requirements":
|
| 134 |
+
- Create `FEATURE_DIR/checklists/` directory if it doesn't exist
|
| 135 |
+
- Generate unique checklist filename:
|
| 136 |
+
- Use short, descriptive name based on domain (e.g., `ux.md`, `api.md`, `security.md`)
|
| 137 |
+
- Format: `[domain].md`
|
| 138 |
+
- File handling behavior:
|
| 139 |
+
- If file does NOT exist: Create new file and number items starting from CHK001
|
| 140 |
+
- If file exists: Append new items to existing file, continuing from the last CHK ID (e.g., if last item is CHK015, start new items at CHK016)
|
| 141 |
+
- Never delete or replace existing checklist content - always preserve and append
|
| 142 |
+
|
| 143 |
+
**CORE PRINCIPLE - Test the Requirements, Not the Implementation**:
|
| 144 |
+
Every checklist item MUST evaluate the REQUIREMENTS THEMSELVES for:
|
| 145 |
+
- **Completeness**: Are all necessary requirements present?
|
| 146 |
+
- **Clarity**: Are requirements unambiguous and specific?
|
| 147 |
+
- **Consistency**: Do requirements align with each other?
|
| 148 |
+
- **Measurability**: Can requirements be objectively verified?
|
| 149 |
+
- **Coverage**: Are all scenarios/edge cases addressed?
|
| 150 |
+
|
| 151 |
+
**Category Structure** - Group items by requirement quality dimensions:
|
| 152 |
+
- **Requirement Completeness** (Are all necessary requirements documented?)
|
| 153 |
+
- **Requirement Clarity** (Are requirements specific and unambiguous?)
|
| 154 |
+
- **Requirement Consistency** (Do requirements align without conflicts?)
|
| 155 |
+
- **Acceptance Criteria Quality** (Are success criteria measurable?)
|
| 156 |
+
- **Scenario Coverage** (Are all flows/cases addressed?)
|
| 157 |
+
- **Edge Case Coverage** (Are boundary conditions defined?)
|
| 158 |
+
- **Non-Functional Requirements** (Performance, Security, Accessibility, etc. - are they specified?)
|
| 159 |
+
- **Dependencies & Assumptions** (Are they documented and validated?)
|
| 160 |
+
- **Ambiguities & Conflicts** (What needs clarification?)
|
| 161 |
+
|
| 162 |
+
**HOW TO WRITE CHECKLIST ITEMS - "Unit Tests for English"**:
|
| 163 |
+
|
| 164 |
+
β **WRONG** (Testing implementation):
|
| 165 |
+
- "Verify landing page displays 3 episode cards"
|
| 166 |
+
- "Test hover states work on desktop"
|
| 167 |
+
- "Confirm logo click navigates home"
|
| 168 |
+
|
| 169 |
+
β
**CORRECT** (Testing requirements quality):
|
| 170 |
+
- "Are the exact number and layout of featured episodes specified?" [Completeness]
|
| 171 |
+
- "Is 'prominent display' quantified with specific sizing/positioning?" [Clarity]
|
| 172 |
+
- "Are hover state requirements consistent across all interactive elements?" [Consistency]
|
| 173 |
+
- "Are keyboard navigation requirements defined for all interactive UI?" [Coverage]
|
| 174 |
+
- "Is the fallback behavior specified when logo image fails to load?" [Edge Cases]
|
| 175 |
+
- "Are loading states defined for asynchronous episode data?" [Completeness]
|
| 176 |
+
- "Does the spec define visual hierarchy for competing UI elements?" [Clarity]
|
| 177 |
+
|
| 178 |
+
**ITEM STRUCTURE**:
|
| 179 |
+
Each item should follow this pattern:
|
| 180 |
+
- Question format asking about requirement quality
|
| 181 |
+
- Focus on what's WRITTEN (or not written) in the spec/plan
|
| 182 |
+
- Include quality dimension in brackets [Completeness/Clarity/Consistency/etc.]
|
| 183 |
+
- Reference spec section `[Spec Β§X.Y]` when checking existing requirements
|
| 184 |
+
- Use `[Gap]` marker when checking for missing requirements
|
| 185 |
+
|
| 186 |
+
**EXAMPLES BY QUALITY DIMENSION**:
|
| 187 |
+
|
| 188 |
+
Completeness:
|
| 189 |
+
- "Are error handling requirements defined for all API failure modes? [Gap]"
|
| 190 |
+
- "Are accessibility requirements specified for all interactive elements? [Completeness]"
|
| 191 |
+
- "Are mobile breakpoint requirements defined for responsive layouts? [Gap]"
|
| 192 |
+
|
| 193 |
+
Clarity:
|
| 194 |
+
- "Is 'fast loading' quantified with specific timing thresholds? [Clarity, Spec Β§NFR-2]"
|
| 195 |
+
- "Are 'related episodes' selection criteria explicitly defined? [Clarity, Spec Β§FR-5]"
|
| 196 |
+
- "Is 'prominent' defined with measurable visual properties? [Ambiguity, Spec Β§FR-4]"
|
| 197 |
+
|
| 198 |
+
Consistency:
|
| 199 |
+
- "Do navigation requirements align across all pages? [Consistency, Spec Β§FR-10]"
|
| 200 |
+
- "Are card component requirements consistent between landing and detail pages? [Consistency]"
|
| 201 |
+
|
| 202 |
+
Coverage:
|
| 203 |
+
- "Are requirements defined for zero-state scenarios (no episodes)? [Coverage, Edge Case]"
|
| 204 |
+
- "Are concurrent user interaction scenarios addressed? [Coverage, Gap]"
|
| 205 |
+
- "Are requirements specified for partial data loading failures? [Coverage, Exception Flow]"
|
| 206 |
+
|
| 207 |
+
Measurability:
|
| 208 |
+
- "Are visual hierarchy requirements measurable/testable? [Acceptance Criteria, Spec Β§FR-1]"
|
| 209 |
+
- "Can 'balanced visual weight' be objectively verified? [Measurability, Spec Β§FR-2]"
|
| 210 |
+
|
| 211 |
+
**Scenario Classification & Coverage** (Requirements Quality Focus):
|
| 212 |
+
- Check if requirements exist for: Primary, Alternate, Exception/Error, Recovery, Non-Functional scenarios
|
| 213 |
+
- For each scenario class, ask: "Are [scenario type] requirements complete, clear, and consistent?"
|
| 214 |
+
- If scenario class missing: "Are [scenario type] requirements intentionally excluded or missing? [Gap]"
|
| 215 |
+
- Include resilience/rollback when state mutation occurs: "Are rollback requirements defined for migration failures? [Gap]"
|
| 216 |
+
|
| 217 |
+
**Traceability Requirements**:
|
| 218 |
+
- MINIMUM: β₯80% of items MUST include at least one traceability reference
|
| 219 |
+
- Each item should reference: spec section `[Spec Β§X.Y]`, or use markers: `[Gap]`, `[Ambiguity]`, `[Conflict]`, `[Assumption]`
|
| 220 |
+
- If no ID system exists: "Is a requirement & acceptance criteria ID scheme established? [Traceability]"
|
| 221 |
+
|
| 222 |
+
**Surface & Resolve Issues** (Requirements Quality Problems):
|
| 223 |
+
Ask questions about the requirements themselves:
|
| 224 |
+
- Ambiguities: "Is the term 'fast' quantified with specific metrics? [Ambiguity, Spec Β§NFR-1]"
|
| 225 |
+
- Conflicts: "Do navigation requirements conflict between Β§FR-10 and Β§FR-10a? [Conflict]"
|
| 226 |
+
- Assumptions: "Is the assumption of 'always available podcast API' validated? [Assumption]"
|
| 227 |
+
- Dependencies: "Are external podcast API requirements documented? [Dependency, Gap]"
|
| 228 |
+
- Missing definitions: "Is 'visual hierarchy' defined with measurable criteria? [Gap]"
|
| 229 |
+
|
| 230 |
+
**Content Consolidation**:
|
| 231 |
+
- Soft cap: If raw candidate items > 40, prioritize by risk/impact
|
| 232 |
+
- Merge near-duplicates checking the same requirement aspect
|
| 233 |
+
- If >5 low-impact edge cases, create one item: "Are edge cases X, Y, Z addressed in requirements? [Coverage]"
|
| 234 |
+
|
| 235 |
+
**π« ABSOLUTELY PROHIBITED** - These make it an implementation test, not a requirements test:
|
| 236 |
+
- β Any item starting with "Verify", "Test", "Confirm", "Check" + implementation behavior
|
| 237 |
+
- β References to code execution, user actions, system behavior
|
| 238 |
+
- β "Displays correctly", "works properly", "functions as expected"
|
| 239 |
+
- β "Click", "navigate", "render", "load", "execute"
|
| 240 |
+
- β Test cases, test plans, QA procedures
|
| 241 |
+
- β Implementation details (frameworks, APIs, algorithms)
|
| 242 |
+
|
| 243 |
+
**β
REQUIRED PATTERNS** - These test requirements quality:
|
| 244 |
+
- β
"Are [requirement type] defined/specified/documented for [scenario]?"
|
| 245 |
+
- β
"Is [vague term] quantified/clarified with specific criteria?"
|
| 246 |
+
- β
"Are requirements consistent between [section A] and [section B]?"
|
| 247 |
+
- β
"Can [requirement] be objectively measured/verified?"
|
| 248 |
+
- β
"Are [edge cases/scenarios] addressed in requirements?"
|
| 249 |
+
- β
"Does the spec define [missing aspect]?"
|
| 250 |
+
|
| 251 |
+
6. **Structure Reference**: Generate the checklist following the canonical template in `.specify/templates/checklist-template.md` for title, meta section, category headings, and ID formatting. If template is unavailable, use: H1 title, purpose/created meta lines, `##` category sections containing `- [ ] CHK### <requirement item>` lines with globally incrementing IDs starting at CHK001.
|
| 252 |
+
|
| 253 |
+
7. **Report**: Output full path to checklist file, item count, and summarize whether the run created a new file or appended to an existing one. Summarize:
|
| 254 |
+
- Focus areas selected
|
| 255 |
+
- Depth level
|
| 256 |
+
- Actor/timing
|
| 257 |
+
- Any explicit user-specified must-have items incorporated
|
| 258 |
+
|
| 259 |
+
**Important**: Each `/speckit-checklist` command invocation uses a short, descriptive checklist filename and either creates a new file or appends to an existing one. This allows:
|
| 260 |
+
|
| 261 |
+
- Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`)
|
| 262 |
+
- Simple, memorable filenames that indicate checklist purpose
|
| 263 |
+
- Easy identification and navigation in the `checklists/` folder
|
| 264 |
+
|
| 265 |
+
To avoid clutter, use descriptive types and clean up obsolete checklists when done.
|
| 266 |
+
|
| 267 |
+
## Example Checklist Types & Sample Items
|
| 268 |
+
|
| 269 |
+
**UX Requirements Quality:** `ux.md`
|
| 270 |
+
|
| 271 |
+
Sample items (testing the requirements, NOT the implementation):
|
| 272 |
+
|
| 273 |
+
- "Are visual hierarchy requirements defined with measurable criteria? [Clarity, Spec Β§FR-1]"
|
| 274 |
+
- "Is the number and positioning of UI elements explicitly specified? [Completeness, Spec Β§FR-1]"
|
| 275 |
+
- "Are interaction state requirements (hover, focus, active) consistently defined? [Consistency]"
|
| 276 |
+
- "Are accessibility requirements specified for all interactive elements? [Coverage, Gap]"
|
| 277 |
+
- "Is fallback behavior defined when images fail to load? [Edge Case, Gap]"
|
| 278 |
+
- "Can 'prominent display' be objectively measured? [Measurability, Spec Β§FR-4]"
|
| 279 |
+
|
| 280 |
+
**API Requirements Quality:** `api.md`
|
| 281 |
+
|
| 282 |
+
Sample items:
|
| 283 |
+
|
| 284 |
+
- "Are error response formats specified for all failure scenarios? [Completeness]"
|
| 285 |
+
- "Are rate limiting requirements quantified with specific thresholds? [Clarity]"
|
| 286 |
+
- "Are authentication requirements consistent across all endpoints? [Consistency]"
|
| 287 |
+
- "Are retry/timeout requirements defined for external dependencies? [Coverage, Gap]"
|
| 288 |
+
- "Is versioning strategy documented in requirements? [Gap]"
|
| 289 |
+
|
| 290 |
+
**Performance Requirements Quality:** `performance.md`
|
| 291 |
+
|
| 292 |
+
Sample items:
|
| 293 |
+
|
| 294 |
+
- "Are performance requirements quantified with specific metrics? [Clarity]"
|
| 295 |
+
- "Are performance targets defined for all critical user journeys? [Coverage]"
|
| 296 |
+
- "Are performance requirements under different load conditions specified? [Completeness]"
|
| 297 |
+
- "Can performance requirements be objectively measured? [Measurability]"
|
| 298 |
+
- "Are degradation requirements defined for high-load scenarios? [Edge Case, Gap]"
|
| 299 |
+
|
| 300 |
+
**Security Requirements Quality:** `security.md`
|
| 301 |
+
|
| 302 |
+
Sample items:
|
| 303 |
+
|
| 304 |
+
- "Are authentication requirements specified for all protected resources? [Coverage]"
|
| 305 |
+
- "Are data protection requirements defined for sensitive information? [Completeness]"
|
| 306 |
+
- "Is the threat model documented and requirements aligned to it? [Traceability]"
|
| 307 |
+
- "Are security requirements consistent with compliance obligations? [Consistency]"
|
| 308 |
+
- "Are security failure/breach response requirements defined? [Gap, Exception Flow]"
|
| 309 |
+
|
| 310 |
+
## Anti-Examples: What NOT To Do
|
| 311 |
+
|
| 312 |
+
**β WRONG - These test implementation, not requirements:**
|
| 313 |
+
|
| 314 |
+
```markdown
|
| 315 |
+
- [ ] CHK001 - Verify landing page displays 3 episode cards [Spec Β§FR-001]
|
| 316 |
+
- [ ] CHK002 - Test hover states work correctly on desktop [Spec Β§FR-003]
|
| 317 |
+
- [ ] CHK003 - Confirm logo click navigates to home page [Spec Β§FR-010]
|
| 318 |
+
- [ ] CHK004 - Check that related episodes section shows 3-5 items [Spec Β§FR-005]
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
**β
CORRECT - These test requirements quality:**
|
| 322 |
+
|
| 323 |
+
```markdown
|
| 324 |
+
- [ ] CHK001 - Are the number and layout of featured episodes explicitly specified? [Completeness, Spec Β§FR-001]
|
| 325 |
+
- [ ] CHK002 - Are hover state requirements consistently defined for all interactive elements? [Consistency, Spec Β§FR-003]
|
| 326 |
+
- [ ] CHK003 - Are navigation requirements clear for all clickable brand elements? [Clarity, Spec Β§FR-010]
|
| 327 |
+
- [ ] CHK004 - Is the selection criteria for related episodes documented? [Gap, Spec Β§FR-005]
|
| 328 |
+
- [ ] CHK005 - Are loading state requirements defined for asynchronous episode data? [Gap]
|
| 329 |
+
- [ ] CHK006 - Can "visual hierarchy" requirements be objectively measured? [Measurability, Spec Β§FR-001]
|
| 330 |
+
```
|
| 331 |
+
|
| 332 |
+
**Key Differences:**
|
| 333 |
+
|
| 334 |
+
- Wrong: Tests if the system works correctly
|
| 335 |
+
- Correct: Tests if the requirements are written correctly
|
| 336 |
+
- Wrong: Verification of behavior
|
| 337 |
+
- Correct: Validation of requirement quality
|
| 338 |
+
- Wrong: "Does it do X?"
|
| 339 |
+
- Correct: "Is X clearly specified?"
|
| 340 |
+
|
| 341 |
+
## Post-Execution Checks
|
| 342 |
+
|
| 343 |
+
**Check for extension hooks (after checklist generation)**:
|
| 344 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 345 |
+
- If it exists, read it and look for entries under the `hooks.after_checklist` key
|
| 346 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 347 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 348 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 349 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 350 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 351 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 352 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 353 |
+
- **Optional hook** (`optional: true`):
|
| 354 |
+
```
|
| 355 |
+
## Extension Hooks
|
| 356 |
+
|
| 357 |
+
**Optional Hook**: {extension}
|
| 358 |
+
Command: `/{command}`
|
| 359 |
+
Description: {description}
|
| 360 |
+
|
| 361 |
+
Prompt: {prompt}
|
| 362 |
+
To execute: `/{command}`
|
| 363 |
+
```
|
| 364 |
+
- **Mandatory hook** (`optional: false`):
|
| 365 |
+
```
|
| 366 |
+
## Extension Hooks
|
| 367 |
+
|
| 368 |
+
**Automatic Hook**: {extension}
|
| 369 |
+
Executing: `/{command}`
|
| 370 |
+
EXECUTE_COMMAND: {command}
|
| 371 |
+
```
|
| 372 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.claude/skills/speckit-clarify/SKILL.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-clarify"
|
| 3 |
+
description: "Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec."
|
| 4 |
+
argument-hint: "Optional areas to clarify in the spec"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/clarify.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before clarification)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_clarify` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Outline
|
| 58 |
+
|
| 59 |
+
Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
|
| 60 |
+
|
| 61 |
+
Note: This clarification workflow is expected to run (and be completed) BEFORE invoking `/speckit-plan`. If the user explicitly states they are skipping clarification (e.g., exploratory spike), you may proceed, but must warn that downstream rework risk increases.
|
| 62 |
+
|
| 63 |
+
Execution steps:
|
| 64 |
+
|
| 65 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly` from repo root **once** (combined `--json --paths-only` mode / `-Json -PathsOnly`). Parse minimal JSON payload fields:
|
| 66 |
+
- `FEATURE_DIR`
|
| 67 |
+
- `FEATURE_SPEC`
|
| 68 |
+
- (Optionally capture `IMPL_PLAN`, `TASKS` for future chained flows.)
|
| 69 |
+
- If JSON parsing fails, abort and instruct user to re-run `/speckit-specify` or verify feature branch environment.
|
| 70 |
+
- 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").
|
| 71 |
+
|
| 72 |
+
2. Load the current spec file. Perform a structured ambiguity & coverage scan using this taxonomy. For each category, mark status: Clear / Partial / Missing. Produce an internal coverage map used for prioritization (do not output raw map unless no questions will be asked).
|
| 73 |
+
|
| 74 |
+
Functional Scope & Behavior:
|
| 75 |
+
- Core user goals & success criteria
|
| 76 |
+
- Explicit out-of-scope declarations
|
| 77 |
+
- User roles / personas differentiation
|
| 78 |
+
|
| 79 |
+
Domain & Data Model:
|
| 80 |
+
- Entities, attributes, relationships
|
| 81 |
+
- Identity & uniqueness rules
|
| 82 |
+
- Lifecycle/state transitions
|
| 83 |
+
- Data volume / scale assumptions
|
| 84 |
+
|
| 85 |
+
Interaction & UX Flow:
|
| 86 |
+
- Critical user journeys / sequences
|
| 87 |
+
- Error/empty/loading states
|
| 88 |
+
- Accessibility or localization notes
|
| 89 |
+
|
| 90 |
+
Non-Functional Quality Attributes:
|
| 91 |
+
- Performance (latency, throughput targets)
|
| 92 |
+
- Scalability (horizontal/vertical, limits)
|
| 93 |
+
- Reliability & availability (uptime, recovery expectations)
|
| 94 |
+
- Observability (logging, metrics, tracing signals)
|
| 95 |
+
- Security & privacy (authN/Z, data protection, threat assumptions)
|
| 96 |
+
- Compliance / regulatory constraints (if any)
|
| 97 |
+
|
| 98 |
+
Integration & External Dependencies:
|
| 99 |
+
- External services/APIs and failure modes
|
| 100 |
+
- Data import/export formats
|
| 101 |
+
- Protocol/versioning assumptions
|
| 102 |
+
|
| 103 |
+
Edge Cases & Failure Handling:
|
| 104 |
+
- Negative scenarios
|
| 105 |
+
- Rate limiting / throttling
|
| 106 |
+
- Conflict resolution (e.g., concurrent edits)
|
| 107 |
+
|
| 108 |
+
Constraints & Tradeoffs:
|
| 109 |
+
- Technical constraints (language, storage, hosting)
|
| 110 |
+
- Explicit tradeoffs or rejected alternatives
|
| 111 |
+
|
| 112 |
+
Terminology & Consistency:
|
| 113 |
+
- Canonical glossary terms
|
| 114 |
+
- Avoided synonyms / deprecated terms
|
| 115 |
+
|
| 116 |
+
Completion Signals:
|
| 117 |
+
- Acceptance criteria testability
|
| 118 |
+
- Measurable Definition of Done style indicators
|
| 119 |
+
|
| 120 |
+
Misc / Placeholders:
|
| 121 |
+
- TODO markers / unresolved decisions
|
| 122 |
+
- Ambiguous adjectives ("robust", "intuitive") lacking quantification
|
| 123 |
+
|
| 124 |
+
For each category with Partial or Missing status, add a candidate question opportunity unless:
|
| 125 |
+
- Clarification would not materially change implementation or validation strategy
|
| 126 |
+
- Information is better deferred to planning phase (note internally)
|
| 127 |
+
|
| 128 |
+
3. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints:
|
| 129 |
+
- Maximum of 5 total questions across the whole session.
|
| 130 |
+
- Each question must be answerable with EITHER:
|
| 131 |
+
- A short multipleβchoice selection (2β5 distinct, mutually exclusive options), OR
|
| 132 |
+
- A one-word / shortβphrase answer (explicitly constrain: "Answer in <=5 words").
|
| 133 |
+
- Only include questions whose answers materially impact architecture, data modeling, task decomposition, test design, UX behavior, operational readiness, or compliance validation.
|
| 134 |
+
- Ensure category coverage balance: attempt to cover the highest impact unresolved categories first; avoid asking two low-impact questions when a single high-impact area (e.g., security posture) is unresolved.
|
| 135 |
+
- Exclude questions already answered, trivial stylistic preferences, or plan-level execution details (unless blocking correctness).
|
| 136 |
+
- Favor clarifications that reduce downstream rework risk or prevent misaligned acceptance tests.
|
| 137 |
+
- If more than 5 categories remain unresolved, select the top 5 by (Impact * Uncertainty) heuristic.
|
| 138 |
+
|
| 139 |
+
4. Sequential questioning loop (interactive):
|
| 140 |
+
- Present EXACTLY ONE question at a time.
|
| 141 |
+
- For multipleβchoice questions:
|
| 142 |
+
- **Analyze all options** and determine the **most suitable option** based on:
|
| 143 |
+
- Best practices for the project type
|
| 144 |
+
- Common patterns in similar implementations
|
| 145 |
+
- Risk reduction (security, performance, maintainability)
|
| 146 |
+
- Alignment with any explicit project goals or constraints visible in the spec
|
| 147 |
+
- Present your **recommended option prominently** at the top with clear reasoning (1-2 sentences explaining why this is the best choice).
|
| 148 |
+
- Format as: `**Recommended:** Option [X] - <reasoning>`
|
| 149 |
+
- Then render all options as a Markdown table:
|
| 150 |
+
|
| 151 |
+
| Option | Description |
|
| 152 |
+
|--------|-------------|
|
| 153 |
+
| A | <Option A description> |
|
| 154 |
+
| B | <Option B description> |
|
| 155 |
+
| C | <Option C description> (add D/E as needed up to 5) |
|
| 156 |
+
| Short | Provide a different short answer (<=5 words) (Include only if free-form alternative is appropriate) |
|
| 157 |
+
|
| 158 |
+
- After the table, add: `You can reply with the option letter (e.g., "A"), accept the recommendation by saying "yes" or "recommended", or provide your own short answer.`
|
| 159 |
+
- For shortβanswer style (no meaningful discrete options):
|
| 160 |
+
- Provide your **suggested answer** based on best practices and context.
|
| 161 |
+
- Format as: `**Suggested:** <your proposed answer> - <brief reasoning>`
|
| 162 |
+
- Then output: `Format: Short answer (<=5 words). You can accept the suggestion by saying "yes" or "suggested", or provide your own answer.`
|
| 163 |
+
- After the user answers:
|
| 164 |
+
- If the user replies with "yes", "recommended", or "suggested", use your previously stated recommendation/suggestion as the answer.
|
| 165 |
+
- Otherwise, validate the answer maps to one option or fits the <=5 word constraint.
|
| 166 |
+
- If ambiguous, ask for a quick disambiguation (count still belongs to same question; do not advance).
|
| 167 |
+
- Once satisfactory, record it in working memory (do not yet write to disk) and move to the next queued question.
|
| 168 |
+
- Stop asking further questions when:
|
| 169 |
+
- All critical ambiguities resolved early (remaining queued items become unnecessary), OR
|
| 170 |
+
- User signals completion ("done", "good", "no more"), OR
|
| 171 |
+
- You reach 5 asked questions.
|
| 172 |
+
- Never reveal future queued questions in advance.
|
| 173 |
+
- If no valid questions exist at start, immediately report no critical ambiguities.
|
| 174 |
+
|
| 175 |
+
5. Integration after EACH accepted answer (incremental update approach):
|
| 176 |
+
- Maintain in-memory representation of the spec (loaded once at start) plus the raw file contents.
|
| 177 |
+
- For the first integrated answer in this session:
|
| 178 |
+
- Ensure a `## Clarifications` section exists (create it just after the highest-level contextual/overview section per the spec template if missing).
|
| 179 |
+
- Under it, create (if not present) a `### Session YYYY-MM-DD` subheading for today.
|
| 180 |
+
- Append a bullet line immediately after acceptance: `- Q: <question> β A: <final answer>`.
|
| 181 |
+
- Then immediately apply the clarification to the most appropriate section(s):
|
| 182 |
+
- Functional ambiguity β Update or add a bullet in Functional Requirements.
|
| 183 |
+
- User interaction / actor distinction β Update User Stories or Actors subsection (if present) with clarified role, constraint, or scenario.
|
| 184 |
+
- Data shape / entities β Update Data Model (add fields, types, relationships) preserving ordering; note added constraints succinctly.
|
| 185 |
+
- Non-functional constraint β Add/modify measurable criteria in Success Criteria > Measurable Outcomes (convert vague adjective to metric or explicit target).
|
| 186 |
+
- Edge case / negative flow β Add a new bullet under Edge Cases / Error Handling (or create such subsection if template provides placeholder for it).
|
| 187 |
+
- Terminology conflict β Normalize term across spec; retain original only if necessary by adding `(formerly referred to as "X")` once.
|
| 188 |
+
- If the clarification invalidates an earlier ambiguous statement, replace that statement instead of duplicating; leave no obsolete contradictory text.
|
| 189 |
+
- Save the spec file AFTER each integration to minimize risk of context loss (atomic overwrite).
|
| 190 |
+
- Preserve formatting: do not reorder unrelated sections; keep heading hierarchy intact.
|
| 191 |
+
- Keep each inserted clarification minimal and testable (avoid narrative drift).
|
| 192 |
+
|
| 193 |
+
6. Validation (performed after EACH write plus final pass):
|
| 194 |
+
- Clarifications session contains exactly one bullet per accepted answer (no duplicates).
|
| 195 |
+
- Total asked (accepted) questions β€ 5.
|
| 196 |
+
- Updated sections contain no lingering vague placeholders the new answer was meant to resolve.
|
| 197 |
+
- No contradictory earlier statement remains (scan for now-invalid alternative choices removed).
|
| 198 |
+
- Markdown structure valid; only allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD`.
|
| 199 |
+
- Terminology consistency: same canonical term used across all updated sections.
|
| 200 |
+
|
| 201 |
+
7. Write the updated spec back to `FEATURE_SPEC`.
|
| 202 |
+
|
| 203 |
+
8. Report completion (after questioning loop ends or early termination):
|
| 204 |
+
- Number of questions asked & answered.
|
| 205 |
+
- Path to updated spec.
|
| 206 |
+
- Sections touched (list names).
|
| 207 |
+
- Coverage summary table listing each taxonomy category with Status: Resolved (was Partial/Missing and addressed), Deferred (exceeds question quota or better suited for planning), Clear (already sufficient), Outstanding (still Partial/Missing but low impact).
|
| 208 |
+
- If any Outstanding or Deferred remain, recommend whether to proceed to `/speckit-plan` or run `/speckit-clarify` again later post-plan.
|
| 209 |
+
- Suggested next command.
|
| 210 |
+
|
| 211 |
+
Behavior rules:
|
| 212 |
+
|
| 213 |
+
- If no meaningful ambiguities found (or all potential questions would be low-impact), respond: "No critical ambiguities detected worth formal clarification." and suggest proceeding.
|
| 214 |
+
- If spec file missing, instruct user to run `/speckit-specify` first (do not create a new spec here).
|
| 215 |
+
- Never exceed 5 total asked questions (clarification retries for a single question do not count as new questions).
|
| 216 |
+
- Avoid speculative tech stack questions unless the absence blocks functional clarity.
|
| 217 |
+
- Respect user early termination signals ("stop", "done", "proceed").
|
| 218 |
+
- If no questions asked due to full coverage, output a compact coverage summary (all categories Clear) then suggest advancing.
|
| 219 |
+
- If quota reached with unresolved high-impact categories remaining, explicitly flag them under Deferred with rationale.
|
| 220 |
+
|
| 221 |
+
Context for prioritization: $ARGUMENTS
|
| 222 |
+
|
| 223 |
+
## Post-Execution Checks
|
| 224 |
+
|
| 225 |
+
**Check for extension hooks (after clarification)**:
|
| 226 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 227 |
+
- If it exists, read it and look for entries under the `hooks.after_clarify` key
|
| 228 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 229 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 230 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 231 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 232 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 233 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 234 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 235 |
+
- **Optional hook** (`optional: true`):
|
| 236 |
+
```
|
| 237 |
+
## Extension Hooks
|
| 238 |
+
|
| 239 |
+
**Optional Hook**: {extension}
|
| 240 |
+
Command: `/{command}`
|
| 241 |
+
Description: {description}
|
| 242 |
+
|
| 243 |
+
Prompt: {prompt}
|
| 244 |
+
To execute: `/{command}`
|
| 245 |
+
```
|
| 246 |
+
- **Mandatory hook** (`optional: false`):
|
| 247 |
+
```
|
| 248 |
+
## Extension Hooks
|
| 249 |
+
|
| 250 |
+
**Automatic Hook**: {extension}
|
| 251 |
+
Executing: `/{command}`
|
| 252 |
+
EXECUTE_COMMAND: {command}
|
| 253 |
+
```
|
| 254 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.claude/skills/speckit-constitution/SKILL.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-constitution"
|
| 3 |
+
description: "Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync."
|
| 4 |
+
argument-hint: "Principles or values for the project constitution"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/constitution.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before constitution update)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_constitution` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Outline
|
| 58 |
+
|
| 59 |
+
You are updating the project constitution at `.specify/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
|
| 60 |
+
|
| 61 |
+
**Note**: If `.specify/memory/constitution.md` does not exist yet, it should have been initialized from `.specify/templates/constitution-template.md` during project setup. If it's missing, copy the template first.
|
| 62 |
+
|
| 63 |
+
Follow this execution flow:
|
| 64 |
+
|
| 65 |
+
1. Load the existing constitution at `.specify/memory/constitution.md`.
|
| 66 |
+
- Identify every placeholder token of the form `[ALL_CAPS_IDENTIFIER]`.
|
| 67 |
+
**IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
|
| 68 |
+
|
| 69 |
+
2. Collect/derive values for placeholders:
|
| 70 |
+
- If user input (conversation) supplies a value, use it.
|
| 71 |
+
- Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded).
|
| 72 |
+
- For governance dates: `RATIFICATION_DATE` is the original adoption date (if unknown ask or mark TODO), `LAST_AMENDED_DATE` is today if changes are made, otherwise keep previous.
|
| 73 |
+
- `CONSTITUTION_VERSION` must increment according to semantic versioning rules:
|
| 74 |
+
- MAJOR: Backward incompatible governance/principle removals or redefinitions.
|
| 75 |
+
- MINOR: New principle/section added or materially expanded guidance.
|
| 76 |
+
- PATCH: Clarifications, wording, typo fixes, non-semantic refinements.
|
| 77 |
+
- If version bump type ambiguous, propose reasoning before finalizing.
|
| 78 |
+
|
| 79 |
+
3. Draft the updated constitution content:
|
| 80 |
+
- Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yetβexplicitly justify any left).
|
| 81 |
+
- Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance.
|
| 82 |
+
- Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing nonβnegotiable rules, explicit rationale if not obvious.
|
| 83 |
+
- Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations.
|
| 84 |
+
|
| 85 |
+
4. Consistency propagation checklist (convert prior checklist into active validations):
|
| 86 |
+
- Read `.specify/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
|
| 87 |
+
- Read `.specify/templates/spec-template.md` for scope/requirements alignmentβupdate if constitution adds/removes mandatory sections or constraints.
|
| 88 |
+
- Read `.specify/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
|
| 89 |
+
- Read each command file in `.specify/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
|
| 90 |
+
- Read any runtime guidance docs (e.g., `README.md`, `docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed.
|
| 91 |
+
|
| 92 |
+
5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
|
| 93 |
+
- Version change: old β new
|
| 94 |
+
- List of modified principles (old title β new title if renamed)
|
| 95 |
+
- Added sections
|
| 96 |
+
- Removed sections
|
| 97 |
+
- Templates requiring updates (β
updated / β pending) with file paths
|
| 98 |
+
- Follow-up TODOs if any placeholders intentionally deferred.
|
| 99 |
+
|
| 100 |
+
6. Validation before final output:
|
| 101 |
+
- No remaining unexplained bracket tokens.
|
| 102 |
+
- Version line matches report.
|
| 103 |
+
- Dates ISO format YYYY-MM-DD.
|
| 104 |
+
- Principles are declarative, testable, and free of vague language ("should" β replace with MUST/SHOULD rationale where appropriate).
|
| 105 |
+
|
| 106 |
+
7. Write the completed constitution back to `.specify/memory/constitution.md` (overwrite).
|
| 107 |
+
|
| 108 |
+
8. Output a final summary to the user with:
|
| 109 |
+
- New version and bump rationale.
|
| 110 |
+
- Any files flagged for manual follow-up.
|
| 111 |
+
- Suggested commit message (e.g., `docs: amend constitution to vX.Y.Z (principle additions + governance update)`).
|
| 112 |
+
|
| 113 |
+
Formatting & Style Requirements:
|
| 114 |
+
|
| 115 |
+
- Use Markdown headings exactly as in the template (do not demote/promote levels).
|
| 116 |
+
- Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks.
|
| 117 |
+
- Keep a single blank line between sections.
|
| 118 |
+
- Avoid trailing whitespace.
|
| 119 |
+
|
| 120 |
+
If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps.
|
| 121 |
+
|
| 122 |
+
If critical info missing (e.g., ratification date truly unknown), insert `TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items.
|
| 123 |
+
|
| 124 |
+
Do not create a new template; always operate on the existing `.specify/memory/constitution.md` file.
|
| 125 |
+
|
| 126 |
+
## Post-Execution Checks
|
| 127 |
+
|
| 128 |
+
**Check for extension hooks (after constitution update)**:
|
| 129 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 130 |
+
- If it exists, read it and look for entries under the `hooks.after_constitution` key
|
| 131 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 132 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 133 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 134 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 135 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 136 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 137 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 138 |
+
- **Optional hook** (`optional: true`):
|
| 139 |
+
```
|
| 140 |
+
## Extension Hooks
|
| 141 |
+
|
| 142 |
+
**Optional Hook**: {extension}
|
| 143 |
+
Command: `/{command}`
|
| 144 |
+
Description: {description}
|
| 145 |
+
|
| 146 |
+
Prompt: {prompt}
|
| 147 |
+
To execute: `/{command}`
|
| 148 |
+
```
|
| 149 |
+
- **Mandatory hook** (`optional: false`):
|
| 150 |
+
```
|
| 151 |
+
## Extension Hooks
|
| 152 |
+
|
| 153 |
+
**Automatic Hook**: {extension}
|
| 154 |
+
Executing: `/{command}`
|
| 155 |
+
EXECUTE_COMMAND: {command}
|
| 156 |
+
```
|
| 157 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.claude/skills/speckit-git-commit/SKILL.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: speckit-git-commit
|
| 3 |
+
description: Auto-commit changes after a Spec Kit command completes
|
| 4 |
+
compatibility: Requires spec-kit project structure with .specify/ directory
|
| 5 |
+
metadata:
|
| 6 |
+
author: github-spec-kit
|
| 7 |
+
source: git:commands/speckit.git.commit.md
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Auto-Commit Changes
|
| 11 |
+
|
| 12 |
+
Automatically stage and commit all changes after a Spec Kit command completes.
|
| 13 |
+
|
| 14 |
+
## Behavior
|
| 15 |
+
|
| 16 |
+
This command is invoked as a hook after (or before) core commands. It:
|
| 17 |
+
|
| 18 |
+
1. Determines the event name from the hook context (e.g., if invoked as an `after_specify` hook, the event is `after_specify`; if `before_plan`, the event is `before_plan`)
|
| 19 |
+
2. Checks `.specify/extensions/git/git-config.yml` for the `auto_commit` section
|
| 20 |
+
3. Looks up the specific event key to see if auto-commit is enabled
|
| 21 |
+
4. Falls back to `auto_commit.default` if no event-specific key exists
|
| 22 |
+
5. Uses the per-command `message` if configured, otherwise a default message
|
| 23 |
+
6. If enabled and there are uncommitted changes, runs `git add .` + `git commit`
|
| 24 |
+
|
| 25 |
+
## Execution
|
| 26 |
+
|
| 27 |
+
Determine the event name from the hook that triggered this command, then run the script:
|
| 28 |
+
|
| 29 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/auto-commit.sh <event_name>`
|
| 30 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/auto-commit.ps1 <event_name>`
|
| 31 |
+
|
| 32 |
+
Replace `<event_name>` with the actual hook event (e.g., `after_specify`, `before_plan`, `after_implement`).
|
| 33 |
+
|
| 34 |
+
## Configuration
|
| 35 |
+
|
| 36 |
+
In `.specify/extensions/git/git-config.yml`:
|
| 37 |
+
|
| 38 |
+
```yaml
|
| 39 |
+
auto_commit:
|
| 40 |
+
default: false # Global toggle β set true to enable for all commands
|
| 41 |
+
after_specify:
|
| 42 |
+
enabled: true # Override per-command
|
| 43 |
+
message: "[Spec Kit] Add specification"
|
| 44 |
+
after_plan:
|
| 45 |
+
enabled: false
|
| 46 |
+
message: "[Spec Kit] Add implementation plan"
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Graceful Degradation
|
| 50 |
+
|
| 51 |
+
- If Git is not available or the current directory is not a repository: skips with a warning
|
| 52 |
+
- If no config file exists: skips (disabled by default)
|
| 53 |
+
- If no changes to commit: skips with a message
|
.claude/skills/speckit-git-feature/SKILL.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: speckit-git-feature
|
| 3 |
+
description: Create a feature branch with sequential or timestamp numbering
|
| 4 |
+
compatibility: Requires spec-kit project structure with .specify/ directory
|
| 5 |
+
metadata:
|
| 6 |
+
author: github-spec-kit
|
| 7 |
+
source: git:commands/speckit.git.feature.md
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Create Feature Branch
|
| 11 |
+
|
| 12 |
+
Create and switch to a new git feature branch for the given specification. This command handles **branch creation only** β the spec directory and files are created by the core `/speckit-specify` workflow.
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Environment Variable Override
|
| 23 |
+
|
| 24 |
+
If the user explicitly provided `GIT_BRANCH_NAME` (e.g., via environment variable, argument, or in their request), pass it through to the script by setting the `GIT_BRANCH_NAME` environment variable before invoking the script. When `GIT_BRANCH_NAME` is set:
|
| 25 |
+
- The script uses the exact value as the branch name, bypassing all prefix/suffix generation
|
| 26 |
+
- `--short-name`, `--number`, and `--timestamp` flags are ignored
|
| 27 |
+
- `FEATURE_NUM` is extracted from the name if it starts with a numeric prefix, otherwise set to the full branch name
|
| 28 |
+
|
| 29 |
+
## Prerequisites
|
| 30 |
+
|
| 31 |
+
- Verify Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 32 |
+
- If Git is not available, warn the user and skip branch creation
|
| 33 |
+
|
| 34 |
+
## Branch Numbering Mode
|
| 35 |
+
|
| 36 |
+
Determine the branch numbering strategy by checking configuration in this order:
|
| 37 |
+
|
| 38 |
+
1. Check `.specify/extensions/git/git-config.yml` for `branch_numbering` value
|
| 39 |
+
2. Check `.specify/init-options.json` for `branch_numbering` value (backward compatibility)
|
| 40 |
+
3. Default to `sequential` if neither exists
|
| 41 |
+
|
| 42 |
+
## Execution
|
| 43 |
+
|
| 44 |
+
Generate a concise short name (2-4 words) for the branch:
|
| 45 |
+
- Analyze the feature description and extract the most meaningful keywords
|
| 46 |
+
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
| 47 |
+
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
| 48 |
+
|
| 49 |
+
Run the appropriate script based on your platform:
|
| 50 |
+
|
| 51 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/create-new-feature.sh --json --short-name "<short-name>" "<feature description>"`
|
| 52 |
+
- **Bash (timestamp)**: `.specify/extensions/git/scripts/bash/create-new-feature.sh --json --timestamp --short-name "<short-name>" "<feature description>"`
|
| 53 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/create-new-feature.ps1 -Json -ShortName "<short-name>" "<feature description>"`
|
| 54 |
+
- **PowerShell (timestamp)**: `.specify/extensions/git/scripts/powershell/create-new-feature.ps1 -Json -Timestamp -ShortName "<short-name>" "<feature description>"`
|
| 55 |
+
|
| 56 |
+
**IMPORTANT**:
|
| 57 |
+
- Do NOT pass `--number` β the script determines the correct next number automatically
|
| 58 |
+
- Always include the JSON flag (`--json` for Bash, `-Json` for PowerShell) so the output can be parsed reliably
|
| 59 |
+
- You must only ever run this script once per feature
|
| 60 |
+
- The JSON output will contain `BRANCH_NAME` and `FEATURE_NUM`
|
| 61 |
+
|
| 62 |
+
## Graceful Degradation
|
| 63 |
+
|
| 64 |
+
If Git is not installed or the current directory is not a Git repository:
|
| 65 |
+
- Branch creation is skipped with a warning: `[specify] Warning: Git repository not detected; skipped branch creation`
|
| 66 |
+
- The script still outputs `BRANCH_NAME` and `FEATURE_NUM` so the caller can reference them
|
| 67 |
+
|
| 68 |
+
## Output
|
| 69 |
+
|
| 70 |
+
The script outputs JSON with:
|
| 71 |
+
- `BRANCH_NAME`: The branch name (e.g., `003-user-auth` or `20260319-143022-user-auth`)
|
| 72 |
+
- `FEATURE_NUM`: The numeric or timestamp prefix used
|
.claude/skills/speckit-git-initialize/SKILL.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: speckit-git-initialize
|
| 3 |
+
description: Initialize a Git repository with an initial commit
|
| 4 |
+
compatibility: Requires spec-kit project structure with .specify/ directory
|
| 5 |
+
metadata:
|
| 6 |
+
author: github-spec-kit
|
| 7 |
+
source: git:commands/speckit.git.initialize.md
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Initialize Git Repository
|
| 11 |
+
|
| 12 |
+
Initialize a Git repository in the current project directory if one does not already exist.
|
| 13 |
+
|
| 14 |
+
## Execution
|
| 15 |
+
|
| 16 |
+
Run the appropriate script from the project root:
|
| 17 |
+
|
| 18 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/initialize-repo.sh`
|
| 19 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/initialize-repo.ps1`
|
| 20 |
+
|
| 21 |
+
If the extension scripts are not found, fall back to:
|
| 22 |
+
- **Bash**: `git init && git add . && git commit -m "Initial commit from Specify template"`
|
| 23 |
+
- **PowerShell**: `git init; git add .; git commit -m "Initial commit from Specify template"`
|
| 24 |
+
|
| 25 |
+
The script handles all checks internally:
|
| 26 |
+
- Skips if Git is not available
|
| 27 |
+
- Skips if already inside a Git repository
|
| 28 |
+
- Runs `git init`, `git add .`, and `git commit` with an initial commit message
|
| 29 |
+
|
| 30 |
+
## Customization
|
| 31 |
+
|
| 32 |
+
Replace the script to add project-specific Git initialization steps:
|
| 33 |
+
- Custom `.gitignore` templates
|
| 34 |
+
- Default branch naming (`git config init.defaultBranch`)
|
| 35 |
+
- Git LFS setup
|
| 36 |
+
- Git hooks installation
|
| 37 |
+
- Commit signing configuration
|
| 38 |
+
- Git Flow initialization
|
| 39 |
+
|
| 40 |
+
## Output
|
| 41 |
+
|
| 42 |
+
On success:
|
| 43 |
+
- `β Git repository initialized`
|
| 44 |
+
|
| 45 |
+
## Graceful Degradation
|
| 46 |
+
|
| 47 |
+
If Git is not installed:
|
| 48 |
+
- Warn the user
|
| 49 |
+
- Skip repository initialization
|
| 50 |
+
- The project continues to function without Git (specs can still be created under `specs/`)
|
| 51 |
+
|
| 52 |
+
If Git is installed but `git init`, `git add .`, or `git commit` fails:
|
| 53 |
+
- Surface the error to the user
|
| 54 |
+
- Stop this command rather than continuing with a partially initialized repository
|
.claude/skills/speckit-git-remote/SKILL.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: speckit-git-remote
|
| 3 |
+
description: Detect Git remote URL for GitHub integration
|
| 4 |
+
compatibility: Requires spec-kit project structure with .specify/ directory
|
| 5 |
+
metadata:
|
| 6 |
+
author: github-spec-kit
|
| 7 |
+
source: git:commands/speckit.git.remote.md
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Detect Git Remote URL
|
| 11 |
+
|
| 12 |
+
Detect the Git remote URL for integration with GitHub services (e.g., issue creation).
|
| 13 |
+
|
| 14 |
+
## Prerequisites
|
| 15 |
+
|
| 16 |
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 17 |
+
- If Git is not available, output a warning and return empty:
|
| 18 |
+
```
|
| 19 |
+
[specify] Warning: Git repository not detected; cannot determine remote URL
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
## Execution
|
| 23 |
+
|
| 24 |
+
Run the following command to get the remote URL:
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
git config --get remote.origin.url
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Output
|
| 31 |
+
|
| 32 |
+
Parse the remote URL and determine:
|
| 33 |
+
|
| 34 |
+
1. **Repository owner**: Extract from the URL (e.g., `github` from `https://github.com/github/spec-kit.git`)
|
| 35 |
+
2. **Repository name**: Extract from the URL (e.g., `spec-kit` from `https://github.com/github/spec-kit.git`)
|
| 36 |
+
3. **Is GitHub**: Whether the remote points to a GitHub repository
|
| 37 |
+
|
| 38 |
+
Supported URL formats:
|
| 39 |
+
- HTTPS: `https://github.com/<owner>/<repo>.git`
|
| 40 |
+
- SSH: `git@github.com:<owner>/<repo>.git`
|
| 41 |
+
|
| 42 |
+
> [!CAUTION]
|
| 43 |
+
> ONLY report a GitHub repository if the remote URL actually points to github.com.
|
| 44 |
+
> Do NOT assume the remote is GitHub if the URL format doesn't match.
|
| 45 |
+
|
| 46 |
+
## Graceful Degradation
|
| 47 |
+
|
| 48 |
+
If Git is not installed, the directory is not a Git repository, or no remote is configured:
|
| 49 |
+
- Return an empty result
|
| 50 |
+
- Do NOT error β other workflows should continue without Git remote information
|
.claude/skills/speckit-git-validate/SKILL.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: speckit-git-validate
|
| 3 |
+
description: Validate current branch follows feature branch naming conventions
|
| 4 |
+
compatibility: Requires spec-kit project structure with .specify/ directory
|
| 5 |
+
metadata:
|
| 6 |
+
author: github-spec-kit
|
| 7 |
+
source: git:commands/speckit.git.validate.md
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Validate Feature Branch
|
| 11 |
+
|
| 12 |
+
Validate that the current Git branch follows the expected feature branch naming conventions.
|
| 13 |
+
|
| 14 |
+
## Prerequisites
|
| 15 |
+
|
| 16 |
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 17 |
+
- If Git is not available, output a warning and skip validation:
|
| 18 |
+
```
|
| 19 |
+
[specify] Warning: Git repository not detected; skipped branch validation
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
## Validation Rules
|
| 23 |
+
|
| 24 |
+
Get the current branch name:
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
git rev-parse --abbrev-ref HEAD
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
The branch name must match one of these patterns:
|
| 31 |
+
|
| 32 |
+
1. **Sequential**: `^[0-9]{3,}-` (e.g., `001-feature-name`, `042-fix-bug`, `1000-big-feature`)
|
| 33 |
+
2. **Timestamp**: `^[0-9]{8}-[0-9]{6}-` (e.g., `20260319-143022-feature-name`)
|
| 34 |
+
|
| 35 |
+
## Execution
|
| 36 |
+
|
| 37 |
+
If on a feature branch (matches either pattern):
|
| 38 |
+
- Output: `β On feature branch: <branch-name>`
|
| 39 |
+
- Check if the corresponding spec directory exists under `specs/`:
|
| 40 |
+
- For sequential branches, look for `specs/<prefix>-*` where prefix matches the numeric portion
|
| 41 |
+
- For timestamp branches, look for `specs/<prefix>-*` where prefix matches the `YYYYMMDD-HHMMSS` portion
|
| 42 |
+
- If spec directory exists: `β Spec directory found: <path>`
|
| 43 |
+
- If spec directory missing: `β No spec directory found for prefix <prefix>`
|
| 44 |
+
|
| 45 |
+
If NOT on a feature branch:
|
| 46 |
+
- Output: `β Not on a feature branch. Current branch: <branch-name>`
|
| 47 |
+
- Output: `Feature branches should be named like: 001-feature-name or 20260319-143022-feature-name`
|
| 48 |
+
|
| 49 |
+
## Graceful Degradation
|
| 50 |
+
|
| 51 |
+
If Git is not installed or the directory is not a Git repository:
|
| 52 |
+
- Check the `SPECIFY_FEATURE` environment variable as a fallback
|
| 53 |
+
- If set, validate that value against the naming patterns
|
| 54 |
+
- If not set, skip validation with a warning
|
.claude/skills/speckit-implement/SKILL.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-implement"
|
| 3 |
+
description: "Execute the implementation plan by processing and executing all tasks defined in tasks.md"
|
| 4 |
+
argument-hint: "Optional implementation guidance or task filter"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/implement.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before implementation)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_implement` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Outline
|
| 58 |
+
|
| 59 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` 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").
|
| 60 |
+
|
| 61 |
+
2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
|
| 62 |
+
- Scan all checklist files in the checklists/ directory
|
| 63 |
+
- For each checklist, count:
|
| 64 |
+
- Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
|
| 65 |
+
- Completed items: Lines matching `- [X]` or `- [x]`
|
| 66 |
+
- Incomplete items: Lines matching `- [ ]`
|
| 67 |
+
- Create a status table:
|
| 68 |
+
|
| 69 |
+
```text
|
| 70 |
+
| Checklist | Total | Completed | Incomplete | Status |
|
| 71 |
+
|-----------|-------|-----------|------------|--------|
|
| 72 |
+
| ux.md | 12 | 12 | 0 | β PASS |
|
| 73 |
+
| test.md | 8 | 5 | 3 | β FAIL |
|
| 74 |
+
| security.md | 6 | 6 | 0 | β PASS |
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
- Calculate overall status:
|
| 78 |
+
- **PASS**: All checklists have 0 incomplete items
|
| 79 |
+
- **FAIL**: One or more checklists have incomplete items
|
| 80 |
+
|
| 81 |
+
- **If any checklist is incomplete**:
|
| 82 |
+
- Display the table with incomplete item counts
|
| 83 |
+
- **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
|
| 84 |
+
- Wait for user response before continuing
|
| 85 |
+
- If user says "no" or "wait" or "stop", halt execution
|
| 86 |
+
- If user says "yes" or "proceed" or "continue", proceed to step 3
|
| 87 |
+
|
| 88 |
+
- **If all checklists are complete**:
|
| 89 |
+
- Display the table showing all checklists passed
|
| 90 |
+
- Automatically proceed to step 3
|
| 91 |
+
|
| 92 |
+
3. Load and analyze the implementation context:
|
| 93 |
+
- **REQUIRED**: Read tasks.md for the complete task list and execution plan
|
| 94 |
+
- **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
|
| 95 |
+
- **IF EXISTS**: Read data-model.md for entities and relationships
|
| 96 |
+
- **IF EXISTS**: Read contracts/ for API specifications and test requirements
|
| 97 |
+
- **IF EXISTS**: Read research.md for technical decisions and constraints
|
| 98 |
+
- **IF EXISTS**: Read .specify/memory/constitution.md for governance constraints
|
| 99 |
+
- **IF EXISTS**: Read quickstart.md for integration scenarios
|
| 100 |
+
|
| 101 |
+
4. **Project Setup Verification**:
|
| 102 |
+
- **REQUIRED**: Create/verify ignore files based on actual project setup:
|
| 103 |
+
|
| 104 |
+
**Detection & Creation Logic**:
|
| 105 |
+
- Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
|
| 106 |
+
|
| 107 |
+
```sh
|
| 108 |
+
git rev-parse --git-dir 2>/dev/null
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
- Check if Dockerfile* exists or Docker in plan.md β create/verify .dockerignore
|
| 112 |
+
- Check if .eslintrc* exists β create/verify .eslintignore
|
| 113 |
+
- Check if eslint.config.* exists β ensure the config's `ignores` entries cover required patterns
|
| 114 |
+
- Check if .prettierrc* exists β create/verify .prettierignore
|
| 115 |
+
- Check if .npmrc or package.json exists β create/verify .npmignore (if publishing)
|
| 116 |
+
- Check if terraform files (*.tf) exist β create/verify .terraformignore
|
| 117 |
+
- Check if .helmignore needed (helm charts present) β create/verify .helmignore
|
| 118 |
+
|
| 119 |
+
**If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
|
| 120 |
+
**If ignore file missing**: Create with full pattern set for detected technology
|
| 121 |
+
|
| 122 |
+
**Common Patterns by Technology** (from plan.md tech stack):
|
| 123 |
+
- **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
|
| 124 |
+
- **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
|
| 125 |
+
- **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
|
| 126 |
+
- **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
|
| 127 |
+
- **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
|
| 128 |
+
- **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
|
| 129 |
+
- **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
|
| 130 |
+
- **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
|
| 131 |
+
- **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
|
| 132 |
+
- **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
|
| 133 |
+
- **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `*.dll`, `autom4te.cache/`, `config.status`, `config.log`, `.idea/`, `*.log`, `.env*`
|
| 134 |
+
- **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
|
| 135 |
+
- **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
|
| 136 |
+
- **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
|
| 137 |
+
|
| 138 |
+
**Tool-Specific Patterns**:
|
| 139 |
+
- **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
|
| 140 |
+
- **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
|
| 141 |
+
- **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
|
| 142 |
+
- **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
|
| 143 |
+
- **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
|
| 144 |
+
|
| 145 |
+
5. Parse tasks.md structure and extract:
|
| 146 |
+
- **Task phases**: Setup, Tests, Core, Integration, Polish
|
| 147 |
+
- **Task dependencies**: Sequential vs parallel execution rules
|
| 148 |
+
- **Task details**: ID, description, file paths, parallel markers [P]
|
| 149 |
+
- **Execution flow**: Order and dependency requirements
|
| 150 |
+
|
| 151 |
+
6. Execute implementation following the task plan:
|
| 152 |
+
- **Phase-by-phase execution**: Complete each phase before moving to the next
|
| 153 |
+
- **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
|
| 154 |
+
- **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
|
| 155 |
+
- **File-based coordination**: Tasks affecting the same files must run sequentially
|
| 156 |
+
- **Validation checkpoints**: Verify each phase completion before proceeding
|
| 157 |
+
|
| 158 |
+
7. Implementation execution rules:
|
| 159 |
+
- **Setup first**: Initialize project structure, dependencies, configuration
|
| 160 |
+
- **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
|
| 161 |
+
- **Core development**: Implement models, services, CLI commands, endpoints
|
| 162 |
+
- **Integration work**: Database connections, middleware, logging, external services
|
| 163 |
+
- **Polish and validation**: Unit tests, performance optimization, documentation
|
| 164 |
+
|
| 165 |
+
8. Progress tracking and error handling:
|
| 166 |
+
- Report progress after each completed task
|
| 167 |
+
- Halt execution if any non-parallel task fails
|
| 168 |
+
- For parallel tasks [P], continue with successful tasks, report failed ones
|
| 169 |
+
- Provide clear error messages with context for debugging
|
| 170 |
+
- Suggest next steps if implementation cannot proceed
|
| 171 |
+
- **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
|
| 172 |
+
|
| 173 |
+
9. Completion validation:
|
| 174 |
+
- Verify all required tasks are completed
|
| 175 |
+
- Check that implemented features match the original specification
|
| 176 |
+
- Validate that tests pass and coverage meets requirements
|
| 177 |
+
- Confirm the implementation follows the technical plan
|
| 178 |
+
- Report final status with summary of completed work
|
| 179 |
+
|
| 180 |
+
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.
|
| 181 |
+
|
| 182 |
+
10. **Check for extension hooks**: After completion validation, check if `.specify/extensions.yml` exists in the project root.
|
| 183 |
+
- If it exists, read it and look for entries under the `hooks.after_implement` key
|
| 184 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 185 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 186 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 187 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 188 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 189 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 190 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 191 |
+
- **Optional hook** (`optional: true`):
|
| 192 |
+
```
|
| 193 |
+
## Extension Hooks
|
| 194 |
+
|
| 195 |
+
**Optional Hook**: {extension}
|
| 196 |
+
Command: `/{command}`
|
| 197 |
+
Description: {description}
|
| 198 |
+
|
| 199 |
+
Prompt: {prompt}
|
| 200 |
+
To execute: `/{command}`
|
| 201 |
+
```
|
| 202 |
+
- **Mandatory hook** (`optional: false`):
|
| 203 |
+
```
|
| 204 |
+
## Extension Hooks
|
| 205 |
+
|
| 206 |
+
**Automatic Hook**: {extension}
|
| 207 |
+
Executing: `/{command}`
|
| 208 |
+
EXECUTE_COMMAND: {command}
|
| 209 |
+
```
|
| 210 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.claude/skills/speckit-plan/SKILL.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-plan"
|
| 3 |
+
description: "Execute the implementation planning workflow using the plan template to generate design artifacts."
|
| 4 |
+
argument-hint: "Optional guidance for the planning phase"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/plan.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before planning)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_plan` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Outline
|
| 58 |
+
|
| 59 |
+
1. **Setup**: Run `.specify/scripts/powershell/setup-plan.ps1 -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").
|
| 60 |
+
|
| 61 |
+
2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied).
|
| 62 |
+
|
| 63 |
+
3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
|
| 64 |
+
- Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
|
| 65 |
+
- Fill Constitution Check section from constitution
|
| 66 |
+
- Evaluate gates (ERROR if violations unjustified)
|
| 67 |
+
- Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
|
| 68 |
+
- Phase 1: Generate data-model.md, contracts/, quickstart.md
|
| 69 |
+
- Phase 1: Update agent context by running the agent script
|
| 70 |
+
- Re-evaluate Constitution Check post-design
|
| 71 |
+
|
| 72 |
+
4. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
|
| 73 |
+
|
| 74 |
+
5. **Check for extension hooks**: After reporting, check if `.specify/extensions.yml` exists in the project root.
|
| 75 |
+
- If it exists, read it and look for entries under the `hooks.after_plan` key
|
| 76 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 77 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 78 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 79 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 80 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 81 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 82 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 83 |
+
- **Optional hook** (`optional: true`):
|
| 84 |
+
```
|
| 85 |
+
## Extension Hooks
|
| 86 |
+
|
| 87 |
+
**Optional Hook**: {extension}
|
| 88 |
+
Command: `/{command}`
|
| 89 |
+
Description: {description}
|
| 90 |
+
|
| 91 |
+
Prompt: {prompt}
|
| 92 |
+
To execute: `/{command}`
|
| 93 |
+
```
|
| 94 |
+
- **Mandatory hook** (`optional: false`):
|
| 95 |
+
```
|
| 96 |
+
## Extension Hooks
|
| 97 |
+
|
| 98 |
+
**Automatic Hook**: {extension}
|
| 99 |
+
Executing: `/{command}`
|
| 100 |
+
EXECUTE_COMMAND: {command}
|
| 101 |
+
```
|
| 102 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 103 |
+
|
| 104 |
+
## Phases
|
| 105 |
+
|
| 106 |
+
### Phase 0: Outline & Research
|
| 107 |
+
|
| 108 |
+
1. **Extract unknowns from Technical Context** above:
|
| 109 |
+
- For each NEEDS CLARIFICATION β research task
|
| 110 |
+
- For each dependency β best practices task
|
| 111 |
+
- For each integration β patterns task
|
| 112 |
+
|
| 113 |
+
2. **Generate and dispatch research agents**:
|
| 114 |
+
|
| 115 |
+
```text
|
| 116 |
+
For each unknown in Technical Context:
|
| 117 |
+
Task: "Research {unknown} for {feature context}"
|
| 118 |
+
For each technology choice:
|
| 119 |
+
Task: "Find best practices for {tech} in {domain}"
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
3. **Consolidate findings** in `research.md` using format:
|
| 123 |
+
- Decision: [what was chosen]
|
| 124 |
+
- Rationale: [why chosen]
|
| 125 |
+
- Alternatives considered: [what else evaluated]
|
| 126 |
+
|
| 127 |
+
**Output**: research.md with all NEEDS CLARIFICATION resolved
|
| 128 |
+
|
| 129 |
+
### Phase 1: Design & Contracts
|
| 130 |
+
|
| 131 |
+
**Prerequisites:** `research.md` complete
|
| 132 |
+
|
| 133 |
+
1. **Extract entities from feature spec** β `data-model.md`:
|
| 134 |
+
- Entity name, fields, relationships
|
| 135 |
+
- Validation rules from requirements
|
| 136 |
+
- State transitions if applicable
|
| 137 |
+
|
| 138 |
+
2. **Define interface contracts** (if project has external interfaces) β `/contracts/`:
|
| 139 |
+
- Identify what interfaces the project exposes to users or other systems
|
| 140 |
+
- Document the contract format appropriate for the project type
|
| 141 |
+
- Examples: public APIs for libraries, command schemas for CLI tools, endpoints for web services, grammars for parsers, UI contracts for applications
|
| 142 |
+
- Skip if project is purely internal (build scripts, one-off tools, etc.)
|
| 143 |
+
|
| 144 |
+
3. **Agent context update**:
|
| 145 |
+
- Update the plan reference between the `<!-- SPECKIT START -->` and `<!-- SPECKIT END -->` markers in `CLAUDE.md` to point to the plan file created in step 1 (the IMPL_PLAN path)
|
| 146 |
+
|
| 147 |
+
**Output**: data-model.md, /contracts/*, quickstart.md, updated agent context file
|
| 148 |
+
|
| 149 |
+
## Key rules
|
| 150 |
+
|
| 151 |
+
- Use absolute paths for filesystem operations; use project-relative paths for references in documentation and agent context files
|
| 152 |
+
- ERROR on gate failures or unresolved clarifications
|
.claude/skills/speckit-specify/SKILL.md
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-specify"
|
| 3 |
+
description: "Create or update the feature specification from a natural language feature description."
|
| 4 |
+
argument-hint: "Describe the feature you want to specify"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/specify.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before specification)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_specify` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Outline
|
| 58 |
+
|
| 59 |
+
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.
|
| 60 |
+
|
| 61 |
+
Given that feature description, do this:
|
| 62 |
+
|
| 63 |
+
1. **Generate a concise short name** (2-4 words) for the feature:
|
| 64 |
+
- Analyze the feature description and extract the most meaningful keywords
|
| 65 |
+
- Create a 2-4 word short name that captures the essence of the feature
|
| 66 |
+
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
| 67 |
+
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
| 68 |
+
- Keep it concise but descriptive enough to understand the feature at a glance
|
| 69 |
+
- Examples:
|
| 70 |
+
- "I want to add user authentication" β "user-auth"
|
| 71 |
+
- "Implement OAuth2 integration for the API" β "oauth2-api-integration"
|
| 72 |
+
- "Create a dashboard for analytics" β "analytics-dashboard"
|
| 73 |
+
- "Fix payment processing timeout bug" β "fix-payment-timeout"
|
| 74 |
+
|
| 75 |
+
2. **Branch creation** (optional, via hook):
|
| 76 |
+
|
| 77 |
+
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.
|
| 78 |
+
|
| 79 |
+
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).
|
| 80 |
+
|
| 81 |
+
3. **Create the spec feature directory**:
|
| 82 |
+
|
| 83 |
+
Specs live under the default `specs/` directory unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
|
| 84 |
+
|
| 85 |
+
**Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
|
| 86 |
+
1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
|
| 87 |
+
2. Otherwise, auto-generate it under `specs/`:
|
| 88 |
+
- Check `.specify/init-options.json` for `branch_numbering`
|
| 89 |
+
- If `"timestamp"`: prefix is `YYYYMMDD-HHMMSS` (current timestamp)
|
| 90 |
+
- If `"sequential"` or absent: prefix is `NNN` (next available 3-digit number after scanning existing directories in `specs/`)
|
| 91 |
+
- Construct the directory name: `<prefix>-<short-name>` (e.g., `003-user-auth` or `20260319-143022-user-auth`)
|
| 92 |
+
- Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<directory-name>`
|
| 93 |
+
|
| 94 |
+
**Create the directory and spec file**:
|
| 95 |
+
- `mkdir -p SPECIFY_FEATURE_DIRECTORY`
|
| 96 |
+
- Copy `.specify/templates/spec-template.md` to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
|
| 97 |
+
- Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
|
| 98 |
+
- Persist the resolved path to `.specify/feature.json`:
|
| 99 |
+
```json
|
| 100 |
+
{
|
| 101 |
+
"feature_directory": "<resolved feature dir>"
|
| 102 |
+
}
|
| 103 |
+
```
|
| 104 |
+
Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
|
| 105 |
+
This allows downstream commands (`/speckit-plan`, `/speckit-tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
|
| 106 |
+
|
| 107 |
+
**IMPORTANT**:
|
| 108 |
+
- You must only create one feature per `/speckit-specify` invocation
|
| 109 |
+
- The spec directory name and the git branch name are independent β they may be the same but that is the user's choice
|
| 110 |
+
- The spec directory and file are always created by this command, never by the hook
|
| 111 |
+
|
| 112 |
+
4. Load `.specify/templates/spec-template.md` to understand required sections.
|
| 113 |
+
|
| 114 |
+
5. Follow this execution flow:
|
| 115 |
+
1. Parse user description from arguments
|
| 116 |
+
If empty: ERROR "No feature description provided"
|
| 117 |
+
2. Extract key concepts from description
|
| 118 |
+
Identify: actors, actions, data, constraints
|
| 119 |
+
3. For unclear aspects:
|
| 120 |
+
- Make informed guesses based on context and industry standards
|
| 121 |
+
- Only mark with [NEEDS CLARIFICATION: specific question] if:
|
| 122 |
+
- The choice significantly impacts feature scope or user experience
|
| 123 |
+
- Multiple reasonable interpretations exist with different implications
|
| 124 |
+
- No reasonable default exists
|
| 125 |
+
- **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
|
| 126 |
+
- Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
|
| 127 |
+
4. Fill User Scenarios & Testing section
|
| 128 |
+
If no clear user flow: ERROR "Cannot determine user scenarios"
|
| 129 |
+
5. Generate Functional Requirements
|
| 130 |
+
Each requirement must be testable
|
| 131 |
+
Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
|
| 132 |
+
6. Define Success Criteria
|
| 133 |
+
Create measurable, technology-agnostic outcomes
|
| 134 |
+
Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
|
| 135 |
+
Each criterion must be verifiable without implementation details
|
| 136 |
+
7. Identify Key Entities (if data involved)
|
| 137 |
+
8. Return: SUCCESS (spec ready for planning)
|
| 138 |
+
|
| 139 |
+
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.
|
| 140 |
+
|
| 141 |
+
7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
|
| 142 |
+
|
| 143 |
+
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:
|
| 144 |
+
|
| 145 |
+
```markdown
|
| 146 |
+
# Specification Quality Checklist: [FEATURE NAME]
|
| 147 |
+
|
| 148 |
+
**Purpose**: Validate specification completeness and quality before proceeding to planning
|
| 149 |
+
**Created**: [DATE]
|
| 150 |
+
**Feature**: [Link to spec.md]
|
| 151 |
+
|
| 152 |
+
## Content Quality
|
| 153 |
+
|
| 154 |
+
- [ ] No implementation details (languages, frameworks, APIs)
|
| 155 |
+
- [ ] Focused on user value and business needs
|
| 156 |
+
- [ ] Written for non-technical stakeholders
|
| 157 |
+
- [ ] All mandatory sections completed
|
| 158 |
+
|
| 159 |
+
## Requirement Completeness
|
| 160 |
+
|
| 161 |
+
- [ ] No [NEEDS CLARIFICATION] markers remain
|
| 162 |
+
- [ ] Requirements are testable and unambiguous
|
| 163 |
+
- [ ] Success criteria are measurable
|
| 164 |
+
- [ ] Success criteria are technology-agnostic (no implementation details)
|
| 165 |
+
- [ ] All acceptance scenarios are defined
|
| 166 |
+
- [ ] Edge cases are identified
|
| 167 |
+
- [ ] Scope is clearly bounded
|
| 168 |
+
- [ ] Dependencies and assumptions identified
|
| 169 |
+
|
| 170 |
+
## Feature Readiness
|
| 171 |
+
|
| 172 |
+
- [ ] All functional requirements have clear acceptance criteria
|
| 173 |
+
- [ ] User scenarios cover primary flows
|
| 174 |
+
- [ ] Feature meets measurable outcomes defined in Success Criteria
|
| 175 |
+
- [ ] No implementation details leak into specification
|
| 176 |
+
|
| 177 |
+
## Notes
|
| 178 |
+
|
| 179 |
+
- Items marked incomplete require spec updates before `/speckit-clarify` or `/speckit-plan`
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
b. **Run Validation Check**: Review the spec against each checklist item:
|
| 183 |
+
- For each item, determine if it passes or fails
|
| 184 |
+
- Document specific issues found (quote relevant spec sections)
|
| 185 |
+
|
| 186 |
+
c. **Handle Validation Results**:
|
| 187 |
+
|
| 188 |
+
- **If all items pass**: Mark checklist complete and proceed to step 8
|
| 189 |
+
|
| 190 |
+
- **If items fail (excluding [NEEDS CLARIFICATION])**:
|
| 191 |
+
1. List the failing items and specific issues
|
| 192 |
+
2. Update the spec to address each issue
|
| 193 |
+
3. Re-run validation until all items pass (max 3 iterations)
|
| 194 |
+
4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
|
| 195 |
+
|
| 196 |
+
- **If [NEEDS CLARIFICATION] markers remain**:
|
| 197 |
+
1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
|
| 198 |
+
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
|
| 199 |
+
3. For each clarification needed (max 3), present options to user in this format:
|
| 200 |
+
|
| 201 |
+
```markdown
|
| 202 |
+
## Question [N]: [Topic]
|
| 203 |
+
|
| 204 |
+
**Context**: [Quote relevant spec section]
|
| 205 |
+
|
| 206 |
+
**What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
|
| 207 |
+
|
| 208 |
+
**Suggested Answers**:
|
| 209 |
+
|
| 210 |
+
| Option | Answer | Implications |
|
| 211 |
+
|--------|--------|--------------|
|
| 212 |
+
| A | [First suggested answer] | [What this means for the feature] |
|
| 213 |
+
| B | [Second suggested answer] | [What this means for the feature] |
|
| 214 |
+
| C | [Third suggested answer] | [What this means for the feature] |
|
| 215 |
+
| Custom | Provide your own answer | [Explain how to provide custom input] |
|
| 216 |
+
|
| 217 |
+
**Your choice**: _[Wait for user response]_
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
|
| 221 |
+
- Use consistent spacing with pipes aligned
|
| 222 |
+
- Each cell should have spaces around content: `| Content |` not `|Content|`
|
| 223 |
+
- Header separator must have at least 3 dashes: `|--------|`
|
| 224 |
+
- Test that the table renders correctly in markdown preview
|
| 225 |
+
5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
|
| 226 |
+
6. Present all questions together before waiting for responses
|
| 227 |
+
7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
|
| 228 |
+
8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
|
| 229 |
+
9. Re-run validation after all clarifications are resolved
|
| 230 |
+
|
| 231 |
+
d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
|
| 232 |
+
|
| 233 |
+
8. **Report completion** to the user with:
|
| 234 |
+
- `SPECIFY_FEATURE_DIRECTORY` β the feature directory path
|
| 235 |
+
- `SPEC_FILE` β the spec file path
|
| 236 |
+
- Checklist results summary
|
| 237 |
+
- Readiness for the next phase (`/speckit-clarify` or `/speckit-plan`)
|
| 238 |
+
|
| 239 |
+
9. **Check for extension hooks**: After reporting completion, check if `.specify/extensions.yml` exists in the project root.
|
| 240 |
+
- If it exists, read it and look for entries under the `hooks.after_specify` key
|
| 241 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 242 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 243 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 244 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 245 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 246 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 247 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 248 |
+
- **Optional hook** (`optional: true`):
|
| 249 |
+
```
|
| 250 |
+
## Extension Hooks
|
| 251 |
+
|
| 252 |
+
**Optional Hook**: {extension}
|
| 253 |
+
Command: `/{command}`
|
| 254 |
+
Description: {description}
|
| 255 |
+
|
| 256 |
+
Prompt: {prompt}
|
| 257 |
+
To execute: `/{command}`
|
| 258 |
+
```
|
| 259 |
+
- **Mandatory hook** (`optional: false`):
|
| 260 |
+
```
|
| 261 |
+
## Extension Hooks
|
| 262 |
+
|
| 263 |
+
**Automatic Hook**: {extension}
|
| 264 |
+
Executing: `/{command}`
|
| 265 |
+
EXECUTE_COMMAND: {command}
|
| 266 |
+
```
|
| 267 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 268 |
+
|
| 269 |
+
**NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
|
| 270 |
+
|
| 271 |
+
## Quick Guidelines
|
| 272 |
+
|
| 273 |
+
- Focus on **WHAT** users need and **WHY**.
|
| 274 |
+
- Avoid HOW to implement (no tech stack, APIs, code structure).
|
| 275 |
+
- Written for business stakeholders, not developers.
|
| 276 |
+
- DO NOT create any checklists that are embedded in the spec. That will be a separate command.
|
| 277 |
+
|
| 278 |
+
### Section Requirements
|
| 279 |
+
|
| 280 |
+
- **Mandatory sections**: Must be completed for every feature
|
| 281 |
+
- **Optional sections**: Include only when relevant to the feature
|
| 282 |
+
- When a section doesn't apply, remove it entirely (don't leave as "N/A")
|
| 283 |
+
|
| 284 |
+
### For AI Generation
|
| 285 |
+
|
| 286 |
+
When creating this spec from a user prompt:
|
| 287 |
+
|
| 288 |
+
1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
|
| 289 |
+
2. **Document assumptions**: Record reasonable defaults in the Assumptions section
|
| 290 |
+
3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
|
| 291 |
+
- Significantly impact feature scope or user experience
|
| 292 |
+
- Have multiple reasonable interpretations with different implications
|
| 293 |
+
- Lack any reasonable default
|
| 294 |
+
4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
|
| 295 |
+
5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
|
| 296 |
+
6. **Common areas needing clarification** (only if no reasonable default exists):
|
| 297 |
+
- Feature scope and boundaries (include/exclude specific use cases)
|
| 298 |
+
- User types and permissions (if multiple conflicting interpretations possible)
|
| 299 |
+
- Security/compliance requirements (when legally/financially significant)
|
| 300 |
+
|
| 301 |
+
**Examples of reasonable defaults** (don't ask about these):
|
| 302 |
+
|
| 303 |
+
- Data retention: Industry-standard practices for the domain
|
| 304 |
+
- Performance targets: Standard web/mobile app expectations unless specified
|
| 305 |
+
- Error handling: User-friendly messages with appropriate fallbacks
|
| 306 |
+
- Authentication method: Standard session-based or OAuth2 for web apps
|
| 307 |
+
- Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
|
| 308 |
+
|
| 309 |
+
### Success Criteria Guidelines
|
| 310 |
+
|
| 311 |
+
Success criteria must be:
|
| 312 |
+
|
| 313 |
+
1. **Measurable**: Include specific metrics (time, percentage, count, rate)
|
| 314 |
+
2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
|
| 315 |
+
3. **User-focused**: Describe outcomes from user/business perspective, not system internals
|
| 316 |
+
4. **Verifiable**: Can be tested/validated without knowing implementation details
|
| 317 |
+
|
| 318 |
+
**Good examples**:
|
| 319 |
+
|
| 320 |
+
- "Users can complete checkout in under 3 minutes"
|
| 321 |
+
- "System supports 10,000 concurrent users"
|
| 322 |
+
- "95% of searches return results in under 1 second"
|
| 323 |
+
- "Task completion rate improves by 40%"
|
| 324 |
+
|
| 325 |
+
**Bad examples** (implementation-focused):
|
| 326 |
+
|
| 327 |
+
- "API response time is under 200ms" (too technical, use "Users see results instantly")
|
| 328 |
+
- "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
|
| 329 |
+
- "React components render efficiently" (framework-specific)
|
| 330 |
+
- "Redis cache hit rate above 80%" (technology-specific)
|
.claude/skills/speckit-tasks/SKILL.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-tasks"
|
| 3 |
+
description: "Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts."
|
| 4 |
+
argument-hint: "Optional task generation constraints"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/tasks.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before tasks generation)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_tasks` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Outline
|
| 58 |
+
|
| 59 |
+
1. **Setup**: Run `.specify/scripts/powershell/setup-tasks.ps1 -Json` from repo root and parse FEATURE_DIR, TASKS_TEMPLATE, and AVAILABLE_DOCS list. `FEATURE_DIR` and `TASKS_TEMPLATE` must be absolute paths when provided. `AVAILABLE_DOCS` is a list of document names/relative paths available under `FEATURE_DIR` (for example `research.md` or `contracts/`). 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").
|
| 60 |
+
|
| 61 |
+
2. **Load design documents**: Read from FEATURE_DIR:
|
| 62 |
+
- **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
|
| 63 |
+
- **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
|
| 64 |
+
- Note: Not all projects have all documents. Generate tasks based on what's available.
|
| 65 |
+
|
| 66 |
+
3. **Execute task generation workflow**:
|
| 67 |
+
- Load plan.md and extract tech stack, libraries, project structure
|
| 68 |
+
- Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
|
| 69 |
+
- If data-model.md exists: Extract entities and map to user stories
|
| 70 |
+
- If contracts/ exists: Map interface contracts to user stories
|
| 71 |
+
- If research.md exists: Extract decisions for setup tasks
|
| 72 |
+
- Generate tasks organized by user story (see Task Generation Rules below)
|
| 73 |
+
- Generate dependency graph showing user story completion order
|
| 74 |
+
- Create parallel execution examples per user story
|
| 75 |
+
- Validate task completeness (each user story has all needed tasks, independently testable)
|
| 76 |
+
|
| 77 |
+
4. **Generate tasks.md**: Read the tasks template from TASKS_TEMPLATE (from the JSON output above) and use it as structure. If TASKS_TEMPLATE is empty, fall back to `.specify/templates/tasks-template.md`. Fill with:
|
| 78 |
+
- Correct feature name from plan.md
|
| 79 |
+
- Phase 1: Setup tasks (project initialization)
|
| 80 |
+
- Phase 2: Foundational tasks (blocking prerequisites for all user stories)
|
| 81 |
+
- Phase 3+: One phase per user story (in priority order from spec.md)
|
| 82 |
+
- Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
|
| 83 |
+
- Final Phase: Polish & cross-cutting concerns
|
| 84 |
+
- All tasks must follow the strict checklist format (see Task Generation Rules below)
|
| 85 |
+
- Clear file paths for each task
|
| 86 |
+
- Dependencies section showing story completion order
|
| 87 |
+
- Parallel execution examples per story
|
| 88 |
+
- Implementation strategy section (MVP first, incremental delivery)
|
| 89 |
+
|
| 90 |
+
5. **Report**: Output path to generated tasks.md and summary:
|
| 91 |
+
- Total task count
|
| 92 |
+
- Task count per user story
|
| 93 |
+
- Parallel opportunities identified
|
| 94 |
+
- Independent test criteria for each story
|
| 95 |
+
- Suggested MVP scope (typically just User Story 1)
|
| 96 |
+
- Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
|
| 97 |
+
|
| 98 |
+
6. **Check for extension hooks**: After tasks.md is generated, check if `.specify/extensions.yml` exists in the project root.
|
| 99 |
+
- If it exists, read it and look for entries under the `hooks.after_tasks` key
|
| 100 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 101 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 102 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 103 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 104 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 105 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 106 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 107 |
+
- **Optional hook** (`optional: true`):
|
| 108 |
+
```
|
| 109 |
+
## Extension Hooks
|
| 110 |
+
|
| 111 |
+
**Optional Hook**: {extension}
|
| 112 |
+
Command: `/{command}`
|
| 113 |
+
Description: {description}
|
| 114 |
+
|
| 115 |
+
Prompt: {prompt}
|
| 116 |
+
To execute: `/{command}`
|
| 117 |
+
```
|
| 118 |
+
- **Mandatory hook** (`optional: false`):
|
| 119 |
+
```
|
| 120 |
+
## Extension Hooks
|
| 121 |
+
|
| 122 |
+
**Automatic Hook**: {extension}
|
| 123 |
+
Executing: `/{command}`
|
| 124 |
+
EXECUTE_COMMAND: {command}
|
| 125 |
+
```
|
| 126 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 127 |
+
|
| 128 |
+
Context for task generation: $ARGUMENTS
|
| 129 |
+
|
| 130 |
+
The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
|
| 131 |
+
|
| 132 |
+
## Task Generation Rules
|
| 133 |
+
|
| 134 |
+
**CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
|
| 135 |
+
|
| 136 |
+
**Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
|
| 137 |
+
|
| 138 |
+
### Checklist Format (REQUIRED)
|
| 139 |
+
|
| 140 |
+
Every task MUST strictly follow this format:
|
| 141 |
+
|
| 142 |
+
```text
|
| 143 |
+
- [ ] [TaskID] [P?] [Story?] Description with file path
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
**Format Components**:
|
| 147 |
+
|
| 148 |
+
1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
|
| 149 |
+
2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
|
| 150 |
+
3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
|
| 151 |
+
4. **[Story] label**: REQUIRED for user story phase tasks only
|
| 152 |
+
- Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
|
| 153 |
+
- Setup phase: NO story label
|
| 154 |
+
- Foundational phase: NO story label
|
| 155 |
+
- User Story phases: MUST have story label
|
| 156 |
+
- Polish phase: NO story label
|
| 157 |
+
5. **Description**: Clear action with exact file path
|
| 158 |
+
|
| 159 |
+
**Examples**:
|
| 160 |
+
|
| 161 |
+
- β
CORRECT: `- [ ] T001 Create project structure per implementation plan`
|
| 162 |
+
- β
CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
|
| 163 |
+
- β
CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
|
| 164 |
+
- β
CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
|
| 165 |
+
- β WRONG: `- [ ] Create User model` (missing ID and Story label)
|
| 166 |
+
- β WRONG: `T001 [US1] Create model` (missing checkbox)
|
| 167 |
+
- β WRONG: `- [ ] [US1] Create User model` (missing Task ID)
|
| 168 |
+
- β WRONG: `- [ ] T001 [US1] Create model` (missing file path)
|
| 169 |
+
|
| 170 |
+
### Task Organization
|
| 171 |
+
|
| 172 |
+
1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
|
| 173 |
+
- Each user story (P1, P2, P3...) gets its own phase
|
| 174 |
+
- Map all related components to their story:
|
| 175 |
+
- Models needed for that story
|
| 176 |
+
- Services needed for that story
|
| 177 |
+
- Interfaces/UI needed for that story
|
| 178 |
+
- If tests requested: Tests specific to that story
|
| 179 |
+
- Mark story dependencies (most stories should be independent)
|
| 180 |
+
|
| 181 |
+
2. **From Contracts**:
|
| 182 |
+
- Map each interface contract β to the user story it serves
|
| 183 |
+
- If tests requested: Each interface contract β contract test task [P] before implementation in that story's phase
|
| 184 |
+
|
| 185 |
+
3. **From Data Model**:
|
| 186 |
+
- Map each entity to the user story(ies) that need it
|
| 187 |
+
- If entity serves multiple stories: Put in earliest story or Setup phase
|
| 188 |
+
- Relationships β service layer tasks in appropriate story phase
|
| 189 |
+
|
| 190 |
+
4. **From Setup/Infrastructure**:
|
| 191 |
+
- Shared infrastructure β Setup phase (Phase 1)
|
| 192 |
+
- Foundational/blocking tasks β Foundational phase (Phase 2)
|
| 193 |
+
- Story-specific setup β within that story's phase
|
| 194 |
+
|
| 195 |
+
### Phase Structure
|
| 196 |
+
|
| 197 |
+
- **Phase 1**: Setup (project initialization)
|
| 198 |
+
- **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
|
| 199 |
+
- **Phase 3+**: User Stories in priority order (P1, P2, P3...)
|
| 200 |
+
- Within each story: Tests (if requested) β Models β Services β Endpoints β Integration
|
| 201 |
+
- Each phase should be a complete, independently testable increment
|
| 202 |
+
- **Final Phase**: Polish & Cross-Cutting Concerns
|
.claude/skills/speckit-taskstoissues/SKILL.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: "speckit-taskstoissues"
|
| 3 |
+
description: "Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts."
|
| 4 |
+
argument-hint: "Optional filter or label for GitHub issues"
|
| 5 |
+
compatibility: "Requires spec-kit project structure with .specify/ directory"
|
| 6 |
+
metadata:
|
| 7 |
+
author: "github-spec-kit"
|
| 8 |
+
source: "templates/commands/taskstoissues.md"
|
| 9 |
+
user-invocable: true
|
| 10 |
+
disable-model-invocation: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## User Input
|
| 15 |
+
|
| 16 |
+
```text
|
| 17 |
+
$ARGUMENTS
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 21 |
+
|
| 22 |
+
## Pre-Execution Checks
|
| 23 |
+
|
| 24 |
+
**Check for extension hooks (before tasks-to-issues conversion)**:
|
| 25 |
+
- Check if `.specify/extensions.yml` exists in the project root.
|
| 26 |
+
- If it exists, read it and look for entries under the `hooks.before_taskstoissues` key
|
| 27 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 28 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 29 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 30 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 31 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 32 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 33 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 34 |
+
- **Optional hook** (`optional: true`):
|
| 35 |
+
```
|
| 36 |
+
## Extension Hooks
|
| 37 |
+
|
| 38 |
+
**Optional Pre-Hook**: {extension}
|
| 39 |
+
Command: `/{command}`
|
| 40 |
+
Description: {description}
|
| 41 |
+
|
| 42 |
+
Prompt: {prompt}
|
| 43 |
+
To execute: `/{command}`
|
| 44 |
+
```
|
| 45 |
+
- **Mandatory hook** (`optional: false`):
|
| 46 |
+
```
|
| 47 |
+
## Extension Hooks
|
| 48 |
+
|
| 49 |
+
**Automatic Pre-Hook**: {extension}
|
| 50 |
+
Executing: `/{command}`
|
| 51 |
+
EXECUTE_COMMAND: {command}
|
| 52 |
+
|
| 53 |
+
Wait for the result of the hook command before proceeding to the Outline.
|
| 54 |
+
```
|
| 55 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
| 56 |
+
|
| 57 |
+
## Outline
|
| 58 |
+
|
| 59 |
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` 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").
|
| 60 |
+
1. From the executed script, extract the path to **tasks**.
|
| 61 |
+
1. Get the Git remote by running:
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
git config --get remote.origin.url
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
> [!CAUTION]
|
| 68 |
+
> ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
|
| 69 |
+
|
| 70 |
+
1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote.
|
| 71 |
+
|
| 72 |
+
> [!CAUTION]
|
| 73 |
+
> UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
|
| 74 |
+
|
| 75 |
+
## Post-Execution Checks
|
| 76 |
+
|
| 77 |
+
**Check for extension hooks (after tasks-to-issues conversion)**:
|
| 78 |
+
Check if `.specify/extensions.yml` exists in the project root.
|
| 79 |
+
- If it exists, read it and look for entries under the `hooks.after_taskstoissues` key
|
| 80 |
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
| 81 |
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
| 82 |
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
| 83 |
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
| 84 |
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
| 85 |
+
- When constructing slash commands from hook command names, replace dots (`.`) with hyphens (`-`). For example, `speckit.git.commit` β `/speckit-git-commit`.
|
| 86 |
+
- For each executable hook, output the following based on its `optional` flag:
|
| 87 |
+
- **Optional hook** (`optional: true`):
|
| 88 |
+
```
|
| 89 |
+
## Extension Hooks
|
| 90 |
+
|
| 91 |
+
**Optional Hook**: {extension}
|
| 92 |
+
Command: `/{command}`
|
| 93 |
+
Description: {description}
|
| 94 |
+
|
| 95 |
+
Prompt: {prompt}
|
| 96 |
+
To execute: `/{command}`
|
| 97 |
+
```
|
| 98 |
+
- **Mandatory hook** (`optional: false`):
|
| 99 |
+
```
|
| 100 |
+
## Extension Hooks
|
| 101 |
+
|
| 102 |
+
**Automatic Hook**: {extension}
|
| 103 |
+
Executing: `/{command}`
|
| 104 |
+
EXECUTE_COMMAND: {command}
|
| 105 |
+
```
|
| 106 |
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
.gitignore
CHANGED
|
@@ -42,4 +42,5 @@ API_CONTRACT_AGENT_ACTIVE.md
|
|
| 42 |
API_CONTRACT_ORCHESTRATION.md
|
| 43 |
|
| 44 |
# Database logos (served via CDN)
|
| 45 |
-
public/databases/
|
|
|
|
|
|
| 42 |
API_CONTRACT_ORCHESTRATION.md
|
| 43 |
|
| 44 |
# Database logos (served via CDN)
|
| 45 |
+
public/databases/
|
| 46 |
+
archieved/
|
.specify/extensions.yml
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
installed:
|
| 2 |
+
- git
|
| 3 |
+
settings:
|
| 4 |
+
auto_execute_hooks: true
|
| 5 |
+
hooks:
|
| 6 |
+
before_constitution:
|
| 7 |
+
- extension: git
|
| 8 |
+
command: speckit.git.initialize
|
| 9 |
+
enabled: true
|
| 10 |
+
optional: false
|
| 11 |
+
prompt: Execute speckit.git.initialize?
|
| 12 |
+
description: Initialize Git repository before constitution setup
|
| 13 |
+
condition: null
|
| 14 |
+
before_specify:
|
| 15 |
+
- extension: git
|
| 16 |
+
command: speckit.git.feature
|
| 17 |
+
enabled: true
|
| 18 |
+
optional: false
|
| 19 |
+
prompt: Execute speckit.git.feature?
|
| 20 |
+
description: Create feature branch before specification
|
| 21 |
+
condition: null
|
| 22 |
+
before_clarify:
|
| 23 |
+
- extension: git
|
| 24 |
+
command: speckit.git.commit
|
| 25 |
+
enabled: true
|
| 26 |
+
optional: true
|
| 27 |
+
prompt: Commit outstanding changes before clarification?
|
| 28 |
+
description: Auto-commit before spec clarification
|
| 29 |
+
condition: null
|
| 30 |
+
before_plan:
|
| 31 |
+
- extension: git
|
| 32 |
+
command: speckit.git.commit
|
| 33 |
+
enabled: true
|
| 34 |
+
optional: true
|
| 35 |
+
prompt: Commit outstanding changes before planning?
|
| 36 |
+
description: Auto-commit before implementation planning
|
| 37 |
+
condition: null
|
| 38 |
+
before_tasks:
|
| 39 |
+
- extension: git
|
| 40 |
+
command: speckit.git.commit
|
| 41 |
+
enabled: true
|
| 42 |
+
optional: true
|
| 43 |
+
prompt: Commit outstanding changes before task generation?
|
| 44 |
+
description: Auto-commit before task generation
|
| 45 |
+
condition: null
|
| 46 |
+
before_implement:
|
| 47 |
+
- extension: git
|
| 48 |
+
command: speckit.git.commit
|
| 49 |
+
enabled: true
|
| 50 |
+
optional: true
|
| 51 |
+
prompt: Commit outstanding changes before implementation?
|
| 52 |
+
description: Auto-commit before implementation
|
| 53 |
+
condition: null
|
| 54 |
+
before_checklist:
|
| 55 |
+
- extension: git
|
| 56 |
+
command: speckit.git.commit
|
| 57 |
+
enabled: true
|
| 58 |
+
optional: true
|
| 59 |
+
prompt: Commit outstanding changes before checklist?
|
| 60 |
+
description: Auto-commit before checklist generation
|
| 61 |
+
condition: null
|
| 62 |
+
before_analyze:
|
| 63 |
+
- extension: git
|
| 64 |
+
command: speckit.git.commit
|
| 65 |
+
enabled: true
|
| 66 |
+
optional: true
|
| 67 |
+
prompt: Commit outstanding changes before analysis?
|
| 68 |
+
description: Auto-commit before analysis
|
| 69 |
+
condition: null
|
| 70 |
+
before_taskstoissues:
|
| 71 |
+
- extension: git
|
| 72 |
+
command: speckit.git.commit
|
| 73 |
+
enabled: true
|
| 74 |
+
optional: true
|
| 75 |
+
prompt: Commit outstanding changes before issue sync?
|
| 76 |
+
description: Auto-commit before tasks-to-issues conversion
|
| 77 |
+
condition: null
|
| 78 |
+
after_constitution:
|
| 79 |
+
- extension: git
|
| 80 |
+
command: speckit.git.commit
|
| 81 |
+
enabled: true
|
| 82 |
+
optional: true
|
| 83 |
+
prompt: Commit constitution changes?
|
| 84 |
+
description: Auto-commit after constitution update
|
| 85 |
+
condition: null
|
| 86 |
+
after_specify:
|
| 87 |
+
- extension: git
|
| 88 |
+
command: speckit.git.commit
|
| 89 |
+
enabled: true
|
| 90 |
+
optional: true
|
| 91 |
+
prompt: Commit specification changes?
|
| 92 |
+
description: Auto-commit after specification
|
| 93 |
+
condition: null
|
| 94 |
+
after_clarify:
|
| 95 |
+
- extension: git
|
| 96 |
+
command: speckit.git.commit
|
| 97 |
+
enabled: true
|
| 98 |
+
optional: true
|
| 99 |
+
prompt: Commit clarification changes?
|
| 100 |
+
description: Auto-commit after spec clarification
|
| 101 |
+
condition: null
|
| 102 |
+
after_plan:
|
| 103 |
+
- extension: git
|
| 104 |
+
command: speckit.git.commit
|
| 105 |
+
enabled: true
|
| 106 |
+
optional: true
|
| 107 |
+
prompt: Commit plan changes?
|
| 108 |
+
description: Auto-commit after implementation planning
|
| 109 |
+
condition: null
|
| 110 |
+
after_tasks:
|
| 111 |
+
- extension: git
|
| 112 |
+
command: speckit.git.commit
|
| 113 |
+
enabled: true
|
| 114 |
+
optional: true
|
| 115 |
+
prompt: Commit task changes?
|
| 116 |
+
description: Auto-commit after task generation
|
| 117 |
+
condition: null
|
| 118 |
+
after_implement:
|
| 119 |
+
- extension: git
|
| 120 |
+
command: speckit.git.commit
|
| 121 |
+
enabled: true
|
| 122 |
+
optional: true
|
| 123 |
+
prompt: Commit implementation changes?
|
| 124 |
+
description: Auto-commit after implementation
|
| 125 |
+
condition: null
|
| 126 |
+
after_checklist:
|
| 127 |
+
- extension: git
|
| 128 |
+
command: speckit.git.commit
|
| 129 |
+
enabled: true
|
| 130 |
+
optional: true
|
| 131 |
+
prompt: Commit checklist changes?
|
| 132 |
+
description: Auto-commit after checklist generation
|
| 133 |
+
condition: null
|
| 134 |
+
after_analyze:
|
| 135 |
+
- extension: git
|
| 136 |
+
command: speckit.git.commit
|
| 137 |
+
enabled: true
|
| 138 |
+
optional: true
|
| 139 |
+
prompt: Commit analysis results?
|
| 140 |
+
description: Auto-commit after analysis
|
| 141 |
+
condition: null
|
| 142 |
+
after_taskstoissues:
|
| 143 |
+
- extension: git
|
| 144 |
+
command: speckit.git.commit
|
| 145 |
+
enabled: true
|
| 146 |
+
optional: true
|
| 147 |
+
prompt: Commit after syncing issues?
|
| 148 |
+
description: Auto-commit after tasks-to-issues conversion
|
| 149 |
+
condition: null
|
.specify/extensions/.registry
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "1.0",
|
| 3 |
+
"extensions": {
|
| 4 |
+
"git": {
|
| 5 |
+
"version": "1.0.0",
|
| 6 |
+
"source": "local",
|
| 7 |
+
"manifest_hash": "sha256:9731aa8143a72fbebfdb440f155038ab42642517c2b2bdbbf67c8fdbe076ed79",
|
| 8 |
+
"enabled": true,
|
| 9 |
+
"priority": 10,
|
| 10 |
+
"registered_commands": {
|
| 11 |
+
"claude": [
|
| 12 |
+
"speckit.git.feature",
|
| 13 |
+
"speckit.git.validate",
|
| 14 |
+
"speckit.git.remote",
|
| 15 |
+
"speckit.git.initialize",
|
| 16 |
+
"speckit.git.commit"
|
| 17 |
+
]
|
| 18 |
+
},
|
| 19 |
+
"registered_skills": [],
|
| 20 |
+
"installed_at": "2026-06-15T03:28:42.563955+00:00"
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
}
|
.specify/extensions/git/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git Branching Workflow Extension
|
| 2 |
+
|
| 3 |
+
Git repository initialization, feature branch creation, numbering (sequential/timestamp), validation, remote detection, and auto-commit for Spec Kit.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
This extension provides Git operations as an optional, self-contained module. It manages:
|
| 8 |
+
|
| 9 |
+
- **Repository initialization** with configurable commit messages
|
| 10 |
+
- **Feature branch creation** with sequential (`001-feature-name`) or timestamp (`20260319-143022-feature-name`) numbering
|
| 11 |
+
- **Branch validation** to ensure branches follow naming conventions
|
| 12 |
+
- **Git remote detection** for GitHub integration (e.g., issue creation)
|
| 13 |
+
- **Auto-commit** after core commands (configurable per-command with custom messages)
|
| 14 |
+
|
| 15 |
+
## Commands
|
| 16 |
+
|
| 17 |
+
| Command | Description |
|
| 18 |
+
|---------|-------------|
|
| 19 |
+
| `speckit.git.initialize` | Initialize a Git repository with a configurable commit message |
|
| 20 |
+
| `speckit.git.feature` | Create a feature branch with sequential or timestamp numbering |
|
| 21 |
+
| `speckit.git.validate` | Validate current branch follows feature branch naming conventions |
|
| 22 |
+
| `speckit.git.remote` | Detect Git remote URL for GitHub integration |
|
| 23 |
+
| `speckit.git.commit` | Auto-commit changes (configurable per-command enable/disable and messages) |
|
| 24 |
+
|
| 25 |
+
## Hooks
|
| 26 |
+
|
| 27 |
+
| Event | Command | Optional | Description |
|
| 28 |
+
|-------|---------|----------|-------------|
|
| 29 |
+
| `before_constitution` | `speckit.git.initialize` | No | Init git repo before constitution |
|
| 30 |
+
| `before_specify` | `speckit.git.feature` | No | Create feature branch before specification |
|
| 31 |
+
| `before_clarify` | `speckit.git.commit` | Yes | Commit outstanding changes before clarification |
|
| 32 |
+
| `before_plan` | `speckit.git.commit` | Yes | Commit outstanding changes before planning |
|
| 33 |
+
| `before_tasks` | `speckit.git.commit` | Yes | Commit outstanding changes before task generation |
|
| 34 |
+
| `before_implement` | `speckit.git.commit` | Yes | Commit outstanding changes before implementation |
|
| 35 |
+
| `before_checklist` | `speckit.git.commit` | Yes | Commit outstanding changes before checklist |
|
| 36 |
+
| `before_analyze` | `speckit.git.commit` | Yes | Commit outstanding changes before analysis |
|
| 37 |
+
| `before_taskstoissues` | `speckit.git.commit` | Yes | Commit outstanding changes before issue sync |
|
| 38 |
+
| `after_constitution` | `speckit.git.commit` | Yes | Auto-commit after constitution update |
|
| 39 |
+
| `after_specify` | `speckit.git.commit` | Yes | Auto-commit after specification |
|
| 40 |
+
| `after_clarify` | `speckit.git.commit` | Yes | Auto-commit after clarification |
|
| 41 |
+
| `after_plan` | `speckit.git.commit` | Yes | Auto-commit after planning |
|
| 42 |
+
| `after_tasks` | `speckit.git.commit` | Yes | Auto-commit after task generation |
|
| 43 |
+
| `after_implement` | `speckit.git.commit` | Yes | Auto-commit after implementation |
|
| 44 |
+
| `after_checklist` | `speckit.git.commit` | Yes | Auto-commit after checklist |
|
| 45 |
+
| `after_analyze` | `speckit.git.commit` | Yes | Auto-commit after analysis |
|
| 46 |
+
| `after_taskstoissues` | `speckit.git.commit` | Yes | Auto-commit after issue sync |
|
| 47 |
+
|
| 48 |
+
## Configuration
|
| 49 |
+
|
| 50 |
+
Configuration is stored in `.specify/extensions/git/git-config.yml`:
|
| 51 |
+
|
| 52 |
+
```yaml
|
| 53 |
+
# Branch numbering strategy: "sequential" or "timestamp"
|
| 54 |
+
branch_numbering: sequential
|
| 55 |
+
|
| 56 |
+
# Custom commit message for git init
|
| 57 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
| 58 |
+
|
| 59 |
+
# Auto-commit per command (all disabled by default)
|
| 60 |
+
# Example: enable auto-commit after specify
|
| 61 |
+
auto_commit:
|
| 62 |
+
default: false
|
| 63 |
+
after_specify:
|
| 64 |
+
enabled: true
|
| 65 |
+
message: "[Spec Kit] Add specification"
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Installation
|
| 69 |
+
|
| 70 |
+
```bash
|
| 71 |
+
# Install the bundled git extension (no network required)
|
| 72 |
+
specify extension add git
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Disabling
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
# Disable the git extension (spec creation continues without branching)
|
| 79 |
+
specify extension disable git
|
| 80 |
+
|
| 81 |
+
# Re-enable it
|
| 82 |
+
specify extension enable git
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Graceful Degradation
|
| 86 |
+
|
| 87 |
+
When Git is not installed or the directory is not a Git repository:
|
| 88 |
+
- Spec directories are still created under `specs/`
|
| 89 |
+
- Branch creation is skipped with a warning
|
| 90 |
+
- Branch validation is skipped with a warning
|
| 91 |
+
- Remote detection returns empty results
|
| 92 |
+
|
| 93 |
+
## Scripts
|
| 94 |
+
|
| 95 |
+
The extension bundles cross-platform scripts:
|
| 96 |
+
|
| 97 |
+
- `scripts/bash/create-new-feature.sh` β Bash implementation
|
| 98 |
+
- `scripts/bash/git-common.sh` β Shared Git utilities (Bash)
|
| 99 |
+
- `scripts/powershell/create-new-feature.ps1` β PowerShell implementation
|
| 100 |
+
- `scripts/powershell/git-common.ps1` β Shared Git utilities (PowerShell)
|
.specify/extensions/git/commands/speckit.git.commit.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Auto-commit changes after a Spec Kit command completes"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Auto-Commit Changes
|
| 6 |
+
|
| 7 |
+
Automatically stage and commit all changes after a Spec Kit command completes.
|
| 8 |
+
|
| 9 |
+
## Behavior
|
| 10 |
+
|
| 11 |
+
This command is invoked as a hook after (or before) core commands. It:
|
| 12 |
+
|
| 13 |
+
1. Determines the event name from the hook context (e.g., if invoked as an `after_specify` hook, the event is `after_specify`; if `before_plan`, the event is `before_plan`)
|
| 14 |
+
2. Checks `.specify/extensions/git/git-config.yml` for the `auto_commit` section
|
| 15 |
+
3. Looks up the specific event key to see if auto-commit is enabled
|
| 16 |
+
4. Falls back to `auto_commit.default` if no event-specific key exists
|
| 17 |
+
5. Uses the per-command `message` if configured, otherwise a default message
|
| 18 |
+
6. If enabled and there are uncommitted changes, runs `git add .` + `git commit`
|
| 19 |
+
|
| 20 |
+
## Execution
|
| 21 |
+
|
| 22 |
+
Determine the event name from the hook that triggered this command, then run the script:
|
| 23 |
+
|
| 24 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/auto-commit.sh <event_name>`
|
| 25 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/auto-commit.ps1 <event_name>`
|
| 26 |
+
|
| 27 |
+
Replace `<event_name>` with the actual hook event (e.g., `after_specify`, `before_plan`, `after_implement`).
|
| 28 |
+
|
| 29 |
+
## Configuration
|
| 30 |
+
|
| 31 |
+
In `.specify/extensions/git/git-config.yml`:
|
| 32 |
+
|
| 33 |
+
```yaml
|
| 34 |
+
auto_commit:
|
| 35 |
+
default: false # Global toggle β set true to enable for all commands
|
| 36 |
+
after_specify:
|
| 37 |
+
enabled: true # Override per-command
|
| 38 |
+
message: "[Spec Kit] Add specification"
|
| 39 |
+
after_plan:
|
| 40 |
+
enabled: false
|
| 41 |
+
message: "[Spec Kit] Add implementation plan"
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Graceful Degradation
|
| 45 |
+
|
| 46 |
+
- If Git is not available or the current directory is not a repository: skips with a warning
|
| 47 |
+
- If no config file exists: skips (disabled by default)
|
| 48 |
+
- If no changes to commit: skips with a message
|
.specify/extensions/git/commands/speckit.git.feature.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Create a feature branch with sequential or timestamp numbering"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Create Feature Branch
|
| 6 |
+
|
| 7 |
+
Create and switch to a new git feature branch for the given specification. This command handles **branch creation only** β the spec directory and files are created by the core `__SPECKIT_COMMAND_SPECIFY__` workflow.
|
| 8 |
+
|
| 9 |
+
## User Input
|
| 10 |
+
|
| 11 |
+
```text
|
| 12 |
+
$ARGUMENTS
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
You **MUST** consider the user input before proceeding (if not empty).
|
| 16 |
+
|
| 17 |
+
## Environment Variable Override
|
| 18 |
+
|
| 19 |
+
If the user explicitly provided `GIT_BRANCH_NAME` (e.g., via environment variable, argument, or in their request), pass it through to the script by setting the `GIT_BRANCH_NAME` environment variable before invoking the script. When `GIT_BRANCH_NAME` is set:
|
| 20 |
+
- The script uses the exact value as the branch name, bypassing all prefix/suffix generation
|
| 21 |
+
- `--short-name`, `--number`, and `--timestamp` flags are ignored
|
| 22 |
+
- `FEATURE_NUM` is extracted from the name if it starts with a numeric prefix, otherwise set to the full branch name
|
| 23 |
+
|
| 24 |
+
## Prerequisites
|
| 25 |
+
|
| 26 |
+
- Verify Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 27 |
+
- If Git is not available, warn the user and skip branch creation
|
| 28 |
+
|
| 29 |
+
## Branch Numbering Mode
|
| 30 |
+
|
| 31 |
+
Determine the branch numbering strategy by checking configuration in this order:
|
| 32 |
+
|
| 33 |
+
1. Check `.specify/extensions/git/git-config.yml` for `branch_numbering` value
|
| 34 |
+
2. Check `.specify/init-options.json` for `branch_numbering` value (backward compatibility)
|
| 35 |
+
3. Default to `sequential` if neither exists
|
| 36 |
+
|
| 37 |
+
## Execution
|
| 38 |
+
|
| 39 |
+
Generate a concise short name (2-4 words) for the branch:
|
| 40 |
+
- Analyze the feature description and extract the most meaningful keywords
|
| 41 |
+
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
| 42 |
+
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
| 43 |
+
|
| 44 |
+
Run the appropriate script based on your platform:
|
| 45 |
+
|
| 46 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/create-new-feature.sh --json --short-name "<short-name>" "<feature description>"`
|
| 47 |
+
- **Bash (timestamp)**: `.specify/extensions/git/scripts/bash/create-new-feature.sh --json --timestamp --short-name "<short-name>" "<feature description>"`
|
| 48 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/create-new-feature.ps1 -Json -ShortName "<short-name>" "<feature description>"`
|
| 49 |
+
- **PowerShell (timestamp)**: `.specify/extensions/git/scripts/powershell/create-new-feature.ps1 -Json -Timestamp -ShortName "<short-name>" "<feature description>"`
|
| 50 |
+
|
| 51 |
+
**IMPORTANT**:
|
| 52 |
+
- Do NOT pass `--number` β the script determines the correct next number automatically
|
| 53 |
+
- Always include the JSON flag (`--json` for Bash, `-Json` for PowerShell) so the output can be parsed reliably
|
| 54 |
+
- You must only ever run this script once per feature
|
| 55 |
+
- The JSON output will contain `BRANCH_NAME` and `FEATURE_NUM`
|
| 56 |
+
|
| 57 |
+
## Graceful Degradation
|
| 58 |
+
|
| 59 |
+
If Git is not installed or the current directory is not a Git repository:
|
| 60 |
+
- Branch creation is skipped with a warning: `[specify] Warning: Git repository not detected; skipped branch creation`
|
| 61 |
+
- The script still outputs `BRANCH_NAME` and `FEATURE_NUM` so the caller can reference them
|
| 62 |
+
|
| 63 |
+
## Output
|
| 64 |
+
|
| 65 |
+
The script outputs JSON with:
|
| 66 |
+
- `BRANCH_NAME`: The branch name (e.g., `003-user-auth` or `20260319-143022-user-auth`)
|
| 67 |
+
- `FEATURE_NUM`: The numeric or timestamp prefix used
|
.specify/extensions/git/commands/speckit.git.initialize.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Initialize a Git repository with an initial commit"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Initialize Git Repository
|
| 6 |
+
|
| 7 |
+
Initialize a Git repository in the current project directory if one does not already exist.
|
| 8 |
+
|
| 9 |
+
## Execution
|
| 10 |
+
|
| 11 |
+
Run the appropriate script from the project root:
|
| 12 |
+
|
| 13 |
+
- **Bash**: `.specify/extensions/git/scripts/bash/initialize-repo.sh`
|
| 14 |
+
- **PowerShell**: `.specify/extensions/git/scripts/powershell/initialize-repo.ps1`
|
| 15 |
+
|
| 16 |
+
If the extension scripts are not found, fall back to:
|
| 17 |
+
- **Bash**: `git init && git add . && git commit -m "Initial commit from Specify template"`
|
| 18 |
+
- **PowerShell**: `git init; git add .; git commit -m "Initial commit from Specify template"`
|
| 19 |
+
|
| 20 |
+
The script handles all checks internally:
|
| 21 |
+
- Skips if Git is not available
|
| 22 |
+
- Skips if already inside a Git repository
|
| 23 |
+
- Runs `git init`, `git add .`, and `git commit` with an initial commit message
|
| 24 |
+
|
| 25 |
+
## Customization
|
| 26 |
+
|
| 27 |
+
Replace the script to add project-specific Git initialization steps:
|
| 28 |
+
- Custom `.gitignore` templates
|
| 29 |
+
- Default branch naming (`git config init.defaultBranch`)
|
| 30 |
+
- Git LFS setup
|
| 31 |
+
- Git hooks installation
|
| 32 |
+
- Commit signing configuration
|
| 33 |
+
- Git Flow initialization
|
| 34 |
+
|
| 35 |
+
## Output
|
| 36 |
+
|
| 37 |
+
On success:
|
| 38 |
+
- `β Git repository initialized`
|
| 39 |
+
|
| 40 |
+
## Graceful Degradation
|
| 41 |
+
|
| 42 |
+
If Git is not installed:
|
| 43 |
+
- Warn the user
|
| 44 |
+
- Skip repository initialization
|
| 45 |
+
- The project continues to function without Git (specs can still be created under `specs/`)
|
| 46 |
+
|
| 47 |
+
If Git is installed but `git init`, `git add .`, or `git commit` fails:
|
| 48 |
+
- Surface the error to the user
|
| 49 |
+
- Stop this command rather than continuing with a partially initialized repository
|
.specify/extensions/git/commands/speckit.git.remote.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Detect Git remote URL for GitHub integration"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Detect Git Remote URL
|
| 6 |
+
|
| 7 |
+
Detect the Git remote URL for integration with GitHub services (e.g., issue creation).
|
| 8 |
+
|
| 9 |
+
## Prerequisites
|
| 10 |
+
|
| 11 |
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 12 |
+
- If Git is not available, output a warning and return empty:
|
| 13 |
+
```
|
| 14 |
+
[specify] Warning: Git repository not detected; cannot determine remote URL
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Execution
|
| 18 |
+
|
| 19 |
+
Run the following command to get the remote URL:
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
git config --get remote.origin.url
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## Output
|
| 26 |
+
|
| 27 |
+
Parse the remote URL and determine:
|
| 28 |
+
|
| 29 |
+
1. **Repository owner**: Extract from the URL (e.g., `github` from `https://github.com/github/spec-kit.git`)
|
| 30 |
+
2. **Repository name**: Extract from the URL (e.g., `spec-kit` from `https://github.com/github/spec-kit.git`)
|
| 31 |
+
3. **Is GitHub**: Whether the remote points to a GitHub repository
|
| 32 |
+
|
| 33 |
+
Supported URL formats:
|
| 34 |
+
- HTTPS: `https://github.com/<owner>/<repo>.git`
|
| 35 |
+
- SSH: `git@github.com:<owner>/<repo>.git`
|
| 36 |
+
|
| 37 |
+
> [!CAUTION]
|
| 38 |
+
> ONLY report a GitHub repository if the remote URL actually points to github.com.
|
| 39 |
+
> Do NOT assume the remote is GitHub if the URL format doesn't match.
|
| 40 |
+
|
| 41 |
+
## Graceful Degradation
|
| 42 |
+
|
| 43 |
+
If Git is not installed, the directory is not a Git repository, or no remote is configured:
|
| 44 |
+
- Return an empty result
|
| 45 |
+
- Do NOT error β other workflows should continue without Git remote information
|
.specify/extensions/git/commands/speckit.git.validate.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: "Validate current branch follows feature branch naming conventions"
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Validate Feature Branch
|
| 6 |
+
|
| 7 |
+
Validate that the current Git branch follows the expected feature branch naming conventions.
|
| 8 |
+
|
| 9 |
+
## Prerequisites
|
| 10 |
+
|
| 11 |
+
- Check if Git is available by running `git rev-parse --is-inside-work-tree 2>/dev/null`
|
| 12 |
+
- If Git is not available, output a warning and skip validation:
|
| 13 |
+
```
|
| 14 |
+
[specify] Warning: Git repository not detected; skipped branch validation
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Validation Rules
|
| 18 |
+
|
| 19 |
+
Get the current branch name:
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
git rev-parse --abbrev-ref HEAD
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
The branch name must match one of these patterns:
|
| 26 |
+
|
| 27 |
+
1. **Sequential**: `^[0-9]{3,}-` (e.g., `001-feature-name`, `042-fix-bug`, `1000-big-feature`)
|
| 28 |
+
2. **Timestamp**: `^[0-9]{8}-[0-9]{6}-` (e.g., `20260319-143022-feature-name`)
|
| 29 |
+
|
| 30 |
+
## Execution
|
| 31 |
+
|
| 32 |
+
If on a feature branch (matches either pattern):
|
| 33 |
+
- Output: `β On feature branch: <branch-name>`
|
| 34 |
+
- Check if the corresponding spec directory exists under `specs/`:
|
| 35 |
+
- For sequential branches, look for `specs/<prefix>-*` where prefix matches the numeric portion
|
| 36 |
+
- For timestamp branches, look for `specs/<prefix>-*` where prefix matches the `YYYYMMDD-HHMMSS` portion
|
| 37 |
+
- If spec directory exists: `β Spec directory found: <path>`
|
| 38 |
+
- If spec directory missing: `β No spec directory found for prefix <prefix>`
|
| 39 |
+
|
| 40 |
+
If NOT on a feature branch:
|
| 41 |
+
- Output: `β Not on a feature branch. Current branch: <branch-name>`
|
| 42 |
+
- Output: `Feature branches should be named like: 001-feature-name or 20260319-143022-feature-name`
|
| 43 |
+
|
| 44 |
+
## Graceful Degradation
|
| 45 |
+
|
| 46 |
+
If Git is not installed or the directory is not a Git repository:
|
| 47 |
+
- Check the `SPECIFY_FEATURE` environment variable as a fallback
|
| 48 |
+
- If set, validate that value against the naming patterns
|
| 49 |
+
- If not set, skip validation with a warning
|
.specify/extensions/git/config-template.yml
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git Branching Workflow Extension Configuration
|
| 2 |
+
# Copied to .specify/extensions/git/git-config.yml on install
|
| 3 |
+
|
| 4 |
+
# Branch numbering strategy: "sequential" (001, 002, ...) or "timestamp" (YYYYMMDD-HHMMSS)
|
| 5 |
+
branch_numbering: sequential
|
| 6 |
+
|
| 7 |
+
# Commit message used by `git commit` during repository initialization
|
| 8 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
| 9 |
+
|
| 10 |
+
# Auto-commit before/after core commands.
|
| 11 |
+
# Set "default" to enable for all commands, then override per-command.
|
| 12 |
+
# Each key can be true/false. Message is customizable per-command.
|
| 13 |
+
auto_commit:
|
| 14 |
+
default: false
|
| 15 |
+
before_clarify:
|
| 16 |
+
enabled: false
|
| 17 |
+
message: "[Spec Kit] Save progress before clarification"
|
| 18 |
+
before_plan:
|
| 19 |
+
enabled: false
|
| 20 |
+
message: "[Spec Kit] Save progress before planning"
|
| 21 |
+
before_tasks:
|
| 22 |
+
enabled: false
|
| 23 |
+
message: "[Spec Kit] Save progress before task generation"
|
| 24 |
+
before_implement:
|
| 25 |
+
enabled: false
|
| 26 |
+
message: "[Spec Kit] Save progress before implementation"
|
| 27 |
+
before_checklist:
|
| 28 |
+
enabled: false
|
| 29 |
+
message: "[Spec Kit] Save progress before checklist"
|
| 30 |
+
before_analyze:
|
| 31 |
+
enabled: false
|
| 32 |
+
message: "[Spec Kit] Save progress before analysis"
|
| 33 |
+
before_taskstoissues:
|
| 34 |
+
enabled: false
|
| 35 |
+
message: "[Spec Kit] Save progress before issue sync"
|
| 36 |
+
after_constitution:
|
| 37 |
+
enabled: false
|
| 38 |
+
message: "[Spec Kit] Add project constitution"
|
| 39 |
+
after_specify:
|
| 40 |
+
enabled: false
|
| 41 |
+
message: "[Spec Kit] Add specification"
|
| 42 |
+
after_clarify:
|
| 43 |
+
enabled: false
|
| 44 |
+
message: "[Spec Kit] Clarify specification"
|
| 45 |
+
after_plan:
|
| 46 |
+
enabled: false
|
| 47 |
+
message: "[Spec Kit] Add implementation plan"
|
| 48 |
+
after_tasks:
|
| 49 |
+
enabled: false
|
| 50 |
+
message: "[Spec Kit] Add tasks"
|
| 51 |
+
after_implement:
|
| 52 |
+
enabled: false
|
| 53 |
+
message: "[Spec Kit] Implementation progress"
|
| 54 |
+
after_checklist:
|
| 55 |
+
enabled: false
|
| 56 |
+
message: "[Spec Kit] Add checklist"
|
| 57 |
+
after_analyze:
|
| 58 |
+
enabled: false
|
| 59 |
+
message: "[Spec Kit] Add analysis report"
|
| 60 |
+
after_taskstoissues:
|
| 61 |
+
enabled: false
|
| 62 |
+
message: "[Spec Kit] Sync tasks to issues"
|
.specify/extensions/git/extension.yml
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version: "1.0"
|
| 2 |
+
|
| 3 |
+
extension:
|
| 4 |
+
id: git
|
| 5 |
+
name: "Git Branching Workflow"
|
| 6 |
+
version: "1.0.0"
|
| 7 |
+
description: "Feature branch creation, numbering (sequential/timestamp), validation, and Git remote detection"
|
| 8 |
+
author: spec-kit-core
|
| 9 |
+
repository: https://github.com/github/spec-kit
|
| 10 |
+
license: MIT
|
| 11 |
+
|
| 12 |
+
requires:
|
| 13 |
+
speckit_version: ">=0.2.0"
|
| 14 |
+
tools:
|
| 15 |
+
- name: git
|
| 16 |
+
required: false
|
| 17 |
+
|
| 18 |
+
provides:
|
| 19 |
+
commands:
|
| 20 |
+
- name: speckit.git.feature
|
| 21 |
+
file: commands/speckit.git.feature.md
|
| 22 |
+
description: "Create a feature branch with sequential or timestamp numbering"
|
| 23 |
+
- name: speckit.git.validate
|
| 24 |
+
file: commands/speckit.git.validate.md
|
| 25 |
+
description: "Validate current branch follows feature branch naming conventions"
|
| 26 |
+
- name: speckit.git.remote
|
| 27 |
+
file: commands/speckit.git.remote.md
|
| 28 |
+
description: "Detect Git remote URL for GitHub integration"
|
| 29 |
+
- name: speckit.git.initialize
|
| 30 |
+
file: commands/speckit.git.initialize.md
|
| 31 |
+
description: "Initialize a Git repository with an initial commit"
|
| 32 |
+
- name: speckit.git.commit
|
| 33 |
+
file: commands/speckit.git.commit.md
|
| 34 |
+
description: "Auto-commit changes after a Spec Kit command completes"
|
| 35 |
+
|
| 36 |
+
config:
|
| 37 |
+
- name: "git-config.yml"
|
| 38 |
+
template: "config-template.yml"
|
| 39 |
+
description: "Git branching configuration"
|
| 40 |
+
required: false
|
| 41 |
+
|
| 42 |
+
hooks:
|
| 43 |
+
before_constitution:
|
| 44 |
+
command: speckit.git.initialize
|
| 45 |
+
optional: false
|
| 46 |
+
description: "Initialize Git repository before constitution setup"
|
| 47 |
+
before_specify:
|
| 48 |
+
command: speckit.git.feature
|
| 49 |
+
optional: false
|
| 50 |
+
description: "Create feature branch before specification"
|
| 51 |
+
before_clarify:
|
| 52 |
+
command: speckit.git.commit
|
| 53 |
+
optional: true
|
| 54 |
+
prompt: "Commit outstanding changes before clarification?"
|
| 55 |
+
description: "Auto-commit before spec clarification"
|
| 56 |
+
before_plan:
|
| 57 |
+
command: speckit.git.commit
|
| 58 |
+
optional: true
|
| 59 |
+
prompt: "Commit outstanding changes before planning?"
|
| 60 |
+
description: "Auto-commit before implementation planning"
|
| 61 |
+
before_tasks:
|
| 62 |
+
command: speckit.git.commit
|
| 63 |
+
optional: true
|
| 64 |
+
prompt: "Commit outstanding changes before task generation?"
|
| 65 |
+
description: "Auto-commit before task generation"
|
| 66 |
+
before_implement:
|
| 67 |
+
command: speckit.git.commit
|
| 68 |
+
optional: true
|
| 69 |
+
prompt: "Commit outstanding changes before implementation?"
|
| 70 |
+
description: "Auto-commit before implementation"
|
| 71 |
+
before_checklist:
|
| 72 |
+
command: speckit.git.commit
|
| 73 |
+
optional: true
|
| 74 |
+
prompt: "Commit outstanding changes before checklist?"
|
| 75 |
+
description: "Auto-commit before checklist generation"
|
| 76 |
+
before_analyze:
|
| 77 |
+
command: speckit.git.commit
|
| 78 |
+
optional: true
|
| 79 |
+
prompt: "Commit outstanding changes before analysis?"
|
| 80 |
+
description: "Auto-commit before analysis"
|
| 81 |
+
before_taskstoissues:
|
| 82 |
+
command: speckit.git.commit
|
| 83 |
+
optional: true
|
| 84 |
+
prompt: "Commit outstanding changes before issue sync?"
|
| 85 |
+
description: "Auto-commit before tasks-to-issues conversion"
|
| 86 |
+
after_constitution:
|
| 87 |
+
command: speckit.git.commit
|
| 88 |
+
optional: true
|
| 89 |
+
prompt: "Commit constitution changes?"
|
| 90 |
+
description: "Auto-commit after constitution update"
|
| 91 |
+
after_specify:
|
| 92 |
+
command: speckit.git.commit
|
| 93 |
+
optional: true
|
| 94 |
+
prompt: "Commit specification changes?"
|
| 95 |
+
description: "Auto-commit after specification"
|
| 96 |
+
after_clarify:
|
| 97 |
+
command: speckit.git.commit
|
| 98 |
+
optional: true
|
| 99 |
+
prompt: "Commit clarification changes?"
|
| 100 |
+
description: "Auto-commit after spec clarification"
|
| 101 |
+
after_plan:
|
| 102 |
+
command: speckit.git.commit
|
| 103 |
+
optional: true
|
| 104 |
+
prompt: "Commit plan changes?"
|
| 105 |
+
description: "Auto-commit after implementation planning"
|
| 106 |
+
after_tasks:
|
| 107 |
+
command: speckit.git.commit
|
| 108 |
+
optional: true
|
| 109 |
+
prompt: "Commit task changes?"
|
| 110 |
+
description: "Auto-commit after task generation"
|
| 111 |
+
after_implement:
|
| 112 |
+
command: speckit.git.commit
|
| 113 |
+
optional: true
|
| 114 |
+
prompt: "Commit implementation changes?"
|
| 115 |
+
description: "Auto-commit after implementation"
|
| 116 |
+
after_checklist:
|
| 117 |
+
command: speckit.git.commit
|
| 118 |
+
optional: true
|
| 119 |
+
prompt: "Commit checklist changes?"
|
| 120 |
+
description: "Auto-commit after checklist generation"
|
| 121 |
+
after_analyze:
|
| 122 |
+
command: speckit.git.commit
|
| 123 |
+
optional: true
|
| 124 |
+
prompt: "Commit analysis results?"
|
| 125 |
+
description: "Auto-commit after analysis"
|
| 126 |
+
after_taskstoissues:
|
| 127 |
+
command: speckit.git.commit
|
| 128 |
+
optional: true
|
| 129 |
+
prompt: "Commit after syncing issues?"
|
| 130 |
+
description: "Auto-commit after tasks-to-issues conversion"
|
| 131 |
+
|
| 132 |
+
tags:
|
| 133 |
+
- "git"
|
| 134 |
+
- "branching"
|
| 135 |
+
- "workflow"
|
| 136 |
+
|
| 137 |
+
config:
|
| 138 |
+
defaults:
|
| 139 |
+
branch_numbering: sequential
|
| 140 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
.specify/extensions/git/git-config.yml
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Git Branching Workflow Extension Configuration
|
| 2 |
+
# Copied to .specify/extensions/git/git-config.yml on install
|
| 3 |
+
|
| 4 |
+
# Branch numbering strategy: "sequential" (001, 002, ...) or "timestamp" (YYYYMMDD-HHMMSS)
|
| 5 |
+
branch_numbering: sequential
|
| 6 |
+
|
| 7 |
+
# Commit message used by `git commit` during repository initialization
|
| 8 |
+
init_commit_message: "[Spec Kit] Initial commit"
|
| 9 |
+
|
| 10 |
+
# Auto-commit before/after core commands.
|
| 11 |
+
# Set "default" to enable for all commands, then override per-command.
|
| 12 |
+
# Each key can be true/false. Message is customizable per-command.
|
| 13 |
+
auto_commit:
|
| 14 |
+
default: false
|
| 15 |
+
before_clarify:
|
| 16 |
+
enabled: false
|
| 17 |
+
message: "[Spec Kit] Save progress before clarification"
|
| 18 |
+
before_plan:
|
| 19 |
+
enabled: false
|
| 20 |
+
message: "[Spec Kit] Save progress before planning"
|
| 21 |
+
before_tasks:
|
| 22 |
+
enabled: false
|
| 23 |
+
message: "[Spec Kit] Save progress before task generation"
|
| 24 |
+
before_implement:
|
| 25 |
+
enabled: false
|
| 26 |
+
message: "[Spec Kit] Save progress before implementation"
|
| 27 |
+
before_checklist:
|
| 28 |
+
enabled: false
|
| 29 |
+
message: "[Spec Kit] Save progress before checklist"
|
| 30 |
+
before_analyze:
|
| 31 |
+
enabled: false
|
| 32 |
+
message: "[Spec Kit] Save progress before analysis"
|
| 33 |
+
before_taskstoissues:
|
| 34 |
+
enabled: false
|
| 35 |
+
message: "[Spec Kit] Save progress before issue sync"
|
| 36 |
+
after_constitution:
|
| 37 |
+
enabled: false
|
| 38 |
+
message: "[Spec Kit] Add project constitution"
|
| 39 |
+
after_specify:
|
| 40 |
+
enabled: false
|
| 41 |
+
message: "[Spec Kit] Add specification"
|
| 42 |
+
after_clarify:
|
| 43 |
+
enabled: false
|
| 44 |
+
message: "[Spec Kit] Clarify specification"
|
| 45 |
+
after_plan:
|
| 46 |
+
enabled: false
|
| 47 |
+
message: "[Spec Kit] Add implementation plan"
|
| 48 |
+
after_tasks:
|
| 49 |
+
enabled: false
|
| 50 |
+
message: "[Spec Kit] Add tasks"
|
| 51 |
+
after_implement:
|
| 52 |
+
enabled: false
|
| 53 |
+
message: "[Spec Kit] Implementation progress"
|
| 54 |
+
after_checklist:
|
| 55 |
+
enabled: false
|
| 56 |
+
message: "[Spec Kit] Add checklist"
|
| 57 |
+
after_analyze:
|
| 58 |
+
enabled: false
|
| 59 |
+
message: "[Spec Kit] Add analysis report"
|
| 60 |
+
after_taskstoissues:
|
| 61 |
+
enabled: false
|
| 62 |
+
message: "[Spec Kit] Sync tasks to issues"
|
.specify/extensions/git/scripts/bash/auto-commit.sh
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git extension: auto-commit.sh
|
| 3 |
+
# Automatically commit changes after a Spec Kit command completes.
|
| 4 |
+
# Checks per-command config keys in git-config.yml before committing.
|
| 5 |
+
#
|
| 6 |
+
# Usage: auto-commit.sh <event_name>
|
| 7 |
+
# e.g.: auto-commit.sh after_specify
|
| 8 |
+
|
| 9 |
+
set -e
|
| 10 |
+
|
| 11 |
+
EVENT_NAME="${1:-}"
|
| 12 |
+
if [ -z "$EVENT_NAME" ]; then
|
| 13 |
+
echo "Usage: $0 <event_name>" >&2
|
| 14 |
+
exit 1
|
| 15 |
+
fi
|
| 16 |
+
|
| 17 |
+
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 18 |
+
|
| 19 |
+
_find_project_root() {
|
| 20 |
+
local dir="$1"
|
| 21 |
+
while [ "$dir" != "/" ]; do
|
| 22 |
+
if [ -d "$dir/.specify" ] || [ -d "$dir/.git" ]; then
|
| 23 |
+
echo "$dir"
|
| 24 |
+
return 0
|
| 25 |
+
fi
|
| 26 |
+
dir="$(dirname "$dir")"
|
| 27 |
+
done
|
| 28 |
+
return 1
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
REPO_ROOT=$(_find_project_root "$SCRIPT_DIR") || REPO_ROOT="$(pwd)"
|
| 32 |
+
cd "$REPO_ROOT"
|
| 33 |
+
|
| 34 |
+
# Check if git is available
|
| 35 |
+
if ! command -v git >/dev/null 2>&1; then
|
| 36 |
+
echo "[specify] Warning: Git not found; skipped auto-commit" >&2
|
| 37 |
+
exit 0
|
| 38 |
+
fi
|
| 39 |
+
|
| 40 |
+
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
| 41 |
+
echo "[specify] Warning: Not a Git repository; skipped auto-commit" >&2
|
| 42 |
+
exit 0
|
| 43 |
+
fi
|
| 44 |
+
|
| 45 |
+
# Read per-command config from git-config.yml
|
| 46 |
+
_config_file="$REPO_ROOT/.specify/extensions/git/git-config.yml"
|
| 47 |
+
_enabled=false
|
| 48 |
+
_commit_msg=""
|
| 49 |
+
|
| 50 |
+
if [ -f "$_config_file" ]; then
|
| 51 |
+
# Parse the auto_commit section for this event.
|
| 52 |
+
# Look for auto_commit.<event_name>.enabled and .message
|
| 53 |
+
# Also check auto_commit.default as fallback.
|
| 54 |
+
_in_auto_commit=false
|
| 55 |
+
_in_event=false
|
| 56 |
+
_default_enabled=false
|
| 57 |
+
|
| 58 |
+
while IFS= read -r _line; do
|
| 59 |
+
# Detect auto_commit: section
|
| 60 |
+
if echo "$_line" | grep -q '^auto_commit:'; then
|
| 61 |
+
_in_auto_commit=true
|
| 62 |
+
_in_event=false
|
| 63 |
+
continue
|
| 64 |
+
fi
|
| 65 |
+
|
| 66 |
+
# Exit auto_commit section on next top-level key
|
| 67 |
+
if $_in_auto_commit && echo "$_line" | grep -Eq '^[a-z]'; then
|
| 68 |
+
break
|
| 69 |
+
fi
|
| 70 |
+
|
| 71 |
+
if $_in_auto_commit; then
|
| 72 |
+
# Check default key
|
| 73 |
+
if echo "$_line" | grep -Eq "^[[:space:]]+default:[[:space:]]"; then
|
| 74 |
+
_val=$(echo "$_line" | sed 's/^[^:]*:[[:space:]]*//' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
|
| 75 |
+
[ "$_val" = "true" ] && _default_enabled=true
|
| 76 |
+
fi
|
| 77 |
+
|
| 78 |
+
# Detect our event subsection
|
| 79 |
+
if echo "$_line" | grep -Eq "^[[:space:]]+${EVENT_NAME}:"; then
|
| 80 |
+
_in_event=true
|
| 81 |
+
continue
|
| 82 |
+
fi
|
| 83 |
+
|
| 84 |
+
# Inside our event subsection
|
| 85 |
+
if $_in_event; then
|
| 86 |
+
# Exit on next sibling key (same indent level as event name)
|
| 87 |
+
if echo "$_line" | grep -Eq '^[[:space:]]{2}[a-z]' && ! echo "$_line" | grep -Eq '^[[:space:]]{4}'; then
|
| 88 |
+
_in_event=false
|
| 89 |
+
continue
|
| 90 |
+
fi
|
| 91 |
+
if echo "$_line" | grep -Eq '[[:space:]]+enabled:'; then
|
| 92 |
+
_val=$(echo "$_line" | sed 's/^[^:]*:[[:space:]]*//' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
|
| 93 |
+
[ "$_val" = "true" ] && _enabled=true
|
| 94 |
+
[ "$_val" = "false" ] && _enabled=false
|
| 95 |
+
fi
|
| 96 |
+
if echo "$_line" | grep -Eq '[[:space:]]+message:'; then
|
| 97 |
+
_commit_msg=$(echo "$_line" | sed 's/^[^:]*:[[:space:]]*//' | sed 's/^["'\'']//' | sed 's/["'\'']*$//')
|
| 98 |
+
fi
|
| 99 |
+
fi
|
| 100 |
+
fi
|
| 101 |
+
done < "$_config_file"
|
| 102 |
+
|
| 103 |
+
# If event-specific key not found, use default
|
| 104 |
+
if [ "$_enabled" = "false" ] && [ "$_default_enabled" = "true" ]; then
|
| 105 |
+
# Only use default if the event wasn't explicitly set to false
|
| 106 |
+
# Check if event section existed at all
|
| 107 |
+
if ! grep -q "^[[:space:]]*${EVENT_NAME}:" "$_config_file" 2>/dev/null; then
|
| 108 |
+
_enabled=true
|
| 109 |
+
fi
|
| 110 |
+
fi
|
| 111 |
+
else
|
| 112 |
+
# No config file β auto-commit disabled by default
|
| 113 |
+
exit 0
|
| 114 |
+
fi
|
| 115 |
+
|
| 116 |
+
if [ "$_enabled" != "true" ]; then
|
| 117 |
+
exit 0
|
| 118 |
+
fi
|
| 119 |
+
|
| 120 |
+
# Check if there are changes to commit
|
| 121 |
+
if git diff --quiet HEAD 2>/dev/null && git diff --cached --quiet 2>/dev/null && [ -z "$(git ls-files --others --exclude-standard 2>/dev/null)" ]; then
|
| 122 |
+
echo "[specify] No changes to commit after $EVENT_NAME" >&2
|
| 123 |
+
exit 0
|
| 124 |
+
fi
|
| 125 |
+
|
| 126 |
+
# Derive a human-readable command name from the event
|
| 127 |
+
# e.g., after_specify -> specify, before_plan -> plan
|
| 128 |
+
_command_name=$(echo "$EVENT_NAME" | sed 's/^after_//' | sed 's/^before_//')
|
| 129 |
+
_phase=$(echo "$EVENT_NAME" | grep -q '^before_' && echo 'before' || echo 'after')
|
| 130 |
+
|
| 131 |
+
# Use custom message if configured, otherwise default
|
| 132 |
+
if [ -z "$_commit_msg" ]; then
|
| 133 |
+
_commit_msg="[Spec Kit] Auto-commit ${_phase} ${_command_name}"
|
| 134 |
+
fi
|
| 135 |
+
|
| 136 |
+
# Stage and commit
|
| 137 |
+
_git_out=$(git add . 2>&1) || { echo "[specify] Error: git add failed: $_git_out" >&2; exit 1; }
|
| 138 |
+
_git_out=$(git commit -q -m "$_commit_msg" 2>&1) || { echo "[specify] Error: git commit failed: $_git_out" >&2; exit 1; }
|
| 139 |
+
|
| 140 |
+
echo "[OK] Changes committed ${_phase} ${_command_name}" >&2
|
.specify/extensions/git/scripts/bash/create-new-feature.sh
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git extension: create-new-feature.sh
|
| 3 |
+
# Adapted from core scripts/bash/create-new-feature.sh for extension layout.
|
| 4 |
+
# Sources common.sh from the project's installed scripts, falling back to
|
| 5 |
+
# git-common.sh for minimal git helpers.
|
| 6 |
+
|
| 7 |
+
set -e
|
| 8 |
+
|
| 9 |
+
JSON_MODE=false
|
| 10 |
+
DRY_RUN=false
|
| 11 |
+
ALLOW_EXISTING=false
|
| 12 |
+
SHORT_NAME=""
|
| 13 |
+
BRANCH_NUMBER=""
|
| 14 |
+
USE_TIMESTAMP=false
|
| 15 |
+
ARGS=()
|
| 16 |
+
i=1
|
| 17 |
+
while [ $i -le $# ]; do
|
| 18 |
+
arg="${!i}"
|
| 19 |
+
case "$arg" in
|
| 20 |
+
--json)
|
| 21 |
+
JSON_MODE=true
|
| 22 |
+
;;
|
| 23 |
+
--dry-run)
|
| 24 |
+
DRY_RUN=true
|
| 25 |
+
;;
|
| 26 |
+
--allow-existing-branch)
|
| 27 |
+
ALLOW_EXISTING=true
|
| 28 |
+
;;
|
| 29 |
+
--short-name)
|
| 30 |
+
if [ $((i + 1)) -gt $# ]; then
|
| 31 |
+
echo 'Error: --short-name requires a value' >&2
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
i=$((i + 1))
|
| 35 |
+
next_arg="${!i}"
|
| 36 |
+
if [[ "$next_arg" == --* ]]; then
|
| 37 |
+
echo 'Error: --short-name requires a value' >&2
|
| 38 |
+
exit 1
|
| 39 |
+
fi
|
| 40 |
+
SHORT_NAME="$next_arg"
|
| 41 |
+
;;
|
| 42 |
+
--number)
|
| 43 |
+
if [ $((i + 1)) -gt $# ]; then
|
| 44 |
+
echo 'Error: --number requires a value' >&2
|
| 45 |
+
exit 1
|
| 46 |
+
fi
|
| 47 |
+
i=$((i + 1))
|
| 48 |
+
next_arg="${!i}"
|
| 49 |
+
if [[ "$next_arg" == --* ]]; then
|
| 50 |
+
echo 'Error: --number requires a value' >&2
|
| 51 |
+
exit 1
|
| 52 |
+
fi
|
| 53 |
+
BRANCH_NUMBER="$next_arg"
|
| 54 |
+
if [[ ! "$BRANCH_NUMBER" =~ ^[0-9]+$ ]]; then
|
| 55 |
+
echo 'Error: --number must be a non-negative integer' >&2
|
| 56 |
+
exit 1
|
| 57 |
+
fi
|
| 58 |
+
;;
|
| 59 |
+
--timestamp)
|
| 60 |
+
USE_TIMESTAMP=true
|
| 61 |
+
;;
|
| 62 |
+
--help|-h)
|
| 63 |
+
echo "Usage: $0 [--json] [--dry-run] [--allow-existing-branch] [--short-name <name>] [--number N] [--timestamp] <feature_description>"
|
| 64 |
+
echo ""
|
| 65 |
+
echo "Options:"
|
| 66 |
+
echo " --json Output in JSON format"
|
| 67 |
+
echo " --dry-run Compute branch name without creating the branch"
|
| 68 |
+
echo " --allow-existing-branch Switch to branch if it already exists instead of failing"
|
| 69 |
+
echo " --short-name <name> Provide a custom short name (2-4 words) for the branch"
|
| 70 |
+
echo " --number N Specify branch number manually (overrides auto-detection)"
|
| 71 |
+
echo " --timestamp Use timestamp prefix (YYYYMMDD-HHMMSS) instead of sequential numbering"
|
| 72 |
+
echo " --help, -h Show this help message"
|
| 73 |
+
echo ""
|
| 74 |
+
echo "Environment variables:"
|
| 75 |
+
echo " GIT_BRANCH_NAME Use this exact branch name, bypassing all prefix/suffix generation"
|
| 76 |
+
echo ""
|
| 77 |
+
echo "Examples:"
|
| 78 |
+
echo " $0 'Add user authentication system' --short-name 'user-auth'"
|
| 79 |
+
echo " $0 'Implement OAuth2 integration for API' --number 5"
|
| 80 |
+
echo " $0 --timestamp --short-name 'user-auth' 'Add user authentication'"
|
| 81 |
+
echo " GIT_BRANCH_NAME=my-branch $0 'feature description'"
|
| 82 |
+
exit 0
|
| 83 |
+
;;
|
| 84 |
+
*)
|
| 85 |
+
ARGS+=("$arg")
|
| 86 |
+
;;
|
| 87 |
+
esac
|
| 88 |
+
i=$((i + 1))
|
| 89 |
+
done
|
| 90 |
+
|
| 91 |
+
FEATURE_DESCRIPTION="${ARGS[*]}"
|
| 92 |
+
if [ -z "$FEATURE_DESCRIPTION" ]; then
|
| 93 |
+
echo "Usage: $0 [--json] [--dry-run] [--allow-existing-branch] [--short-name <name>] [--number N] [--timestamp] <feature_description>" >&2
|
| 94 |
+
exit 1
|
| 95 |
+
fi
|
| 96 |
+
|
| 97 |
+
# Trim whitespace and validate description is not empty
|
| 98 |
+
FEATURE_DESCRIPTION=$(echo "$FEATURE_DESCRIPTION" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g')
|
| 99 |
+
if [ -z "$FEATURE_DESCRIPTION" ]; then
|
| 100 |
+
echo "Error: Feature description cannot be empty or contain only whitespace" >&2
|
| 101 |
+
exit 1
|
| 102 |
+
fi
|
| 103 |
+
|
| 104 |
+
# Function to get highest number from specs directory
|
| 105 |
+
get_highest_from_specs() {
|
| 106 |
+
local specs_dir="$1"
|
| 107 |
+
local highest=0
|
| 108 |
+
|
| 109 |
+
if [ -d "$specs_dir" ]; then
|
| 110 |
+
for dir in "$specs_dir"/*; do
|
| 111 |
+
[ -d "$dir" ] || continue
|
| 112 |
+
dirname=$(basename "$dir")
|
| 113 |
+
# Match sequential prefixes (>=3 digits), but skip timestamp dirs.
|
| 114 |
+
if echo "$dirname" | grep -Eq '^[0-9]{3,}-' && ! echo "$dirname" | grep -Eq '^[0-9]{8}-[0-9]{6}-'; then
|
| 115 |
+
number=$(echo "$dirname" | grep -Eo '^[0-9]+')
|
| 116 |
+
number=$((10#$number))
|
| 117 |
+
if [ "$number" -gt "$highest" ]; then
|
| 118 |
+
highest=$number
|
| 119 |
+
fi
|
| 120 |
+
fi
|
| 121 |
+
done
|
| 122 |
+
fi
|
| 123 |
+
|
| 124 |
+
echo "$highest"
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
# Function to get highest number from git branches
|
| 128 |
+
get_highest_from_branches() {
|
| 129 |
+
git branch -a 2>/dev/null | sed 's/^[* ]*//; s|^remotes/[^/]*/||' | _extract_highest_number
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
# Extract the highest sequential feature number from a list of ref names (one per line).
|
| 133 |
+
_extract_highest_number() {
|
| 134 |
+
local highest=0
|
| 135 |
+
while IFS= read -r name; do
|
| 136 |
+
[ -z "$name" ] && continue
|
| 137 |
+
if echo "$name" | grep -Eq '^[0-9]{3,}-' && ! echo "$name" | grep -Eq '^[0-9]{8}-[0-9]{6}-'; then
|
| 138 |
+
number=$(echo "$name" | grep -Eo '^[0-9]+' || echo "0")
|
| 139 |
+
number=$((10#$number))
|
| 140 |
+
if [ "$number" -gt "$highest" ]; then
|
| 141 |
+
highest=$number
|
| 142 |
+
fi
|
| 143 |
+
fi
|
| 144 |
+
done
|
| 145 |
+
echo "$highest"
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
# Function to get highest number from remote branches without fetching (side-effect-free)
|
| 149 |
+
get_highest_from_remote_refs() {
|
| 150 |
+
local highest=0
|
| 151 |
+
|
| 152 |
+
for remote in $(git remote 2>/dev/null); do
|
| 153 |
+
local remote_highest
|
| 154 |
+
remote_highest=$(GIT_TERMINAL_PROMPT=0 git ls-remote --heads "$remote" 2>/dev/null | sed 's|.*refs/heads/||' | _extract_highest_number)
|
| 155 |
+
if [ "$remote_highest" -gt "$highest" ]; then
|
| 156 |
+
highest=$remote_highest
|
| 157 |
+
fi
|
| 158 |
+
done
|
| 159 |
+
|
| 160 |
+
echo "$highest"
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
# Function to check existing branches and return next available number.
|
| 164 |
+
check_existing_branches() {
|
| 165 |
+
local specs_dir="$1"
|
| 166 |
+
local skip_fetch="${2:-false}"
|
| 167 |
+
|
| 168 |
+
if [ "$skip_fetch" = true ]; then
|
| 169 |
+
local highest_remote=$(get_highest_from_remote_refs)
|
| 170 |
+
local highest_branch=$(get_highest_from_branches)
|
| 171 |
+
if [ "$highest_remote" -gt "$highest_branch" ]; then
|
| 172 |
+
highest_branch=$highest_remote
|
| 173 |
+
fi
|
| 174 |
+
else
|
| 175 |
+
git fetch --all --prune >/dev/null 2>&1 || true
|
| 176 |
+
local highest_branch=$(get_highest_from_branches)
|
| 177 |
+
fi
|
| 178 |
+
|
| 179 |
+
local highest_spec=$(get_highest_from_specs "$specs_dir")
|
| 180 |
+
|
| 181 |
+
local max_num=$highest_branch
|
| 182 |
+
if [ "$highest_spec" -gt "$max_num" ]; then
|
| 183 |
+
max_num=$highest_spec
|
| 184 |
+
fi
|
| 185 |
+
|
| 186 |
+
echo $((max_num + 1))
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
# Function to clean and format a branch name
|
| 190 |
+
clean_branch_name() {
|
| 191 |
+
local name="$1"
|
| 192 |
+
echo "$name" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/-\+/-/g' | sed 's/^-//' | sed 's/-$//'
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
# ---------------------------------------------------------------------------
|
| 196 |
+
# Source common.sh for resolve_template, json_escape, get_repo_root, has_git.
|
| 197 |
+
#
|
| 198 |
+
# Search locations in priority order:
|
| 199 |
+
# 1. .specify/scripts/bash/common.sh under the project root (installed project)
|
| 200 |
+
# 2. scripts/bash/common.sh under the project root (source checkout fallback)
|
| 201 |
+
# 3. git-common.sh next to this script (minimal fallback β lacks resolve_template)
|
| 202 |
+
# ---------------------------------------------------------------------------
|
| 203 |
+
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 204 |
+
|
| 205 |
+
# Find project root by walking up from the script location
|
| 206 |
+
_find_project_root() {
|
| 207 |
+
local dir="$1"
|
| 208 |
+
while [ "$dir" != "/" ]; do
|
| 209 |
+
if [ -d "$dir/.specify" ] || [ -d "$dir/.git" ]; then
|
| 210 |
+
echo "$dir"
|
| 211 |
+
return 0
|
| 212 |
+
fi
|
| 213 |
+
dir="$(dirname "$dir")"
|
| 214 |
+
done
|
| 215 |
+
return 1
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
_common_loaded=false
|
| 219 |
+
_PROJECT_ROOT=$(_find_project_root "$SCRIPT_DIR") || true
|
| 220 |
+
|
| 221 |
+
if [ -n "$_PROJECT_ROOT" ] && [ -f "$_PROJECT_ROOT/.specify/scripts/bash/common.sh" ]; then
|
| 222 |
+
source "$_PROJECT_ROOT/.specify/scripts/bash/common.sh"
|
| 223 |
+
_common_loaded=true
|
| 224 |
+
elif [ -n "$_PROJECT_ROOT" ] && [ -f "$_PROJECT_ROOT/scripts/bash/common.sh" ]; then
|
| 225 |
+
source "$_PROJECT_ROOT/scripts/bash/common.sh"
|
| 226 |
+
_common_loaded=true
|
| 227 |
+
elif [ -f "$SCRIPT_DIR/git-common.sh" ]; then
|
| 228 |
+
source "$SCRIPT_DIR/git-common.sh"
|
| 229 |
+
_common_loaded=true
|
| 230 |
+
fi
|
| 231 |
+
|
| 232 |
+
if [ "$_common_loaded" != "true" ]; then
|
| 233 |
+
echo "Error: Could not locate common.sh or git-common.sh. Please ensure the Specify core scripts are installed." >&2
|
| 234 |
+
exit 1
|
| 235 |
+
fi
|
| 236 |
+
|
| 237 |
+
# Resolve repository root
|
| 238 |
+
if type get_repo_root >/dev/null 2>&1; then
|
| 239 |
+
REPO_ROOT=$(get_repo_root)
|
| 240 |
+
elif git rev-parse --show-toplevel >/dev/null 2>&1; then
|
| 241 |
+
REPO_ROOT=$(git rev-parse --show-toplevel)
|
| 242 |
+
elif [ -n "$_PROJECT_ROOT" ]; then
|
| 243 |
+
REPO_ROOT="$_PROJECT_ROOT"
|
| 244 |
+
else
|
| 245 |
+
echo "Error: Could not determine repository root." >&2
|
| 246 |
+
exit 1
|
| 247 |
+
fi
|
| 248 |
+
|
| 249 |
+
# Check if git is available at this repo root
|
| 250 |
+
if type has_git >/dev/null 2>&1; then
|
| 251 |
+
if has_git "$REPO_ROOT"; then
|
| 252 |
+
HAS_GIT=true
|
| 253 |
+
else
|
| 254 |
+
HAS_GIT=false
|
| 255 |
+
fi
|
| 256 |
+
elif git -C "$REPO_ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
| 257 |
+
HAS_GIT=true
|
| 258 |
+
else
|
| 259 |
+
HAS_GIT=false
|
| 260 |
+
fi
|
| 261 |
+
|
| 262 |
+
cd "$REPO_ROOT"
|
| 263 |
+
|
| 264 |
+
SPECS_DIR="$REPO_ROOT/specs"
|
| 265 |
+
|
| 266 |
+
# Function to generate branch name with stop word filtering
|
| 267 |
+
generate_branch_name() {
|
| 268 |
+
local description="$1"
|
| 269 |
+
|
| 270 |
+
local stop_words="^(i|a|an|the|to|for|of|in|on|at|by|with|from|is|are|was|were|be|been|being|have|has|had|do|does|did|will|would|should|could|can|may|might|must|shall|this|that|these|those|my|your|our|their|want|need|add|get|set)$"
|
| 271 |
+
|
| 272 |
+
local clean_name=$(echo "$description" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/ /g')
|
| 273 |
+
|
| 274 |
+
local meaningful_words=()
|
| 275 |
+
for word in $clean_name; do
|
| 276 |
+
[ -z "$word" ] && continue
|
| 277 |
+
if ! echo "$word" | grep -qiE "$stop_words"; then
|
| 278 |
+
if [ ${#word} -ge 3 ]; then
|
| 279 |
+
meaningful_words+=("$word")
|
| 280 |
+
elif echo "$description" | grep -qw -- "${word^^}"; then
|
| 281 |
+
meaningful_words+=("$word")
|
| 282 |
+
fi
|
| 283 |
+
fi
|
| 284 |
+
done
|
| 285 |
+
|
| 286 |
+
if [ ${#meaningful_words[@]} -gt 0 ]; then
|
| 287 |
+
local max_words=3
|
| 288 |
+
if [ ${#meaningful_words[@]} -eq 4 ]; then max_words=4; fi
|
| 289 |
+
|
| 290 |
+
local result=""
|
| 291 |
+
local count=0
|
| 292 |
+
for word in "${meaningful_words[@]}"; do
|
| 293 |
+
if [ $count -ge $max_words ]; then break; fi
|
| 294 |
+
if [ -n "$result" ]; then result="$result-"; fi
|
| 295 |
+
result="$result$word"
|
| 296 |
+
count=$((count + 1))
|
| 297 |
+
done
|
| 298 |
+
echo "$result"
|
| 299 |
+
else
|
| 300 |
+
local cleaned=$(clean_branch_name "$description")
|
| 301 |
+
echo "$cleaned" | tr '-' '\n' | grep -v '^$' | head -3 | tr '\n' '-' | sed 's/-$//'
|
| 302 |
+
fi
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
# Check for GIT_BRANCH_NAME env var override (exact branch name, no prefix/suffix)
|
| 306 |
+
if [ -n "${GIT_BRANCH_NAME:-}" ]; then
|
| 307 |
+
BRANCH_NAME="$GIT_BRANCH_NAME"
|
| 308 |
+
# Extract FEATURE_NUM from the branch name if it starts with a numeric prefix
|
| 309 |
+
# Check timestamp pattern first (YYYYMMDD-HHMMSS-) since it also matches the simpler ^[0-9]+ pattern
|
| 310 |
+
if echo "$BRANCH_NAME" | grep -Eq '^[0-9]{8}-[0-9]{6}-'; then
|
| 311 |
+
FEATURE_NUM=$(echo "$BRANCH_NAME" | grep -Eo '^[0-9]{8}-[0-9]{6}')
|
| 312 |
+
BRANCH_SUFFIX="${BRANCH_NAME#${FEATURE_NUM}-}"
|
| 313 |
+
elif echo "$BRANCH_NAME" | grep -Eq '^[0-9]+-'; then
|
| 314 |
+
FEATURE_NUM=$(echo "$BRANCH_NAME" | grep -Eo '^[0-9]+')
|
| 315 |
+
BRANCH_SUFFIX="${BRANCH_NAME#${FEATURE_NUM}-}"
|
| 316 |
+
else
|
| 317 |
+
FEATURE_NUM="$BRANCH_NAME"
|
| 318 |
+
BRANCH_SUFFIX="$BRANCH_NAME"
|
| 319 |
+
fi
|
| 320 |
+
else
|
| 321 |
+
# Generate branch name
|
| 322 |
+
if [ -n "$SHORT_NAME" ]; then
|
| 323 |
+
BRANCH_SUFFIX=$(clean_branch_name "$SHORT_NAME")
|
| 324 |
+
else
|
| 325 |
+
BRANCH_SUFFIX=$(generate_branch_name "$FEATURE_DESCRIPTION")
|
| 326 |
+
fi
|
| 327 |
+
|
| 328 |
+
# Warn if --number and --timestamp are both specified
|
| 329 |
+
if [ "$USE_TIMESTAMP" = true ] && [ -n "$BRANCH_NUMBER" ]; then
|
| 330 |
+
>&2 echo "[specify] Warning: --number is ignored when --timestamp is used"
|
| 331 |
+
BRANCH_NUMBER=""
|
| 332 |
+
fi
|
| 333 |
+
|
| 334 |
+
# Determine branch prefix
|
| 335 |
+
if [ "$USE_TIMESTAMP" = true ]; then
|
| 336 |
+
FEATURE_NUM=$(date +%Y%m%d-%H%M%S)
|
| 337 |
+
BRANCH_NAME="${FEATURE_NUM}-${BRANCH_SUFFIX}"
|
| 338 |
+
else
|
| 339 |
+
if [ -z "$BRANCH_NUMBER" ]; then
|
| 340 |
+
if [ "$DRY_RUN" = true ] && [ "$HAS_GIT" = true ]; then
|
| 341 |
+
BRANCH_NUMBER=$(check_existing_branches "$SPECS_DIR" true)
|
| 342 |
+
elif [ "$DRY_RUN" = true ]; then
|
| 343 |
+
HIGHEST=$(get_highest_from_specs "$SPECS_DIR")
|
| 344 |
+
BRANCH_NUMBER=$((HIGHEST + 1))
|
| 345 |
+
elif [ "$HAS_GIT" = true ]; then
|
| 346 |
+
BRANCH_NUMBER=$(check_existing_branches "$SPECS_DIR")
|
| 347 |
+
else
|
| 348 |
+
HIGHEST=$(get_highest_from_specs "$SPECS_DIR")
|
| 349 |
+
BRANCH_NUMBER=$((HIGHEST + 1))
|
| 350 |
+
fi
|
| 351 |
+
fi
|
| 352 |
+
|
| 353 |
+
FEATURE_NUM=$(printf "%03d" "$((10#$BRANCH_NUMBER))")
|
| 354 |
+
BRANCH_NAME="${FEATURE_NUM}-${BRANCH_SUFFIX}"
|
| 355 |
+
fi
|
| 356 |
+
fi
|
| 357 |
+
|
| 358 |
+
# GitHub enforces a 244-byte limit on branch names
|
| 359 |
+
MAX_BRANCH_LENGTH=244
|
| 360 |
+
_byte_length() { printf '%s' "$1" | LC_ALL=C wc -c | tr -d ' '; }
|
| 361 |
+
BRANCH_BYTE_LEN=$(_byte_length "$BRANCH_NAME")
|
| 362 |
+
if [ -n "${GIT_BRANCH_NAME:-}" ] && [ "$BRANCH_BYTE_LEN" -gt $MAX_BRANCH_LENGTH ]; then
|
| 363 |
+
>&2 echo "Error: GIT_BRANCH_NAME must be 244 bytes or fewer in UTF-8. Provided value is ${BRANCH_BYTE_LEN} bytes."
|
| 364 |
+
exit 1
|
| 365 |
+
elif [ "$BRANCH_BYTE_LEN" -gt $MAX_BRANCH_LENGTH ]; then
|
| 366 |
+
PREFIX_LENGTH=$(( ${#FEATURE_NUM} + 1 ))
|
| 367 |
+
MAX_SUFFIX_LENGTH=$((MAX_BRANCH_LENGTH - PREFIX_LENGTH))
|
| 368 |
+
|
| 369 |
+
TRUNCATED_SUFFIX=$(echo "$BRANCH_SUFFIX" | cut -c1-$MAX_SUFFIX_LENGTH)
|
| 370 |
+
TRUNCATED_SUFFIX=$(echo "$TRUNCATED_SUFFIX" | sed 's/-$//')
|
| 371 |
+
|
| 372 |
+
ORIGINAL_BRANCH_NAME="$BRANCH_NAME"
|
| 373 |
+
BRANCH_NAME="${FEATURE_NUM}-${TRUNCATED_SUFFIX}"
|
| 374 |
+
|
| 375 |
+
>&2 echo "[specify] Warning: Branch name exceeded GitHub's 244-byte limit"
|
| 376 |
+
>&2 echo "[specify] Original: $ORIGINAL_BRANCH_NAME (${#ORIGINAL_BRANCH_NAME} bytes)"
|
| 377 |
+
>&2 echo "[specify] Truncated to: $BRANCH_NAME (${#BRANCH_NAME} bytes)"
|
| 378 |
+
fi
|
| 379 |
+
|
| 380 |
+
if [ "$DRY_RUN" != true ]; then
|
| 381 |
+
if [ "$HAS_GIT" = true ]; then
|
| 382 |
+
branch_create_error=""
|
| 383 |
+
if ! branch_create_error=$(git checkout -q -b "$BRANCH_NAME" 2>&1); then
|
| 384 |
+
current_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
|
| 385 |
+
if git branch --list "$BRANCH_NAME" | grep -q .; then
|
| 386 |
+
if [ "$ALLOW_EXISTING" = true ]; then
|
| 387 |
+
if [ "$current_branch" = "$BRANCH_NAME" ]; then
|
| 388 |
+
:
|
| 389 |
+
elif ! switch_branch_error=$(git checkout -q "$BRANCH_NAME" 2>&1); then
|
| 390 |
+
>&2 echo "Error: Failed to switch to existing branch '$BRANCH_NAME'. Please resolve any local changes or conflicts and try again."
|
| 391 |
+
if [ -n "$switch_branch_error" ]; then
|
| 392 |
+
>&2 printf '%s\n' "$switch_branch_error"
|
| 393 |
+
fi
|
| 394 |
+
exit 1
|
| 395 |
+
fi
|
| 396 |
+
elif [ "$USE_TIMESTAMP" = true ]; then
|
| 397 |
+
>&2 echo "Error: Branch '$BRANCH_NAME' already exists. Rerun to get a new timestamp or use a different --short-name."
|
| 398 |
+
exit 1
|
| 399 |
+
else
|
| 400 |
+
>&2 echo "Error: Branch '$BRANCH_NAME' already exists. Please use a different feature name or specify a different number with --number."
|
| 401 |
+
exit 1
|
| 402 |
+
fi
|
| 403 |
+
else
|
| 404 |
+
>&2 echo "Error: Failed to create git branch '$BRANCH_NAME'."
|
| 405 |
+
if [ -n "$branch_create_error" ]; then
|
| 406 |
+
>&2 printf '%s\n' "$branch_create_error"
|
| 407 |
+
else
|
| 408 |
+
>&2 echo "Please check your git configuration and try again."
|
| 409 |
+
fi
|
| 410 |
+
exit 1
|
| 411 |
+
fi
|
| 412 |
+
fi
|
| 413 |
+
else
|
| 414 |
+
>&2 echo "[specify] Warning: Git repository not detected; skipped branch creation for $BRANCH_NAME"
|
| 415 |
+
fi
|
| 416 |
+
|
| 417 |
+
printf '# To persist: export SPECIFY_FEATURE=%q\n' "$BRANCH_NAME" >&2
|
| 418 |
+
fi
|
| 419 |
+
|
| 420 |
+
if $JSON_MODE; then
|
| 421 |
+
if command -v jq >/dev/null 2>&1; then
|
| 422 |
+
if [ "$DRY_RUN" = true ]; then
|
| 423 |
+
jq -cn \
|
| 424 |
+
--arg branch_name "$BRANCH_NAME" \
|
| 425 |
+
--arg feature_num "$FEATURE_NUM" \
|
| 426 |
+
'{BRANCH_NAME:$branch_name,FEATURE_NUM:$feature_num,DRY_RUN:true}'
|
| 427 |
+
else
|
| 428 |
+
jq -cn \
|
| 429 |
+
--arg branch_name "$BRANCH_NAME" \
|
| 430 |
+
--arg feature_num "$FEATURE_NUM" \
|
| 431 |
+
'{BRANCH_NAME:$branch_name,FEATURE_NUM:$feature_num}'
|
| 432 |
+
fi
|
| 433 |
+
else
|
| 434 |
+
if type json_escape >/dev/null 2>&1; then
|
| 435 |
+
_je_branch=$(json_escape "$BRANCH_NAME")
|
| 436 |
+
_je_num=$(json_escape "$FEATURE_NUM")
|
| 437 |
+
else
|
| 438 |
+
_je_branch="$BRANCH_NAME"
|
| 439 |
+
_je_num="$FEATURE_NUM"
|
| 440 |
+
fi
|
| 441 |
+
if [ "$DRY_RUN" = true ]; then
|
| 442 |
+
printf '{"BRANCH_NAME":"%s","FEATURE_NUM":"%s","DRY_RUN":true}\n' "$_je_branch" "$_je_num"
|
| 443 |
+
else
|
| 444 |
+
printf '{"BRANCH_NAME":"%s","FEATURE_NUM":"%s"}\n' "$_je_branch" "$_je_num"
|
| 445 |
+
fi
|
| 446 |
+
fi
|
| 447 |
+
else
|
| 448 |
+
echo "BRANCH_NAME: $BRANCH_NAME"
|
| 449 |
+
echo "FEATURE_NUM: $FEATURE_NUM"
|
| 450 |
+
if [ "$DRY_RUN" != true ]; then
|
| 451 |
+
printf '# To persist in your shell: export SPECIFY_FEATURE=%q\n' "$BRANCH_NAME"
|
| 452 |
+
fi
|
| 453 |
+
fi
|
.specify/extensions/git/scripts/bash/git-common.sh
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git-specific common functions for the git extension.
|
| 3 |
+
# Extracted from scripts/bash/common.sh β contains only git-specific
|
| 4 |
+
# branch validation and detection logic.
|
| 5 |
+
|
| 6 |
+
# Check if we have git available at the repo root
|
| 7 |
+
has_git() {
|
| 8 |
+
local repo_root="${1:-$(pwd)}"
|
| 9 |
+
{ [ -d "$repo_root/.git" ] || [ -f "$repo_root/.git" ]; } && \
|
| 10 |
+
command -v git >/dev/null 2>&1 && \
|
| 11 |
+
git -C "$repo_root" rev-parse --is-inside-work-tree >/dev/null 2>&1
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
# Strip a single optional path segment (e.g. gitflow "feat/004-name" -> "004-name").
|
| 15 |
+
# Only when the full name is exactly two slash-free segments; otherwise returns the raw name.
|
| 16 |
+
spec_kit_effective_branch_name() {
|
| 17 |
+
local raw="$1"
|
| 18 |
+
if [[ "$raw" =~ ^([^/]+)/([^/]+)$ ]]; then
|
| 19 |
+
printf '%s\n' "${BASH_REMATCH[2]}"
|
| 20 |
+
else
|
| 21 |
+
printf '%s\n' "$raw"
|
| 22 |
+
fi
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
# Validate that a branch name matches the expected feature branch pattern.
|
| 26 |
+
# Accepts sequential (###-* with >=3 digits) or timestamp (YYYYMMDD-HHMMSS-*) formats.
|
| 27 |
+
# Logic aligned with scripts/bash/common.sh check_feature_branch after effective-name normalization.
|
| 28 |
+
check_feature_branch() {
|
| 29 |
+
local raw="$1"
|
| 30 |
+
local has_git_repo="$2"
|
| 31 |
+
|
| 32 |
+
# For non-git repos, we can't enforce branch naming but still provide output
|
| 33 |
+
if [[ "$has_git_repo" != "true" ]]; then
|
| 34 |
+
echo "[specify] Warning: Git repository not detected; skipped branch validation" >&2
|
| 35 |
+
return 0
|
| 36 |
+
fi
|
| 37 |
+
|
| 38 |
+
local branch
|
| 39 |
+
branch=$(spec_kit_effective_branch_name "$raw")
|
| 40 |
+
|
| 41 |
+
# Accept sequential prefix (3+ digits) but exclude malformed timestamps
|
| 42 |
+
# Malformed: 7-or-8 digit date + 6-digit time with no trailing slug (e.g. "2026031-143022" or "20260319-143022")
|
| 43 |
+
local is_sequential=false
|
| 44 |
+
if [[ "$branch" =~ ^[0-9]{3,}- ]] && [[ ! "$branch" =~ ^[0-9]{7}-[0-9]{6}- ]] && [[ ! "$branch" =~ ^[0-9]{7,8}-[0-9]{6}$ ]]; then
|
| 45 |
+
is_sequential=true
|
| 46 |
+
fi
|
| 47 |
+
if [[ "$is_sequential" != "true" ]] && [[ ! "$branch" =~ ^[0-9]{8}-[0-9]{6}- ]]; then
|
| 48 |
+
echo "ERROR: Not on a feature branch. Current branch: $raw" >&2
|
| 49 |
+
echo "Feature branches should be named like: 001-feature-name, 1234-feature-name, or 20260319-143022-feature-name" >&2
|
| 50 |
+
return 1
|
| 51 |
+
fi
|
| 52 |
+
|
| 53 |
+
return 0
|
| 54 |
+
}
|
.specify/extensions/git/scripts/bash/initialize-repo.sh
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Git extension: initialize-repo.sh
|
| 3 |
+
# Initialize a Git repository with an initial commit.
|
| 4 |
+
# Customizable β replace this script to add .gitignore templates,
|
| 5 |
+
# default branch config, git-flow, LFS, signing, etc.
|
| 6 |
+
|
| 7 |
+
set -e
|
| 8 |
+
|
| 9 |
+
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 10 |
+
|
| 11 |
+
# Find project root
|
| 12 |
+
_find_project_root() {
|
| 13 |
+
local dir="$1"
|
| 14 |
+
while [ "$dir" != "/" ]; do
|
| 15 |
+
if [ -d "$dir/.specify" ] || [ -d "$dir/.git" ]; then
|
| 16 |
+
echo "$dir"
|
| 17 |
+
return 0
|
| 18 |
+
fi
|
| 19 |
+
dir="$(dirname "$dir")"
|
| 20 |
+
done
|
| 21 |
+
return 1
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
REPO_ROOT=$(_find_project_root "$SCRIPT_DIR") || REPO_ROOT="$(pwd)"
|
| 25 |
+
cd "$REPO_ROOT"
|
| 26 |
+
|
| 27 |
+
# Read commit message from extension config, fall back to default
|
| 28 |
+
COMMIT_MSG="[Spec Kit] Initial commit"
|
| 29 |
+
_config_file="$REPO_ROOT/.specify/extensions/git/git-config.yml"
|
| 30 |
+
if [ -f "$_config_file" ]; then
|
| 31 |
+
_msg=$(grep '^init_commit_message:' "$_config_file" 2>/dev/null | sed 's/^init_commit_message:[[:space:]]*//' | sed 's/^["'\'']//' | sed 's/["'\'']*$//')
|
| 32 |
+
if [ -n "$_msg" ]; then
|
| 33 |
+
COMMIT_MSG="$_msg"
|
| 34 |
+
fi
|
| 35 |
+
fi
|
| 36 |
+
|
| 37 |
+
# Check if git is available
|
| 38 |
+
if ! command -v git >/dev/null 2>&1; then
|
| 39 |
+
echo "[specify] Warning: Git not found; skipped repository initialization" >&2
|
| 40 |
+
exit 0
|
| 41 |
+
fi
|
| 42 |
+
|
| 43 |
+
# Check if already a git repo
|
| 44 |
+
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
| 45 |
+
echo "[specify] Git repository already initialized; skipping" >&2
|
| 46 |
+
exit 0
|
| 47 |
+
fi
|
| 48 |
+
|
| 49 |
+
# Initialize
|
| 50 |
+
_git_out=$(git init -q 2>&1) || { echo "[specify] Error: git init failed: $_git_out" >&2; exit 1; }
|
| 51 |
+
_git_out=$(git add . 2>&1) || { echo "[specify] Error: git add failed: $_git_out" >&2; exit 1; }
|
| 52 |
+
_git_out=$(git commit --allow-empty -q -m "$COMMIT_MSG" 2>&1) || { echo "[specify] Error: git commit failed: $_git_out" >&2; exit 1; }
|
| 53 |
+
|
| 54 |
+
echo "β Git repository initialized" >&2
|
.specify/extensions/git/scripts/powershell/auto-commit.ps1
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git extension: auto-commit.ps1
|
| 3 |
+
# Automatically commit changes after a Spec Kit command completes.
|
| 4 |
+
# Checks per-command config keys in git-config.yml before committing.
|
| 5 |
+
#
|
| 6 |
+
# Usage: auto-commit.ps1 <event_name>
|
| 7 |
+
# e.g.: auto-commit.ps1 after_specify
|
| 8 |
+
param(
|
| 9 |
+
[Parameter(Position = 0, Mandatory = $true)]
|
| 10 |
+
[string]$EventName
|
| 11 |
+
)
|
| 12 |
+
$ErrorActionPreference = 'Stop'
|
| 13 |
+
|
| 14 |
+
function Find-ProjectRoot {
|
| 15 |
+
param([string]$StartDir)
|
| 16 |
+
$current = Resolve-Path $StartDir
|
| 17 |
+
while ($true) {
|
| 18 |
+
foreach ($marker in @('.specify', '.git')) {
|
| 19 |
+
if (Test-Path (Join-Path $current $marker)) {
|
| 20 |
+
return $current
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
$parent = Split-Path $current -Parent
|
| 24 |
+
if ($parent -eq $current) { return $null }
|
| 25 |
+
$current = $parent
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
$repoRoot = Find-ProjectRoot -StartDir $PSScriptRoot
|
| 30 |
+
if (-not $repoRoot) { $repoRoot = Get-Location }
|
| 31 |
+
Set-Location $repoRoot
|
| 32 |
+
|
| 33 |
+
# Check if git is available
|
| 34 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
| 35 |
+
Write-Warning "[specify] Warning: Git not found; skipped auto-commit"
|
| 36 |
+
exit 0
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
# Temporarily relax ErrorActionPreference so git stderr warnings
|
| 40 |
+
# (e.g. CRLF notices on Windows) do not become terminating errors.
|
| 41 |
+
$savedEAP = $ErrorActionPreference
|
| 42 |
+
$ErrorActionPreference = 'Continue'
|
| 43 |
+
try {
|
| 44 |
+
git rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 45 |
+
$isRepo = $LASTEXITCODE -eq 0
|
| 46 |
+
} finally {
|
| 47 |
+
$ErrorActionPreference = $savedEAP
|
| 48 |
+
}
|
| 49 |
+
if (-not $isRepo) {
|
| 50 |
+
Write-Warning "[specify] Warning: Not a Git repository; skipped auto-commit"
|
| 51 |
+
exit 0
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
# Read per-command config from git-config.yml
|
| 55 |
+
$configFile = Join-Path $repoRoot ".specify/extensions/git/git-config.yml"
|
| 56 |
+
$enabled = $false
|
| 57 |
+
$commitMsg = ""
|
| 58 |
+
|
| 59 |
+
if (Test-Path $configFile) {
|
| 60 |
+
# Parse YAML to find auto_commit section
|
| 61 |
+
$inAutoCommit = $false
|
| 62 |
+
$inEvent = $false
|
| 63 |
+
$defaultEnabled = $false
|
| 64 |
+
|
| 65 |
+
foreach ($line in Get-Content $configFile) {
|
| 66 |
+
# Detect auto_commit: section
|
| 67 |
+
if ($line -match '^auto_commit:') {
|
| 68 |
+
$inAutoCommit = $true
|
| 69 |
+
$inEvent = $false
|
| 70 |
+
continue
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
# Exit auto_commit section on next top-level key
|
| 74 |
+
if ($inAutoCommit -and $line -match '^[a-z]') {
|
| 75 |
+
break
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
if ($inAutoCommit) {
|
| 79 |
+
# Check default key
|
| 80 |
+
if ($line -match '^\s+default:\s*(.+)$') {
|
| 81 |
+
$val = $matches[1].Trim().ToLower()
|
| 82 |
+
if ($val -eq 'true') { $defaultEnabled = $true }
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
# Detect our event subsection
|
| 86 |
+
if ($line -match "^\s+${EventName}:") {
|
| 87 |
+
$inEvent = $true
|
| 88 |
+
continue
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
# Inside our event subsection
|
| 92 |
+
if ($inEvent) {
|
| 93 |
+
# Exit on next sibling key (2-space indent, not 4+)
|
| 94 |
+
if ($line -match '^\s{2}[a-z]' -and $line -notmatch '^\s{4}') {
|
| 95 |
+
$inEvent = $false
|
| 96 |
+
continue
|
| 97 |
+
}
|
| 98 |
+
if ($line -match '\s+enabled:\s*(.+)$') {
|
| 99 |
+
$val = $matches[1].Trim().ToLower()
|
| 100 |
+
if ($val -eq 'true') { $enabled = $true }
|
| 101 |
+
if ($val -eq 'false') { $enabled = $false }
|
| 102 |
+
}
|
| 103 |
+
if ($line -match '\s+message:\s*(.+)$') {
|
| 104 |
+
$commitMsg = $matches[1].Trim() -replace '^["'']' -replace '["'']$'
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
# If event-specific key not found, use default
|
| 111 |
+
if (-not $enabled -and $defaultEnabled) {
|
| 112 |
+
$hasEventKey = Select-String -Path $configFile -Pattern "^\s*${EventName}:" -Quiet
|
| 113 |
+
if (-not $hasEventKey) {
|
| 114 |
+
$enabled = $true
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
} else {
|
| 118 |
+
# No config file β auto-commit disabled by default
|
| 119 |
+
exit 0
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if (-not $enabled) {
|
| 123 |
+
exit 0
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
# Check if there are changes to commit
|
| 127 |
+
# Relax ErrorActionPreference so CRLF warnings on stderr do not terminate.
|
| 128 |
+
$savedEAP = $ErrorActionPreference
|
| 129 |
+
$ErrorActionPreference = 'Continue'
|
| 130 |
+
try {
|
| 131 |
+
git diff --quiet HEAD 2>$null; $d1 = $LASTEXITCODE
|
| 132 |
+
git diff --cached --quiet 2>$null; $d2 = $LASTEXITCODE
|
| 133 |
+
$untracked = git ls-files --others --exclude-standard 2>$null
|
| 134 |
+
} finally {
|
| 135 |
+
$ErrorActionPreference = $savedEAP
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
if ($d1 -eq 0 -and $d2 -eq 0 -and -not $untracked) {
|
| 139 |
+
Write-Host "[specify] No changes to commit after $EventName" -ForegroundColor DarkGray
|
| 140 |
+
exit 0
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
# Derive a human-readable command name from the event
|
| 144 |
+
$commandName = $EventName -replace '^after_', '' -replace '^before_', ''
|
| 145 |
+
$phase = if ($EventName -match '^before_') { 'before' } else { 'after' }
|
| 146 |
+
|
| 147 |
+
# Use custom message if configured, otherwise default
|
| 148 |
+
if (-not $commitMsg) {
|
| 149 |
+
$commitMsg = "[Spec Kit] Auto-commit $phase $commandName"
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
# Stage and commit
|
| 153 |
+
# Relax ErrorActionPreference so CRLF warnings on stderr do not terminate,
|
| 154 |
+
# while still allowing redirected error output to be captured for diagnostics.
|
| 155 |
+
$savedEAP = $ErrorActionPreference
|
| 156 |
+
$ErrorActionPreference = 'Continue'
|
| 157 |
+
try {
|
| 158 |
+
$out = git add . 2>&1 | Out-String
|
| 159 |
+
if ($LASTEXITCODE -ne 0) { throw "git add failed: $out" }
|
| 160 |
+
$out = git commit -q -m $commitMsg 2>&1 | Out-String
|
| 161 |
+
if ($LASTEXITCODE -ne 0) { throw "git commit failed: $out" }
|
| 162 |
+
} catch {
|
| 163 |
+
Write-Warning "[specify] Error: $_"
|
| 164 |
+
exit 1
|
| 165 |
+
} finally {
|
| 166 |
+
$ErrorActionPreference = $savedEAP
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
Write-Host "[OK] Changes committed $phase $commandName"
|
.specify/extensions/git/scripts/powershell/create-new-feature.ps1
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git extension: create-new-feature.ps1
|
| 3 |
+
# Adapted from core scripts/powershell/create-new-feature.ps1 for extension layout.
|
| 4 |
+
# Sources common.ps1 from the project's installed scripts, falling back to
|
| 5 |
+
# git-common.ps1 for minimal git helpers.
|
| 6 |
+
[CmdletBinding()]
|
| 7 |
+
param(
|
| 8 |
+
[switch]$Json,
|
| 9 |
+
[switch]$AllowExistingBranch,
|
| 10 |
+
[switch]$DryRun,
|
| 11 |
+
[string]$ShortName,
|
| 12 |
+
[Parameter()]
|
| 13 |
+
[long]$Number = 0,
|
| 14 |
+
[switch]$Timestamp,
|
| 15 |
+
[switch]$Help,
|
| 16 |
+
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
|
| 17 |
+
[string[]]$FeatureDescription
|
| 18 |
+
)
|
| 19 |
+
$ErrorActionPreference = 'Stop'
|
| 20 |
+
|
| 21 |
+
if ($Help) {
|
| 22 |
+
Write-Host "Usage: ./create-new-feature.ps1 [-Json] [-DryRun] [-AllowExistingBranch] [-ShortName <name>] [-Number N] [-Timestamp] <feature description>"
|
| 23 |
+
Write-Host ""
|
| 24 |
+
Write-Host "Options:"
|
| 25 |
+
Write-Host " -Json Output in JSON format"
|
| 26 |
+
Write-Host " -DryRun Compute branch name without creating the branch"
|
| 27 |
+
Write-Host " -AllowExistingBranch Switch to branch if it already exists instead of failing"
|
| 28 |
+
Write-Host " -ShortName <name> Provide a custom short name (2-4 words) for the branch"
|
| 29 |
+
Write-Host " -Number N Specify branch number manually (overrides auto-detection)"
|
| 30 |
+
Write-Host " -Timestamp Use timestamp prefix (YYYYMMDD-HHMMSS) instead of sequential numbering"
|
| 31 |
+
Write-Host " -Help Show this help message"
|
| 32 |
+
Write-Host ""
|
| 33 |
+
Write-Host "Environment variables:"
|
| 34 |
+
Write-Host " GIT_BRANCH_NAME Use this exact branch name, bypassing all prefix/suffix generation"
|
| 35 |
+
Write-Host ""
|
| 36 |
+
exit 0
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if (-not $FeatureDescription -or $FeatureDescription.Count -eq 0) {
|
| 40 |
+
Write-Error "Usage: ./create-new-feature.ps1 [-Json] [-DryRun] [-AllowExistingBranch] [-ShortName <name>] [-Number N] [-Timestamp] <feature description>"
|
| 41 |
+
exit 1
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
$featureDesc = ($FeatureDescription -join ' ').Trim()
|
| 45 |
+
|
| 46 |
+
if ([string]::IsNullOrWhiteSpace($featureDesc)) {
|
| 47 |
+
Write-Error "Error: Feature description cannot be empty or contain only whitespace"
|
| 48 |
+
exit 1
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function Get-HighestNumberFromSpecs {
|
| 52 |
+
param([string]$SpecsDir)
|
| 53 |
+
|
| 54 |
+
[long]$highest = 0
|
| 55 |
+
if (Test-Path $SpecsDir) {
|
| 56 |
+
Get-ChildItem -Path $SpecsDir -Directory | ForEach-Object {
|
| 57 |
+
if ($_.Name -match '^(\d{3,})-' -and $_.Name -notmatch '^\d{8}-\d{6}-') {
|
| 58 |
+
[long]$num = 0
|
| 59 |
+
if ([long]::TryParse($matches[1], [ref]$num) -and $num -gt $highest) {
|
| 60 |
+
$highest = $num
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
return $highest
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
function Get-HighestNumberFromNames {
|
| 69 |
+
param([string[]]$Names)
|
| 70 |
+
|
| 71 |
+
[long]$highest = 0
|
| 72 |
+
foreach ($name in $Names) {
|
| 73 |
+
if ($name -match '^(\d{3,})-' -and $name -notmatch '^\d{8}-\d{6}-') {
|
| 74 |
+
[long]$num = 0
|
| 75 |
+
if ([long]::TryParse($matches[1], [ref]$num) -and $num -gt $highest) {
|
| 76 |
+
$highest = $num
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
return $highest
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
function Get-HighestNumberFromBranches {
|
| 84 |
+
param()
|
| 85 |
+
|
| 86 |
+
try {
|
| 87 |
+
$branches = git branch -a 2>$null
|
| 88 |
+
if ($LASTEXITCODE -eq 0 -and $branches) {
|
| 89 |
+
$cleanNames = $branches | ForEach-Object {
|
| 90 |
+
$_.Trim() -replace '^\*?\s+', '' -replace '^remotes/[^/]+/', ''
|
| 91 |
+
}
|
| 92 |
+
return Get-HighestNumberFromNames -Names $cleanNames
|
| 93 |
+
}
|
| 94 |
+
} catch {
|
| 95 |
+
Write-Verbose "Could not check Git branches: $_"
|
| 96 |
+
}
|
| 97 |
+
return 0
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
function Get-HighestNumberFromRemoteRefs {
|
| 101 |
+
[long]$highest = 0
|
| 102 |
+
try {
|
| 103 |
+
$remotes = git remote 2>$null
|
| 104 |
+
if ($remotes) {
|
| 105 |
+
foreach ($remote in $remotes) {
|
| 106 |
+
$env:GIT_TERMINAL_PROMPT = '0'
|
| 107 |
+
$refs = git ls-remote --heads $remote 2>$null
|
| 108 |
+
$env:GIT_TERMINAL_PROMPT = $null
|
| 109 |
+
if ($LASTEXITCODE -eq 0 -and $refs) {
|
| 110 |
+
$refNames = $refs | ForEach-Object {
|
| 111 |
+
if ($_ -match 'refs/heads/(.+)$') { $matches[1] }
|
| 112 |
+
} | Where-Object { $_ }
|
| 113 |
+
$remoteHighest = Get-HighestNumberFromNames -Names $refNames
|
| 114 |
+
if ($remoteHighest -gt $highest) { $highest = $remoteHighest }
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
} catch {
|
| 119 |
+
Write-Verbose "Could not query remote refs: $_"
|
| 120 |
+
}
|
| 121 |
+
return $highest
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
function Get-NextBranchNumber {
|
| 125 |
+
param(
|
| 126 |
+
[string]$SpecsDir,
|
| 127 |
+
[switch]$SkipFetch
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
if ($SkipFetch) {
|
| 131 |
+
$highestBranch = Get-HighestNumberFromBranches
|
| 132 |
+
$highestRemote = Get-HighestNumberFromRemoteRefs
|
| 133 |
+
$highestBranch = [Math]::Max($highestBranch, $highestRemote)
|
| 134 |
+
} else {
|
| 135 |
+
try {
|
| 136 |
+
git fetch --all --prune 2>$null | Out-Null
|
| 137 |
+
} catch { }
|
| 138 |
+
$highestBranch = Get-HighestNumberFromBranches
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
$highestSpec = Get-HighestNumberFromSpecs -SpecsDir $SpecsDir
|
| 142 |
+
$maxNum = [Math]::Max($highestBranch, $highestSpec)
|
| 143 |
+
return $maxNum + 1
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
function ConvertTo-CleanBranchName {
|
| 147 |
+
param([string]$Name)
|
| 148 |
+
return $Name.ToLower() -replace '[^a-z0-9]', '-' -replace '-{2,}', '-' -replace '^-', '' -replace '-$', ''
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
# ---------------------------------------------------------------------------
|
| 152 |
+
# Source common.ps1 from the project's installed scripts.
|
| 153 |
+
# Search locations in priority order:
|
| 154 |
+
# 1. .specify/scripts/powershell/common.ps1 under the project root
|
| 155 |
+
# 2. scripts/powershell/common.ps1 under the project root (source checkout)
|
| 156 |
+
# 3. git-common.ps1 next to this script (minimal fallback)
|
| 157 |
+
# ---------------------------------------------------------------------------
|
| 158 |
+
function Find-ProjectRoot {
|
| 159 |
+
param([string]$StartDir)
|
| 160 |
+
$current = Resolve-Path $StartDir
|
| 161 |
+
while ($true) {
|
| 162 |
+
foreach ($marker in @('.specify', '.git')) {
|
| 163 |
+
if (Test-Path (Join-Path $current $marker)) {
|
| 164 |
+
return $current
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
$parent = Split-Path $current -Parent
|
| 168 |
+
if ($parent -eq $current) { return $null }
|
| 169 |
+
$current = $parent
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
$projectRoot = Find-ProjectRoot -StartDir $PSScriptRoot
|
| 174 |
+
$commonLoaded = $false
|
| 175 |
+
|
| 176 |
+
if ($projectRoot) {
|
| 177 |
+
$candidates = @(
|
| 178 |
+
(Join-Path $projectRoot ".specify/scripts/powershell/common.ps1"),
|
| 179 |
+
(Join-Path $projectRoot "scripts/powershell/common.ps1")
|
| 180 |
+
)
|
| 181 |
+
foreach ($candidate in $candidates) {
|
| 182 |
+
if (Test-Path $candidate) {
|
| 183 |
+
. $candidate
|
| 184 |
+
$commonLoaded = $true
|
| 185 |
+
break
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if (-not $commonLoaded -and (Test-Path "$PSScriptRoot/git-common.ps1")) {
|
| 191 |
+
. "$PSScriptRoot/git-common.ps1"
|
| 192 |
+
$commonLoaded = $true
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
if (-not $commonLoaded) {
|
| 196 |
+
throw "Unable to locate common script file. Please ensure the Specify core scripts are installed."
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
# Resolve repository root
|
| 200 |
+
if (Get-Command Get-RepoRoot -ErrorAction SilentlyContinue) {
|
| 201 |
+
$repoRoot = Get-RepoRoot
|
| 202 |
+
} elseif ($projectRoot) {
|
| 203 |
+
$repoRoot = $projectRoot
|
| 204 |
+
} else {
|
| 205 |
+
throw "Could not determine repository root."
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
# Check if git is available
|
| 209 |
+
if (Get-Command Test-HasGit -ErrorAction SilentlyContinue) {
|
| 210 |
+
# Call without parameters for compatibility with core common.ps1 (no -RepoRoot param)
|
| 211 |
+
# and git-common.ps1 (has -RepoRoot param with default).
|
| 212 |
+
$hasGit = Test-HasGit
|
| 213 |
+
} else {
|
| 214 |
+
try {
|
| 215 |
+
git -C $repoRoot rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 216 |
+
$hasGit = ($LASTEXITCODE -eq 0)
|
| 217 |
+
} catch {
|
| 218 |
+
$hasGit = $false
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
Set-Location $repoRoot
|
| 223 |
+
|
| 224 |
+
$specsDir = Join-Path $repoRoot 'specs'
|
| 225 |
+
|
| 226 |
+
function Get-BranchName {
|
| 227 |
+
param([string]$Description)
|
| 228 |
+
|
| 229 |
+
$stopWords = @(
|
| 230 |
+
'i', 'a', 'an', 'the', 'to', 'for', 'of', 'in', 'on', 'at', 'by', 'with', 'from',
|
| 231 |
+
'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had',
|
| 232 |
+
'do', 'does', 'did', 'will', 'would', 'should', 'could', 'can', 'may', 'might', 'must', 'shall',
|
| 233 |
+
'this', 'that', 'these', 'those', 'my', 'your', 'our', 'their',
|
| 234 |
+
'want', 'need', 'add', 'get', 'set'
|
| 235 |
+
)
|
| 236 |
+
|
| 237 |
+
$cleanName = $Description.ToLower() -replace '[^a-z0-9\s]', ' '
|
| 238 |
+
$words = $cleanName -split '\s+' | Where-Object { $_ }
|
| 239 |
+
|
| 240 |
+
$meaningfulWords = @()
|
| 241 |
+
foreach ($word in $words) {
|
| 242 |
+
if ($stopWords -contains $word) { continue }
|
| 243 |
+
if ($word.Length -ge 3) {
|
| 244 |
+
$meaningfulWords += $word
|
| 245 |
+
} elseif ($Description -match "\b$($word.ToUpper())\b") {
|
| 246 |
+
$meaningfulWords += $word
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
if ($meaningfulWords.Count -gt 0) {
|
| 251 |
+
$maxWords = if ($meaningfulWords.Count -eq 4) { 4 } else { 3 }
|
| 252 |
+
$result = ($meaningfulWords | Select-Object -First $maxWords) -join '-'
|
| 253 |
+
return $result
|
| 254 |
+
} else {
|
| 255 |
+
$result = ConvertTo-CleanBranchName -Name $Description
|
| 256 |
+
$fallbackWords = ($result -split '-') | Where-Object { $_ } | Select-Object -First 3
|
| 257 |
+
return [string]::Join('-', $fallbackWords)
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
# Check for GIT_BRANCH_NAME env var override (exact branch name, no prefix/suffix)
|
| 262 |
+
if ($env:GIT_BRANCH_NAME) {
|
| 263 |
+
$branchName = $env:GIT_BRANCH_NAME
|
| 264 |
+
# Check 244-byte limit (UTF-8) for override names
|
| 265 |
+
$branchNameUtf8ByteCount = [System.Text.Encoding]::UTF8.GetByteCount($branchName)
|
| 266 |
+
if ($branchNameUtf8ByteCount -gt 244) {
|
| 267 |
+
throw "GIT_BRANCH_NAME must be 244 bytes or fewer in UTF-8. Provided value is $branchNameUtf8ByteCount bytes; please supply a shorter override branch name."
|
| 268 |
+
}
|
| 269 |
+
# Extract FEATURE_NUM from the branch name if it starts with a numeric prefix
|
| 270 |
+
# Check timestamp pattern first (YYYYMMDD-HHMMSS-) since it also matches the simpler ^\d+ pattern
|
| 271 |
+
if ($branchName -match '^(\d{8}-\d{6})-') {
|
| 272 |
+
$featureNum = $matches[1]
|
| 273 |
+
} elseif ($branchName -match '^(\d+)-') {
|
| 274 |
+
$featureNum = $matches[1]
|
| 275 |
+
} else {
|
| 276 |
+
$featureNum = $branchName
|
| 277 |
+
}
|
| 278 |
+
} else {
|
| 279 |
+
if ($ShortName) {
|
| 280 |
+
$branchSuffix = ConvertTo-CleanBranchName -Name $ShortName
|
| 281 |
+
} else {
|
| 282 |
+
$branchSuffix = Get-BranchName -Description $featureDesc
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
if ($Timestamp -and $Number -ne 0) {
|
| 286 |
+
Write-Warning "[specify] Warning: -Number is ignored when -Timestamp is used"
|
| 287 |
+
$Number = 0
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
if ($Timestamp) {
|
| 291 |
+
$featureNum = Get-Date -Format 'yyyyMMdd-HHmmss'
|
| 292 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 293 |
+
} else {
|
| 294 |
+
if ($Number -eq 0) {
|
| 295 |
+
if ($DryRun -and $hasGit) {
|
| 296 |
+
$Number = Get-NextBranchNumber -SpecsDir $specsDir -SkipFetch
|
| 297 |
+
} elseif ($DryRun) {
|
| 298 |
+
$Number = (Get-HighestNumberFromSpecs -SpecsDir $specsDir) + 1
|
| 299 |
+
} elseif ($hasGit) {
|
| 300 |
+
$Number = Get-NextBranchNumber -SpecsDir $specsDir
|
| 301 |
+
} else {
|
| 302 |
+
$Number = (Get-HighestNumberFromSpecs -SpecsDir $specsDir) + 1
|
| 303 |
+
}
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
$featureNum = ('{0:000}' -f $Number)
|
| 307 |
+
$branchName = "$featureNum-$branchSuffix"
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
$maxBranchLength = 244
|
| 312 |
+
if ($branchName.Length -gt $maxBranchLength) {
|
| 313 |
+
$prefixLength = $featureNum.Length + 1
|
| 314 |
+
$maxSuffixLength = $maxBranchLength - $prefixLength
|
| 315 |
+
|
| 316 |
+
$truncatedSuffix = $branchSuffix.Substring(0, [Math]::Min($branchSuffix.Length, $maxSuffixLength))
|
| 317 |
+
$truncatedSuffix = $truncatedSuffix -replace '-$', ''
|
| 318 |
+
|
| 319 |
+
$originalBranchName = $branchName
|
| 320 |
+
$branchName = "$featureNum-$truncatedSuffix"
|
| 321 |
+
|
| 322 |
+
Write-Warning "[specify] Branch name exceeded GitHub's 244-byte limit"
|
| 323 |
+
Write-Warning "[specify] Original: $originalBranchName ($($originalBranchName.Length) bytes)"
|
| 324 |
+
Write-Warning "[specify] Truncated to: $branchName ($($branchName.Length) bytes)"
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
if (-not $DryRun) {
|
| 328 |
+
if ($hasGit) {
|
| 329 |
+
$branchCreated = $false
|
| 330 |
+
$branchCreateError = ''
|
| 331 |
+
try {
|
| 332 |
+
$branchCreateError = git checkout -q -b $branchName 2>&1 | Out-String
|
| 333 |
+
if ($LASTEXITCODE -eq 0) {
|
| 334 |
+
$branchCreated = $true
|
| 335 |
+
}
|
| 336 |
+
} catch {
|
| 337 |
+
$branchCreateError = $_.Exception.Message
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
if (-not $branchCreated) {
|
| 341 |
+
$currentBranch = ''
|
| 342 |
+
try { $currentBranch = (git rev-parse --abbrev-ref HEAD 2>$null).Trim() } catch {}
|
| 343 |
+
$existingBranch = git branch --list $branchName 2>$null
|
| 344 |
+
if ($existingBranch) {
|
| 345 |
+
if ($AllowExistingBranch) {
|
| 346 |
+
if ($currentBranch -eq $branchName) {
|
| 347 |
+
# Already on the target branch
|
| 348 |
+
} else {
|
| 349 |
+
$switchBranchError = git checkout -q $branchName 2>&1 | Out-String
|
| 350 |
+
if ($LASTEXITCODE -ne 0) {
|
| 351 |
+
if ($switchBranchError) {
|
| 352 |
+
Write-Error "Error: Branch '$branchName' exists but could not be checked out.`n$($switchBranchError.Trim())"
|
| 353 |
+
} else {
|
| 354 |
+
Write-Error "Error: Branch '$branchName' exists but could not be checked out. Resolve any uncommitted changes or conflicts and try again."
|
| 355 |
+
}
|
| 356 |
+
exit 1
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
} elseif ($Timestamp) {
|
| 360 |
+
Write-Error "Error: Branch '$branchName' already exists. Rerun to get a new timestamp or use a different -ShortName."
|
| 361 |
+
exit 1
|
| 362 |
+
} else {
|
| 363 |
+
Write-Error "Error: Branch '$branchName' already exists. Please use a different feature name or specify a different number with -Number."
|
| 364 |
+
exit 1
|
| 365 |
+
}
|
| 366 |
+
} else {
|
| 367 |
+
if ($branchCreateError) {
|
| 368 |
+
Write-Error "Error: Failed to create git branch '$branchName'.`n$($branchCreateError.Trim())"
|
| 369 |
+
} else {
|
| 370 |
+
Write-Error "Error: Failed to create git branch '$branchName'. Please check your git configuration and try again."
|
| 371 |
+
}
|
| 372 |
+
exit 1
|
| 373 |
+
}
|
| 374 |
+
}
|
| 375 |
+
} else {
|
| 376 |
+
if ($Json) {
|
| 377 |
+
[Console]::Error.WriteLine("[specify] Warning: Git repository not detected; skipped branch creation for $branchName")
|
| 378 |
+
} else {
|
| 379 |
+
Write-Warning "[specify] Warning: Git repository not detected; skipped branch creation for $branchName"
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
$env:SPECIFY_FEATURE = $branchName
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
if ($Json) {
|
| 387 |
+
$obj = [PSCustomObject]@{
|
| 388 |
+
BRANCH_NAME = $branchName
|
| 389 |
+
FEATURE_NUM = $featureNum
|
| 390 |
+
HAS_GIT = $hasGit
|
| 391 |
+
}
|
| 392 |
+
if ($DryRun) {
|
| 393 |
+
$obj | Add-Member -NotePropertyName 'DRY_RUN' -NotePropertyValue $true
|
| 394 |
+
}
|
| 395 |
+
$obj | ConvertTo-Json -Compress
|
| 396 |
+
} else {
|
| 397 |
+
Write-Output "BRANCH_NAME: $branchName"
|
| 398 |
+
Write-Output "FEATURE_NUM: $featureNum"
|
| 399 |
+
Write-Output "HAS_GIT: $hasGit"
|
| 400 |
+
if (-not $DryRun) {
|
| 401 |
+
Write-Output "SPECIFY_FEATURE environment variable set to: $branchName"
|
| 402 |
+
}
|
| 403 |
+
}
|
.specify/extensions/git/scripts/powershell/git-common.ps1
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git-specific common functions for the git extension.
|
| 3 |
+
# Extracted from scripts/powershell/common.ps1 β contains only git-specific
|
| 4 |
+
# branch validation and detection logic.
|
| 5 |
+
|
| 6 |
+
function Test-HasGit {
|
| 7 |
+
param([string]$RepoRoot = (Get-Location))
|
| 8 |
+
try {
|
| 9 |
+
if (-not (Test-Path (Join-Path $RepoRoot '.git'))) { return $false }
|
| 10 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) { return $false }
|
| 11 |
+
git -C $RepoRoot rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 12 |
+
return ($LASTEXITCODE -eq 0)
|
| 13 |
+
} catch {
|
| 14 |
+
return $false
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function Get-SpecKitEffectiveBranchName {
|
| 19 |
+
param([string]$Branch)
|
| 20 |
+
if ($Branch -match '^([^/]+)/([^/]+)$') {
|
| 21 |
+
return $Matches[2]
|
| 22 |
+
}
|
| 23 |
+
return $Branch
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
function Test-FeatureBranch {
|
| 27 |
+
param(
|
| 28 |
+
[string]$Branch,
|
| 29 |
+
[bool]$HasGit = $true
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# For non-git repos, we can't enforce branch naming but still provide output
|
| 33 |
+
if (-not $HasGit) {
|
| 34 |
+
Write-Warning "[specify] Warning: Git repository not detected; skipped branch validation"
|
| 35 |
+
return $true
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
$raw = $Branch
|
| 39 |
+
$Branch = Get-SpecKitEffectiveBranchName $raw
|
| 40 |
+
|
| 41 |
+
# Accept sequential prefix (3+ digits) but exclude malformed timestamps
|
| 42 |
+
# Malformed: 7-or-8 digit date + 6-digit time with no trailing slug (e.g. "2026031-143022" or "20260319-143022")
|
| 43 |
+
$hasMalformedTimestamp = ($Branch -match '^[0-9]{7}-[0-9]{6}-') -or ($Branch -match '^(?:\d{7}|\d{8})-\d{6}$')
|
| 44 |
+
$isSequential = ($Branch -match '^[0-9]{3,}-') -and (-not $hasMalformedTimestamp)
|
| 45 |
+
if (-not $isSequential -and $Branch -notmatch '^\d{8}-\d{6}-') {
|
| 46 |
+
[Console]::Error.WriteLine("ERROR: Not on a feature branch. Current branch: $raw")
|
| 47 |
+
[Console]::Error.WriteLine("Feature branches should be named like: 001-feature-name, 1234-feature-name, or 20260319-143022-feature-name")
|
| 48 |
+
return $false
|
| 49 |
+
}
|
| 50 |
+
return $true
|
| 51 |
+
}
|
.specify/extensions/git/scripts/powershell/initialize-repo.ps1
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env pwsh
|
| 2 |
+
# Git extension: initialize-repo.ps1
|
| 3 |
+
# Initialize a Git repository with an initial commit.
|
| 4 |
+
# Customizable β replace this script to add .gitignore templates,
|
| 5 |
+
# default branch config, git-flow, LFS, signing, etc.
|
| 6 |
+
$ErrorActionPreference = 'Stop'
|
| 7 |
+
|
| 8 |
+
# Find project root
|
| 9 |
+
function Find-ProjectRoot {
|
| 10 |
+
param([string]$StartDir)
|
| 11 |
+
$current = Resolve-Path $StartDir
|
| 12 |
+
while ($true) {
|
| 13 |
+
foreach ($marker in @('.specify', '.git')) {
|
| 14 |
+
if (Test-Path (Join-Path $current $marker)) {
|
| 15 |
+
return $current
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
$parent = Split-Path $current -Parent
|
| 19 |
+
if ($parent -eq $current) { return $null }
|
| 20 |
+
$current = $parent
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
$repoRoot = Find-ProjectRoot -StartDir $PSScriptRoot
|
| 25 |
+
if (-not $repoRoot) { $repoRoot = Get-Location }
|
| 26 |
+
Set-Location $repoRoot
|
| 27 |
+
|
| 28 |
+
# Read commit message from extension config, fall back to default
|
| 29 |
+
$commitMsg = "[Spec Kit] Initial commit"
|
| 30 |
+
$configFile = Join-Path $repoRoot ".specify/extensions/git/git-config.yml"
|
| 31 |
+
if (Test-Path $configFile) {
|
| 32 |
+
foreach ($line in Get-Content $configFile) {
|
| 33 |
+
if ($line -match '^init_commit_message:\s*(.+)$') {
|
| 34 |
+
$val = $matches[1].Trim() -replace '^["'']' -replace '["'']$'
|
| 35 |
+
if ($val) { $commitMsg = $val }
|
| 36 |
+
break
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
# Check if git is available
|
| 42 |
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
| 43 |
+
Write-Warning "[specify] Warning: Git not found; skipped repository initialization"
|
| 44 |
+
exit 0
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
# Check if already a git repo
|
| 48 |
+
try {
|
| 49 |
+
git rev-parse --is-inside-work-tree 2>$null | Out-Null
|
| 50 |
+
if ($LASTEXITCODE -eq 0) {
|
| 51 |
+
Write-Warning "[specify] Git repository already initialized; skipping"
|
| 52 |
+
exit 0
|
| 53 |
+
}
|
| 54 |
+
} catch { }
|
| 55 |
+
|
| 56 |
+
# Initialize
|
| 57 |
+
try {
|
| 58 |
+
$out = git init -q 2>&1 | Out-String
|
| 59 |
+
if ($LASTEXITCODE -ne 0) { throw "git init failed: $out" }
|
| 60 |
+
$out = git add . 2>&1 | Out-String
|
| 61 |
+
if ($LASTEXITCODE -ne 0) { throw "git add failed: $out" }
|
| 62 |
+
$out = git commit --allow-empty -q -m $commitMsg 2>&1 | Out-String
|
| 63 |
+
if ($LASTEXITCODE -ne 0) { throw "git commit failed: $out" }
|
| 64 |
+
} catch {
|
| 65 |
+
Write-Warning "[specify] Error: $_"
|
| 66 |
+
exit 1
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
Write-Host "β Git repository initialized"
|
.specify/feature.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"feature_directory": "specs/001-unified-analysis-chat"
|
| 3 |
+
}
|
.specify/init-options.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"ai": "codex",
|
| 3 |
+
"ai_skills": true,
|
| 4 |
+
"branch_numbering": "sequential",
|
| 5 |
+
"context_file": "AGENTS.md",
|
| 6 |
+
"here": true,
|
| 7 |
+
"integration": "codex",
|
| 8 |
+
"script": "ps",
|
| 9 |
+
"speckit_version": "0.8.11"
|
| 10 |
+
}
|
.specify/integration.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "0.8.11",
|
| 3 |
+
"integration_state_schema": 1,
|
| 4 |
+
"installed_integrations": [
|
| 5 |
+
"codex"
|
| 6 |
+
],
|
| 7 |
+
"integration_settings": {
|
| 8 |
+
"codex": {
|
| 9 |
+
"script": "ps",
|
| 10 |
+
"invoke_separator": "-"
|
| 11 |
+
}
|
| 12 |
+
},
|
| 13 |
+
"integration": "codex",
|
| 14 |
+
"default_integration": "codex"
|
| 15 |
+
}
|
.specify/integrations/claude.manifest.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"integration": "claude",
|
| 3 |
+
"version": "0.8.11",
|
| 4 |
+
"installed_at": "2026-06-15T03:28:41.672517+00:00",
|
| 5 |
+
"files": {
|
| 6 |
+
".claude/skills/speckit-analyze/SKILL.md": "adb9c4baed1d0e27cebd08e506a7247c1357ee721b6ea340201553d5792e6c8a",
|
| 7 |
+
".claude/skills/speckit-checklist/SKILL.md": "812b2a102310470141b313670a51e7f33fe4f673a3b8c3d97ddff4abce2e5fbd",
|
| 8 |
+
".claude/skills/speckit-clarify/SKILL.md": "0ca2d6dd6eae86d0e02149b1c3df0b7770e5e5dcfc0482f2b7176b12f6f6457d",
|
| 9 |
+
".claude/skills/speckit-constitution/SKILL.md": "c1a044aba243ca6aff627fb5e4404feb6f1108d4f7dd174631bee3ae477d6c15",
|
| 10 |
+
".claude/skills/speckit-implement/SKILL.md": "efeb6dc763bcf6ee5fe6732ce4d4243fe7c9c37f1db10ac39d8b0780ff9eebe0",
|
| 11 |
+
".claude/skills/speckit-plan/SKILL.md": "5dbf517056a7df98de24835cb44c582b8d9b5c95950f917b129a740ca7f6448b",
|
| 12 |
+
".claude/skills/speckit-specify/SKILL.md": "caadc05119eca453709a0425ed88d253883f9c55da4c13a4898367653a859483",
|
| 13 |
+
".claude/skills/speckit-tasks/SKILL.md": "6a8ca4d9d9948e4f50ed7614cd5a0c743b510fd98d6791de554db8f53a0626ed",
|
| 14 |
+
".claude/skills/speckit-taskstoissues/SKILL.md": "ccacc12041d1e27d3afffc7a189ac3d17444836e10eeb4e128b272b5e8ae45cb"
|
| 15 |
+
}
|
| 16 |
+
}
|
.specify/integrations/codex.manifest.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"integration": "codex",
|
| 3 |
+
"version": "0.8.11",
|
| 4 |
+
"installed_at": "2026-06-25T09:21:07.651744+00:00",
|
| 5 |
+
"files": {
|
| 6 |
+
".agents/skills/speckit-analyze/SKILL.md": "05205af63fdd10e35df85d1a1665d5a20e72695dd30d76587dbcc0a27bbf2051",
|
| 7 |
+
".agents/skills/speckit-checklist/SKILL.md": "60211dd559005c546c9dbefe94255baa0a6fddf41b6b0746c2e91e93ec893011",
|
| 8 |
+
".agents/skills/speckit-clarify/SKILL.md": "2b61f83d35162b25043e7d2f9be4d9dc9254b3de52350b648c8d7cf225ff864a",
|
| 9 |
+
".agents/skills/speckit-constitution/SKILL.md": "7310adee465ee6a439a689518e6c133ce851d808c7a6e64d66f659ad8b4bd56e",
|
| 10 |
+
".agents/skills/speckit-implement/SKILL.md": "5e29f604896c21d068db377c279ce5e643d818555c8c4ed1b25ad176187ae547",
|
| 11 |
+
".agents/skills/speckit-plan/SKILL.md": "8f23b270185a63a10e1c7b9c477e867c3115a6195e67528f4b3f3f40b9a99bec",
|
| 12 |
+
".agents/skills/speckit-specify/SKILL.md": "164542c78d6415ea9e16bb063652e989e14524a9a273176273e6c9b5ffa0b942",
|
| 13 |
+
".agents/skills/speckit-tasks/SKILL.md": "d3fecde732546a8d2f4b11d241289a42d183420fae9c4c3f861292228a4006c2",
|
| 14 |
+
".agents/skills/speckit-taskstoissues/SKILL.md": "93cacb7c23e4cb4e1c954ac6681389be8a3862f4eb22f9f710de8299a219aadf"
|
| 15 |
+
}
|
| 16 |
+
}
|
.specify/integrations/speckit.manifest.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"integration": "speckit",
|
| 3 |
+
"version": "0.8.11",
|
| 4 |
+
"installed_at": "2026-06-15T03:28:41.770647+00:00",
|
| 5 |
+
"files": {
|
| 6 |
+
".specify/scripts/powershell/check-prerequisites.ps1": "bcb37804b0757c37799b65a9321c1d3fb7b7ddcab6703c55c5b9a142c9166bf1",
|
| 7 |
+
".specify/scripts/powershell/common.ps1": "916b3ea1e29ef626a353f0ec011f906c6afff6818a97d560a0321b8557d970ec",
|
| 8 |
+
".specify/scripts/powershell/create-new-feature.ps1": "0a7fc929db81b6318205ab3506187762bae1c4d3b2184f15e903ca54b78511e2",
|
| 9 |
+
".specify/scripts/powershell/setup-plan.ps1": "137af47d79085d2770714ece307ed8f56f0d4cb1e9ec0c17db5c5c0d0b8a8c4c",
|
| 10 |
+
".specify/scripts/powershell/setup-tasks.ps1": "aa7b19077dc4f6feee1dae47f68dc3e6d8ac75adf572a949443f3322b753cfa2",
|
| 11 |
+
".specify/templates/checklist-template.md": "c37695297e5d3153d64f82c21223509940b13932046c7961c42d1d669516130c",
|
| 12 |
+
".specify/templates/constitution-template.md": "ce7549540fa45543cca797a150201d868e64495fdff39dc38246fb17bd4024b3",
|
| 13 |
+
".specify/templates/plan-template.md": "cc7f7979cf8d8836ec26492785affd80791d3422a2b745062ec695be8c985ef7",
|
| 14 |
+
".specify/templates/spec-template.md": "3945437fc35cd30a5b2bf7beea680337c3516826d3efa5a6b92c4a7eca1ba28e",
|
| 15 |
+
".specify/templates/tasks-template.md": "fc29a233f6f5a27ca31f1aa46b596af6500c627441c6e62b2bc4a1d721525842"
|
| 16 |
+
}
|
| 17 |
+
}
|
.specify/memory/constitution.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# [PROJECT_NAME] Constitution
|
| 2 |
+
<!-- Example: Spec Constitution, TaskFlow Constitution, etc. -->
|
| 3 |
+
|
| 4 |
+
## Core Principles
|
| 5 |
+
|
| 6 |
+
### [PRINCIPLE_1_NAME]
|
| 7 |
+
<!-- Example: I. Library-First -->
|
| 8 |
+
[PRINCIPLE_1_DESCRIPTION]
|
| 9 |
+
<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries -->
|
| 10 |
+
|
| 11 |
+
### [PRINCIPLE_2_NAME]
|
| 12 |
+
<!-- Example: II. CLI Interface -->
|
| 13 |
+
[PRINCIPLE_2_DESCRIPTION]
|
| 14 |
+
<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args β stdout, errors β stderr; Support JSON + human-readable formats -->
|
| 15 |
+
|
| 16 |
+
### [PRINCIPLE_3_NAME]
|
| 17 |
+
<!-- Example: III. Test-First (NON-NEGOTIABLE) -->
|
| 18 |
+
[PRINCIPLE_3_DESCRIPTION]
|
| 19 |
+
<!-- Example: TDD mandatory: Tests written β User approved β Tests fail β Then implement; Red-Green-Refactor cycle strictly enforced -->
|
| 20 |
+
|
| 21 |
+
### [PRINCIPLE_4_NAME]
|
| 22 |
+
<!-- Example: IV. Integration Testing -->
|
| 23 |
+
[PRINCIPLE_4_DESCRIPTION]
|
| 24 |
+
<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas -->
|
| 25 |
+
|
| 26 |
+
### [PRINCIPLE_5_NAME]
|
| 27 |
+
<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity -->
|
| 28 |
+
[PRINCIPLE_5_DESCRIPTION]
|
| 29 |
+
<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles -->
|
| 30 |
+
|
| 31 |
+
## [SECTION_2_NAME]
|
| 32 |
+
<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. -->
|
| 33 |
+
|
| 34 |
+
[SECTION_2_CONTENT]
|
| 35 |
+
<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. -->
|
| 36 |
+
|
| 37 |
+
## [SECTION_3_NAME]
|
| 38 |
+
<!-- Example: Development Workflow, Review Process, Quality Gates, etc. -->
|
| 39 |
+
|
| 40 |
+
[SECTION_3_CONTENT]
|
| 41 |
+
<!-- Example: Code review requirements, testing gates, deployment approval process, etc. -->
|
| 42 |
+
|
| 43 |
+
## Governance
|
| 44 |
+
<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan -->
|
| 45 |
+
|
| 46 |
+
[GOVERNANCE_RULES]
|
| 47 |
+
<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance -->
|
| 48 |
+
|
| 49 |
+
**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE]
|
| 50 |
+
<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 -->
|