From de1db34b084aab95aa494d04dd4bc8466cdd3bb7 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 25 Sep 2025 21:01:43 -0600 Subject: [PATCH 01/31] feat(agent): Added Amazon Q Developer CLI Integration --- .../scripts/create-github-release.sh | 2 ++ .../scripts/create-release-packages.sh | 5 ++++- AGENTS.md | 14 +++++++++----- README.md | 8 +++++--- scripts/bash/update-agent-context.sh | 17 +++++++++++++---- scripts/powershell/update-agent-context.ps1 | 11 +++++++---- src/specify_cli/__init__.py | 19 ++++++++++++++----- templates/plan-template.md | 2 +- 8 files changed, 55 insertions(+), 23 deletions(-) diff --git a/.github/workflows/scripts/create-github-release.sh b/.github/workflows/scripts/create-github-release.sh index 0257520f..26b08880 100644 --- a/.github/workflows/scripts/create-github-release.sh +++ b/.github/workflows/scripts/create-github-release.sh @@ -38,5 +38,7 @@ gh release create "$VERSION" \ .genreleases/spec-kit-template-auggie-ps-"$VERSION".zip \ .genreleases/spec-kit-template-roo-sh-"$VERSION".zip \ .genreleases/spec-kit-template-roo-ps-"$VERSION".zip \ + .genreleases/spec-kit-template-q-sh-"$VERSION".zip \ + .genreleases/spec-kit-template-q-ps-"$VERSION".zip \ --title "Spec Kit Templates - $VERSION_NO_V" \ --notes-file release_notes.md \ No newline at end of file diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.sh index 1a12e558..82601c60 100644 --- a/.github/workflows/scripts/create-release-packages.sh +++ b/.github/workflows/scripts/create-release-packages.sh @@ -172,13 +172,16 @@ build_variant() { roo) mkdir -p "$base_dir/.roo/commands" generate_commands roo md "\$ARGUMENTS" "$base_dir/.roo/commands" "$script" ;; + q) + mkdir -p "$base_dir/.amazonq/prompts" + generate_commands q md "\$ARGUMENTS" "$base_dir/.amazonq/prompts" "$script" ;; esac ( cd "$base_dir" && zip -r "../spec-kit-template-${agent}-${script}-${NEW_VERSION}.zip" . ) echo "Created $GENRELEASES_DIR/spec-kit-template-${agent}-${script}-${NEW_VERSION}.zip" } # Determine agent list -ALL_AGENTS=(claude gemini copilot cursor qwen opencode windsurf codex kilocode auggie roo) +ALL_AGENTS=(claude gemini copilot cursor qwen opencode windsurf codex kilocode auggie roo q) ALL_SCRIPTS=(sh ps) diff --git a/AGENTS.md b/AGENTS.md index 59b99566..6cae6703 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,6 +38,8 @@ Specify supports multiple AI agents by generating agent-specific command files a | **Qwen Code** | `.qwen/commands/` | TOML | `qwen` | Alibaba's Qwen Code CLI | | **opencode** | `.opencode/command/` | Markdown | `opencode` | opencode CLI | | **Windsurf** | `.windsurf/workflows/` | Markdown | N/A (IDE-based) | Windsurf IDE workflows | +| **Amazon Q Developer CLI** | `.amazonq/prompts/` | Markdown | `q` | Amazon Q Developer CLI | + ### Step-by-Step Integration Guide @@ -55,7 +57,8 @@ AI_CHOICES = { "cursor": "Cursor", "qwen": "Qwen Code", "opencode": "opencode", - "windsurf": "Windsurf" # Add new agent here + "windsurf": "Windsurf", + "q": "Amazon Q Developer CLI" # Add new agent here } ``` @@ -69,10 +72,11 @@ agent_folder_map = { "qwen": ".qwen/", "opencode": ".opencode/", "codex": ".codex/", - "windsurf": ".windsurf/", # Add new agent folder here + "windsurf": ".windsurf/", "kilocode": ".kilocode/", "auggie": ".auggie/", - "copilot": ".github/" + "copilot": ".github/", + "q": ".amazonq/" # Add new agent folder here } ``` @@ -99,7 +103,7 @@ Modify `.github/workflows/scripts/create-release-packages.sh`: ##### Add to ALL_AGENTS array: ```bash -ALL_AGENTS=(claude gemini copilot cursor qwen opencode windsurf) +ALL_AGENTS=(claude gemini copilot cursor qwen opencode windsurf q) ``` ##### Add case statement for directory structure: @@ -206,7 +210,7 @@ Work within integrated development environments: ## Command File Formats ### Markdown Format -Used by: Claude, Cursor, opencode, Windsurf +Used by: Claude, Cursor, opencode, Windsurf, Amazon Q Developer ```markdown --- diff --git a/README.md b/README.md index b4e91c37..ef53ee56 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ Want to see Spec Kit in action? Watch our [video overview](https://www.youtube.c | [Kilo Code](https://github.com/Kilo-Org/kilocode) | ✅ | | | [Auggie CLI](https://docs.augmentcode.com/cli/overview) | ✅ | | | [Roo Code](https://roocode.com/) | ✅ | | +| [Amazon Q Developer CLI](https://aws.amazon.com/developer/learning/q-developer-cli/) | ✅ | | | [Codex CLI](https://github.com/openai/codex) | ⚠️ | Codex [does not support](https://github.com/openai/codex/issues/2890) custom arguments for slash commands. | ## 🔧 Specify CLI Reference @@ -151,7 +152,7 @@ The `specify` command supports the following options: | Argument/Option | Type | Description | |------------------------|----------|------------------------------------------------------------------------------| | `` | Argument | Name for your new project directory (optional if using `--here`, or use `.` for current directory) | -| `--ai` | Option | AI assistant to use: `claude`, `gemini`, `copilot`, `cursor`, `qwen`, `opencode`, `codex`, `windsurf`, `kilocode`, `auggie`, or `roo` | +| `--ai` | Option | AI assistant to use: `claude`, `gemini`, `copilot`, `cursor`, `qwen`, `opencode`, `codex`, `windsurf`, `kilocode`, `auggie`, `roo`, or `q` | | `--script` | Option | Script variant to use: `sh` (bash/zsh) or `ps` (PowerShell) | | `--ignore-agent-tools` | Flag | Skip checks for AI agent tools like Claude Code | | `--no-git` | Flag | Skip git repository initialization | @@ -268,7 +269,7 @@ Our research and experimentation focus on: ## 🔧 Prerequisites - **Linux/macOS** (or WSL2 on Windows) -- AI coding agent: [Claude Code](https://www.anthropic.com/claude-code), [GitHub Copilot](https://code.visualstudio.com/), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [Cursor](https://cursor.sh/), [Qwen CLI](https://github.com/QwenLM/qwen-code), [opencode](https://opencode.ai/), [Codex CLI](https://github.com/openai/codex), or [Windsurf](https://windsurf.com/) +- AI coding agent: [Claude Code](https://www.anthropic.com/claude-code), [GitHub Copilot](https://code.visualstudio.com/), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [Cursor](https://cursor.sh/), [Qwen CLI](https://github.com/QwenLM/qwen-code), [opencode](https://opencode.ai/), [Codex CLI](https://github.com/openai/codex), [Windsurf](https://windsurf.com/), or [Amazon Q Developer CLI](https://aws.amazon.com/developer/learning/q-developer-cli/) - [uv](https://docs.astral.sh/uv/) for package management - [Python 3.11+](https://www.python.org/downloads/) - [Git](https://git-scm.com/downloads) @@ -318,6 +319,7 @@ specify init --ai qwen specify init --ai opencode specify init --ai codex specify init --ai windsurf +specify init --ai q # Or in current directory: specify init . --ai claude specify init . --ai codex @@ -330,7 +332,7 @@ specify init . --force --ai claude specify init --here --force --ai claude ``` -The CLI will check if you have Claude Code, Gemini CLI, Cursor CLI, Qwen CLI, opencode, or Codex CLI installed. If you do not, or you prefer to get the templates without checking for the right tools, use `--ignore-agent-tools` with your command: +The CLI will check if you have Claude Code, Gemini CLI, Cursor CLI, Qwen CLI, opencode, Codex CLI, or Amazon Q Developer CLI installed. If you do not, or you prefer to get the templates without checking for the right tools, use `--ignore-agent-tools` with your command: ```bash specify init --ai claude --ignore-agent-tools diff --git a/scripts/bash/update-agent-context.sh b/scripts/bash/update-agent-context.sh index d3cc422e..036d6b21 100644 --- a/scripts/bash/update-agent-context.sh +++ b/scripts/bash/update-agent-context.sh @@ -30,12 +30,12 @@ # # 5. Multi-Agent Support # - Handles agent-specific file paths and naming conventions -# - Supports: Claude, Gemini, Copilot, Cursor, Qwen, opencode, Codex, Windsurf +# - Supports: Claude, Gemini, Copilot, Cursor, Qwen, opencode, Codex, Windsurf, Kilo Code, Auggie CLI, or Amazon Q Developer CLI # - Can update single agents or all existing agent files # - Creates default Claude file if no agent files exist # # Usage: ./update-agent-context.sh [agent_type] -# Agent types: claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf +# Agent types: claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|q # Leave empty to update all existing agent files set -e @@ -69,6 +69,7 @@ WINDSURF_FILE="$REPO_ROOT/.windsurf/rules/specify-rules.md" KILOCODE_FILE="$REPO_ROOT/.kilocode/rules/specify-rules.md" AUGGIE_FILE="$REPO_ROOT/.augment/rules/specify-rules.md" ROO_FILE="$REPO_ROOT/.roo/rules/specify-rules.md" +Q_FILE="$REPO_ROOT/AGENTS.md" # Template file TEMPLATE_FILE="$REPO_ROOT/.specify/templates/agent-file-template.md" @@ -580,9 +581,12 @@ update_specific_agent() { roo) update_agent_file "$ROO_FILE" "Roo Code" ;; + q) + update_agent_file "$Q_FILE" "Amazon Q Developer CLI" + ;; *) log_error "Unknown agent type '$agent_type'" - log_error "Expected: claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|roo" + log_error "Expected: claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|roo|q" exit 1 ;; esac @@ -641,6 +645,11 @@ update_all_existing_agents() { update_agent_file "$ROO_FILE" "Roo Code" found_agent=true fi + + if [[ -f "$Q_FILE" ]]; then + update_agent_file "$Q_FILE" "Amazon Q Developer CLI" + found_agent=true + fi # If no agent files exist, create a default Claude file if [[ "$found_agent" == false ]]; then @@ -665,7 +674,7 @@ print_summary() { fi echo - log_info "Usage: $0 [claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|roo]" + log_info "Usage: $0 [claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|q]" } #============================================================================== diff --git a/scripts/powershell/update-agent-context.ps1 b/scripts/powershell/update-agent-context.ps1 index 8f4830a9..a182c6d2 100644 --- a/scripts/powershell/update-agent-context.ps1 +++ b/scripts/powershell/update-agent-context.ps1 @@ -9,7 +9,7 @@ Mirrors the behavior of scripts/bash/update-agent-context.sh: 2. Plan Data Extraction 3. Agent File Management (create from template or update existing) 4. Content Generation (technology stack, recent changes, timestamp) - 5. Multi-Agent Support (claude, gemini, copilot, cursor, qwen, opencode, codex, windsurf) + 5. Multi-Agent Support (claude, gemini, copilot, cursor, qwen, opencode, codex, windsurf, kilocode, auggie, roo, q) .PARAMETER AgentType Optional agent key to update a single agent. If omitted, updates all existing agent files (creating a default Claude file if none exist). @@ -25,7 +25,7 @@ Relies on common helper functions in common.ps1 #> param( [Parameter(Position=0)] - [ValidateSet('claude','gemini','copilot','cursor','qwen','opencode','codex','windsurf','kilocode','auggie','roo')] + [ValidateSet('claude','gemini','copilot','cursor','qwen','opencode','codex','windsurf','kilocode','auggie','roo','q')] [string]$AgentType ) @@ -54,6 +54,7 @@ $WINDSURF_FILE = Join-Path $REPO_ROOT '.windsurf/rules/specify-rules.md' $KILOCODE_FILE = Join-Path $REPO_ROOT '.kilocode/rules/specify-rules.md' $AUGGIE_FILE = Join-Path $REPO_ROOT '.augment/rules/specify-rules.md' $ROO_FILE = Join-Path $REPO_ROOT '.roo/rules/specify-rules.md' +$Q_FILE = Join-Path $REPO_ROOT 'AGENTS.md' $TEMPLATE_FILE = Join-Path $REPO_ROOT '.specify/templates/agent-file-template.md' @@ -376,7 +377,8 @@ function Update-SpecificAgent { 'kilocode' { Update-AgentFile -TargetFile $KILOCODE_FILE -AgentName 'Kilo Code' } 'auggie' { Update-AgentFile -TargetFile $AUGGIE_FILE -AgentName 'Auggie CLI' } 'roo' { Update-AgentFile -TargetFile $ROO_FILE -AgentName 'Roo Code' } - default { Write-Err "Unknown agent type '$Type'"; Write-Err 'Expected: claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|roo'; return $false } + 'q' { Update-AgentFile -TargetFile $Q_FILE -AgentName 'Amazon Q Developer CLI' } + default { Write-Err "Unknown agent type '$Type'"; Write-Err 'Expected: claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|roo|q'; return $false } } } @@ -393,6 +395,7 @@ function Update-AllExistingAgents { if (Test-Path $KILOCODE_FILE) { if (-not (Update-AgentFile -TargetFile $KILOCODE_FILE -AgentName 'Kilo Code')) { $ok = $false }; $found = $true } if (Test-Path $AUGGIE_FILE) { if (-not (Update-AgentFile -TargetFile $AUGGIE_FILE -AgentName 'Auggie CLI')) { $ok = $false }; $found = $true } if (Test-Path $ROO_FILE) { if (-not (Update-AgentFile -TargetFile $ROO_FILE -AgentName 'Roo Code')) { $ok = $false }; $found = $true } + if (Test-Path $Q_FILE) { if (-not (Update-AgentFile -TargetFile $Q_FILE -AgentName 'Amazon Q Developer CLI')) { $ok = $false }; $found = $true } if (-not $found) { Write-Info 'No existing agent files found, creating default Claude file...' if (-not (Update-AgentFile -TargetFile $CLAUDE_FILE -AgentName 'Claude Code')) { $ok = $false } @@ -407,7 +410,7 @@ function Print-Summary { if ($NEW_FRAMEWORK) { Write-Host " - Added framework: $NEW_FRAMEWORK" } if ($NEW_DB -and $NEW_DB -ne 'N/A') { Write-Host " - Added database: $NEW_DB" } Write-Host '' - Write-Info 'Usage: ./update-agent-context.ps1 [-AgentType claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|roo]' + Write-Info 'Usage: ./update-agent-context.ps1 [-AgentType claude|gemini|copilot|cursor|qwen|opencode|codex|windsurf|kilocode|auggie|roo|q]' } function Main { diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index a5be99d7..1ade2472 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -77,6 +77,7 @@ AI_CHOICES = { "kilocode": "Kilo Code", "auggie": "Auggie CLI", "roo": "Roo Code", + "q": "Amazon Q Developer CLI", } # Add script type choices SCRIPT_TYPE_CHOICES = {"sh": "POSIX Shell (bash/zsh)", "ps": "PowerShell"} @@ -750,7 +751,7 @@ def ensure_executable_scripts(project_path: Path, tracker: StepTracker | None = @app.command() def init( project_name: str = typer.Argument(None, help="Name for your new project directory (optional if using --here, or use '.' for current directory)"), - ai_assistant: str = typer.Option(None, "--ai", help="AI assistant to use: claude, gemini, copilot, cursor, qwen, opencode, codex, windsurf, kilocode, or auggie"), + ai_assistant: str = typer.Option(None, "--ai", help="AI assistant to use: claude, gemini, copilot, cursor, qwen, opencode, codex, windsurf, kilocode, auggie or q"), script_type: str = typer.Option(None, "--script", help="Script type to use: sh or ps"), ignore_agent_tools: bool = typer.Option(False, "--ignore-agent-tools", help="Skip checks for AI agent tools like Claude Code"), no_git: bool = typer.Option(False, "--no-git", help="Skip git repository initialization"), @@ -765,8 +766,8 @@ def init( This command will: 1. Check that required tools are installed (git is optional) - 2. Let you choose your AI assistant (Claude Code, Gemini CLI, GitHub Copilot, Cursor, Qwen Code, opencode, Codex CLI, Windsurf, Kilo Code, or Auggie CLI) - 3. Download the appropriate template from GitHub + 2. Let you choose your AI assistant (Claude Code, Gemini CLI, GitHub Copilot, Cursor, Qwen Code, opencode, Codex CLI, Windsurf, Kilo Code, Auggie CLI, or Amazon Q Developer CLI) + 3. Download the appropriate template from GitHub (or use local release if --local or --local-release is specified) 4. Extract the template to a new project directory or current directory 5. Initialize a fresh git repository (if not --no-git and no existing repo) 6. Optionally set up AI assistant commands @@ -782,6 +783,7 @@ def init( specify init my-project --ai codex specify init my-project --ai windsurf specify init my-project --ai auggie + specify init my-project --ai q specify init --ignore-agent-tools my-project specify init . --ai claude # Initialize in current directory specify init . # Initialize in current directory (interactive AI selection) @@ -906,6 +908,10 @@ def init( if not check_tool("auggie", "https://docs.augmentcode.com/cli/setup-auggie/install-auggie-cli"): install_url = "https://docs.augmentcode.com/cli/setup-auggie/install-auggie-cli" agent_tool_missing = True + elif selected_ai == "q": + if not check_tool("q", "https://github.com/aws/amazon-q-developer-cli"): + install_url = "https://aws.amazon.com/developer/learning/q-developer-cli/" + agent_tool_missing = True # GitHub Copilot and Cursor checks are not needed as they're typically available in supported IDEs if agent_tool_missing: @@ -1030,7 +1036,8 @@ def init( "kilocode": ".kilocode/", "auggie": ".augment/", "copilot": ".github/", - "roo": ".roo/" + "roo": ".roo/", + "q": ".amazonq/" } if selected_ai in agent_folder_map: @@ -1119,6 +1126,7 @@ def check(): tracker.add("opencode", "opencode") tracker.add("codex", "Codex CLI") tracker.add("auggie", "Auggie CLI") + tracker.add("q", "Amazon Q Developer CLI") git_ok = check_tool_for_tracker("git", tracker) claude_ok = check_tool_for_tracker("claude", tracker) @@ -1132,6 +1140,7 @@ def check(): opencode_ok = check_tool_for_tracker("opencode", tracker) codex_ok = check_tool_for_tracker("codex", tracker) auggie_ok = check_tool_for_tracker("auggie", tracker) + q_ok = check_tool_for_tracker("q", tracker) console.print(tracker.render()) @@ -1139,7 +1148,7 @@ def check(): if not git_ok: console.print("[dim]Tip: Install git for repository management[/dim]") - if not (claude_ok or gemini_ok or cursor_ok or qwen_ok or windsurf_ok or kilocode_ok or opencode_ok or codex_ok or auggie_ok): + if not (claude_ok or gemini_ok or cursor_ok or qwen_ok or windsurf_ok or kilocode_ok or opencode_ok or codex_ok or auggie_ok or q_ok): console.print("[dim]Tip: Install an AI assistant for the best experience[/dim]") diff --git a/templates/plan-template.md b/templates/plan-template.md index 283ffd4b..5e28b50e 100644 --- a/templates/plan-template.md +++ b/templates/plan-template.md @@ -24,7 +24,7 @@ scripts: → Update Progress Tracking: Initial Constitution Check 5. Execute Phase 0 → research.md → If NEEDS CLARIFICATION remain: ERROR "Resolve unknowns" -6. Execute Phase 1 → contracts, data-model.md, quickstart.md, agent-specific template file (e.g., `CLAUDE.md` for Claude Code, `.github/copilot-instructions.md` for GitHub Copilot, `GEMINI.md` for Gemini CLI, `QWEN.md` for Qwen Code or `AGENTS.md` for opencode). +6. Execute Phase 1 → contracts, data-model.md, quickstart.md, agent-specific template file (e.g., `CLAUDE.md` for Claude Code, `.github/copilot-instructions.md` for GitHub Copilot, `GEMINI.md` for Gemini CLI, `QWEN.md` for Qwen Code, or `AGENTS.md` for all other agents). 7. Re-evaluate Constitution Check section → If new violations: Refactor design, return to Phase 1 → Update Progress Tracking: Post-Design Constitution Check From b2f749ef413659aa4395eaa532e0216ccb4f2520 Mon Sep 17 00:00:00 2001 From: stenyin Date: Wed, 24 Sep 2025 21:44:34 +0800 Subject: [PATCH 02/31] fix: add UTF-8 encoding to file read/write operations in update-agent-context.ps1 --- scripts/powershell/update-agent-context.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/powershell/update-agent-context.ps1 b/scripts/powershell/update-agent-context.ps1 index 8f4830a9..8f727f81 100644 --- a/scripts/powershell/update-agent-context.ps1 +++ b/scripts/powershell/update-agent-context.ps1 @@ -124,7 +124,7 @@ function Extract-PlanField { if (-not (Test-Path $PlanFile)) { return '' } # Lines like **Language/Version**: Python 3.12 $regex = "^\*\*$([Regex]::Escape($FieldPattern))\*\*: (.+)$" - Get-Content -LiteralPath $PlanFile | ForEach-Object { + Get-Content -LiteralPath $PlanFile -Encoding utf8 | ForEach-Object { if ($_ -match $regex) { $val = $Matches[1].Trim() if ($val -notin @('NEEDS CLARIFICATION','N/A')) { return $val } @@ -215,7 +215,7 @@ function New-AgentFile { $escaped_framework = $NEW_FRAMEWORK $escaped_branch = $CURRENT_BRANCH - $content = Get-Content -LiteralPath $temp -Raw + $content = Get-Content -LiteralPath $temp -Raw -Encoding utf8 $content = $content -replace '\[PROJECT NAME\]',$ProjectName $content = $content -replace '\[DATE\]',$Date.ToString('yyyy-MM-dd') @@ -253,7 +253,7 @@ function New-AgentFile { $parent = Split-Path -Parent $TargetFile if (-not (Test-Path $parent)) { New-Item -ItemType Directory -Path $parent | Out-Null } - Set-Content -LiteralPath $TargetFile -Value $content -NoNewline + Set-Content -LiteralPath $TargetFile -Value $content -NoNewline -Encoding utf8 Remove-Item $temp -Force return $true } @@ -285,7 +285,7 @@ function Update-ExistingAgentFile { if ($techStack) { $newChangeEntry = "- ${CURRENT_BRANCH}: Added ${techStack}" } elseif ($NEW_DB -and $NEW_DB -notin @('N/A','NEEDS CLARIFICATION')) { $newChangeEntry = "- ${CURRENT_BRANCH}: Added ${NEW_DB}" } - $lines = Get-Content -LiteralPath $TargetFile + $lines = Get-Content -LiteralPath $TargetFile -Encoding utf8 $output = New-Object System.Collections.Generic.List[string] $inTech = $false; $inChanges = $false; $techAdded = $false; $changeAdded = $false; $existingChanges = 0 @@ -327,7 +327,7 @@ function Update-ExistingAgentFile { $newTechEntries | ForEach-Object { $output.Add($_) } } - Set-Content -LiteralPath $TargetFile -Value ($output -join [Environment]::NewLine) + Set-Content -LiteralPath $TargetFile -Value ($output -join [Environment]::NewLine) -Encoding utf8 return $true } From cc75a22e455ab5da9c95b97e62fe866cb85010f1 Mon Sep 17 00:00:00 2001 From: Maxi Ferreira Date: Tue, 30 Sep 2025 11:11:41 -0700 Subject: [PATCH 03/31] Update URLs to Contributing and Support Guides in Docs ## Problem The links to the contributing and support guides at the bottom of [the docs site home page](https://github.github.com/spec-kit/index.html) currently take you to a 404 page. ## Solution Update the links to the correct URLs, pointing to the guides that are currently in the repo's root directory rather than within the `docs` folder. --- docs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 34da7023..9a10e7ca 100644 --- a/docs/index.md +++ b/docs/index.md @@ -55,8 +55,8 @@ Our research and experimentation focus on: ## Contributing -Please see our [Contributing Guide](CONTRIBUTING.md) for information on how to contribute to this project. +Please see our [Contributing Guide](https://github.com/github/spec-kit/blob/main/CONTRIBUTING.md) for information on how to contribute to this project. ## Support -For support, please check our [Support Guide](SUPPORT.md) or open an issue on GitHub. +For support, please check our [Support Guide](https://github.com/github/spec-kit/blob/main/SUPPORT.md) or open an issue on GitHub. From f430138895bc62211cee75d5bfe3c1f0caad5d64 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 1 Oct 2025 02:47:58 -0600 Subject: [PATCH 04/31] docs: clarify Amazon Q limitation and update init docstring --- README.md | 2 +- src/specify_cli/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef53ee56..12ed5703 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ Want to see Spec Kit in action? Watch our [video overview](https://www.youtube.c | [Kilo Code](https://github.com/Kilo-Org/kilocode) | ✅ | | | [Auggie CLI](https://docs.augmentcode.com/cli/overview) | ✅ | | | [Roo Code](https://roocode.com/) | ✅ | | -| [Amazon Q Developer CLI](https://aws.amazon.com/developer/learning/q-developer-cli/) | ✅ | | +| [Amazon Q Developer CLI](https://aws.amazon.com/developer/learning/q-developer-cli/) | ⚠️ | Amazon Q Developer CLI does not support custom arguments for slash commands. | | [Codex CLI](https://github.com/openai/codex) | ⚠️ | Codex [does not support](https://github.com/openai/codex/issues/2890) custom arguments for slash commands. | ## 🔧 Specify CLI Reference diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index 1ade2472..8268bf09 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -767,7 +767,7 @@ def init( This command will: 1. Check that required tools are installed (git is optional) 2. Let you choose your AI assistant (Claude Code, Gemini CLI, GitHub Copilot, Cursor, Qwen Code, opencode, Codex CLI, Windsurf, Kilo Code, Auggie CLI, or Amazon Q Developer CLI) - 3. Download the appropriate template from GitHub (or use local release if --local or --local-release is specified) + 3. Download the appropriate template from GitHub 4. Extract the template to a new project directory or current directory 5. Initialize a fresh git repository (if not --no-git and no existing repo) 6. Optionally set up AI assistant commands From 12b823e4c22840c4fd545cfb5829dd35b83762ad Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 1 Oct 2025 02:54:59 -0600 Subject: [PATCH 05/31] docs(readme): link Amazon Q slash command limitation issue --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12ed5703..30d9c378 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ Want to see Spec Kit in action? Watch our [video overview](https://www.youtube.c | [Kilo Code](https://github.com/Kilo-Org/kilocode) | ✅ | | | [Auggie CLI](https://docs.augmentcode.com/cli/overview) | ✅ | | | [Roo Code](https://roocode.com/) | ✅ | | -| [Amazon Q Developer CLI](https://aws.amazon.com/developer/learning/q-developer-cli/) | ⚠️ | Amazon Q Developer CLI does not support custom arguments for slash commands. | +| [Amazon Q Developer CLI](https://aws.amazon.com/developer/learning/q-developer-cli/) | ⚠️ | Amazon Q Developer CLI [does not support](https://github.com/aws/amazon-q-developer-cli/issues/3064) custom arguments for slash commands. | | [Codex CLI](https://github.com/openai/codex) | ⚠️ | Codex [does not support](https://github.com/openai/codex/issues/2890) custom arguments for slash commands. | ## 🔧 Specify CLI Reference From 3ee225f624188751f5aed9b2a29c137d18a259ab Mon Sep 17 00:00:00 2001 From: Emanuel Turis <60395856+emanuelturis@users.noreply.github.com> Date: Wed, 1 Oct 2025 12:09:41 +0300 Subject: [PATCH 06/31] Remove Codex named args limitation from README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4e91c37..385a2d49 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ Want to see Spec Kit in action? Watch our [video overview](https://www.youtube.c | [Kilo Code](https://github.com/Kilo-Org/kilocode) | ✅ | | | [Auggie CLI](https://docs.augmentcode.com/cli/overview) | ✅ | | | [Roo Code](https://roocode.com/) | ✅ | | -| [Codex CLI](https://github.com/openai/codex) | ⚠️ | Codex [does not support](https://github.com/openai/codex/issues/2890) custom arguments for slash commands. | +| [Codex CLI](https://github.com/openai/codex) | ✅ | | ## 🔧 Specify CLI Reference From 75df2999f4dbd5f354cea16a350594156d809ba2 Mon Sep 17 00:00:00 2001 From: Emanuel Turis Date: Fri, 3 Oct 2025 16:31:36 +0300 Subject: [PATCH 07/31] Remove Codex named args limitation warning --- src/specify_cli/__init__.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index a5be99d7..14e06fe3 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -1088,17 +1088,6 @@ def init( console.print() console.print(enhancements_panel) - if selected_ai == "codex": - warning_text = """[bold yellow]Important Note:[/bold yellow] - -Custom prompts do not yet support arguments in Codex. You may need to manually specify additional project instructions directly in prompt files located in [cyan].codex/prompts/[/cyan]. - -For more information, see: [cyan]https://github.com/openai/codex/issues/2890[/cyan]""" - - warning_panel = Panel(warning_text, title="Slash Commands in Codex", border_style="yellow", padding=(1,2)) - console.print() - console.print(warning_panel) - @app.command() def check(): """Check that all required tools are installed.""" From 5042c76558e0f6b7a0479e5529c359279da7d80c Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 17:08:14 -0700 Subject: [PATCH 08/31] Template cleanup and reorganization --- .../scripts/create-release-packages.sh | 41 +++-- templates/commands/plan.md | 93 +++++++---- templates/commands/specify.md | 55 ++++++- templates/commands/tasks.md | 92 ++++++----- templates/plan-template.md | 147 ++---------------- templates/spec-template.md | 101 +++--------- templates/tasks-template.md | 92 ++++------- 7 files changed, 251 insertions(+), 370 deletions(-) diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.sh index 82601c60..bd32a37e 100644 --- a/.github/workflows/scripts/create-release-packages.sh +++ b/.github/workflows/scripts/create-release-packages.sh @@ -42,7 +42,7 @@ generate_commands() { mkdir -p "$output_dir" for template in templates/commands/*.md; do [[ -f "$template" ]] || continue - local name description script_command body + local name description script_command agent_script_command body name=$(basename "$template" .md) # Normalize line endings @@ -57,13 +57,29 @@ generate_commands() { script_command="(Missing script command for $script_variant)" fi + # Extract agent_script command from YAML frontmatter if present + agent_script_command=$(printf '%s\n' "$file_content" | awk ' + /^agent_scripts:$/ { in_agent_scripts=1; next } + in_agent_scripts && /^[[:space:]]*'"$script_variant"':[[:space:]]*/ { + sub(/^[[:space:]]*'"$script_variant"':[[:space:]]*/, "") + print + exit + } + in_agent_scripts && /^[a-zA-Z]/ { in_agent_scripts=0 } + ') + # Replace {SCRIPT} placeholder with the script command body=$(printf '%s\n' "$file_content" | sed "s|{SCRIPT}|${script_command}|g") - # Remove the scripts: section from frontmatter while preserving YAML structure + # Replace {AGENT_SCRIPT} placeholder with the agent script command if found + if [[ -n $agent_script_command ]]; then + body=$(printf '%s\n' "$body" | sed "s|{AGENT_SCRIPT}|${agent_script_command}|g") + fi + + # Remove the scripts: and agent_scripts: sections from frontmatter while preserving YAML structure body=$(printf '%s\n' "$body" | awk ' /^---$/ { print; if (++dash_count == 1) in_frontmatter=1; else in_frontmatter=0; next } - in_frontmatter && /^scripts:$/ { skip_scripts=1; next } + in_frontmatter && /^(scripts|agent_scripts):$/ { skip_scripts=1; next } in_frontmatter && /^[a-zA-Z].*:/ && skip_scripts { skip_scripts=0 } in_frontmatter && skip_scripts && /^[[:space:]]/ { next } { print } @@ -113,24 +129,7 @@ build_variant() { fi [[ -d templates ]] && { mkdir -p "$SPEC_DIR/templates"; find templates -type f -not -path "templates/commands/*" -exec cp --parents {} "$SPEC_DIR"/ \; ; echo "Copied templates -> .specify/templates"; } - # Inject variant into plan-template.md within .specify/templates if present - local plan_tpl="$base_dir/.specify/templates/plan-template.md" - if [[ -f "$plan_tpl" ]]; then - plan_norm=$(tr -d '\r' < "$plan_tpl") - # Extract script command from YAML frontmatter - script_command=$(printf '%s\n' "$plan_norm" | awk -v sv="$script" '/^[[:space:]]*'"$script"':[[:space:]]*/ {sub(/^[[:space:]]*'"$script"':[[:space:]]*/, ""); print; exit}') - if [[ -n $script_command ]]; then - # Always prefix with .specify/ for plan usage - script_command=".specify/$script_command" - # Replace {SCRIPT} placeholder with the script command and __AGENT__ with agent name - substituted=$(sed "s|{SCRIPT}|${script_command}|g" "$plan_tpl" | tr -d '\r' | sed "s|__AGENT__|${agent}|g") - # Strip YAML frontmatter from plan template output (keep body only) - stripped=$(printf '%s\n' "$substituted" | awk 'BEGIN{fm=0;dash=0} /^---$/ {dash++; if(dash==1){fm=1; next} else if(dash==2){fm=0; next}} {if(!fm) print}') - printf '%s\n' "$stripped" > "$plan_tpl" - else - echo "Warning: no plan-template script command found for $script in YAML frontmatter" >&2 - fi - fi + # NOTE: We substitute {ARGS} internally. Outward tokens differ intentionally: # * Markdown/prompt (claude, copilot, cursor, opencode): $ARGUMENTS # * TOML (gemini, qwen): {{args}} diff --git a/templates/commands/plan.md b/templates/commands/plan.md index 32522c23..09bbb064 100644 --- a/templates/commands/plan.md +++ b/templates/commands/plan.md @@ -3,6 +3,9 @@ description: Execute the implementation planning workflow using the plan templat scripts: sh: scripts/bash/setup-plan.sh --json ps: scripts/powershell/setup-plan.ps1 -Json +agent_scripts: + sh: scripts/bash/update-agent-context.sh __AGENT__ + ps: scripts/powershell/update-agent-context.ps1 -AgentType __AGENT__ --- The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). @@ -11,36 +14,72 @@ User input: $ARGUMENTS -Given the implementation details provided as an argument, do this: +## Execution Steps -1. Run `{SCRIPT}` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. All future file paths must be absolute. - - BEFORE proceeding, inspect FEATURE_SPEC for a `## Clarifications` section with at least one `Session` subheading. If missing or clearly ambiguous areas remain (vague adjectives, unresolved critical choices), PAUSE and instruct the user to run `/clarify` first to reduce rework. Only continue if: (a) Clarifications exist OR (b) an explicit user override is provided (e.g., "proceed without clarification"). Do not attempt to fabricate clarifications yourself. -2. Read and analyze the feature specification to understand: - - The feature requirements and user stories - - Functional and non-functional requirements - - Success criteria and acceptance criteria - - Any technical constraints or dependencies mentioned +1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. + - Before proceeding: Check FEATURE_SPEC has `## Clarifications` section. If missing or ambiguous, instruct user to run `/clarify` first. -3. Read the constitution at `/memory/constitution.md` to understand constitutional requirements. +2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied). -4. Execute the implementation plan template: - - Load `/templates/plan-template.md` (already copied to IMPL_PLAN path) - - Set Input path to FEATURE_SPEC - - Run the Execution Flow (main) function steps 1-9 - - The template is self-contained and executable - - Follow error handling and gate checks as specified - - Let the template guide artifact generation in $SPECS_DIR: - * Phase 0 generates research.md - * Phase 1 generates data-model.md, contracts/, quickstart.md - * Phase 2 generates tasks.md - - Incorporate user-provided details from arguments into Technical Context: {ARGS} - - Update Progress Tracking as you complete each phase +3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to: + - Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION") + - Fill Constitution Check section from constitution + - Evaluate gates (ERROR if violations unjustified) + - Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION) + - Phase 1: Generate data-model.md, contracts/, quickstart.md + - Phase 1: Update agent context by running the agent script + - Re-evaluate Constitution Check post-design -5. Verify execution completed: - - Check Progress Tracking shows all phases complete - - Ensure all required artifacts were generated - - Confirm no ERROR states in execution +4. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts. -6. Report results with branch name, file paths, and generated artifacts. +## Phases -Use absolute paths with the repository root for all file operations to avoid path issues. +### Phase 0: Outline & Research + +1. **Extract unknowns from Technical Context** above: + - For each NEEDS CLARIFICATION → research task + - For each dependency → best practices task + - For each integration → patterns task + +2. **Generate and dispatch research agents**: + ``` + For each unknown in Technical Context: + Task: "Research {unknown} for {feature context}" + For each technology choice: + Task: "Find best practices for {tech} in {domain}" + ``` + +3. **Consolidate findings** in `research.md` using format: + - Decision: [what was chosen] + - Rationale: [why chosen] + - Alternatives considered: [what else evaluated] + +**Output**: research.md with all NEEDS CLARIFICATION resolved + +### Phase 1: Design & Contracts + +**Prerequisites:** `research.md` complete + +1. **Extract entities from feature spec** → `data-model.md`: + - Entity name, fields, relationships + - Validation rules from requirements + - State transitions if applicable + +2. **Generate API contracts** from functional requirements: + - For each user action → endpoint + - Use standard REST/GraphQL patterns + - Output OpenAPI/GraphQL schema to `/contracts/` + +3. **Agent context update**: + - Run `{AGENT_SCRIPT}` + - These scripts detect which AI agent is in use + - Update the appropriate agent-specific context file + - Add only new technology from current plan + - Preserve manual additions between markers + +**Output**: data-model.md, /contracts/*, quickstart.md, agent-specific file + +## Key rules + +- Use absolute paths +- ERROR on gate failures or unresolved clarifications diff --git a/templates/commands/specify.md b/templates/commands/specify.md index 652c86a2..5757c8bd 100644 --- a/templates/commands/specify.md +++ b/templates/commands/specify.md @@ -18,7 +18,56 @@ Given that feature description, do this: 1. Run the script `{SCRIPT}` from repo root and parse its JSON output for BRANCH_NAME and SPEC_FILE. All file paths must be absolute. **IMPORTANT** You must only ever run this script once. The JSON is provided in the terminal as output - always refer to it to get the actual content you're looking for. 2. Load `templates/spec-template.md` to understand required sections. -3. 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. -4. Report completion with branch name, spec file path, and readiness for the next phase. -Note: The script creates and checks out the new branch and initializes the spec file before writing. +3. Follow this execution flow: + + 1. Parse user description from Input + If empty: ERROR "No feature description provided" + 2. Extract key concepts from description + Identify: actors, actions, data, constraints + 3. For each unclear aspect: + Mark with [NEEDS CLARIFICATION: specific question] + 4. Fill User Scenarios & Testing section + If no clear user flow: ERROR "Cannot determine user scenarios" + 5. Generate Functional Requirements + Each requirement must be testable + Mark ambiguous requirements + 6. Identify Key Entities (if data involved) + 7. Run Review Checklist + If any [NEEDS CLARIFICATION]: WARN "Spec has uncertainties" + If implementation details found: ERROR "Remove tech details" + 8. Return: SUCCESS (spec ready for planning) + +4. 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. +5. Report completion with branch name, spec file path, and readiness for the next phase. + +**NOTE:** The script creates and checks out the new branch and initializes the spec file before writing. + +## General Guidelines + +## Quick Guidelines + +- Focus on WHAT users need and WHY +- Avoid HOW to implement (no tech stack, APIs, code structure) +- Written for business stakeholders, not developers + +### Section Requirements + +- **Mandatory sections**: Must be completed for every feature +- **Optional sections**: Include only when relevant to the feature +- When a section doesn't apply, remove it entirely (don't leave as "N/A") + +### For AI Generation + +When creating this spec from a user prompt: + +1. **Mark all ambiguities**: Use [NEEDS CLARIFICATION: specific question] for any assumption you'd need to make +2. **Don't guess**: If the prompt doesn't specify something (e.g., "login system" without auth method), mark it +3. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item +4. **Common underspecified areas**: + - User types and permissions + - Data retention/deletion policies + - Performance targets and scale + - Error handling behaviors + - Integration requirements + - Security/compliance needs \ No newline at end of file diff --git a/templates/commands/tasks.md b/templates/commands/tasks.md index eb0ef2b6..d97f9b25 100644 --- a/templates/commands/tasks.md +++ b/templates/commands/tasks.md @@ -11,55 +11,65 @@ User input: $ARGUMENTS -1. Run `{SCRIPT}` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. -2. Load and analyze available design documents: - - Always read plan.md for tech stack and libraries - - IF EXISTS: Read data-model.md for entities - - IF EXISTS: Read contracts/ for API endpoints - - IF EXISTS: Read research.md for technical decisions - - IF EXISTS: Read quickstart.md for test scenarios +## Execution Steps - Note: Not all projects have all documents. For example: - - CLI tools might not have contracts/ - - Simple libraries might not need data-model.md - - Generate tasks based on what's available +1. **Setup**: Run `{SCRIPT}` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. -3. Generate tasks following the template: - - Use `/templates/tasks-template.md` as the base - - Replace example tasks with actual tasks based on: - * **Setup tasks**: Project init, dependencies, linting - * **Test tasks [P]**: One per contract, one per integration scenario - * **Core tasks**: One per entity, service, CLI command, endpoint - * **Integration tasks**: DB connections, middleware, logging - * **Polish tasks [P]**: Unit tests, performance, docs +2. **Load design documents**: Read from FEATURE_DIR: + - **Required**: plan.md (tech stack, libraries, structure) + - **Optional**: data-model.md (entities), contracts/ (API endpoints), research.md (decisions), quickstart.md (test scenarios) + - Note: Not all projects have all documents. Generate tasks based on what's available. -4. Task generation rules: - - Each contract file → contract test task marked [P] - - Each entity in data-model → model creation task marked [P] - - Each endpoint → implementation task (not parallel if shared files) - - Each user story → integration test marked [P] - - Different files = can be parallel [P] - - Same file = sequential (no [P]) +3. **Execute task generation workflow** (follow the template structure): + - Load plan.md and extract tech stack, libraries, project structure + - If data-model.md exists: Extract entities → generate model tasks + - If contracts/ exists: Each file → generate endpoint/API tasks + - If research.md exists: Extract decisions → generate setup tasks + - Generate tasks by category: Setup, Core Implementation, Integration, Polish + - **Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature spec or user asks for TDD approach + - Apply task rules: + * Different files = mark [P] for parallel + * Same file = sequential (no [P]) + * If tests requested: Tests before implementation (TDD order) + - Number tasks sequentially (T001, T002...) + - Generate dependency graph + - Create parallel execution examples + - Validate task completeness (all entities have implementations, all endpoints covered) -5. Order tasks by dependencies: - - Setup before everything - - Tests before implementation (TDD) - - Models before services - - Services before endpoints - - Core before integration - - Everything before polish - -6. Include parallel execution examples: - - Group [P] tasks that can run together - - Show actual Task agent commands - -7. Create FEATURE_DIR/tasks.md with: - - Correct feature name from implementation plan - - Numbered tasks (T001, T002, etc.) +4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with: + - Correct feature name from plan.md + - Numbered tasks (T001, T002...) in dependency order - Clear file paths for each task + - [P] markers for parallelizable tasks + - Phase groupings based on what's needed (Setup, Core Implementation, Integration, Polish) + - If tests requested: Include separate "Tests First (TDD)" phase before Core Implementation - Dependency notes + +5. **Report**: Output path to generated tasks.md and summary of task counts by phase. - Parallel execution guidance Context for task generation: {ARGS} The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context. + +## Task Generation Rules + +**IMPORTANT**: Tests are optional. Only generate test tasks if the user explicitly requested testing or TDD approach in the feature specification. + +1. **From Contracts**: + - Each contract/endpoint → implementation task + - If tests requested: Each contract → contract test task [P] before implementation + +2. **From Data Model**: + - Each entity → model creation task [P] + - Relationships → service layer tasks + +3. **From User Stories**: + - Each story → implementation tasks + - If tests requested: Each story → integration test [P] + - If quickstart.md exists: Validation tasks + +4. **Ordering**: + - Without tests: Setup → Models → Services → Endpoints → Integration → Polish + - With tests (TDD): Setup → Tests → Models → Services → Endpoints → Integration → Polish + - Dependencies block parallel execution \ No newline at end of file diff --git a/templates/plan-template.md b/templates/plan-template.md index 5e28b50e..40c5969a 100644 --- a/templates/plan-template.md +++ b/templates/plan-template.md @@ -1,45 +1,22 @@ ---- -description: "Implementation plan template for feature development" -scripts: - sh: scripts/bash/update-agent-context.sh __AGENT__ - ps: scripts/powershell/update-agent-context.ps1 -AgentType __AGENT__ ---- - # Implementation Plan: [FEATURE] **Branch**: `[###-feature-name]` | **Date**: [DATE] | **Spec**: [link] **Input**: Feature specification from `/specs/[###-feature-name]/spec.md` -## Execution Flow (/plan command scope) -``` -1. Load feature spec from Input path - → If not found: ERROR "No feature spec at {path}" -2. Fill Technical Context (scan for NEEDS CLARIFICATION) - → Detect Project Type from file system structure or context (web=frontend+backend, mobile=app+api) - → Set Structure Decision based on project type -3. Fill the Constitution Check section based on the content of the constitution document. -4. Evaluate Constitution Check section below - → If violations exist: Document in Complexity Tracking - → If no justification possible: ERROR "Simplify approach first" - → Update Progress Tracking: Initial Constitution Check -5. Execute Phase 0 → research.md - → If NEEDS CLARIFICATION remain: ERROR "Resolve unknowns" -6. Execute Phase 1 → contracts, data-model.md, quickstart.md, agent-specific template file (e.g., `CLAUDE.md` for Claude Code, `.github/copilot-instructions.md` for GitHub Copilot, `GEMINI.md` for Gemini CLI, `QWEN.md` for Qwen Code, or `AGENTS.md` for all other agents). -7. Re-evaluate Constitution Check section - → If new violations: Refactor design, return to Phase 1 - → Update Progress Tracking: Post-Design Constitution Check -8. Plan Phase 2 → Describe task generation approach (DO NOT create tasks.md) -9. STOP - Ready for /tasks command -``` - -**IMPORTANT**: The /plan command STOPS at step 7. Phases 2-4 are executed by other commands: -- Phase 2: /tasks command creates tasks.md -- Phase 3-4: Implementation execution (manual or via tools) +**Note**: This template is filled in by the `/plan` command. See `.specify/templates/commands/plan.md` for the execution workflow. ## Summary + [Extract from feature spec: primary requirement + technical approach from research] ## Technical Context + + + **Language/Version**: [e.g., Python 3.11, Swift 5.9, Rust 1.75 or NEEDS CLARIFICATION] **Primary Dependencies**: [e.g., FastAPI, UIKit, LLVM or NEEDS CLARIFICATION] **Storage**: [if applicable, e.g., PostgreSQL, CoreData, files or N/A] @@ -51,6 +28,7 @@ scripts: **Scale/Scope**: [domain-specific, e.g., 10k users, 1M LOC, 50 screens or NEEDS CLARIFICATION] ## Constitution Check + *GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.* [Gates determined based on constitution file] @@ -58,6 +36,7 @@ scripts: ## Project Structure ### Documentation (this feature) + ``` specs/[###-feature]/ ├── plan.md # This file (/plan command output) @@ -75,6 +54,7 @@ specs/[###-feature]/ real paths (e.g., apps/admin, packages/something). The delivered plan must not include Option labels. --> + ``` # [REMOVE IF UNUSED] Option 1: Single project (DEFAULT) src/ @@ -114,112 +94,11 @@ ios/ or android/ **Structure Decision**: [Document the selected structure and reference the real directories captured above] -## Phase 0: Outline & Research -1. **Extract unknowns from Technical Context** above: - - For each NEEDS CLARIFICATION → research task - - For each dependency → best practices task - - For each integration → patterns task - -2. **Generate and dispatch research agents**: - ``` - For each unknown in Technical Context: - Task: "Research {unknown} for {feature context}" - For each technology choice: - Task: "Find best practices for {tech} in {domain}" - ``` - -3. **Consolidate findings** in `research.md` using format: - - Decision: [what was chosen] - - Rationale: [why chosen] - - Alternatives considered: [what else evaluated] - -**Output**: research.md with all NEEDS CLARIFICATION resolved - -## Phase 1: Design & Contracts -*Prerequisites: research.md complete* - -1. **Extract entities from feature spec** → `data-model.md`: - - Entity name, fields, relationships - - Validation rules from requirements - - State transitions if applicable - -2. **Generate API contracts** from functional requirements: - - For each user action → endpoint - - Use standard REST/GraphQL patterns - - Output OpenAPI/GraphQL schema to `/contracts/` - -3. **Generate contract tests** from contracts: - - One test file per endpoint - - Assert request/response schemas - - Tests must fail (no implementation yet) - -4. **Extract test scenarios** from user stories: - - Each story → integration test scenario - - Quickstart test = story validation steps - -5. **Update agent file incrementally** (O(1) operation): - - Run `{SCRIPT}` - **IMPORTANT**: Execute it exactly as specified above. Do not add or remove any arguments. - - If exists: Add only NEW tech from current plan - - Preserve manual additions between markers - - Update recent changes (keep last 3) - - Keep under 150 lines for token efficiency - - Output to repository root - -**Output**: data-model.md, /contracts/*, failing tests, quickstart.md, agent-specific file - -## Phase 2: Task Planning Approach -*This section describes what the /tasks command will do - DO NOT execute during /plan* - -**Task Generation Strategy**: -- Load `.specify/templates/tasks-template.md` as base -- Generate tasks from Phase 1 design docs (contracts, data model, quickstart) -- Each contract → contract test task [P] -- Each entity → model creation task [P] -- Each user story → integration test task -- Implementation tasks to make tests pass - -**Ordering Strategy**: -- TDD order: Tests before implementation -- Dependency order: Models before services before UI -- Mark [P] for parallel execution (independent files) - -**Estimated Output**: 25-30 numbered, ordered tasks in tasks.md - -**IMPORTANT**: This phase is executed by the /tasks command, NOT by /plan - -## Phase 3+: Future Implementation -*These phases are beyond the scope of the /plan command* - -**Phase 3**: Task execution (/tasks command creates tasks.md) -**Phase 4**: Implementation (execute tasks.md following constitutional principles) -**Phase 5**: Validation (run tests, execute quickstart.md, performance validation) - ## Complexity Tracking + *Fill ONLY if Constitution Check has violations that must be justified* | Violation | Why Needed | Simpler Alternative Rejected Because | |-----------|------------|-------------------------------------| | [e.g., 4th project] | [current need] | [why 3 projects insufficient] | | [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] | - - -## Progress Tracking -*This checklist is updated during execution flow* - -**Phase Status**: -- [ ] Phase 0: Research complete (/plan command) -- [ ] Phase 1: Design complete (/plan command) -- [ ] Phase 2: Task planning complete (/plan command - describe approach only) -- [ ] Phase 3: Tasks generated (/tasks command) -- [ ] Phase 4: Implementation complete -- [ ] Phase 5: Validation passed - -**Gate Status**: -- [ ] Initial Constitution Check: PASS -- [ ] Post-Design Constitution Check: PASS -- [ ] All NEEDS CLARIFICATION resolved -- [ ] Complexity deviations documented - ---- -*Based on Constitution v2.1.1 - See `/memory/constitution.md`* diff --git a/templates/spec-template.md b/templates/spec-template.md index 7915e7dd..fd5dbfb9 100644 --- a/templates/spec-template.md +++ b/templates/spec-template.md @@ -5,69 +5,41 @@ **Status**: Draft **Input**: User description: "$ARGUMENTS" -## Execution Flow (main) -``` -1. Parse user description from Input - → If empty: ERROR "No feature description provided" -2. Extract key concepts from description - → Identify: actors, actions, data, constraints -3. For each unclear aspect: - → Mark with [NEEDS CLARIFICATION: specific question] -4. Fill User Scenarios & Testing section - → If no clear user flow: ERROR "Cannot determine user scenarios" -5. Generate Functional Requirements - → Each requirement must be testable - → Mark ambiguous requirements -6. Identify Key Entities (if data involved) -7. Run Review Checklist - → If any [NEEDS CLARIFICATION]: WARN "Spec has uncertainties" - → If implementation details found: ERROR "Remove tech details" -8. Return: SUCCESS (spec ready for planning) -``` - ---- - -## ⚡ Quick Guidelines -- ✅ Focus on WHAT users need and WHY -- ❌ Avoid HOW to implement (no tech stack, APIs, code structure) -- 👥 Written for business stakeholders, not developers - -### Section Requirements -- **Mandatory sections**: Must be completed for every feature -- **Optional sections**: Include only when relevant to the feature -- When a section doesn't apply, remove it entirely (don't leave as "N/A") - -### For AI Generation -When creating this spec from a user prompt: -1. **Mark all ambiguities**: Use [NEEDS CLARIFICATION: specific question] for any assumption you'd need to make -2. **Don't guess**: If the prompt doesn't specify something (e.g., "login system" without auth method), mark it -3. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item -4. **Common underspecified areas**: - - User types and permissions - - Data retention/deletion policies - - Performance targets and scale - - Error handling behaviors - - Integration requirements - - Security/compliance needs - ---- - ## User Scenarios & Testing *(mandatory)* ### Primary User Story + [Describe the main user journey in plain language] ### Acceptance Scenarios + + + 1. **Given** [initial state], **When** [action], **Then** [expected outcome] 2. **Given** [initial state], **When** [action], **Then** [expected outcome] ### Edge Cases + + + - What happens when [boundary condition]? - How does system handle [error scenario]? ## Requirements *(mandatory)* + + ### Functional Requirements + - **FR-001**: System MUST [specific capability, e.g., "allow users to create accounts"] - **FR-002**: System MUST [specific capability, e.g., "validate email addresses"] - **FR-003**: Users MUST be able to [key interaction, e.g., "reset their password"] @@ -75,42 +47,11 @@ When creating this spec from a user prompt: - **FR-005**: System MUST [behavior, e.g., "log all security events"] *Example of marking unclear requirements:* + - **FR-006**: System MUST authenticate users via [NEEDS CLARIFICATION: auth method not specified - email/password, SSO, OAuth?] - **FR-007**: System MUST retain user data for [NEEDS CLARIFICATION: retention period not specified] ### Key Entities *(include if feature involves data)* + - **[Entity 1]**: [What it represents, key attributes without implementation] - **[Entity 2]**: [What it represents, relationships to other entities] - ---- - -## Review & Acceptance Checklist -*GATE: Automated checks run during main() execution* - -### Content Quality -- [ ] No implementation details (languages, frameworks, APIs) -- [ ] Focused on user value and business needs -- [ ] Written for non-technical stakeholders -- [ ] All mandatory sections completed - -### Requirement Completeness -- [ ] No [NEEDS CLARIFICATION] markers remain -- [ ] Requirements are testable and unambiguous -- [ ] Success criteria are measurable -- [ ] Scope is clearly bounded -- [ ] Dependencies and assumptions identified - ---- - -## Execution Status -*Updated by main() during processing* - -- [ ] User description parsed -- [ ] Key concepts extracted -- [ ] Ambiguities marked -- [ ] User scenarios defined -- [ ] Requirements generated -- [ ] Entities identified -- [ ] Review checklist passed - ---- diff --git a/templates/tasks-template.md b/templates/tasks-template.md index b8a28faf..855335c5 100644 --- a/templates/tasks-template.md +++ b/templates/tasks-template.md @@ -1,36 +1,13 @@ +--- +description: "Task list template for feature implementation" +--- + # Tasks: [FEATURE NAME] **Input**: Design documents from `/specs/[###-feature-name]/` **Prerequisites**: plan.md (required), research.md, data-model.md, contracts/ -## Execution Flow (main) -``` -1. Load plan.md from feature directory - → If not found: ERROR "No implementation plan found" - → Extract: tech stack, libraries, structure -2. Load optional design documents: - → data-model.md: Extract entities → model tasks - → contracts/: Each file → contract test task - → research.md: Extract decisions → setup tasks -3. Generate tasks by category: - → Setup: project init, dependencies, linting - → Tests: contract tests, integration tests - → Core: models, services, CLI commands - → Integration: DB, middleware, logging - → Polish: unit tests, performance, docs -4. Apply task rules: - → Different files = mark [P] for parallel - → Same file = sequential (no [P]) - → Tests before implementation (TDD) -5. Number tasks sequentially (T001, T002...) -6. Generate dependency graph -7. Create parallel execution examples -8. Validate task completeness: - → All contracts have tests? - → All entities have models? - → All endpoints implemented? -9. Return: SUCCESS (tasks ready for execution) -``` +**Tests**: The examples below include test tasks. Tests are OPTIONAL - only include them if explicitly requested in the feature specification. ## Format: `[ID] [P?] Description` - **[P]**: Can run in parallel (different files, no dependencies) @@ -42,19 +19,34 @@ - **Mobile**: `api/src/`, `ios/src/` or `android/src/` - Paths shown below assume single project - adjust based on plan.md structure + + ## Phase 3.1: Setup - [ ] T001 Create project structure per implementation plan - [ ] T002 Initialize [language] project with [framework] dependencies - [ ] T003 [P] Configure linting and formatting tools -## Phase 3.2: Tests First (TDD) ⚠️ MUST COMPLETE BEFORE 3.3 -**CRITICAL: These tests MUST be written and MUST FAIL before ANY implementation** +## Phase 3.2: Tests First (TDD) - OPTIONAL ⚠️ +**NOTE: This phase is only included if tests are explicitly requested** +**If included: These tests MUST be written and MUST FAIL before ANY implementation** - [ ] T004 [P] Contract test POST /api/users in tests/contract/test_users_post.py - [ ] T005 [P] Contract test GET /api/users/{id} in tests/contract/test_users_get.py - [ ] T006 [P] Integration test user registration in tests/integration/test_registration.py - [ ] T007 [P] Integration test auth flow in tests/integration/test_auth.py -## Phase 3.3: Core Implementation (ONLY after tests are failing) +## Phase 3.3: Core Implementation - [ ] T008 [P] User model in src/models/user.py - [ ] T009 [P] UserService CRUD in src/services/user_service.py - [ ] T010 [P] CLI --create-user in src/cli/user_commands.py @@ -70,11 +62,11 @@ - [ ] T018 CORS and security headers ## Phase 3.5: Polish -- [ ] T019 [P] Unit tests for validation in tests/unit/test_validation.py -- [ ] T020 Performance tests (<200ms) -- [ ] T021 [P] Update docs/api.md -- [ ] T022 Remove duplication -- [ ] T023 Run manual-testing.md +- [ ] T019 [P] Documentation updates in docs/ +- [ ] T020 Code cleanup and refactoring +- [ ] T021 Performance optimization +- [ ] T022 [P] Unit tests (if requested) in tests/unit/ +- [ ] T023 Run quickstart.md validation ## Dependencies - Tests (T004-T007) before implementation (T008-T014) @@ -97,31 +89,3 @@ Task: "Integration test auth in tests/integration/test_auth.py" - Commit after each task - Avoid: vague tasks, same file conflicts -## Task Generation Rules -*Applied during main() execution* - -1. **From Contracts**: - - Each contract file → contract test task [P] - - Each endpoint → implementation task - -2. **From Data Model**: - - Each entity → model creation task [P] - - Relationships → service layer tasks - -3. **From User Stories**: - - Each story → integration test [P] - - Quickstart scenarios → validation tasks - -4. **Ordering**: - - Setup → Tests → Models → Services → Endpoints → Polish - - Dependencies block parallel execution - -## Validation Checklist -*GATE: Checked by main() before returning* - -- [ ] All contracts have corresponding tests -- [ ] All entities have model tasks -- [ ] All tests come before implementation -- [ ] Parallel tasks truly independent -- [ ] Each task specifies exact file path -- [ ] No task modifies same file as another [P] task \ No newline at end of file From 265534c5ad91daaae799d637ddd967adb33c8630 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 17:18:01 -0700 Subject: [PATCH 09/31] Update logs --- CHANGELOG.md | 5 +++-- templates/commands/clarify.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9485cb4..64763442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,17 @@ -All notable changes to the Specify CLI will be documented in this file. +All notable changes to the Specify CLI and templates are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [LATEST_VERSION] - RELEASE_DATE +## [0.0.18] - 2025-10-03 ### Added - Support for using `.` as a shorthand for current directory in `specify init .` command, equivalent to `--here` flag but more intuitive for users +- Refactor the prompts and templates to simplify their capabilities and how they are tracked. No more polluting things with tests when they are not needed. ## [0.0.17] - 2025-09-22 diff --git a/templates/commands/clarify.md b/templates/commands/clarify.md index e3f4a79d..9873a515 100644 --- a/templates/commands/clarify.md +++ b/templates/commands/clarify.md @@ -80,7 +80,7 @@ Execution steps: - Information is better deferred to planning phase (note internally) 3. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints: - - Maximum of 5 total questions across the whole session. + - Maximum of 10 total questions across the whole session. - Each question must be answerable with EITHER: * A short multiple‑choice selection (2–5 distinct, mutually exclusive options), OR * A one-word / short‑phrase answer (explicitly constrain: "Answer in <=5 words"). From a172e4cb6e4c6ba9eb63b1114a21cf15482d098d Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 19:30:15 -0700 Subject: [PATCH 10/31] Update commands. --- templates/checklist-template.md | 40 +++++++++ templates/commands/analyze.md | 4 +- templates/commands/checklist.md | 130 +++++++++++++++++++++++++++++ templates/commands/clarify.md | 2 +- templates/commands/constitution.md | 2 +- templates/commands/implement.md | 43 ++++++++-- templates/commands/plan.md | 2 +- templates/commands/specify.md | 14 ++-- templates/commands/tasks.md | 2 +- 9 files changed, 218 insertions(+), 21 deletions(-) create mode 100644 templates/checklist-template.md create mode 100644 templates/commands/checklist.md diff --git a/templates/checklist-template.md b/templates/checklist-template.md new file mode 100644 index 00000000..f0c23b20 --- /dev/null +++ b/templates/checklist-template.md @@ -0,0 +1,40 @@ +# [CHECKLIST TYPE] Checklist: [FEATURE NAME] + +**Purpose**: [Brief description of what this checklist covers] +**Created**: [DATE] +**Feature**: [Link to spec.md or relevant documentation] + +**Note**: This checklist is generated by the `/checklist` command based on feature context and requirements. + + + +## [Category 1] + +- [ ] CHK001 First checklist item with clear action +- [ ] CHK002 Second checklist item +- [ ] CHK003 Third checklist item + +## [Category 2] + +- [ ] CHK004 Another category item +- [ ] CHK005 Item with specific criteria +- [ ] CHK006 Final item in this category + +## Notes + +- Check items off as completed: `[x]` +- Add comments or findings inline +- Link to relevant resources or documentation +- Items are numbered sequentially for easy reference diff --git a/templates/commands/analyze.md b/templates/commands/analyze.md index c07d550b..ef418dc0 100644 --- a/templates/commands/analyze.md +++ b/templates/commands/analyze.md @@ -9,8 +9,8 @@ The user input to you can be provided directly by the agent or as a command argu User input: -$ARGUMENTS - +`$ARGUMENTS +` Goal: 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 `/tasks` has successfully produced a complete `tasks.md`. 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). diff --git a/templates/commands/checklist.md b/templates/commands/checklist.md new file mode 100644 index 00000000..7465527b --- /dev/null +++ b/templates/commands/checklist.md @@ -0,0 +1,130 @@ +--- +description: Generate a custom checklist for the current feature based on user requirements. +scripts: + sh: scripts/bash/check-prerequisites.sh --json + ps: scripts/powershell/check-prerequisites.ps1 -Json +--- + +The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). + +User input: + +`$ARGUMENTS +` +## Execution Steps + +1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list. + - All file paths must be absolute. + +2. **Clarify intent (dynamic)**: Derive THREE contextual clarifying questions (no pre-baked catalog). They MUST: + - Be generated from the user's phrasing + extracted signals from spec/plan/tasks + - Only ask about information that materially changes checklist content + - Be skipped individually if already unambiguous in `$ARGUMENTS` + - Prefer precision over breadth + + Generation algorithm: + 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"). + 2. Cluster signals into candidate focus areas (max 4) ranked by relevance. + 3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit. + 4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria. + 5. Formulate up to three questions chosen from these archetypes: + - Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?") + - Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?") + - Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?") + - Audience framing (e.g., "Will this be used by the author only or peers during PR review?") + - Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?") + + Question formatting rules: + - If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters + - Limit to A–E options maximum; omit table if a free-form answer is clearer + - Never ask the user to restate what they already said + - Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope." + + Defaults when interaction impossible: + - Depth: Standard + - Audience: Reviewer (PR) if code-related; Author otherwise + - Focus: Top 2 relevance clusters + + Output the three questions (or fewer if not needed) and wait for answers before continuing. Clearly label each as Q1/Q2/Q3. + +3. **Understand user request**: Combine `$ARGUMENTS` + clarifying answers: + - Derive checklist theme (e.g., security, review, deploy, ux) + - Consolidate explicit must-have items mentioned by user + - Map focus selections to category scaffolding + - Infer any missing context from spec/plan/tasks (do NOT hallucinate) + +4. **Load feature context**: Read from FEATURE_DIR: + - spec.md: Feature requirements and scope + - plan.md (if exists): Technical details, dependencies + - tasks.md (if exists): Implementation tasks + - Use context to enrich or validate checklist items (omit irrelevant categories) + +5. **Generate checklist**: + - Create `FEATURE_DIR/checklists/` directory if it doesn't exist + - Generate unique checklist filename: + * Use short, descriptive name based on checklist type + * Format: `[type].md` (e.g., `ux.md`, `test.md`, `security.md`, `deploy.md`) + * If file exists, append counter: `[type]-2.md`, `[type]-3.md`, etc. + * Examples: `ux.md`, `test.md`, `security.md`, `deploy.md`, `review-2.md` + - Use format: `[ ] CHK001 Item description here` + - Number items sequentially starting from CHK001 + - Group items by category/section if applicable + - Include brief explanations or links where helpful + - Each `/checklist` run creates a NEW file (never overwrites existing checklists) + +6. **Checklist structure**: + ```markdown + # [Checklist Type] Checklist: [Feature Name] + + **Purpose**: [Brief description of what this checklist covers] + **Created**: [Date] + + ## [Category 1] + - [ ] CHK001 First item + - [ ] CHK002 Second item + + ## [Category 2] + - [ ] CHK003 Third item + ``` + +7. **Report**: Output full path to created checklist, item count, and remind user that each run creates a new file. Summarize: + - Focus areas selected + - Depth level + - Actor/timing + - Any explicit user-specified must-have items incorporated + +**Important**: Each `/checklist` command invocation creates a NEW checklist file using short, descriptive names. This allows: +- Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`) +- Simple, memorable filenames that indicate checklist purpose +- Counter-based uniqueness for duplicate types (e.g., `review-2.md`) +- Easy identification and navigation in the checklists/ folder + +To avoid clutter, use descriptive types and clean up obsolete checklists when done. + +## Example Checklist Types + +**Code Review:** `review.md` +- Code quality checks +- Documentation requirements +- Test coverage verification +- Security considerations + +**Pre-Deployment:** `deploy.md` +- Build verification +- Test execution +- Configuration validation +- Rollback plan + +**Accessibility:** `ux.md` or `a11y.md` +- WCAG compliance +- Keyboard navigation +- Screen reader compatibility +- Color contrast + +**Security:** `security.md` +- Input validation +- Authentication/authorization +- Data encryption +- Dependency vulnerabilities + +Generate checklist items that are specific, actionable, and relevant to the feature context. diff --git a/templates/commands/clarify.md b/templates/commands/clarify.md index 9873a515..c5821623 100644 --- a/templates/commands/clarify.md +++ b/templates/commands/clarify.md @@ -9,7 +9,7 @@ The user input to you can be provided directly by the agent or as a command argu User input: -$ARGUMENTS +`$ARGUMENTS` Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file. diff --git a/templates/commands/constitution.md b/templates/commands/constitution.md index 605e9363..c8b37912 100644 --- a/templates/commands/constitution.md +++ b/templates/commands/constitution.md @@ -6,7 +6,7 @@ The user input to you can be provided directly by the agent or as a command argu User input: -$ARGUMENTS +`$ARGUMENTS` You are updating the project constitution at `/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. diff --git a/templates/commands/implement.md b/templates/commands/implement.md index ff2f1b69..bc20db01 100644 --- a/templates/commands/implement.md +++ b/templates/commands/implement.md @@ -9,11 +9,40 @@ The user input can be provided directly by the agent or as a command argument - User input: -$ARGUMENTS +`$ARGUMENTS` 1. Run `{SCRIPT}` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. -2. Load and analyze the implementation context: +2. **Check checklists status** (if FEATURE_DIR/checklists/ exists): + - Scan all checklist files in the checklists/ directory + - For each checklist, count: + * Total items: All lines matching `- [ ]` or `- [X]` or `- [x]` + * Completed items: Lines matching `- [X]` or `- [x]` + * Incomplete items: Lines matching `- [ ]` + - Create a status table: + ``` + | Checklist | Total | Completed | Incomplete | Status | + |-----------|-------|-----------|------------|--------| + | ux.md | 12 | 12 | 0 | ✓ PASS | + | test.md | 8 | 5 | 3 | ✗ FAIL | + | security.md | 6 | 6 | 0 | ✓ PASS | + ``` + - Calculate overall status: + * **PASS**: All checklists have 0 incomplete items + * **FAIL**: One or more checklists have incomplete items + + - **If any checklist is incomplete**: + * Display the table with incomplete item counts + * **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)" + * Wait for user response before continuing + * If user says "no" or "wait" or "stop", halt execution + * If user says "yes" or "proceed" or "continue", proceed to step 3 + + - **If all checklists are complete**: + * Display the table showing all checklists passed + * Automatically proceed to step 3 + +3. Load and analyze the implementation context: - **REQUIRED**: Read tasks.md for the complete task list and execution plan - **REQUIRED**: Read plan.md for tech stack, architecture, and file structure - **IF EXISTS**: Read data-model.md for entities and relationships @@ -21,27 +50,27 @@ $ARGUMENTS - **IF EXISTS**: Read research.md for technical decisions and constraints - **IF EXISTS**: Read quickstart.md for integration scenarios -3. Parse tasks.md structure and extract: +4. Parse tasks.md structure and extract: - **Task phases**: Setup, Tests, Core, Integration, Polish - **Task dependencies**: Sequential vs parallel execution rules - **Task details**: ID, description, file paths, parallel markers [P] - **Execution flow**: Order and dependency requirements -4. Execute implementation following the task plan: +5. Execute implementation following the task plan: - **Phase-by-phase execution**: Complete each phase before moving to the next - **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together - **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks - **File-based coordination**: Tasks affecting the same files must run sequentially - **Validation checkpoints**: Verify each phase completion before proceeding -5. Implementation execution rules: +6. Implementation execution rules: - **Setup first**: Initialize project structure, dependencies, configuration - **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios - **Core development**: Implement models, services, CLI commands, endpoints - **Integration work**: Database connections, middleware, logging, external services - **Polish and validation**: Unit tests, performance optimization, documentation -6. Progress tracking and error handling: +7. Progress tracking and error handling: - Report progress after each completed task - Halt execution if any non-parallel task fails - For parallel tasks [P], continue with successful tasks, report failed ones @@ -49,7 +78,7 @@ $ARGUMENTS - Suggest next steps if implementation cannot proceed - **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file. -7. Completion validation: +8. Completion validation: - Verify all required tasks are completed - Check that implemented features match the original specification - Validate that tests pass and coverage meets requirements diff --git a/templates/commands/plan.md b/templates/commands/plan.md index 09bbb064..37b4851f 100644 --- a/templates/commands/plan.md +++ b/templates/commands/plan.md @@ -12,7 +12,7 @@ The user input to you can be provided directly by the agent or as a command argu User input: -$ARGUMENTS +`$ARGUMENTS` ## Execution Steps diff --git a/templates/commands/specify.md b/templates/commands/specify.md index 5757c8bd..d9e1e2fe 100644 --- a/templates/commands/specify.md +++ b/templates/commands/specify.md @@ -9,7 +9,7 @@ The user input to you can be provided directly by the agent or as a command argu User input: -$ARGUMENTS +`$ARGUMENTS` The text the user typed after `/specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `{ARGS}` appears literally below. Do not ask the user to repeat it unless they provided an empty command. @@ -33,10 +33,7 @@ Given that feature description, do this: Each requirement must be testable Mark ambiguous requirements 6. Identify Key Entities (if data involved) - 7. Run Review Checklist - If any [NEEDS CLARIFICATION]: WARN "Spec has uncertainties" - If implementation details found: ERROR "Remove tech details" - 8. Return: SUCCESS (spec ready for planning) + 7. Return: SUCCESS (spec ready for planning) 4. 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. 5. Report completion with branch name, spec file path, and readiness for the next phase. @@ -47,9 +44,10 @@ Given that feature description, do this: ## Quick Guidelines -- Focus on WHAT users need and WHY -- Avoid HOW to implement (no tech stack, APIs, code structure) -- Written for business stakeholders, not developers +- Focus on **WHAT** users need and **WHY**. +- Avoid HOW to implement (no tech stack, APIs, code structure). +- Written for business stakeholders, not developers. +- DO NOT create any checklists that are embedded in the spec. That will be a separate command. ### Section Requirements diff --git a/templates/commands/tasks.md b/templates/commands/tasks.md index d97f9b25..ad05d3c9 100644 --- a/templates/commands/tasks.md +++ b/templates/commands/tasks.md @@ -9,7 +9,7 @@ The user input to you can be provided directly by the agent or as a command argu User input: -$ARGUMENTS +`$ARGUMENTS` ## Execution Steps From 8374777206c9bda50083ba4c511021c26bd48e1e Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:31:58 -0700 Subject: [PATCH 11/31] Consistency updates to commands --- templates/commands/analyze.md | 242 +++++++++++++++++++---------- templates/commands/checklist.md | 10 +- templates/commands/clarify.md | 10 +- templates/commands/constitution.md | 10 +- templates/commands/implement.md | 10 +- templates/commands/plan.md | 10 +- templates/commands/specify.md | 10 +- templates/commands/tasks.md | 10 +- 8 files changed, 208 insertions(+), 104 deletions(-) diff --git a/templates/commands/analyze.md b/templates/commands/analyze.md index ef418dc0..ab11284c 100644 --- a/templates/commands/analyze.md +++ b/templates/commands/analyze.md @@ -5,100 +5,182 @@ scripts: ps: scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks --- -The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` -`$ARGUMENTS -` -Goal: 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 `/tasks` has successfully produced a complete `tasks.md`. +You **MUST** consider the user input before proceeding (if not empty). -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). +## Goal -Constitution Authority: The project constitution (`/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 `/analyze`. +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 `/tasks` has successfully produced a complete `tasks.md`. -Execution steps: +## Operating Constraints -1. Run `{SCRIPT}` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths: - - SPEC = FEATURE_DIR/spec.md - - PLAN = FEATURE_DIR/plan.md - - TASKS = FEATURE_DIR/tasks.md - Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command). +**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). -2. Load artifacts: - - Parse spec.md sections: Overview/Context, Functional Requirements, Non-Functional Requirements, User Stories, Edge Cases (if present). - - Parse plan.md: Architecture/stack choices, Data Model references, Phases, Technical constraints. - - Parse tasks.md: Task IDs, descriptions, phase grouping, parallel markers [P], referenced file paths. - - Load constitution `/memory/constitution.md` for principle validation. +**Constitution Authority**: The project constitution (`/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 `/analyze`. -3. Build internal semantic models: - - Requirements inventory: Each functional + non-functional requirement with a stable key (derive slug based on imperative phrase; e.g., "User can upload file" -> `user-can-upload-file`). - - User story/action inventory. - - Task coverage mapping: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases). - - Constitution rule set: Extract principle names and any MUST/SHOULD normative statements. +## Execution Steps -4. Detection passes: - A. Duplication detection: - - Identify near-duplicate requirements. Mark lower-quality phrasing for consolidation. - B. Ambiguity detection: - - Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria. - - Flag unresolved placeholders (TODO, TKTK, ???, , etc.). - C. Underspecification: - - Requirements with verbs but missing object or measurable outcome. - - User stories missing acceptance criteria alignment. - - Tasks referencing files or components not defined in spec/plan. - D. Constitution alignment: - - Any requirement or plan element conflicting with a MUST principle. - - Missing mandated sections or quality gates from constitution. - E. Coverage gaps: - - Requirements with zero associated tasks. - - Tasks with no mapped requirement/story. - - Non-functional requirements not reflected in tasks (e.g., performance, security). - F. Inconsistency: - - Terminology drift (same concept named differently across files). - - Data entities referenced in plan but absent in spec (or vice versa). - - Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note). - - Conflicting requirements (e.g., one requires to use Next.js while other says to use Vue as the framework). +### 1. Initialize Analysis Context -5. Severity assignment heuristic: - - CRITICAL: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality. - - HIGH: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion. - - MEDIUM: Terminology drift, missing non-functional task coverage, underspecified edge case. - - LOW: Style/wording improvements, minor redundancy not affecting execution order. +Run `{SCRIPT}` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths: -6. Produce a Markdown report (no file writes) with sections: +- SPEC = FEATURE_DIR/spec.md +- PLAN = FEATURE_DIR/plan.md +- TASKS = FEATURE_DIR/tasks.md - ### Specification Analysis Report - | ID | Category | Severity | Location(s) | Summary | Recommendation | - |----|----------|----------|-------------|---------|----------------| - | A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version | - (Add one row per finding; generate stable IDs prefixed by category initial.) +Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command). - Additional subsections: - - Coverage Summary Table: - | Requirement Key | Has Task? | Task IDs | Notes | - - Constitution Alignment Issues (if any) - - Unmapped Tasks (if any) - - Metrics: - * Total Requirements - * Total Tasks - * Coverage % (requirements with >=1 task) - * Ambiguity Count - * Duplication Count - * Critical Issues Count +### 2. Load Artifacts (Progressive Disclosure) -7. At end of report, output a concise Next Actions block: - - If CRITICAL issues exist: Recommend resolving before `/implement`. - - If only LOW/MEDIUM: User may proceed, but provide improvement suggestions. - - Provide explicit command suggestions: e.g., "Run /specify with refinement", "Run /plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'". +Load only the minimal necessary context from each artifact: -8. Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.) +**From spec.md:** -Behavior rules: -- NEVER modify files. -- NEVER hallucinate missing sections—if absent, report them. -- KEEP findings deterministic: if rerun without changes, produce consistent IDs and counts. -- LIMIT total findings in the main table to 50; aggregate remainder in a summarized overflow note. -- If zero issues found, emit a success report with coverage statistics and proceed recommendation. +- Overview/Context +- Functional Requirements +- Non-Functional Requirements +- User Stories +- Edge Cases (if present) -Context: {ARGS} +**From plan.md:** + +- Architecture/stack choices +- Data Model references +- Phases +- Technical constraints + +**From tasks.md:** + +- Task IDs +- Descriptions +- Phase grouping +- Parallel markers [P] +- Referenced file paths + +**From constitution:** + +- Load `/memory/constitution.md` for principle validation + +### 3. Build Semantic Models + +Create internal representations (do not include raw artifacts in output): + +- **Requirements inventory**: Each functional + non-functional requirement with a stable key (derive slug based on imperative phrase; e.g., "User can upload file" → `user-can-upload-file`) +- **User story/action inventory**: Discrete user actions with acceptance criteria +- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases) +- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements + +### 4. Detection Passes (Token-Efficient Analysis) + +Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary. + +#### A. Duplication Detection + +- Identify near-duplicate requirements +- Mark lower-quality phrasing for consolidation + +#### B. Ambiguity Detection + +- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria +- Flag unresolved placeholders (TODO, TKTK, ???, ``, etc.) + +#### C. Underspecification + +- Requirements with verbs but missing object or measurable outcome +- User stories missing acceptance criteria alignment +- Tasks referencing files or components not defined in spec/plan + +#### D. Constitution Alignment + +- Any requirement or plan element conflicting with a MUST principle +- Missing mandated sections or quality gates from constitution + +#### E. Coverage Gaps + +- Requirements with zero associated tasks +- Tasks with no mapped requirement/story +- Non-functional requirements not reflected in tasks (e.g., performance, security) + +#### F. Inconsistency + +- Terminology drift (same concept named differently across files) +- Data entities referenced in plan but absent in spec (or vice versa) +- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note) +- Conflicting requirements (e.g., one requires Next.js while other specifies Vue) + +### 5. Severity Assignment + +Use this heuristic to prioritize findings: + +- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality +- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion +- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case +- **LOW**: Style/wording improvements, minor redundancy not affecting execution order + +### 6. Produce Compact Analysis Report + +Output a Markdown report (no file writes) with the following structure: + +## Specification Analysis Report + +| ID | Category | Severity | Location(s) | Summary | Recommendation | +|----|----------|----------|-------------|---------|----------------| +| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version | + +(Add one row per finding; generate stable IDs prefixed by category initial.) + +**Coverage Summary Table:** + +| Requirement Key | Has Task? | Task IDs | Notes | +|-----------------|-----------|----------|-------| + +**Constitution Alignment Issues:** (if any) + +**Unmapped Tasks:** (if any) + +**Metrics:** + +- Total Requirements +- Total Tasks +- Coverage % (requirements with >=1 task) +- Ambiguity Count +- Duplication Count +- Critical Issues Count + +### 7. Provide Next Actions + +At end of report, output a concise Next Actions block: + +- If CRITICAL issues exist: Recommend resolving before `/implement` +- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions +- Provide explicit command suggestions: e.g., "Run /specify with refinement", "Run /plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'" + +### 8. Offer Remediation + +Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.) + +## Operating Principles + +### Context Efficiency + +- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation +- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis +- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow +- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts + +### Analysis Guidelines + +- **NEVER modify files** (this is read-only analysis) +- **NEVER hallucinate missing sections** (if absent, report them accurately) +- **Prioritize constitution violations** (these are always CRITICAL) +- **Use examples over exhaustive rules** (cite specific instances, not generic patterns) +- **Report zero issues gracefully** (emit success report with coverage statistics) + +## Context + +{ARGS} diff --git a/templates/commands/checklist.md b/templates/commands/checklist.md index 7465527b..b21737c0 100644 --- a/templates/commands/checklist.md +++ b/templates/commands/checklist.md @@ -5,12 +5,14 @@ scripts: ps: scripts/powershell/check-prerequisites.ps1 -Json --- -The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` + +You **MUST** consider the user input before proceeding (if not empty). -`$ARGUMENTS -` ## Execution Steps 1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list. diff --git a/templates/commands/clarify.md b/templates/commands/clarify.md index c5821623..eed35410 100644 --- a/templates/commands/clarify.md +++ b/templates/commands/clarify.md @@ -5,11 +5,15 @@ scripts: ps: scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly --- -The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` -`$ARGUMENTS` +You **MUST** consider the user input before proceeding (if not empty). + +## Outline Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file. diff --git a/templates/commands/constitution.md b/templates/commands/constitution.md index c8b37912..f6f8b243 100644 --- a/templates/commands/constitution.md +++ b/templates/commands/constitution.md @@ -2,11 +2,15 @@ description: Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync. --- -The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` -`$ARGUMENTS` +You **MUST** consider the user input before proceeding (if not empty). + +## Outline You are updating the project constitution at `/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. diff --git a/templates/commands/implement.md b/templates/commands/implement.md index bc20db01..6478e9e7 100644 --- a/templates/commands/implement.md +++ b/templates/commands/implement.md @@ -5,11 +5,15 @@ scripts: ps: scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks --- -The user input can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` -`$ARGUMENTS` +You **MUST** consider the user input before proceeding (if not empty). + +## Outline 1. Run `{SCRIPT}` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. diff --git a/templates/commands/plan.md b/templates/commands/plan.md index 37b4851f..7348ada4 100644 --- a/templates/commands/plan.md +++ b/templates/commands/plan.md @@ -8,13 +8,15 @@ agent_scripts: ps: scripts/powershell/update-agent-context.ps1 -AgentType __AGENT__ --- -The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` -`$ARGUMENTS` +You **MUST** consider the user input before proceeding (if not empty). -## Execution Steps +## Outline 1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. - Before proceeding: Check FEATURE_SPEC has `## Clarifications` section. If missing or ambiguous, instruct user to run `/clarify` first. diff --git a/templates/commands/specify.md b/templates/commands/specify.md index d9e1e2fe..357c0083 100644 --- a/templates/commands/specify.md +++ b/templates/commands/specify.md @@ -5,11 +5,15 @@ scripts: ps: scripts/powershell/create-new-feature.ps1 -Json "{ARGS}" --- -The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` -`$ARGUMENTS` +You **MUST** consider the user input before proceeding (if not empty). + +## Outline The text the user typed after `/specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `{ARGS}` appears literally below. Do not ask the user to repeat it unless they provided an empty command. diff --git a/templates/commands/tasks.md b/templates/commands/tasks.md index ad05d3c9..d6beea73 100644 --- a/templates/commands/tasks.md +++ b/templates/commands/tasks.md @@ -5,13 +5,15 @@ scripts: ps: scripts/powershell/check-prerequisites.ps1 -Json --- -The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty). +## User Input -User input: +```text +$ARGUMENTS +``` -`$ARGUMENTS` +You **MUST** consider the user input before proceeding (if not empty). -## Execution Steps +## Outline 1. **Setup**: Run `{SCRIPT}` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. From 83dcb4a2f5b88a64d0271dde6e03ecbd3f4ec1a5 Mon Sep 17 00:00:00 2001 From: Den Delimarsky <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:33:45 -0700 Subject: [PATCH 12/31] Update .github/workflows/scripts/create-release-packages.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/scripts/create-release-packages.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.sh index bd32a37e..73469a4a 100644 --- a/.github/workflows/scripts/create-release-packages.sh +++ b/.github/workflows/scripts/create-release-packages.sh @@ -79,7 +79,8 @@ generate_commands() { # Remove the scripts: and agent_scripts: sections from frontmatter while preserving YAML structure body=$(printf '%s\n' "$body" | awk ' /^---$/ { print; if (++dash_count == 1) in_frontmatter=1; else in_frontmatter=0; next } - in_frontmatter && /^(scripts|agent_scripts):$/ { skip_scripts=1; next } + in_frontmatter && /^scripts:$/ { skip_scripts=1; next } + in_frontmatter && /^agent_scripts:$/ { skip_scripts=1; next } in_frontmatter && /^[a-zA-Z].*:/ && skip_scripts { skip_scripts=0 } in_frontmatter && skip_scripts && /^[[:space:]]/ { next } { print } From 5499d157ab2d719d89fa1144c02e4f2e6b34b032 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:42:25 -0700 Subject: [PATCH 13/31] Update prompt prefix --- .github/workflows/scripts/create-release-packages.sh | 6 +++--- CHANGELOG.md | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.sh index bd32a37e..2e98fb32 100644 --- a/.github/workflows/scripts/create-release-packages.sh +++ b/.github/workflows/scripts/create-release-packages.sh @@ -90,11 +90,11 @@ generate_commands() { case $ext in toml) - { echo "description = \"$description\""; echo; echo "prompt = \"\"\""; echo "$body"; echo "\"\"\""; } > "$output_dir/$name.$ext" ;; + { echo "description = \"$description\""; echo; echo "prompt = \"\"\""; echo "$body"; echo "\"\"\""; } > "$output_dir/speckit.$name.$ext" ;; md) - echo "$body" > "$output_dir/$name.$ext" ;; + echo "$body" > "$output_dir/speckit.$name.$ext" ;; prompt.md) - echo "$body" > "$output_dir/$name.$ext" ;; + echo "$body" > "$output_dir/speckit.$name.$ext" ;; esac done } diff --git a/CHANGELOG.md b/CHANGELOG.md index 64763442..bb58132d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support for using `.` as a shorthand for current directory in `specify init .` command, equivalent to `--here` flag but more intuitive for users - Refactor the prompts and templates to simplify their capabilities and how they are tracked. No more polluting things with tests when they are not needed. +### Changed + +- All command files now prefixed with `speckit.` (e.g., `speckit.specify.md`, `speckit.plan.md`) for better discoverability and differentiation in IDE/CLI command palettes and file explorers + ## [0.0.17] - 2025-09-22 ### Added From 917f271d747660eec140026dbb4407600a5a2a8c Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:25:18 -0700 Subject: [PATCH 14/31] Prompt updates --- templates/commands/checklist.md | 54 ++++++++++++++--------- templates/commands/plan.md | 1 - templates/commands/specify.md | 78 ++++++++++++++++++++++++++++++++- 3 files changed, 109 insertions(+), 24 deletions(-) diff --git a/templates/commands/checklist.md b/templates/commands/checklist.md index b21737c0..52b154b8 100644 --- a/templates/commands/checklist.md +++ b/templates/commands/checklist.md @@ -73,6 +73,12 @@ You **MUST** consider the user input before proceeding (if not empty). - Group items by category/section if applicable - Include brief explanations or links where helpful - Each `/checklist` run creates a NEW file (never overwrites existing checklists) + - **CRITICAL**: Focus checklist items on **specification and requirements quality** for the domain: + * Validate scenario coverage and edge cases + * Ensure requirements are clear, testable, and measurable + * Check for completeness of acceptance criteria + * Verify domain-specific considerations are addressed + * DO NOT include implementation details like unit tests, code quality, or deployment steps 6. **Checklist structure**: ```markdown @@ -105,28 +111,34 @@ To avoid clutter, use descriptive types and clean up obsolete checklists when do ## Example Checklist Types -**Code Review:** `review.md` -- Code quality checks -- Documentation requirements -- Test coverage verification -- Security considerations +**Specification Review:** `spec-review.md` +- Requirement completeness and clarity +- User scenarios and edge cases coverage +- Acceptance criteria definition +- Domain-specific considerations -**Pre-Deployment:** `deploy.md` -- Build verification -- Test execution -- Configuration validation -- Rollback plan +**Requirements Quality:** `requirements.md` +- Testable and measurable outcomes +- Stakeholder alignment verification +- Assumptions and constraints documentation +- Success metrics definition -**Accessibility:** `ux.md` or `a11y.md` -- WCAG compliance -- Keyboard navigation -- Screen reader compatibility -- Color contrast +**UX/Accessibility Scenarios:** `ux.md` or `a11y.md` +- User journey completeness +- Accessibility requirement coverage +- Responsive design considerations +- Internationalization needs -**Security:** `security.md` -- Input validation -- Authentication/authorization -- Data encryption -- Dependency vulnerabilities +**Security Requirements:** `security.md` +- Threat model coverage +- Authentication/authorization requirements +- Data protection requirements +- Compliance and regulatory needs -Generate checklist items that are specific, actionable, and relevant to the feature context. +**API/Integration Scenarios:** `api.md` +- Contract completeness +- Error handling scenarios +- Backward compatibility considerations +- Integration touchpoint coverage + +Generate checklist items that validate the **quality and completeness of specifications and requirements** for the domain, focusing on scenarios, edge cases, and requirement clarity rather than implementation details. diff --git a/templates/commands/plan.md b/templates/commands/plan.md index 7348ada4..7c378fd4 100644 --- a/templates/commands/plan.md +++ b/templates/commands/plan.md @@ -19,7 +19,6 @@ You **MUST** consider the user input before proceeding (if not empty). ## Outline 1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. - - Before proceeding: Check FEATURE_SPEC has `## Clarifications` section. If missing or ambiguous, instruct user to run `/clarify` first. 2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied). diff --git a/templates/commands/specify.md b/templates/commands/specify.md index 357c0083..771f1237 100644 --- a/templates/commands/specify.md +++ b/templates/commands/specify.md @@ -40,7 +40,81 @@ Given that feature description, do this: 7. Return: SUCCESS (spec ready for planning) 4. 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. -5. Report completion with branch name, spec file path, and readiness for the next phase. + +5. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria: + + a. **Create Spec Quality Checklist**: Generate a checklist file at `FEATURE_DIR/checklists/spec.md` using the checklist template structure with these validation items: + + ```markdown + # Specification Quality Checklist: [FEATURE NAME] + + **Purpose**: Validate specification completeness and quality before proceeding to planning + **Created**: [DATE] + **Feature**: [Link to spec.md] + + ## Content Quality + + - [ ] No implementation details (languages, frameworks, APIs) + - [ ] Focused on user value and business needs + - [ ] Written for non-technical stakeholders + - [ ] All mandatory sections completed + + ## Requirement Completeness + + - [ ] No [NEEDS CLARIFICATION] markers remain + - [ ] Requirements are testable and unambiguous + - [ ] Success criteria are measurable + - [ ] Scope is clearly bounded + - [ ] Dependencies and assumptions identified + + ## Notes + + - Items marked incomplete require spec updates before `/clarify` or `/plan` + ``` + + b. **Run Validation Check**: Review the spec against each checklist item: + - For each item, determine if it passes or fails + - Document specific issues found (quote relevant spec sections) + + c. **Handle Validation Results**: + + - **If all items pass**: Mark checklist complete and proceed to step 6 + + - **If items fail (excluding [NEEDS CLARIFICATION])**: + 1. List the failing items and specific issues + 2. Update the spec to address each issue + 3. Re-run validation until all items pass (max 3 iterations) + 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user + + - **If [NEEDS CLARIFICATION] markers remain**: + 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec + 2. For each clarification needed, present options to user in this format: + + ```markdown + ### Clarification Needed: [Topic] + + **Context**: [Quote relevant spec section] + + **Question**: [Specific question from NEEDS CLARIFICATION marker] + + | Option | Description | Implications | + |--------|-------------|--------------| + | A | [First option] | [What this means for the feature] | + | B | [Second option] | [What this means for the feature] | + | C | [Third option] | [What this means for the feature] | + | Custom | Provide your own specification | [Explain how to provide custom input] | + + **Your choice**: _[Wait for user response]_ + ``` + + 3. Wait for user to respond with their choice (A, B, C, or custom input) + 4. Update the spec by replacing the [NEEDS CLARIFICATION] marker with the user's choice + 5. Repeat for all clarification markers + 6. Re-run validation after all clarifications are resolved + + d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status + +6. Report completion with branch name, spec file path, checklist results, and readiness for the next phase (`/clarify` or `/plan`). **NOTE:** The script creates and checks out the new branch and initializes the spec file before writing. @@ -72,4 +146,4 @@ When creating this spec from a user prompt: - Performance targets and scale - Error handling behaviors - Integration requirements - - Security/compliance needs \ No newline at end of file + - Security/compliance needs From 9e0db01b6e7991a4ce95819fadbb0b4f102cea36 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:56:12 -0700 Subject: [PATCH 15/31] Update specify.md --- templates/commands/specify.md | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/templates/commands/specify.md b/templates/commands/specify.md index 771f1237..37886316 100644 --- a/templates/commands/specify.md +++ b/templates/commands/specify.md @@ -43,7 +43,7 @@ Given that feature description, do this: 5. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria: - a. **Create Spec Quality Checklist**: Generate a checklist file at `FEATURE_DIR/checklists/spec.md` using the checklist template structure with these validation items: + a. **Create Spec Quality Checklist**: Generate a checklist file at `FEATURE_DIR/checklists/requirements.md` using the checklist template structure with these validation items: ```markdown # Specification Quality Checklist: [FEATURE NAME] @@ -91,26 +91,34 @@ Given that feature description, do this: 2. For each clarification needed, present options to user in this format: ```markdown - ### Clarification Needed: [Topic] + ## Question [N]: [Topic] **Context**: [Quote relevant spec section] - **Question**: [Specific question from NEEDS CLARIFICATION marker] + **What we need to know**: [Specific question from NEEDS CLARIFICATION marker] - | Option | Description | Implications | - |--------|-------------|--------------| - | A | [First option] | [What this means for the feature] | - | B | [Second option] | [What this means for the feature] | - | C | [Third option] | [What this means for the feature] | - | Custom | Provide your own specification | [Explain how to provide custom input] | + **Suggested Answers**: + + | Option | Answer | Implications | + |--------|--------|--------------| + | A | [First suggested answer] | [What this means for the feature] | + | B | [Second suggested answer] | [What this means for the feature] | + | C | [Third suggested answer] | [What this means for the feature] | + | Custom | Provide your own answer | [Explain how to provide custom input] | **Your choice**: _[Wait for user response]_ ``` - 3. Wait for user to respond with their choice (A, B, C, or custom input) - 4. Update the spec by replacing the [NEEDS CLARIFICATION] marker with the user's choice - 5. Repeat for all clarification markers - 6. Re-run validation after all clarifications are resolved + 3. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted: + - Use consistent spacing with pipes aligned + - Each cell should have spaces around content: `| Content |` not `|Content|` + - Header separator must have at least 3 dashes: `|--------|` + - Test that the table renders correctly in markdown preview + 4. Number questions sequentially (Q1, Q2, Q3, etc.) + 5. Present all questions together before waiting for responses + 6. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B") + 7. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer + 8. Re-run validation after all clarifications are resolved d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status From b06f2b9f8937537932a259e09af0fdd980ccfaf6 Mon Sep 17 00:00:00 2001 From: Korakot Chaovavanich Date: Mon, 6 Oct 2025 07:14:58 +0700 Subject: [PATCH 16/31] Codex CLI is now fully supported --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30d9c378..5769da73 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ Want to see Spec Kit in action? Watch our [video overview](https://www.youtube.c | [Auggie CLI](https://docs.augmentcode.com/cli/overview) | ✅ | | | [Roo Code](https://roocode.com/) | ✅ | | | [Amazon Q Developer CLI](https://aws.amazon.com/developer/learning/q-developer-cli/) | ⚠️ | Amazon Q Developer CLI [does not support](https://github.com/aws/amazon-q-developer-cli/issues/3064) custom arguments for slash commands. | -| [Codex CLI](https://github.com/openai/codex) | ⚠️ | Codex [does not support](https://github.com/openai/codex/issues/2890) custom arguments for slash commands. | +| [Codex CLI](https://github.com/openai/codex) | ✅ | | ## 🔧 Specify CLI Reference From 08b2a0ae55221c3bae377b41ff357aaab2942201 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Sun, 5 Oct 2025 19:29:46 -0700 Subject: [PATCH 17/31] Update checklist.md --- templates/commands/checklist.md | 95 +++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 33 deletions(-) diff --git a/templates/commands/checklist.md b/templates/commands/checklist.md index 52b154b8..dfd09345 100644 --- a/templates/commands/checklist.md +++ b/templates/commands/checklist.md @@ -18,7 +18,7 @@ You **MUST** consider the user input before proceeding (if not empty). 1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list. - All file paths must be absolute. -2. **Clarify intent (dynamic)**: Derive THREE contextual clarifying questions (no pre-baked catalog). They MUST: +2. **Clarify intent (dynamic)**: Derive up to THREE initial contextual clarifying questions (no pre-baked catalog). They MUST: - Be generated from the user's phrasing + extracted signals from spec/plan/tasks - Only ask about information that materially changes checklist content - Be skipped individually if already unambiguous in `$ARGUMENTS` @@ -29,25 +29,26 @@ You **MUST** consider the user input before proceeding (if not empty). 2. Cluster signals into candidate focus areas (max 4) ranked by relevance. 3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit. 4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria. - 5. Formulate up to three questions chosen from these archetypes: + 5. Formulate questions chosen from these archetypes: - Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?") - Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?") - Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?") - Audience framing (e.g., "Will this be used by the author only or peers during PR review?") - Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?") + - Scenario class gap (e.g., "No recovery flows detected—are rollback / partial failure paths in scope?") Question formatting rules: - If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters - Limit to A–E options maximum; omit table if a free-form answer is clearer - Never ask the user to restate what they already said - - Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope." + - Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope." Defaults when interaction impossible: - Depth: Standard - Audience: Reviewer (PR) if code-related; Author otherwise - Focus: Top 2 relevance clusters - Output the three questions (or fewer if not needed) and wait for answers before continuing. Clearly label each as Q1/Q2/Q3. + 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. 3. **Understand user request**: Combine `$ARGUMENTS` + clarifying answers: - Derive checklist theme (e.g., security, review, deploy, ux) @@ -66,34 +67,57 @@ You **MUST** consider the user input before proceeding (if not empty). - Generate unique checklist filename: * Use short, descriptive name based on checklist type * Format: `[type].md` (e.g., `ux.md`, `test.md`, `security.md`, `deploy.md`) - * If file exists, append counter: `[type]-2.md`, `[type]-3.md`, etc. - * Examples: `ux.md`, `test.md`, `security.md`, `deploy.md`, `review-2.md` - - Use format: `[ ] CHK001 Item description here` + * If file exists, append to existing file (e.g., use the same UX checklist) - Number items sequentially starting from CHK001 - - Group items by category/section if applicable - - Include brief explanations or links where helpful + - Group items by category/section ONLY using this controlled set: + - Primary Flows + - Alternate Flows + - Exception / Error Flows + - Recovery & Resilience + - Non-Functional Domains (sub‑grouped or prefixed: Performance, Reliability, Security & Privacy, Accessibility, Observability, Scalability, Data Lifecycle) + - Traceability & Coverage + - Ambiguities & Conflicts + - Assumptions & Dependencies + - Do NOT invent ad-hoc categories; merge sparse categories (<2 items) into the closest higher-signal category. + - Add traceability refs when possible (order: spec section, acceptance criterion). If no ID system exists, create an item: `Establish requirement & acceptance criteria ID scheme before proceeding`. + - Optional brief rationale ONLY if it clarifies requirement intent or risk; never include implementation strategy, code pointers, or test plan details. - Each `/checklist` run creates a NEW file (never overwrites existing checklists) - - **CRITICAL**: Focus checklist items on **specification and requirements quality** for the domain: - * Validate scenario coverage and edge cases - * Ensure requirements are clear, testable, and measurable - * Check for completeness of acceptance criteria - * Verify domain-specific considerations are addressed - * DO NOT include implementation details like unit tests, code quality, or deployment steps + - **CRITICAL**: Focus on requirements & scenario coverage quality (NOT implementation). Enforce clarity, completeness, measurability, domain & cross-cutting obligations; surface ambiguities / assumptions / conflicts / dependencies. NEVER include implementation details (tests, code symbols, algorithms, deployment steps). + - Soft cap: If raw candidate items > 40, prioritize by risk/impact, consolidate minor edge cases, and add one consolidation item: `Consolidate remaining low-impact scenarios (see source docs) after priority review`. + - Minimum traceability coverage: ≥80% of items MUST include at least one traceability reference (spec section OR acceptance criterion). If impossible (missing structure), add corrective item: `Establish requirement & acceptance criteria ID scheme before proceeding` then proceed. -6. **Checklist structure**: - ```markdown - # [Checklist Type] Checklist: [Feature Name] - - **Purpose**: [Brief description of what this checklist covers] - **Created**: [Date] - - ## [Category 1] - - [ ] CHK001 First item - - [ ] CHK002 Second item - - ## [Category 2] - - [ ] CHK003 Third item - ``` + **Scenario Modeling & Traceability (MANDATORY)**: + - Classify scenarios into: Primary, Alternate, Exception/Error, Recovery/Resilience, Non-Functional (performance, reliability, security/privacy, accessibility, observability, scalability, data lifecycle) where applicable. + - At least one item per present scenario class; if a class is intentionally absent add: `Confirm intentional absence of scenarios`. + - Each item MUST include ≥1 of: scenario class tag, spec ref `[Spec §X.Y]`, acceptance criterion `[AC-##]`, or marker `(Assumption)/(Dependency)/(Ambiguity)/(Conflict)` (track coverage ratio for ≥80% traceability rule). + - Surface & cluster ( + - Ambiguities (vague terms: "fast", "robust", "secure") + - Conflicts (contradictory statements) + - Assumptions (unvalidated premises) + - Dependencies (external systems, feature flags, migrations, upstream APIs) + ) — create one resolution item per cluster. + - Include resilience/rollback coverage when state mutation or migrations occur (partial write, degraded mode, backward compatibility, rollback preconditions). + - BANNED: references to specific tests ("unit test", "integration test"), code symbols, frameworks, algorithmic prescriptions, deployment steps. Rephrase any such user input into requirement clarity or coverage validation. + - If a major scenario lacks acceptance criteria, add an item to define measurable criteria. + + **Context Curation (High-Signal Tokens Only)**: + - Load only necessary portions of `spec.md`, `plan.md`, `tasks.md` relevant to active focus areas (avoid full-file dumping where sections are irrelevant). + - Prefer summarizing long sections into concise scenario/requirement bullets before generating items (compaction principle). + - If source docs are large, generate interim summary items (e.g., `Confirm summary of §4 data retention rules is complete`) instead of embedding raw text. + - Use progressive disclosure: add follow-on retrieval only if a gap is detected (missing scenario class, unclear constraint). + - Treat context budget as finite: do not restate already-tagged requirements verbatim across multiple items. + - Merge near-duplicates when: same scenario class + same spec section + overlapping acceptance intent. Keep higher-risk phrasing; add note if consolidation occurred. + - Do not repeat identical spec or acceptance refs in >3 items unless covering distinct scenario classes. + - If >5 low-impact edge cases (minor parameter permutations), cluster into a single aggregated item. + - If user arguments are sparse, prioritize clarifying questions over speculative item generation. + +6. **Structure Reference**: Generate the checklist exactly following the canonical template in `templates/checklist-template.md`. Treat that file as the single source of truth for: + - Title + meta section placement + - Category headings + - Checklist line formatting and ID sequencing + - Prohibited content (implementation details) + + If (and only if) the canonical file is missing/unreadable, fall back to: H1 title, purpose/created meta lines, then one or more `##` category sections containing `- [ ] CHK### ` lines with globally incrementing IDs starting at CHK001. No trailing explanatory footer. 7. **Report**: Output full path to created checklist, item count, and remind user that each run creates a new file. Summarize: - Focus areas selected @@ -101,44 +125,49 @@ You **MUST** consider the user input before proceeding (if not empty). - Actor/timing - Any explicit user-specified must-have items incorporated -**Important**: Each `/checklist` command invocation creates a NEW checklist file using short, descriptive names. This allows: +**Important**: Each `/checklist` command invocation creates a checklist file using short, descriptive names unless file already exists. This allows: + - Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`) - Simple, memorable filenames that indicate checklist purpose -- Counter-based uniqueness for duplicate types (e.g., `review-2.md`) -- Easy identification and navigation in the checklists/ folder +- Easy identification and navigation in the `checklists/` folder To avoid clutter, use descriptive types and clean up obsolete checklists when done. ## Example Checklist Types **Specification Review:** `spec-review.md` + - Requirement completeness and clarity - User scenarios and edge cases coverage - Acceptance criteria definition - Domain-specific considerations **Requirements Quality:** `requirements.md` + - Testable and measurable outcomes - Stakeholder alignment verification - Assumptions and constraints documentation - Success metrics definition **UX/Accessibility Scenarios:** `ux.md` or `a11y.md` + - User journey completeness - Accessibility requirement coverage - Responsive design considerations - Internationalization needs **Security Requirements:** `security.md` + - Threat model coverage - Authentication/authorization requirements - Data protection requirements - Compliance and regulatory needs **API/Integration Scenarios:** `api.md` + - Contract completeness - Error handling scenarios - Backward compatibility considerations - Integration touchpoint coverage -Generate checklist items that validate the **quality and completeness of specifications and requirements** for the domain, focusing on scenarios, edge cases, and requirement clarity rather than implementation details. +Principle reminder: Checklist items validate requirements/scenario coverage quality—not implementation. If in doubt, transform any implementation phrasing into a requirement clarity or coverage validation item. From 533340908002d7bc279eed3af6448695ce9993aa Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Sun, 5 Oct 2025 19:59:17 -0700 Subject: [PATCH 18/31] Cleanup redundancies --- templates/commands/checklist.md | 92 ++++++++++++++++----------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/templates/commands/checklist.md b/templates/commands/checklist.md index dfd09345..7a746019 100644 --- a/templates/commands/checklist.md +++ b/templates/commands/checklist.md @@ -60,64 +60,66 @@ You **MUST** consider the user input before proceeding (if not empty). - spec.md: Feature requirements and scope - plan.md (if exists): Technical details, dependencies - tasks.md (if exists): Implementation tasks - - Use context to enrich or validate checklist items (omit irrelevant categories) + + **Context Loading Strategy**: + - Load only necessary portions relevant to active focus areas (avoid full-file dumping) + - Prefer summarizing long sections into concise scenario/requirement bullets + - Use progressive disclosure: add follow-on retrieval only if gaps detected + - If source docs are large, generate interim summary items instead of embedding raw text 5. **Generate checklist**: - Create `FEATURE_DIR/checklists/` directory if it doesn't exist - Generate unique checklist filename: - * Use short, descriptive name based on checklist type - * Format: `[type].md` (e.g., `ux.md`, `test.md`, `security.md`, `deploy.md`) - * If file exists, append to existing file (e.g., use the same UX checklist) + - Use short, descriptive name based on checklist type + - Format: `[type].md` (e.g., `ux.md`, `test.md`, `security.md`, `deploy.md`) + - If file exists, append to existing file (e.g., use the same UX checklist) - Number items sequentially starting from CHK001 - - Group items by category/section ONLY using this controlled set: - - Primary Flows - - Alternate Flows - - Exception / Error Flows - - Recovery & Resilience - - Non-Functional Domains (sub‑grouped or prefixed: Performance, Reliability, Security & Privacy, Accessibility, Observability, Scalability, Data Lifecycle) - - Traceability & Coverage - - Ambiguities & Conflicts - - Assumptions & Dependencies - - Do NOT invent ad-hoc categories; merge sparse categories (<2 items) into the closest higher-signal category. - - Add traceability refs when possible (order: spec section, acceptance criterion). If no ID system exists, create an item: `Establish requirement & acceptance criteria ID scheme before proceeding`. - - Optional brief rationale ONLY if it clarifies requirement intent or risk; never include implementation strategy, code pointers, or test plan details. - Each `/checklist` run creates a NEW file (never overwrites existing checklists) - - **CRITICAL**: Focus on requirements & scenario coverage quality (NOT implementation). Enforce clarity, completeness, measurability, domain & cross-cutting obligations; surface ambiguities / assumptions / conflicts / dependencies. NEVER include implementation details (tests, code symbols, algorithms, deployment steps). - - Soft cap: If raw candidate items > 40, prioritize by risk/impact, consolidate minor edge cases, and add one consolidation item: `Consolidate remaining low-impact scenarios (see source docs) after priority review`. - - Minimum traceability coverage: ≥80% of items MUST include at least one traceability reference (spec section OR acceptance criterion). If impossible (missing structure), add corrective item: `Establish requirement & acceptance criteria ID scheme before proceeding` then proceed. - **Scenario Modeling & Traceability (MANDATORY)**: - - Classify scenarios into: Primary, Alternate, Exception/Error, Recovery/Resilience, Non-Functional (performance, reliability, security/privacy, accessibility, observability, scalability, data lifecycle) where applicable. - - At least one item per present scenario class; if a class is intentionally absent add: `Confirm intentional absence of scenarios`. - - Each item MUST include ≥1 of: scenario class tag, spec ref `[Spec §X.Y]`, acceptance criterion `[AC-##]`, or marker `(Assumption)/(Dependency)/(Ambiguity)/(Conflict)` (track coverage ratio for ≥80% traceability rule). - - Surface & cluster ( + **Category Structure** - Group items ONLY using this controlled set: + - Primary Flows + - Alternate Flows + - Exception / Error Flows + - Recovery & Resilience + - Non-Functional Domains (sub‑grouped or prefixed: Performance, Reliability, Security & Privacy, Accessibility, Observability, Scalability, Data Lifecycle) + - Traceability & Coverage + - Ambiguities & Conflicts + - Assumptions & Dependencies + + Do NOT invent ad-hoc categories; merge sparse categories (<2 items) into the closest higher-signal category. + + **Scenario Classification & Coverage**: + - Classify scenarios into: Primary, Alternate, Exception/Error, Recovery/Resilience, Non-Functional + - At least one item per present scenario class; if intentionally absent add: `Confirm intentional absence of scenarios` + - Include resilience/rollback coverage when state mutation or migrations occur (partial write, degraded mode, backward compatibility, rollback preconditions) + - If a major scenario lacks acceptance criteria, add an item to define measurable criteria + + **Traceability Requirements**: + - MINIMUM: ≥80% of items MUST include at least one traceability reference + - Each item should include ≥1 of: scenario class tag, spec ref `[Spec §X.Y]`, acceptance criterion `[AC-##]`, or marker `(Assumption)/(Dependency)/(Ambiguity)/(Conflict)` + - If no ID system exists, create an item: `Establish requirement & acceptance criteria ID scheme before proceeding` + + **Surface & Resolve Issues**: + - Cluster and create one resolution item per cluster for: - Ambiguities (vague terms: "fast", "robust", "secure") - Conflicts (contradictory statements) - Assumptions (unvalidated premises) - Dependencies (external systems, feature flags, migrations, upstream APIs) - ) — create one resolution item per cluster. - - Include resilience/rollback coverage when state mutation or migrations occur (partial write, degraded mode, backward compatibility, rollback preconditions). - - BANNED: references to specific tests ("unit test", "integration test"), code symbols, frameworks, algorithmic prescriptions, deployment steps. Rephrase any such user input into requirement clarity or coverage validation. - - If a major scenario lacks acceptance criteria, add an item to define measurable criteria. - **Context Curation (High-Signal Tokens Only)**: - - Load only necessary portions of `spec.md`, `plan.md`, `tasks.md` relevant to active focus areas (avoid full-file dumping where sections are irrelevant). - - Prefer summarizing long sections into concise scenario/requirement bullets before generating items (compaction principle). - - If source docs are large, generate interim summary items (e.g., `Confirm summary of §4 data retention rules is complete`) instead of embedding raw text. - - Use progressive disclosure: add follow-on retrieval only if a gap is detected (missing scenario class, unclear constraint). - - Treat context budget as finite: do not restate already-tagged requirements verbatim across multiple items. - - Merge near-duplicates when: same scenario class + same spec section + overlapping acceptance intent. Keep higher-risk phrasing; add note if consolidation occurred. - - Do not repeat identical spec or acceptance refs in >3 items unless covering distinct scenario classes. - - If >5 low-impact edge cases (minor parameter permutations), cluster into a single aggregated item. - - If user arguments are sparse, prioritize clarifying questions over speculative item generation. + **Content Consolidation**: + - Soft cap: If raw candidate items > 40, prioritize by risk/impact and add: `Consolidate remaining low-impact scenarios (see source docs) after priority review` + - Merge near-duplicates when: same scenario class + same spec section + overlapping acceptance intent + - If >5 low-impact edge cases, cluster into a single aggregated item + - Do not repeat identical spec or acceptance refs in >3 items unless covering distinct scenario classes + - Treat context budget as finite: do not restate already-tagged requirements verbatim across multiple items -6. **Structure Reference**: Generate the checklist exactly following the canonical template in `templates/checklist-template.md`. Treat that file as the single source of truth for: - - Title + meta section placement - - Category headings - - Checklist line formatting and ID sequencing - - Prohibited content (implementation details) + **🚫 PROHIBITED CONTENT** (Requirements Focus ONLY): + - Focus on requirements & scenario coverage quality, NOT implementation + - NEVER include: specific tests ("unit test", "integration test"), code symbols, frameworks, algorithmic prescriptions, deployment steps, test plan details, implementation strategy + - Rephrase any such user input into requirement clarity or coverage validation + - Optional brief rationale ONLY if it clarifies requirement intent or risk - If (and only if) the canonical file is missing/unreadable, fall back to: H1 title, purpose/created meta lines, then one or more `##` category sections containing `- [ ] CHK### ` lines with globally incrementing IDs starting at CHK001. No trailing explanatory footer. +6. **Structure Reference**: Generate the checklist following the canonical template in `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### ` lines with globally incrementing IDs starting at CHK001. 7. **Report**: Output full path to created checklist, item count, and remind user that each run creates a new file. Summarize: - Focus areas selected @@ -169,5 +171,3 @@ To avoid clutter, use descriptive types and clean up obsolete checklists when do - Error handling scenarios - Backward compatibility considerations - Integration touchpoint coverage - -Principle reminder: Checklist items validate requirements/scenario coverage quality—not implementation. If in doubt, transform any implementation phrasing into a requirement clarity or coverage validation item. From 78638a9a374c5169ef84d5fdaf5e3b1cc7c4dad8 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Sun, 5 Oct 2025 22:10:47 -0700 Subject: [PATCH 19/31] Update templates --- templates/commands/checklist.md | 42 ++++++++++++-- templates/commands/specify.md | 98 +++++++++++++++++++++++++-------- templates/spec-template.md | 14 +++++ 3 files changed, 126 insertions(+), 28 deletions(-) diff --git a/templates/commands/checklist.md b/templates/commands/checklist.md index 7a746019..acce2e06 100644 --- a/templates/commands/checklist.md +++ b/templates/commands/checklist.md @@ -5,6 +5,24 @@ scripts: ps: scripts/powershell/check-prerequisites.ps1 -Json --- +## Checklist Purpose + +**CRITICAL CLARIFICATION**: Checklists generated by this command are for **requirements validation**, NOT: +- ❌ Verifying code execution or functionality +- ❌ Testing whether code matches the specification +- ❌ Checking implementation correctness +- ❌ Code review or quality assurance + +**What checklists ARE for**: +- ✅ Ensuring requirements are clearly captured and complete +- ✅ Identifying ambiguities in specifications or plans +- ✅ Verifying proper scenario coverage across the spec and plan +- ✅ Confirming acceptance criteria are well-defined and measurable +- ✅ Detecting gaps, conflicts, or missing edge cases in requirements +- ✅ Validating that the problem domain is properly understood before implementation + +Think of checklists as a **pre-implementation review** to ensure the spec and plan are solid, not a post-implementation verification tool. + ## User Input ```text @@ -88,23 +106,25 @@ You **MUST** consider the user input before proceeding (if not empty). Do NOT invent ad-hoc categories; merge sparse categories (<2 items) into the closest higher-signal category. - **Scenario Classification & Coverage**: + **Scenario Classification & Coverage** (Requirements Validation Focus): - Classify scenarios into: Primary, Alternate, Exception/Error, Recovery/Resilience, Non-Functional - At least one item per present scenario class; if intentionally absent add: `Confirm intentional absence of scenarios` - Include resilience/rollback coverage when state mutation or migrations occur (partial write, degraded mode, backward compatibility, rollback preconditions) - If a major scenario lacks acceptance criteria, add an item to define measurable criteria + - **Focus on requirements validation**: Are scenarios clearly defined? Are acceptance criteria measurable? Are edge cases identified in the spec? **Traceability Requirements**: - MINIMUM: ≥80% of items MUST include at least one traceability reference - Each item should include ≥1 of: scenario class tag, spec ref `[Spec §X.Y]`, acceptance criterion `[AC-##]`, or marker `(Assumption)/(Dependency)/(Ambiguity)/(Conflict)` - If no ID system exists, create an item: `Establish requirement & acceptance criteria ID scheme before proceeding` - **Surface & Resolve Issues**: + **Surface & Resolve Issues** (Pre-Implementation Validation): - Cluster and create one resolution item per cluster for: - - Ambiguities (vague terms: "fast", "robust", "secure") - - Conflicts (contradictory statements) - - Assumptions (unvalidated premises) - - Dependencies (external systems, feature flags, migrations, upstream APIs) + - Ambiguities (vague terms in spec: "fast", "robust", "secure" - these need quantification) + - Conflicts (contradictory statements in requirements) + - Assumptions (unvalidated premises in the spec or plan) + - Dependencies (external systems, feature flags, migrations, upstream APIs - are they documented?) + - Items should focus on "Is this requirement clear enough to implement?" not "Does the code work?" **Content Consolidation**: - Soft cap: If raw candidate items > 40, prioritize by risk/impact and add: `Consolidate remaining low-impact scenarios (see source docs) after priority review` @@ -119,6 +139,16 @@ You **MUST** consider the user input before proceeding (if not empty). - Rephrase any such user input into requirement clarity or coverage validation - Optional brief rationale ONLY if it clarifies requirement intent or risk + **✅ HOW TO PHRASE CHECKLIST ITEMS** (Requirements Validation): + - Good: "Verify error handling scenarios are defined for network failures" + - Bad: "Test error handling for network failures" + - Good: "Confirm acceptance criteria are measurable for performance requirements" + - Bad: "Run performance tests to verify requirements" + - Good: "Identify edge cases for concurrent user access in spec" + - Bad: "Implement thread-safe concurrent access" + - Good: "Clarify ambiguous term 'fast response' with specific timing requirements" + - Bad: "Verify response time is under 100ms" + 6. **Structure Reference**: Generate the checklist following the canonical template in `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### ` lines with globally incrementing IDs starting at CHK001. 7. **Report**: Output full path to created checklist, item count, and remind user that each run creates a new file. Summarize: diff --git a/templates/commands/specify.md b/templates/commands/specify.md index 37886316..8fa35230 100644 --- a/templates/commands/specify.md +++ b/templates/commands/specify.md @@ -29,15 +29,25 @@ Given that feature description, do this: If empty: ERROR "No feature description provided" 2. Extract key concepts from description Identify: actors, actions, data, constraints - 3. For each unclear aspect: - Mark with [NEEDS CLARIFICATION: specific question] + 3. For unclear aspects: + - Make informed guesses based on context and industry standards + - Only mark with [NEEDS CLARIFICATION: specific question] if: + - The choice significantly impacts feature scope or user experience + - Multiple reasonable interpretations exist with different implications + - No reasonable default exists + - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total** + - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details 4. Fill User Scenarios & Testing section If no clear user flow: ERROR "Cannot determine user scenarios" 5. Generate Functional Requirements Each requirement must be testable - Mark ambiguous requirements - 6. Identify Key Entities (if data involved) - 7. Return: SUCCESS (spec ready for planning) + Use reasonable defaults for unspecified details (document assumptions in Assumptions section) + 6. Define Success Criteria + Create measurable, technology-agnostic outcomes + Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion) + Each criterion must be verifiable without implementation details + 7. Identify Key Entities (if data involved) + 8. Return: SUCCESS (spec ready for planning) 4. 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. @@ -64,9 +74,19 @@ Given that feature description, do this: - [ ] No [NEEDS CLARIFICATION] markers remain - [ ] Requirements are testable and unambiguous - [ ] Success criteria are measurable + - [ ] Success criteria are technology-agnostic (no implementation details) + - [ ] All acceptance scenarios are defined + - [ ] Edge cases are identified - [ ] Scope is clearly bounded - [ ] Dependencies and assumptions identified + ## Feature Readiness + + - [ ] All functional requirements have clear acceptance criteria + - [ ] User scenarios cover primary flows + - [ ] Feature meets measurable outcomes defined in Success Criteria + - [ ] No implementation details leak into specification + ## Notes - Items marked incomplete require spec updates before `/clarify` or `/plan` @@ -88,7 +108,8 @@ Given that feature description, do this: - **If [NEEDS CLARIFICATION] markers remain**: 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec - 2. For each clarification needed, present options to user in this format: + 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 + 3. For each clarification needed (max 3), present options to user in this format: ```markdown ## Question [N]: [Topic] @@ -109,16 +130,16 @@ Given that feature description, do this: **Your choice**: _[Wait for user response]_ ``` - 3. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted: + 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted: - Use consistent spacing with pipes aligned - Each cell should have spaces around content: `| Content |` not `|Content|` - Header separator must have at least 3 dashes: `|--------|` - Test that the table renders correctly in markdown preview - 4. Number questions sequentially (Q1, Q2, Q3, etc.) - 5. Present all questions together before waiting for responses - 6. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B") - 7. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer - 8. Re-run validation after all clarifications are resolved + 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total) + 6. Present all questions together before waiting for responses + 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B") + 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer + 9. Re-run validation after all clarifications are resolved d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status @@ -145,13 +166,46 @@ Given that feature description, do this: When creating this spec from a user prompt: -1. **Mark all ambiguities**: Use [NEEDS CLARIFICATION: specific question] for any assumption you'd need to make -2. **Don't guess**: If the prompt doesn't specify something (e.g., "login system" without auth method), mark it -3. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item -4. **Common underspecified areas**: - - User types and permissions - - Data retention/deletion policies - - Performance targets and scale - - Error handling behaviors - - Integration requirements - - Security/compliance needs +1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps +2. **Document assumptions**: Record reasonable defaults in the Assumptions section +3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that: + - Significantly impact feature scope or user experience + - Have multiple reasonable interpretations with different implications + - Lack any reasonable default +4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details +5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item +6. **Common areas needing clarification** (only if no reasonable default exists): + - Feature scope and boundaries (include/exclude specific use cases) + - User types and permissions (if multiple conflicting interpretations possible) + - Security/compliance requirements (when legally/financially significant) + +**Examples of reasonable defaults** (don't ask about these): + +- Data retention: Industry-standard practices for the domain +- Performance targets: Standard web/mobile app expectations unless specified +- Error handling: User-friendly messages with appropriate fallbacks +- Authentication method: Standard session-based or OAuth2 for web apps +- Integration patterns: RESTful APIs unless specified otherwise + +### Success Criteria Guidelines + +Success criteria must be: + +1. **Measurable**: Include specific metrics (time, percentage, count, rate) +2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools +3. **User-focused**: Describe outcomes from user/business perspective, not system internals +4. **Verifiable**: Can be tested/validated without knowing implementation details + +**Good examples**: + +- "Users can complete checkout in under 3 minutes" +- "System supports 10,000 concurrent users" +- "95% of searches return results in under 1 second" +- "Task completion rate improves by 40%" + +**Bad examples** (implementation-focused): + +- "API response time is under 200ms" (too technical, use "Users see results instantly") +- "Database can handle 1000 TPS" (implementation detail, use user-facing metric) +- "React components render efficiently" (framework-specific) +- "Redis cache hit rate above 80%" (technology-specific) diff --git a/templates/spec-template.md b/templates/spec-template.md index fd5dbfb9..db1d1878 100644 --- a/templates/spec-template.md +++ b/templates/spec-template.md @@ -55,3 +55,17 @@ - **[Entity 1]**: [What it represents, key attributes without implementation] - **[Entity 2]**: [What it represents, relationships to other entities] + +## Success Criteria *(mandatory)* + + + +### Measurable Outcomes + +- **SC-001**: [Measurable metric, e.g., "Users can complete account creation in under 2 minutes"] +- **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users without degradation"] +- **SC-003**: [User satisfaction metric, e.g., "90% of users successfully complete primary task on first attempt"] +- **SC-004**: [Business metric, e.g., "Reduce support tickets related to [X] by 50%"] From a6be9bea316508b3e609db0cfb8c788344875b2c Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Sun, 5 Oct 2025 22:55:34 -0700 Subject: [PATCH 20/31] Update checklist.md --- templates/commands/checklist.md | 264 +++++++++++++++++++++----------- 1 file changed, 175 insertions(+), 89 deletions(-) diff --git a/templates/commands/checklist.md b/templates/commands/checklist.md index acce2e06..b9290907 100644 --- a/templates/commands/checklist.md +++ b/templates/commands/checklist.md @@ -5,23 +5,24 @@ scripts: ps: scripts/powershell/check-prerequisites.ps1 -Json --- -## Checklist Purpose +## Checklist Purpose: "Unit Tests for English" -**CRITICAL CLARIFICATION**: Checklists generated by this command are for **requirements validation**, NOT: -- ❌ Verifying code execution or functionality -- ❌ Testing whether code matches the specification -- ❌ Checking implementation correctness -- ❌ Code review or quality assurance +**CRITICAL CONCEPT**: Checklists are **UNIT TESTS FOR REQUIREMENTS WRITING** - they validate the quality, clarity, and completeness of requirements in a given domain. -**What checklists ARE for**: -- ✅ Ensuring requirements are clearly captured and complete -- ✅ Identifying ambiguities in specifications or plans -- ✅ Verifying proper scenario coverage across the spec and plan -- ✅ Confirming acceptance criteria are well-defined and measurable -- ✅ Detecting gaps, conflicts, or missing edge cases in requirements -- ✅ Validating that the problem domain is properly understood before implementation +**NOT for verification/testing**: +- ❌ NOT "Verify the button clicks correctly" +- ❌ NOT "Test error handling works" +- ❌ NOT "Confirm the API returns 200" +- ❌ NOT checking if code/implementation matches the spec -Think of checklists as a **pre-implementation review** to ensure the spec and plan are solid, not a post-implementation verification tool. +**FOR requirements quality validation**: +- ✅ "Are visual hierarchy requirements defined for all card types?" (completeness) +- ✅ "Is 'prominent display' quantified with specific sizing/positioning?" (clarity) +- ✅ "Are hover state requirements consistent across all interactive elements?" (consistency) +- ✅ "Are accessibility requirements defined for keyboard navigation?" (coverage) +- ✅ "Does the spec define what happens when logo image fails to load?" (edge cases) + +**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. ## User Input @@ -85,69 +86,122 @@ You **MUST** consider the user input before proceeding (if not empty). - Use progressive disclosure: add follow-on retrieval only if gaps detected - If source docs are large, generate interim summary items instead of embedding raw text -5. **Generate checklist**: +5. **Generate checklist** - Create "Unit Tests for Requirements": - Create `FEATURE_DIR/checklists/` directory if it doesn't exist - Generate unique checklist filename: - - Use short, descriptive name based on checklist type - - Format: `[type].md` (e.g., `ux.md`, `test.md`, `security.md`, `deploy.md`) - - If file exists, append to existing file (e.g., use the same UX checklist) + - Use short, descriptive name based on domain (e.g., `ux.md`, `api.md`, `security.md`) + - Format: `[domain].md` + - If file exists, append to existing file - Number items sequentially starting from CHK001 - Each `/checklist` run creates a NEW file (never overwrites existing checklists) - **Category Structure** - Group items ONLY using this controlled set: - - Primary Flows - - Alternate Flows - - Exception / Error Flows - - Recovery & Resilience - - Non-Functional Domains (sub‑grouped or prefixed: Performance, Reliability, Security & Privacy, Accessibility, Observability, Scalability, Data Lifecycle) - - Traceability & Coverage - - Ambiguities & Conflicts - - Assumptions & Dependencies + **CORE PRINCIPLE - Test the Requirements, Not the Implementation**: + Every checklist item MUST evaluate the REQUIREMENTS THEMSELVES for: + - **Completeness**: Are all necessary requirements present? + - **Clarity**: Are requirements unambiguous and specific? + - **Consistency**: Do requirements align with each other? + - **Measurability**: Can requirements be objectively verified? + - **Coverage**: Are all scenarios/edge cases addressed? - Do NOT invent ad-hoc categories; merge sparse categories (<2 items) into the closest higher-signal category. + **Category Structure** - Group items by requirement quality dimensions: + - **Requirement Completeness** (Are all necessary requirements documented?) + - **Requirement Clarity** (Are requirements specific and unambiguous?) + - **Requirement Consistency** (Do requirements align without conflicts?) + - **Acceptance Criteria Quality** (Are success criteria measurable?) + - **Scenario Coverage** (Are all flows/cases addressed?) + - **Edge Case Coverage** (Are boundary conditions defined?) + - **Non-Functional Requirements** (Performance, Security, Accessibility, etc. - are they specified?) + - **Dependencies & Assumptions** (Are they documented and validated?) + - **Ambiguities & Conflicts** (What needs clarification?) + + **HOW TO WRITE CHECKLIST ITEMS - "Unit Tests for English"**: + + ❌ **WRONG** (Testing implementation): + - "Verify landing page displays 3 episode cards" + - "Test hover states work on desktop" + - "Confirm logo click navigates home" + + ✅ **CORRECT** (Testing requirements quality): + - "Are the exact number and layout of featured episodes specified?" [Completeness] + - "Is 'prominent display' quantified with specific sizing/positioning?" [Clarity] + - "Are hover state requirements consistent across all interactive elements?" [Consistency] + - "Are keyboard navigation requirements defined for all interactive UI?" [Coverage] + - "Is the fallback behavior specified when logo image fails to load?" [Edge Cases] + - "Are loading states defined for asynchronous episode data?" [Completeness] + - "Does the spec define visual hierarchy for competing UI elements?" [Clarity] + + **ITEM STRUCTURE**: + Each item should follow this pattern: + - Question format asking about requirement quality + - Focus on what's WRITTEN (or not written) in the spec/plan + - Include quality dimension in brackets [Completeness/Clarity/Consistency/etc.] + - Reference spec section `[Spec §X.Y]` when checking existing requirements + - Use `[Gap]` marker when checking for missing requirements + + **EXAMPLES BY QUALITY DIMENSION**: + + Completeness: + - "Are error handling requirements defined for all API failure modes? [Gap]" + - "Are accessibility requirements specified for all interactive elements? [Completeness]" + - "Are mobile breakpoint requirements defined for responsive layouts? [Gap]" + + Clarity: + - "Is 'fast loading' quantified with specific timing thresholds? [Clarity, Spec §NFR-2]" + - "Are 'related episodes' selection criteria explicitly defined? [Clarity, Spec §FR-5]" + - "Is 'prominent' defined with measurable visual properties? [Ambiguity, Spec §FR-4]" + + Consistency: + - "Do navigation requirements align across all pages? [Consistency, Spec §FR-10]" + - "Are card component requirements consistent between landing and detail pages? [Consistency]" + + Coverage: + - "Are requirements defined for zero-state scenarios (no episodes)? [Coverage, Edge Case]" + - "Are concurrent user interaction scenarios addressed? [Coverage, Gap]" + - "Are requirements specified for partial data loading failures? [Coverage, Exception Flow]" + + Measurability: + - "Are visual hierarchy requirements measurable/testable? [Acceptance Criteria, Spec §FR-1]" + - "Can 'balanced visual weight' be objectively verified? [Measurability, Spec §FR-2]" - **Scenario Classification & Coverage** (Requirements Validation Focus): - - Classify scenarios into: Primary, Alternate, Exception/Error, Recovery/Resilience, Non-Functional - - At least one item per present scenario class; if intentionally absent add: `Confirm intentional absence of scenarios` - - Include resilience/rollback coverage when state mutation or migrations occur (partial write, degraded mode, backward compatibility, rollback preconditions) - - If a major scenario lacks acceptance criteria, add an item to define measurable criteria - - **Focus on requirements validation**: Are scenarios clearly defined? Are acceptance criteria measurable? Are edge cases identified in the spec? + **Scenario Classification & Coverage** (Requirements Quality Focus): + - Check if requirements exist for: Primary, Alternate, Exception/Error, Recovery, Non-Functional scenarios + - For each scenario class, ask: "Are [scenario type] requirements complete, clear, and consistent?" + - If scenario class missing: "Are [scenario type] requirements intentionally excluded or missing? [Gap]" + - Include resilience/rollback when state mutation occurs: "Are rollback requirements defined for migration failures? [Gap]" **Traceability Requirements**: - MINIMUM: ≥80% of items MUST include at least one traceability reference - - Each item should include ≥1 of: scenario class tag, spec ref `[Spec §X.Y]`, acceptance criterion `[AC-##]`, or marker `(Assumption)/(Dependency)/(Ambiguity)/(Conflict)` - - If no ID system exists, create an item: `Establish requirement & acceptance criteria ID scheme before proceeding` + - Each item should reference: spec section `[Spec §X.Y]`, or use markers: `[Gap]`, `[Ambiguity]`, `[Conflict]`, `[Assumption]` + - If no ID system exists: "Is a requirement & acceptance criteria ID scheme established? [Traceability]" - **Surface & Resolve Issues** (Pre-Implementation Validation): - - Cluster and create one resolution item per cluster for: - - Ambiguities (vague terms in spec: "fast", "robust", "secure" - these need quantification) - - Conflicts (contradictory statements in requirements) - - Assumptions (unvalidated premises in the spec or plan) - - Dependencies (external systems, feature flags, migrations, upstream APIs - are they documented?) - - Items should focus on "Is this requirement clear enough to implement?" not "Does the code work?" + **Surface & Resolve Issues** (Requirements Quality Problems): + Ask questions about the requirements themselves: + - Ambiguities: "Is the term 'fast' quantified with specific metrics? [Ambiguity, Spec §NFR-1]" + - Conflicts: "Do navigation requirements conflict between §FR-10 and §FR-10a? [Conflict]" + - Assumptions: "Is the assumption of 'always available podcast API' validated? [Assumption]" + - Dependencies: "Are external podcast API requirements documented? [Dependency, Gap]" + - Missing definitions: "Is 'visual hierarchy' defined with measurable criteria? [Gap]" **Content Consolidation**: - - Soft cap: If raw candidate items > 40, prioritize by risk/impact and add: `Consolidate remaining low-impact scenarios (see source docs) after priority review` - - Merge near-duplicates when: same scenario class + same spec section + overlapping acceptance intent - - If >5 low-impact edge cases, cluster into a single aggregated item - - Do not repeat identical spec or acceptance refs in >3 items unless covering distinct scenario classes - - Treat context budget as finite: do not restate already-tagged requirements verbatim across multiple items + - Soft cap: If raw candidate items > 40, prioritize by risk/impact + - Merge near-duplicates checking the same requirement aspect + - If >5 low-impact edge cases, create one item: "Are edge cases X, Y, Z addressed in requirements? [Coverage]" - **🚫 PROHIBITED CONTENT** (Requirements Focus ONLY): - - Focus on requirements & scenario coverage quality, NOT implementation - - NEVER include: specific tests ("unit test", "integration test"), code symbols, frameworks, algorithmic prescriptions, deployment steps, test plan details, implementation strategy - - Rephrase any such user input into requirement clarity or coverage validation - - Optional brief rationale ONLY if it clarifies requirement intent or risk - - **✅ HOW TO PHRASE CHECKLIST ITEMS** (Requirements Validation): - - Good: "Verify error handling scenarios are defined for network failures" - - Bad: "Test error handling for network failures" - - Good: "Confirm acceptance criteria are measurable for performance requirements" - - Bad: "Run performance tests to verify requirements" - - Good: "Identify edge cases for concurrent user access in spec" - - Bad: "Implement thread-safe concurrent access" - - Good: "Clarify ambiguous term 'fast response' with specific timing requirements" - - Bad: "Verify response time is under 100ms" + **🚫 ABSOLUTELY PROHIBITED** - These make it an implementation test, not a requirements test: + - ❌ Any item starting with "Verify", "Test", "Confirm", "Check" + implementation behavior + - ❌ References to code execution, user actions, system behavior + - ❌ "Displays correctly", "works properly", "functions as expected" + - ❌ "Click", "navigate", "render", "load", "execute" + - ❌ Test cases, test plans, QA procedures + - ❌ Implementation details (frameworks, APIs, algorithms) + + **✅ REQUIRED PATTERNS** - These test requirements quality: + - ✅ "Are [requirement type] defined/specified/documented for [scenario]?" + - ✅ "Is [vague term] quantified/clarified with specific criteria?" + - ✅ "Are requirements consistent between [section A] and [section B]?" + - ✅ "Can [requirement] be objectively measured/verified?" + - ✅ "Are [edge cases/scenarios] addressed in requirements?" + - ✅ "Does the spec define [missing aspect]?" 6. **Structure Reference**: Generate the checklist following the canonical template in `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### ` lines with globally incrementing IDs starting at CHK001. @@ -165,39 +219,71 @@ You **MUST** consider the user input before proceeding (if not empty). To avoid clutter, use descriptive types and clean up obsolete checklists when done. -## Example Checklist Types +## Example Checklist Types & Sample Items -**Specification Review:** `spec-review.md` +**UX Requirements Quality:** `ux.md` -- Requirement completeness and clarity -- User scenarios and edge cases coverage -- Acceptance criteria definition -- Domain-specific considerations +Sample items (testing the requirements, NOT the implementation): +- "Are visual hierarchy requirements defined with measurable criteria? [Clarity, Spec §FR-1]" +- "Is the number and positioning of UI elements explicitly specified? [Completeness, Spec §FR-1]" +- "Are interaction state requirements (hover, focus, active) consistently defined? [Consistency]" +- "Are accessibility requirements specified for all interactive elements? [Coverage, Gap]" +- "Is fallback behavior defined when images fail to load? [Edge Case, Gap]" +- "Can 'prominent display' be objectively measured? [Measurability, Spec §FR-4]" -**Requirements Quality:** `requirements.md` +**API Requirements Quality:** `api.md` -- Testable and measurable outcomes -- Stakeholder alignment verification -- Assumptions and constraints documentation -- Success metrics definition +Sample items: +- "Are error response formats specified for all failure scenarios? [Completeness]" +- "Are rate limiting requirements quantified with specific thresholds? [Clarity]" +- "Are authentication requirements consistent across all endpoints? [Consistency]" +- "Are retry/timeout requirements defined for external dependencies? [Coverage, Gap]" +- "Is versioning strategy documented in requirements? [Gap]" -**UX/Accessibility Scenarios:** `ux.md` or `a11y.md` +**Performance Requirements Quality:** `performance.md` -- User journey completeness -- Accessibility requirement coverage -- Responsive design considerations -- Internationalization needs +Sample items: +- "Are performance requirements quantified with specific metrics? [Clarity]" +- "Are performance targets defined for all critical user journeys? [Coverage]" +- "Are performance requirements under different load conditions specified? [Completeness]" +- "Can performance requirements be objectively measured? [Measurability]" +- "Are degradation requirements defined for high-load scenarios? [Edge Case, Gap]" -**Security Requirements:** `security.md` +**Security Requirements Quality:** `security.md` -- Threat model coverage -- Authentication/authorization requirements -- Data protection requirements -- Compliance and regulatory needs +Sample items: +- "Are authentication requirements specified for all protected resources? [Coverage]" +- "Are data protection requirements defined for sensitive information? [Completeness]" +- "Is the threat model documented and requirements aligned to it? [Traceability]" +- "Are security requirements consistent with compliance obligations? [Consistency]" +- "Are security failure/breach response requirements defined? [Gap, Exception Flow]" -**API/Integration Scenarios:** `api.md` +## Anti-Examples: What NOT To Do -- Contract completeness -- Error handling scenarios -- Backward compatibility considerations -- Integration touchpoint coverage +**❌ WRONG - These test implementation, not requirements:** + +```markdown +- [ ] CHK001 - Verify landing page displays 3 episode cards [Spec §FR-001] +- [ ] CHK002 - Test hover states work correctly on desktop [Spec §FR-003] +- [ ] CHK003 - Confirm logo click navigates to home page [Spec §FR-010] +- [ ] CHK004 - Check that related episodes section shows 3-5 items [Spec §FR-005] +``` + +**✅ CORRECT - These test requirements quality:** + +```markdown +- [ ] CHK001 - Are the number and layout of featured episodes explicitly specified? [Completeness, Spec §FR-001] +- [ ] CHK002 - Are hover state requirements consistently defined for all interactive elements? [Consistency, Spec §FR-003] +- [ ] CHK003 - Are navigation requirements clear for all clickable brand elements? [Clarity, Spec §FR-010] +- [ ] CHK004 - Is the selection criteria for related episodes documented? [Gap, Spec §FR-005] +- [ ] CHK005 - Are loading state requirements defined for asynchronous episode data? [Gap] +- [ ] CHK006 - Can "visual hierarchy" requirements be objectively measured? [Measurability, Spec §FR-001] +``` + +**Key Differences:** +- Wrong: Tests if the system works correctly +- Correct: Tests if the requirements are written correctly +- Wrong: Verification of behavior +- Correct: Validation of requirement quality +- Wrong: "Does it do X?" +- Correct: "Is X clearly specified?" From 0037a3f48468bb7979c284a905121a258e9d3026 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:11:52 -0700 Subject: [PATCH 21/31] Update template and docs --- README.md | 26 ++- templates/commands/tasks.md | 104 ++++++++---- templates/spec-template.md | 60 ++++++- templates/tasks-template.md | 318 ++++++++++++++++++++++++++++++------ 4 files changed, 413 insertions(+), 95 deletions(-) diff --git a/README.md b/README.md index 30d9c378..80b8f7c7 100644 --- a/README.md +++ b/README.md @@ -207,16 +207,28 @@ specify check After running `specify init`, your AI coding agent will have access to these slash commands for structured development: +#### Core Commands + +Essential commands for the Spec-Driven Development workflow: + | Command | Description | |-----------------|-----------------------------------------------------------------------| | `/constitution` | Create or update project governing principles and development guidelines | | `/specify` | Define what you want to build (requirements and user stories) | -| `/clarify` | Clarify underspecified areas (must be run before `/plan` unless explicitly skipped; formerly `/quizme`) | | `/plan` | Create technical implementation plans with your chosen tech stack | | `/tasks` | Generate actionable task lists for implementation | -| `/analyze` | Cross-artifact consistency & coverage analysis (run after /tasks, before /implement) | | `/implement` | Execute all tasks to build the feature according to the plan | +#### Optional Commands + +Additional commands for enhanced quality and validation: + +| Command | Description | +|-----------------|-----------------------------------------------------------------------| +| `/clarify` | Clarify underspecified areas (recommended before `/plan`; formerly `/quizme`) | +| `/analyze` | Cross-artifact consistency & coverage analysis (run after /tasks, before /implement) | +| `/checklist` | Generate custom quality checklists that validate requirements completeness, clarity, and consistency (like "unit tests for English") | + ### Environment Variables | Variable | Description | @@ -314,20 +326,18 @@ You will be prompted to select the AI agent you are using. You can also proactiv specify init --ai claude specify init --ai gemini specify init --ai copilot -specify init --ai cursor -specify init --ai qwen -specify init --ai opencode -specify init --ai codex -specify init --ai windsurf -specify init --ai q + # Or in current directory: specify init . --ai claude specify init . --ai codex + # or use --here flag specify init --here --ai claude specify init --here --ai codex + # Force merge into a non-empty current directory specify init . --force --ai claude + # or specify init --here --force --ai claude ``` diff --git a/templates/commands/tasks.md b/templates/commands/tasks.md index d6beea73..f2bafadc 100644 --- a/templates/commands/tasks.md +++ b/templates/commands/tasks.md @@ -18,37 +18,57 @@ You **MUST** consider the user input before proceeding (if not empty). 1. **Setup**: Run `{SCRIPT}` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. 2. **Load design documents**: Read from FEATURE_DIR: - - **Required**: plan.md (tech stack, libraries, structure) + - **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities) - **Optional**: data-model.md (entities), contracts/ (API endpoints), research.md (decisions), quickstart.md (test scenarios) - Note: Not all projects have all documents. Generate tasks based on what's available. 3. **Execute task generation workflow** (follow the template structure): - Load plan.md and extract tech stack, libraries, project structure - - If data-model.md exists: Extract entities → generate model tasks - - If contracts/ exists: Each file → generate endpoint/API tasks + - **Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)** + - If data-model.md exists: Extract entities → map to user stories + - If contracts/ exists: Each file → map endpoints to user stories - If research.md exists: Extract decisions → generate setup tasks - - Generate tasks by category: Setup, Core Implementation, Integration, Polish + - **Generate tasks ORGANIZED BY USER STORY**: + - Setup tasks (shared infrastructure needed by all stories) + - **Foundational tasks (prerequisites that must complete before ANY user story can start)** + - For each user story (in priority order P1, P2, P3...): + - Group all tasks needed to complete JUST that story + - Include models, services, endpoints, UI components specific to that story + - Mark which tasks are [P] parallelizable + - If tests requested: Include tests specific to that story + - Polish/Integration tasks (cross-cutting concerns) - **Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature spec or user asks for TDD approach - Apply task rules: - * Different files = mark [P] for parallel - * Same file = sequential (no [P]) - * If tests requested: Tests before implementation (TDD order) + - Different files = mark [P] for parallel + - Same file = sequential (no [P]) + - If tests requested: Tests before implementation (TDD order) - Number tasks sequentially (T001, T002...) - - Generate dependency graph - - Create parallel execution examples - - Validate task completeness (all entities have implementations, all endpoints covered) + - Generate dependency graph showing user story completion order + - Create parallel execution examples per user story + - Validate task completeness (each user story has all needed tasks, independently testable) 4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with: - Correct feature name from plan.md - - Numbered tasks (T001, T002...) in dependency order + - Phase 1: Setup tasks (project initialization) + - Phase 2: Foundational tasks (blocking prerequisites for all user stories) + - Phase 3+: One phase per user story (in priority order from spec.md) + - Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks + - Clear [Story] labels (US1, US2, US3...) for each task + - [P] markers for parallelizable tasks within each story + - Checkpoint markers after each story phase + - Final Phase: Polish & cross-cutting concerns + - Numbered tasks (T001, T002...) in execution order - Clear file paths for each task - - [P] markers for parallelizable tasks - - Phase groupings based on what's needed (Setup, Core Implementation, Integration, Polish) - - If tests requested: Include separate "Tests First (TDD)" phase before Core Implementation - - Dependency notes + - Dependencies section showing story completion order + - Parallel execution examples per story + - Implementation strategy section (MVP first, incremental delivery) -5. **Report**: Output path to generated tasks.md and summary of task counts by phase. - - Parallel execution guidance +5. **Report**: Output path to generated tasks.md and summary: + - Total task count + - Task count per user story + - Parallel opportunities identified + - Independent test criteria for each story + - Suggested MVP scope (typically just User Story 1) Context for task generation: {ARGS} @@ -58,20 +78,38 @@ The tasks.md should be immediately executable - each task must be specific enoug **IMPORTANT**: Tests are optional. Only generate test tasks if the user explicitly requested testing or TDD approach in the feature specification. -1. **From Contracts**: - - Each contract/endpoint → implementation task - - If tests requested: Each contract → contract test task [P] before implementation - -2. **From Data Model**: - - Each entity → model creation task [P] - - Relationships → service layer tasks - -3. **From User Stories**: - - Each story → implementation tasks - - If tests requested: Each story → integration test [P] - - If quickstart.md exists: Validation tasks +**CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing. + +1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION: + - Each user story (P1, P2, P3...) gets its own phase + - Map all related components to their story: + - Models needed for that story + - Services needed for that story + - Endpoints/UI needed for that story + - If tests requested: Tests specific to that story + - Mark story dependencies (most stories should be independent) + +2. **From Contracts**: + - Map each contract/endpoint → to the user story it serves + - If tests requested: Each contract → contract test task [P] before implementation in that story's phase + +3. **From Data Model**: + - Map each entity → to the user story(ies) that need it + - If entity serves multiple stories: Put in earliest story or Setup phase + - Relationships → service layer tasks in appropriate story phase + +4. **From Setup/Infrastructure**: + - Shared infrastructure → Setup phase (Phase 1) + - Foundational/blocking tasks → Foundational phase (Phase 2) + - Examples: Database schema setup, authentication framework, core libraries, base configurations + - These MUST complete before any user story can be implemented + - Story-specific setup → within that story's phase + +5. **Ordering**: + - Phase 1: Setup (project initialization) + - Phase 2: Foundational (blocking prerequisites - must complete before user stories) + - Phase 3+: User Stories in priority order (P1, P2, P3...) + - Within each story: Tests (if requested) → Models → Services → Endpoints → Integration + - Final Phase: Polish & Cross-Cutting Concerns + - Each user story phase should be a complete, independently testable increment -4. **Ordering**: - - Without tests: Setup → Models → Services → Endpoints → Integration → Polish - - With tests (TDD): Setup → Tests → Models → Services → Endpoints → Integration → Polish - - Dependencies block parallel execution \ No newline at end of file diff --git a/templates/spec-template.md b/templates/spec-template.md index db1d1878..c67d9149 100644 --- a/templates/spec-template.md +++ b/templates/spec-template.md @@ -7,20 +7,64 @@ ## User Scenarios & Testing *(mandatory)* -### Primary User Story - -[Describe the main user journey in plain language] - -### Acceptance Scenarios - +### User Story 1 - [Brief Title] (Priority: P1) + +[Describe this user journey in plain language] + +**Why this priority**: [Explain the value and why it has this priority level] + +**Independent Test**: [Describe how this can be tested independently - e.g., "Can be fully tested by [specific action] and delivers [specific value]"] + +**Acceptance Scenarios**: + 1. **Given** [initial state], **When** [action], **Then** [expected outcome] 2. **Given** [initial state], **When** [action], **Then** [expected outcome] +--- + +### User Story 2 - [Brief Title] (Priority: P2) + +[Describe this user journey in plain language] + +**Why this priority**: [Explain the value and why it has this priority level] + +**Independent Test**: [Describe how this can be tested independently] + +**Acceptance Scenarios**: + +1. **Given** [initial state], **When** [action], **Then** [expected outcome] + +--- + +### User Story 3 - [Brief Title] (Priority: P3) + +[Describe this user journey in plain language] + +**Why this priority**: [Explain the value and why it has this priority level] + +**Independent Test**: [Describe how this can be tested independently] + +**Acceptance Scenarios**: + +1. **Given** [initial state], **When** [action], **Then** [expected outcome] + +--- + +[Add more user stories as needed, each with an assigned priority] + ### Edge Cases -## Phase 3.1: Setup +## Phase 1: Setup (Shared Infrastructure) + +**Purpose**: Project initialization and basic structure + - [ ] T001 Create project structure per implementation plan - [ ] T002 Initialize [language] project with [framework] dependencies - [ ] T003 [P] Configure linting and formatting tools -## Phase 3.2: Tests First (TDD) - OPTIONAL ⚠️ -**NOTE: This phase is only included if tests are explicitly requested** -**If included: These tests MUST be written and MUST FAIL before ANY implementation** -- [ ] T004 [P] Contract test POST /api/users in tests/contract/test_users_post.py -- [ ] T005 [P] Contract test GET /api/users/{id} in tests/contract/test_users_get.py -- [ ] T006 [P] Integration test user registration in tests/integration/test_registration.py -- [ ] T007 [P] Integration test auth flow in tests/integration/test_auth.py +--- -## Phase 3.3: Core Implementation -- [ ] T008 [P] User model in src/models/user.py -- [ ] T009 [P] UserService CRUD in src/services/user_service.py -- [ ] T010 [P] CLI --create-user in src/cli/user_commands.py -- [ ] T011 POST /api/users endpoint -- [ ] T012 GET /api/users/{id} endpoint -- [ ] T013 Input validation -- [ ] T014 Error handling and logging +## Phase 2: Foundational (Blocking Prerequisites) -## Phase 3.4: Integration -- [ ] T015 Connect UserService to DB -- [ ] T016 Auth middleware -- [ ] T017 Request/response logging -- [ ] T018 CORS and security headers +**Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented -## Phase 3.5: Polish -- [ ] T019 [P] Documentation updates in docs/ -- [ ] T020 Code cleanup and refactoring -- [ ] T021 Performance optimization -- [ ] T022 [P] Unit tests (if requested) in tests/unit/ -- [ ] T023 Run quickstart.md validation +**⚠️ CRITICAL**: No user story work can begin until this phase is complete -## Dependencies -- Tests (T004-T007) before implementation (T008-T014) -- T008 blocks T009, T015 -- T016 blocks T018 -- Implementation before polish (T019-T023) +Examples of foundational tasks (adjust based on your project): -## Parallel Example -``` -# Launch T004-T007 together: -Task: "Contract test POST /api/users in tests/contract/test_users_post.py" -Task: "Contract test GET /api/users/{id} in tests/contract/test_users_get.py" -Task: "Integration test registration in tests/integration/test_registration.py" -Task: "Integration test auth in tests/integration/test_auth.py" +- [ ] T004 Setup database schema and migrations framework +- [ ] T005 [P] Implement authentication/authorization framework +- [ ] T006 [P] Setup API routing and middleware structure +- [ ] T007 Create base models/entities that all stories depend on +- [ ] T008 Configure error handling and logging infrastructure +- [ ] T009 Setup environment configuration management + +**Checkpoint**: Foundation ready - user story implementation can now begin in parallel + +--- + +## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP + +**Goal**: [Brief description of what this story delivers] + +**Independent Test**: [How to verify this story works on its own] + +### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️ + +**NOTE: Write these tests FIRST, ensure they FAIL before implementation** + +- [ ] T010 [P] [US1] Contract test for [endpoint] in tests/contract/test_[name].py +- [ ] T011 [P] [US1] Integration test for [user journey] in tests/integration/test_[name].py + +### Implementation for User Story 1 + +- [ ] T012 [P] [US1] Create [Entity1] model in src/models/[entity1].py +- [ ] T013 [P] [US1] Create [Entity2] model in src/models/[entity2].py +- [ ] T014 [US1] Implement [Service] in src/services/[service].py (depends on T012, T013) +- [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py +- [ ] T016 [US1] Add validation and error handling +- [ ] T017 [US1] Add logging for user story 1 operations + +**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently + +--- + +## Phase 4: User Story 2 - [Title] (Priority: P2) + +**Goal**: [Brief description of what this story delivers] + +**Independent Test**: [How to verify this story works on its own] + +### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️ + +- [ ] T018 [P] [US2] Contract test for [endpoint] in tests/contract/test_[name].py +- [ ] T019 [P] [US2] Integration test for [user journey] in tests/integration/test_[name].py + +### Implementation for User Story 2 + +- [ ] T020 [P] [US2] Create [Entity] model in src/models/[entity].py +- [ ] T021 [US2] Implement [Service] in src/services/[service].py +- [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py +- [ ] T023 [US2] Integrate with User Story 1 components (if needed) + +**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently + +--- + +## Phase 5: User Story 3 - [Title] (Priority: P3) + +**Goal**: [Brief description of what this story delivers] + +**Independent Test**: [How to verify this story works on its own] + +### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️ + +- [ ] T024 [P] [US3] Contract test for [endpoint] in tests/contract/test_[name].py +- [ ] T025 [P] [US3] Integration test for [user journey] in tests/integration/test_[name].py + +### Implementation for User Story 3 + +- [ ] T026 [P] [US3] Create [Entity] model in src/models/[entity].py +- [ ] T027 [US3] Implement [Service] in src/services/[service].py +- [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py + +--- + +## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP + +**Goal**: [Brief description of what this story delivers] + +**Independent Test**: [How to verify this story works on its own] + +### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️ + +**NOTE: Write these tests FIRST, ensure they FAIL before implementation** + +- [ ] T005 [P] [US1] Contract test for [endpoint] in tests/contract/test_[name].py +- [ ] T006 [P] [US1] Integration test for [user journey] in tests/integration/test_[name].py + +### Implementation for User Story 1 + +- [ ] T007 [P] [US1] Create [Entity1] model in src/models/[entity1].py +- [ ] T008 [P] [US1] Create [Entity2] model in src/models/[entity2].py +- [ ] T009 [US1] Implement [Service] in src/services/[service].py (depends on T007, T008) +- [ ] T010 [US1] Implement [endpoint/feature] in src/[location]/[file].py +- [ ] T011 [US1] Add validation and error handling +- [ ] T012 [US1] Add logging for user story 1 operations + +**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently + +--- + +## Phase 3: User Story 2 - [Title] (Priority: P2) + +**Goal**: [Brief description of what this story delivers] + +**Independent Test**: [How to verify this story works on its own] + +### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️ + +- [ ] T013 [P] [US2] Contract test for [endpoint] in tests/contract/test_[name].py +- [ ] T014 [P] [US2] Integration test for [user journey] in tests/integration/test_[name].py + +### Implementation for User Story 2 + +- [ ] T015 [P] [US2] Create [Entity] model in src/models/[entity].py +- [ ] T016 [US2] Implement [Service] in src/services/[service].py +- [ ] T017 [US2] Implement [endpoint/feature] in src/[location]/[file].py +- [ ] T018 [US2] Integrate with User Story 1 components (if needed) + +**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently + +--- + +## Phase 4: User Story 3 - [Title] (Priority: P3) + +**Goal**: [Brief description of what this story delivers] + +**Independent Test**: [How to verify this story works on its own] + +### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️ + +- [ ] T019 [P] [US3] Contract test for [endpoint] in tests/contract/test_[name].py +- [ ] T020 [P] [US3] Integration test for [user journey] in tests/integration/test_[name].py + +### Implementation for User Story 3 + +- [ ] T021 [P] [US3] Create [Entity] model in src/models/[entity].py +- [ ] T022 [US3] Implement [Service] in src/services/[service].py +- [ ] T023 [US3] Implement [endpoint/feature] in src/[location]/[file].py + +**Checkpoint**: All user stories should now be independently functional + +--- + +[Add more user story phases as needed, following the same pattern] + +--- + +## Phase N: Polish & Cross-Cutting Concerns + +**Purpose**: Improvements that affect multiple user stories + +- [ ] TXXX [P] Documentation updates in docs/ +- [ ] TXXX Code cleanup and refactoring +- [ ] TXXX Performance optimization across all stories +- [ ] TXXX [P] Additional unit tests (if requested) in tests/unit/ +- [ ] TXXX Security hardening +- [ ] TXXX Run quickstart.md validation + +--- + +## Dependencies & Execution Order + +### Phase Dependencies + +- **Setup (Phase 1)**: No dependencies - can start immediately +- **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories +- **User Stories (Phase 3+)**: All depend on Foundational phase completion + - User stories can then proceed in parallel (if staffed) + - Or sequentially in priority order (P1 → P2 → P3) +- **Polish (Final Phase)**: Depends on all desired user stories being complete + +### User Story Dependencies + +- **User Story 1 (P1)**: Can start after Foundational (Phase 2) - No dependencies on other stories +- **User Story 2 (P2)**: Can start after Foundational (Phase 2) - May integrate with US1 but should be independently testable +- **User Story 3 (P3)**: Can start after Foundational (Phase 2) - May integrate with US1/US2 but should be independently testable + +### Within Each User Story + +- Tests (if included) MUST be written and FAIL before implementation +- Models before services +- Services before endpoints +- Core implementation before integration +- Story complete before moving to next priority + +### Parallel Opportunities + +- All Setup tasks marked [P] can run in parallel +- All Foundational tasks marked [P] can run in parallel (within Phase 2) +- Once Foundational phase completes, all user stories can start in parallel (if team capacity allows) +- All tests for a user story marked [P] can run in parallel +- Models within a story marked [P] can run in parallel +- Different user stories can be worked on in parallel by different team members + +--- + +## Parallel Example: User Story 1 + +```bash +# Launch all tests for User Story 1 together (if tests requested): +Task: "Contract test for [endpoint] in tests/contract/test_[name].py" +Task: "Integration test for [user journey] in tests/integration/test_[name].py" + +# Launch all models for User Story 1 together: +Task: "Create [Entity1] model in src/models/[entity1].py" +Task: "Create [Entity2] model in src/models/[entity2].py" ``` +--- + +## Implementation Strategy + +### MVP First (User Story 1 Only) + +1. Complete Phase 1: Setup +2. Complete Phase 2: Foundational (CRITICAL - blocks all stories) +3. Complete Phase 3: User Story 1 +4. **STOP and VALIDATE**: Test User Story 1 independently +5. Deploy/demo if ready + +### Incremental Delivery + +1. Complete Setup + Foundational → Foundation ready +2. Add User Story 1 → Test independently → Deploy/Demo (MVP!) +3. Add User Story 2 → Test independently → Deploy/Demo +4. Add User Story 3 → Test independently → Deploy/Demo +5. Each story adds value without breaking previous stories + +### Parallel Team Strategy + +With multiple developers: + +1. Team completes Setup + Foundational together +2. Once Foundational is done: + - Developer A: User Story 1 + - Developer B: User Story 2 + - Developer C: User Story 3 +3. Stories complete and integrate independently + +--- + ## Notes -- [P] tasks = different files, no dependencies -- Verify tests fail before implementing -- Commit after each task -- Avoid: vague tasks, same file conflicts + +- [P] tasks = different files, no dependencies +- [Story] label maps task to specific user story for traceability +- Each user story should be independently completable and testable +- Verify tests fail before implementing +- Commit after each task or logical group +- Stop at any checkpoint to validate story independently +- Avoid: vague tasks, same file conflicts, cross-story dependencies that break independence + From 337e192abd3e4265671a16c158052a14b5fda7ee Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:20:09 -0700 Subject: [PATCH 22/31] Update CLI changes --- CHANGELOG.md | 5 +++-- pyproject.toml | 2 +- src/specify_cli/__init__.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb58132d..6a7bcc1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,13 @@ All notable changes to the Specify CLI and templates are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.0.18] - 2025-10-03 +## [0.0.18] - 2025-10-06 ### Added -- Support for using `.` as a shorthand for current directory in `specify init .` command, equivalent to `--here` flag but more intuitive for users +- Support for using `.` as a shorthand for current directory in `specify init .` command, equivalent to `--here` flag but more intuitive for users. - Refactor the prompts and templates to simplify their capabilities and how they are tracked. No more polluting things with tests when they are not needed. +- Ensure that tasks are created per user story (simplifies testing and validation). ### Changed diff --git a/pyproject.toml b/pyproject.toml index 559bad2d..86f9abba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "specify-cli" -version = "0.0.17" +version = "0.0.18" description = "Specify CLI, part of GitHub Spec Kit. A tool to bootstrap your projects for Spec-Driven Development (SDD)." requires-python = ">=3.11" dependencies = [ diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index 7ab114fb..eeeb4917 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -1089,7 +1089,8 @@ def init( "Optional commands that you can use for your specs [bright_black](improve quality & confidence)[/bright_black]", "", f"○ [cyan]/clarify[/] [bright_black](optional)[/bright_black] - Ask structured questions to de-risk ambiguous areas before planning (run before [cyan]/plan[/] if used)", - f"○ [cyan]/analyze[/] [bright_black](optional)[/bright_black] - Cross-artifact consistency & alignment report (after [cyan]/tasks[/], before [cyan]/implement[/])" + f"○ [cyan]/analyze[/] [bright_black](optional)[/bright_black] - Cross-artifact consistency & alignment report (after [cyan]/tasks[/], before [cyan]/implement[/])", + f"○ [cyan]/checklist[/] [bright_black](optional)[/bright_black] - Generate quality checklists to validate requirements completeness, clarity, and consistency (after [cyan]/plan[/])" ] enhancements_panel = Panel("\n".join(enhancement_lines), title="Enhancement Commands", border_style="cyan", padding=(1,2)) console.print() From 14ebde575f780f6fc36f109b13142ec9d7f184ab Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:26:07 -0700 Subject: [PATCH 23/31] Cleanup --- src/specify_cli/__init__.py | 150 +++++++++++++----------------------- 1 file changed, 52 insertions(+), 98 deletions(-) diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index eeeb4917..58977938 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -64,7 +64,6 @@ def _github_auth_headers(cli_token: str | None = None) -> dict: token = _github_token(cli_token) return {"Authorization": f"Bearer {token}"} if token else {} -# Constants AI_CHOICES = { "copilot": "GitHub Copilot", "claude": "Claude Code", @@ -79,13 +78,11 @@ AI_CHOICES = { "roo": "Roo Code", "q": "Amazon Q Developer CLI", } -# Add script type choices + SCRIPT_TYPE_CHOICES = {"sh": "POSIX Shell (bash/zsh)", "ps": "PowerShell"} -# Claude CLI local installation path after migrate-installer CLAUDE_LOCAL_PATH = Path.home() / ".claude" / "local" / "claude" -# ASCII Art Banner BANNER = """ ███████╗██████╗ ███████╗ ██████╗██╗███████╗██╗ ██╗ ██╔════╝██╔══██╗██╔════╝██╔════╝██║██╔════╝╚██╗ ██╔╝ @@ -182,40 +179,26 @@ class StepTracker: tree.add(line) return tree - - -MINI_BANNER = """ -╔═╗╔═╗╔═╗╔═╗╦╔═╗╦ ╦ -╚═╗╠═╝║╣ ║ ║╠╣ ╚╦╝ -╚═╝╩ ╚═╝╚═╝╩╚ ╩ -""" - def get_key(): """Get a single keypress in a cross-platform way using readchar.""" key = readchar.readkey() - - # Arrow keys + if key == readchar.key.UP or key == readchar.key.CTRL_P: return 'up' if key == readchar.key.DOWN or key == readchar.key.CTRL_N: return 'down' - - # Enter/Return + if key == readchar.key.ENTER: return 'enter' - - # Escape + if key == readchar.key.ESC: return 'escape' - - # Ctrl+C + if key == readchar.key.CTRL_C: raise KeyboardInterrupt return key - - def select_with_arrows(options: dict, prompt_text: str = "Select an option", default_key: str = None) -> str: """ Interactive selection using arrow keys with Rich Live display. @@ -233,7 +216,7 @@ def select_with_arrows(options: dict, prompt_text: str = "Select an option", def selected_index = option_keys.index(default_key) else: selected_index = 0 - + selected_key = None def create_selection_panel(): @@ -241,23 +224,23 @@ def select_with_arrows(options: dict, prompt_text: str = "Select an option", def table = Table.grid(padding=(0, 2)) table.add_column(style="cyan", justify="left", width=3) table.add_column(style="white", justify="left") - + for i, key in enumerate(option_keys): if i == selected_index: table.add_row("▶", f"[cyan]{key}[/cyan] [dim]({options[key]})[/dim]") else: table.add_row(" ", f"[cyan]{key}[/cyan] [dim]({options[key]})[/dim]") - + table.add_row("", "") table.add_row("", "[dim]Use ↑/↓ to navigate, Enter to select, Esc to cancel[/dim]") - + return Panel( table, title=f"[bold]{prompt_text}[/bold]", border_style="cyan", padding=(1, 2) ) - + console.print() def run_selection_loop(): @@ -276,7 +259,7 @@ def select_with_arrows(options: dict, prompt_text: str = "Select an option", def elif key == 'escape': console.print("\n[yellow]Selection cancelled[/yellow]") raise typer.Exit(1) - + live.update(create_selection_panel(), refresh=True) except KeyboardInterrupt: @@ -292,14 +275,11 @@ def select_with_arrows(options: dict, prompt_text: str = "Select an option", def # Suppress explicit selection print; tracker / later logic will report consolidated status return selected_key - - console = Console() - class BannerGroup(TyperGroup): """Custom group that shows banner before help.""" - + def format_help(self, ctx, formatter): # Show banner before help show_banner() @@ -314,23 +294,21 @@ app = typer.Typer( cls=BannerGroup, ) - def show_banner(): """Display the ASCII art banner.""" # Create gradient effect with different colors banner_lines = BANNER.strip().split('\n') colors = ["bright_blue", "blue", "cyan", "bright_cyan", "white", "bright_white"] - + styled_banner = Text() for i, line in enumerate(banner_lines): color = colors[i % len(colors)] styled_banner.append(line + "\n", style=color) - + console.print(Align.center(styled_banner)) console.print(Align.center(Text(TAGLINE, style="italic bright_yellow"))) console.print() - @app.callback() def callback(ctx: typer.Context): """Show banner when no subcommand is provided.""" @@ -341,7 +319,6 @@ def callback(ctx: typer.Context): console.print(Align.center("[dim]Run 'specify --help' for usage information[/dim]")) console.print() - def run_command(cmd: list[str], check_return: bool = True, capture: bool = False, shell: bool = False) -> Optional[str]: """Run a shell command and optionally capture output.""" try: @@ -360,7 +337,6 @@ def run_command(cmd: list[str], check_return: bool = True, capture: bool = False raise return None - def check_tool_for_tracker(tool: str, tracker: StepTracker) -> bool: """Check if a tool is installed and update tracker.""" if shutil.which(tool): @@ -370,7 +346,6 @@ def check_tool_for_tracker(tool: str, tracker: StepTracker) -> bool: tracker.error(tool, "not found") return False - def check_tool(tool: str, install_hint: str) -> bool: """Check if a tool is installed.""" @@ -388,7 +363,6 @@ def check_tool(tool: str, install_hint: str) -> bool: else: return False - def is_git_repo(path: Path = None) -> bool: """Check if the specified path is inside a git repository.""" if path is None: @@ -409,7 +383,6 @@ def is_git_repo(path: Path = None) -> bool: except (subprocess.CalledProcessError, FileNotFoundError): return False - def init_git_repo(project_path: Path, quiet: bool = False) -> bool: """Initialize a git repository in the specified path. quiet: if True suppress console output (tracker handles status) @@ -425,7 +398,7 @@ def init_git_repo(project_path: Path, quiet: bool = False) -> bool: if not quiet: console.print("[green]✓[/green] Git repository initialized") return True - + except subprocess.CalledProcessError as e: if not quiet: console.print(f"[red]Error initializing git repository:[/red] {e}") @@ -433,17 +406,16 @@ def init_git_repo(project_path: Path, quiet: bool = False) -> bool: finally: os.chdir(original_cwd) - def download_template_from_github(ai_assistant: str, download_dir: Path, *, script_type: str = "sh", verbose: bool = True, show_progress: bool = True, client: httpx.Client = None, debug: bool = False, github_token: str = None) -> Tuple[Path, dict]: repo_owner = "github" repo_name = "spec-kit" if client is None: client = httpx.Client(verify=ssl_context) - + if verbose: console.print("[cyan]Fetching latest release information...[/cyan]") api_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases/latest" - + try: response = client.get( api_url, @@ -465,7 +437,7 @@ def download_template_from_github(ai_assistant: str, download_dir: Path, *, scri console.print(f"[red]Error fetching release information[/red]") console.print(Panel(str(e), title="Fetch Error", border_style="red")) raise typer.Exit(1) - + # Find the template asset for the specified AI assistant assets = release_data.get("assets", []) pattern = f"spec-kit-template-{ai_assistant}-{script_type}" @@ -485,7 +457,7 @@ def download_template_from_github(ai_assistant: str, download_dir: Path, *, scri download_url = asset["browser_download_url"] filename = asset["name"] file_size = asset["size"] - + if verbose: console.print(f"[cyan]Found template:[/cyan] {filename}") console.print(f"[cyan]Size:[/cyan] {file_size:,} bytes") @@ -494,7 +466,7 @@ def download_template_from_github(ai_assistant: str, download_dir: Path, *, scri zip_path = download_dir / filename if verbose: console.print(f"[cyan]Downloading template...[/cyan]") - + try: with client.stream( "GET", @@ -545,13 +517,12 @@ def download_template_from_github(ai_assistant: str, download_dir: Path, *, scri } return zip_path, metadata - def download_and_extract_template(project_path: Path, ai_assistant: str, script_type: str, is_current_dir: bool = False, *, verbose: bool = True, tracker: StepTracker | None = None, client: httpx.Client = None, debug: bool = False, github_token: str = None) -> Path: """Download the latest release and extract it to create a new project. Returns project_path. Uses tracker if provided (with keys: fetch, download, extract, cleanup) """ current_dir = Path.cwd() - + # Step: fetch + download combined if tracker: tracker.start("fetch", "contacting GitHub API") @@ -577,18 +548,18 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ if verbose: console.print(f"[red]Error downloading template:[/red] {e}") raise - + if tracker: tracker.add("extract", "Extract template") tracker.start("extract") elif verbose: console.print("Extracting template...") - + try: # Create project directory only if not using current directory if not is_current_dir: project_path.mkdir(parents=True) - + with zipfile.ZipFile(zip_path, 'r') as zip_ref: # List all files in the ZIP for debugging zip_contents = zip_ref.namelist() @@ -597,13 +568,13 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ tracker.complete("zip-list", f"{len(zip_contents)} entries") elif verbose: console.print(f"[cyan]ZIP contains {len(zip_contents)} items[/cyan]") - + # For current directory, extract to a temp location first if is_current_dir: with tempfile.TemporaryDirectory() as temp_dir: temp_path = Path(temp_dir) zip_ref.extractall(temp_path) - + # Check what was extracted extracted_items = list(temp_path.iterdir()) if tracker: @@ -611,7 +582,7 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ tracker.complete("extracted-summary", f"temp {len(extracted_items)} items") elif verbose: console.print(f"[cyan]Extracted {len(extracted_items)} items to temp location[/cyan]") - + # Handle GitHub-style ZIP with a single root directory source_dir = temp_path if len(extracted_items) == 1 and extracted_items[0].is_dir(): @@ -621,7 +592,7 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ tracker.complete("flatten") elif verbose: console.print(f"[cyan]Found nested directory structure[/cyan]") - + # Copy contents to current directory for item in source_dir.iterdir(): dest_path = project_path / item.name @@ -647,7 +618,7 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ else: # Extract directly to project directory (original behavior) zip_ref.extractall(project_path) - + # Check what was extracted extracted_items = list(project_path.iterdir()) if tracker: @@ -657,7 +628,7 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ console.print(f"[cyan]Extracted {len(extracted_items)} items to {project_path}:[/cyan]") for item in extracted_items: console.print(f" - {item.name} ({'dir' if item.is_dir() else 'file'})") - + # Handle GitHub-style ZIP with a single root directory if len(extracted_items) == 1 and extracted_items[0].is_dir(): # Move contents up one level @@ -674,7 +645,7 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ tracker.complete("flatten") elif verbose: console.print(f"[cyan]Flattened nested directory structure[/cyan]") - + except Exception as e: if tracker: tracker.error("extract", str(e)) @@ -700,7 +671,7 @@ def download_and_extract_template(project_path: Path, ai_assistant: str, script_ tracker.complete("cleanup") elif verbose: console.print(f"Cleaned up: {zip_path.name}") - + return project_path @@ -775,15 +746,7 @@ def init( Examples: specify init my-project specify init my-project --ai claude - specify init my-project --ai gemini specify init my-project --ai copilot --no-git - specify init my-project --ai cursor - specify init my-project --ai qwen - specify init my-project --ai opencode - specify init my-project --ai codex - specify init my-project --ai windsurf - specify init my-project --ai auggie - specify init my-project --ai q specify init --ignore-agent-tools my-project specify init . --ai claude # Initialize in current directory specify init . # Initialize in current directory (interactive AI selection) @@ -792,29 +755,26 @@ def init( specify init --here specify init --here --force # Skip confirmation when current directory not empty """ - # Show banner first + show_banner() - + # Handle '.' as shorthand for current directory (equivalent to --here) if project_name == ".": here = True project_name = None # Clear project_name to use existing validation logic - - # Validate arguments + if here and project_name: console.print("[red]Error:[/red] Cannot specify both project name and --here flag") raise typer.Exit(1) - + if not here and not project_name: console.print("[red]Error:[/red] Must specify either a project name, use '.' for current directory, or use --here flag") raise typer.Exit(1) - - # Determine project directory + if here: project_name = Path.cwd().name project_path = Path.cwd() - - # Check if current directory has any files + existing_items = list(project_path.iterdir()) if existing_items: console.print(f"[yellow]Warning:[/yellow] Current directory is not empty ({len(existing_items)} items)") @@ -822,14 +782,12 @@ def init( if force: console.print("[cyan]--force supplied: skipping confirmation and proceeding with merge[/cyan]") else: - # Ask for confirmation response = typer.confirm("Do you want to continue?") if not response: console.print("[yellow]Operation cancelled[/yellow]") raise typer.Exit(0) else: project_path = Path(project_name).resolve() - # Check if project directory already exists if project_path.exists(): error_panel = Panel( f"Directory '[cyan]{project_name}[/cyan]' already exists\n" @@ -841,23 +799,22 @@ def init( console.print() console.print(error_panel) raise typer.Exit(1) - - # Create formatted setup info with column alignment + current_dir = Path.cwd() - + setup_lines = [ "[cyan]Specify Project Setup[/cyan]", "", f"{'Project':<15} [green]{project_path.name}[/green]", f"{'Working Path':<15} [dim]{current_dir}[/dim]", ] - + # Add target path only if different from working dir if not here: setup_lines.append(f"{'Target Path':<15} [dim]{project_path}[/dim]") - + console.print(Panel("\n".join(setup_lines), border_style="cyan", padding=(1, 2))) - + # Check git only if we might need it (not --no-git) # Only set to True if the user wants it and the tool is available should_init_git = False @@ -866,7 +823,6 @@ def init( if not should_init_git: console.print("[yellow]Git not found - will skip repository initialization[/yellow]") - # AI assistant selection if ai_assistant: if ai_assistant not in AI_CHOICES: console.print(f"[red]Error:[/red] Invalid AI assistant '{ai_assistant}'. Choose from: {', '.join(AI_CHOICES.keys())}") @@ -879,7 +835,7 @@ def init( "Choose your AI assistant:", "copilot" ) - + # Check agent tools unless ignored if not ignore_agent_tools: agent_tool_missing = False @@ -927,7 +883,7 @@ def init( console.print() console.print(error_panel) raise typer.Exit(1) - + # Determine script type (explicit, interactive, or OS default) if script_type: if script_type not in SCRIPT_TYPE_CHOICES: @@ -942,10 +898,10 @@ def init( selected_script = select_with_arrows(SCRIPT_TYPE_CHOICES, "Choose script type (or press Enter)", default_script) else: selected_script = default_script - + console.print(f"[cyan]Selected AI assistant:[/cyan] {selected_ai}") console.print(f"[cyan]Selected script type:[/cyan] {selected_script}") - + # Download and set up project # New tree-based progress (no emojis); include earlier substeps tracker = StepTracker("Initialize Specify Project") @@ -1023,7 +979,7 @@ def init( # Final static tree (ensures finished state visible after Live context ends) console.print(tracker.render()) console.print("\n[bold green]Project ready.[/bold green]") - + # Agent folder security notice agent_folder_map = { "claude": ".claude/", @@ -1039,7 +995,7 @@ def init( "roo": ".roo/", "q": ".amazonq/" } - + if selected_ai in agent_folder_map: agent_folder = agent_folder_map[selected_ai] security_notice = Panel( @@ -1051,7 +1007,7 @@ def init( ) console.print() console.print(security_notice) - + # Boxed "Next steps" section steps_lines = [] if not here: @@ -1103,7 +1059,7 @@ def check(): console.print("[bold]Checking for installed tools...[/bold]\n") tracker = StepTracker("Check Available Tools") - + tracker.add("git", "Git version control") tracker.add("claude", "Claude Code CLI") tracker.add("gemini", "Gemini CLI") @@ -1117,7 +1073,7 @@ def check(): tracker.add("codex", "Codex CLI") tracker.add("auggie", "Auggie CLI") tracker.add("q", "Amazon Q Developer CLI") - + git_ok = check_tool_for_tracker("git", tracker) claude_ok = check_tool_for_tracker("claude", tracker) gemini_ok = check_tool_for_tracker("gemini", tracker) @@ -1141,10 +1097,8 @@ def check(): if not (claude_ok or gemini_ok or cursor_ok or qwen_ok or windsurf_ok or kilocode_ok or opencode_ok or codex_ok or auggie_ok or q_ok): console.print("[dim]Tip: Install an AI assistant for the best experience[/dim]") - def main(): app() - if __name__ == "__main__": main() From 4dc4887134d1b8776abaf715bd51eeab21c03f1e Mon Sep 17 00:00:00 2001 From: Den Delimarsky <53200638+localden@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:27:26 -0700 Subject: [PATCH 24/31] Update templates/tasks-template.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- templates/tasks-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/tasks-template.md b/templates/tasks-template.md index 0e11d78a..84c1fc4d 100644 --- a/templates/tasks-template.md +++ b/templates/tasks-template.md @@ -185,7 +185,7 @@ Examples of foundational tasks (adjust based on your project): --- -## Phase 4: User Story 3 - [Title] (Priority: P3) +## Phase 3: User Story 3 - [Title] (Priority: P3) **Goal**: [Brief description of what this story delivers] From ba8144da899886a1816587f7bcc10e33400f7726 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:33:06 -0700 Subject: [PATCH 25/31] Update tasks-template.md --- templates/tasks-template.md | 67 ------------------------------------- 1 file changed, 67 deletions(-) diff --git a/templates/tasks-template.md b/templates/tasks-template.md index 84c1fc4d..8bf83d29 100644 --- a/templates/tasks-template.md +++ b/templates/tasks-template.md @@ -135,73 +135,6 @@ Examples of foundational tasks (adjust based on your project): - [ ] T027 [US3] Implement [Service] in src/services/[service].py - [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py ---- - -## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP - -**Goal**: [Brief description of what this story delivers] - -**Independent Test**: [How to verify this story works on its own] - -### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️ - -**NOTE: Write these tests FIRST, ensure they FAIL before implementation** - -- [ ] T005 [P] [US1] Contract test for [endpoint] in tests/contract/test_[name].py -- [ ] T006 [P] [US1] Integration test for [user journey] in tests/integration/test_[name].py - -### Implementation for User Story 1 - -- [ ] T007 [P] [US1] Create [Entity1] model in src/models/[entity1].py -- [ ] T008 [P] [US1] Create [Entity2] model in src/models/[entity2].py -- [ ] T009 [US1] Implement [Service] in src/services/[service].py (depends on T007, T008) -- [ ] T010 [US1] Implement [endpoint/feature] in src/[location]/[file].py -- [ ] T011 [US1] Add validation and error handling -- [ ] T012 [US1] Add logging for user story 1 operations - -**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently - ---- - -## Phase 3: User Story 2 - [Title] (Priority: P2) - -**Goal**: [Brief description of what this story delivers] - -**Independent Test**: [How to verify this story works on its own] - -### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️ - -- [ ] T013 [P] [US2] Contract test for [endpoint] in tests/contract/test_[name].py -- [ ] T014 [P] [US2] Integration test for [user journey] in tests/integration/test_[name].py - -### Implementation for User Story 2 - -- [ ] T015 [P] [US2] Create [Entity] model in src/models/[entity].py -- [ ] T016 [US2] Implement [Service] in src/services/[service].py -- [ ] T017 [US2] Implement [endpoint/feature] in src/[location]/[file].py -- [ ] T018 [US2] Integrate with User Story 1 components (if needed) - -**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently - ---- - -## Phase 3: User Story 3 - [Title] (Priority: P3) - -**Goal**: [Brief description of what this story delivers] - -**Independent Test**: [How to verify this story works on its own] - -### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️ - -- [ ] T019 [P] [US3] Contract test for [endpoint] in tests/contract/test_[name].py -- [ ] T020 [P] [US3] Integration test for [user journey] in tests/integration/test_[name].py - -### Implementation for User Story 3 - -- [ ] T021 [P] [US3] Create [Entity] model in src/models/[entity].py -- [ ] T022 [US3] Implement [Service] in src/services/[service].py -- [ ] T023 [US3] Implement [endpoint/feature] in src/[location]/[file].py - **Checkpoint**: All user stories should now be independently functional --- From cde400f466c7c74161fad2b1749bd4f8eac5931f Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:07:39 -0700 Subject: [PATCH 26/31] Package up VS Code settings for Copilot --- .../workflows/scripts/create-release-packages.sh | 8 ++++++-- CHANGELOG.md | 1 + templates/vscode-settings.json | 13 +++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 templates/vscode-settings.json diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.sh index c5cf1e55..19e49d39 100644 --- a/.github/workflows/scripts/create-release-packages.sh +++ b/.github/workflows/scripts/create-release-packages.sh @@ -129,7 +129,7 @@ build_variant() { esac fi - [[ -d templates ]] && { mkdir -p "$SPEC_DIR/templates"; find templates -type f -not -path "templates/commands/*" -exec cp --parents {} "$SPEC_DIR"/ \; ; echo "Copied templates -> .specify/templates"; } + [[ -d templates ]] && { mkdir -p "$SPEC_DIR/templates"; find templates -type f -not -path "templates/commands/*" -not -name "vscode-settings.json" -exec cp --parents {} "$SPEC_DIR"/ \; ; echo "Copied templates -> .specify/templates"; } # NOTE: We substitute {ARGS} internally. Outward tokens differ intentionally: # * Markdown/prompt (claude, copilot, cursor, opencode): $ARGUMENTS @@ -146,7 +146,11 @@ build_variant() { [[ -f agent_templates/gemini/GEMINI.md ]] && cp agent_templates/gemini/GEMINI.md "$base_dir/GEMINI.md" ;; copilot) mkdir -p "$base_dir/.github/prompts" - generate_commands copilot prompt.md "\$ARGUMENTS" "$base_dir/.github/prompts" "$script" ;; + generate_commands copilot prompt.md "\$ARGUMENTS" "$base_dir/.github/prompts" "$script" + # Create VS Code workspace settings + mkdir -p "$base_dir/.vscode" + [[ -f templates/vscode-settings.json ]] && cp templates/vscode-settings.json "$base_dir/.vscode/settings.json" + ;; cursor) mkdir -p "$base_dir/.cursor/commands" generate_commands cursor md "\$ARGUMENTS" "$base_dir/.cursor/commands" "$script" ;; diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a7bcc1c..ecb6febe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support for using `.` as a shorthand for current directory in `specify init .` command, equivalent to `--here` flag but more intuitive for users. - Refactor the prompts and templates to simplify their capabilities and how they are tracked. No more polluting things with tests when they are not needed. - Ensure that tasks are created per user story (simplifies testing and validation). +- Add support for Visual Studio Code prompt shortcuts and automatic script execution. ### Changed diff --git a/templates/vscode-settings.json b/templates/vscode-settings.json new file mode 100644 index 00000000..3d6be004 --- /dev/null +++ b/templates/vscode-settings.json @@ -0,0 +1,13 @@ +{ + "chat.promptFilesRecommendations": { + "speckit.constitution": true, + "speckit.specify": true, + "speckit.plan": true, + "speckit.tasks": true, + "speckit.implement": true + }, + "chat.tools.terminal.autoApprove": { + ".specify/scripts/bash/": true, + ".specify/scripts/ps/": true + } +} From 15e5572a1d45730bd767c48dbb5b87bfadef2ee0 Mon Sep 17 00:00:00 2001 From: "den (work)" <53200638+localden@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:16:48 -0700 Subject: [PATCH 27/31] Update command reference --- CONTRIBUTING.md | 2 +- README.md | 66 +++++++++++----------- docs/installation.md | 6 +- docs/quickstart.md | 14 ++--- scripts/bash/check-prerequisites.sh | 6 +- scripts/powershell/check-prerequisites.ps1 | 6 +- spec-driven.md | 12 ++-- src/specify_cli/__init__.py | 16 +++--- templates/checklist-template.md | 4 +- templates/commands/checklist.md | 4 +- templates/commands/clarify.md | 8 +-- templates/commands/specify.md | 6 +- templates/plan-template.md | 14 ++--- templates/tasks-template.md | 2 +- 14 files changed, 83 insertions(+), 83 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bf65fa77..b5488c80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,7 +40,7 @@ Here are a few things you can do that will increase the likelihood of your pull When working on spec-kit: -1. Test changes with the `specify` CLI commands (`/specify`, `/plan`, `/tasks`) in your coding agent of choice +1. Test changes with the `specify` CLI commands (`/speckit.specify`, `/speckit.plan`, `/speckit.tasks`) in your coding agent of choice 2. Verify templates are working correctly in `templates/` directory 3. Test script functionality in the `scripts/` directory 4. Ensure memory files (`memory/constitution.md`) are updated if major process changes are made diff --git a/README.md b/README.md index c649e618..2d648155 100644 --- a/README.md +++ b/README.md @@ -73,42 +73,42 @@ uvx --from git+https://github.com/github/spec-kit.git specify init **Must be set in the context of the agent you're working with prior to using `/plan` or follow-up commands. | +| `SPECIFY_FEATURE` | Override feature detection for non-Git repositories. Set to the feature directory name (e.g., `001-photo-albums`) to work on a specific feature when not using Git branches.
**Must be set in the context of the agent you're working with prior to using `/speckit.plan` or follow-up commands. | ## 📚 Core philosophy @@ -354,19 +354,19 @@ Go to the project folder and run your AI agent. In our example, we're using `cla ![Bootstrapping Claude Code environment](./media/bootstrap-claude-code.gif) -You will know that things are configured correctly if you see the `/constitution`, `/specify`, `/plan`, `/tasks`, and `/implement` commands available. +You will know that things are configured correctly if you see the `/speckit.constitution`, `/speckit.specify`, `/speckit.plan`, `/speckit.tasks`, and `/speckit.implement` commands available. -The first step should be establishing your project's governing principles using the `/constitution` command. This helps ensure consistent decision-making throughout all subsequent development phases: +The first step should be establishing your project's governing principles using the `/speckit.constitution` command. This helps ensure consistent decision-making throughout all subsequent development phases: ```text -/constitution Create principles focused on code quality, testing standards, user experience consistency, and performance requirements. Include governance for how these principles should guide technical decisions and implementation choices. +/speckit.constitution Create principles focused on code quality, testing standards, user experience consistency, and performance requirements. Include governance for how these principles should guide technical decisions and implementation choices. ``` This step creates or updates the `.specify/memory/constitution.md` file with your project's foundational guidelines that the AI agent will reference during specification, planning, and implementation phases. ### **STEP 2:** Create project specifications -With your project principles established, you can now create the functional specifications. Use the `/specify` command and then provide the concrete requirements for the project you want to develop. +With your project principles established, you can now create the functional specifications. Use the `/speckit.specify` command and then provide the concrete requirements for the project you want to develop. >[!IMPORTANT] >Be as explicit as possible about _what_ you are trying to build and _why_. **Do not focus on the tech stack at this point**. @@ -426,12 +426,12 @@ With the baseline specification created, you can go ahead and clarify any of the You should run the structured clarification workflow **before** creating a technical plan to reduce rework downstream. Preferred order: -1. Use `/clarify` (structured) – sequential, coverage-based questioning that records answers in a Clarifications section. +1. Use `/speckit.clarify` (structured) – sequential, coverage-based questioning that records answers in a Clarifications section. 2. Optionally follow up with ad-hoc free-form refinement if something still feels vague. If you intentionally want to skip clarification (e.g., spike or exploratory prototype), explicitly state that so the agent doesn't block on missing clarifications. -Example free-form refinement prompt (after `/clarify` if still needed): +Example free-form refinement prompt (after `/speckit.clarify` if still needed): ```text For each sample project or project that you create there should be a variable number of tasks between 5 and 15 @@ -449,7 +449,7 @@ It's important to use the interaction with Claude Code as an opportunity to clar ### **STEP 4:** Generate a plan -You can now be specific about the tech stack and other technical requirements. You can use the `/plan` command that is built into the project template with a prompt like this: +You can now be specific about the tech stack and other technical requirements. You can use the `/speckit.plan` command that is built into the project template with a prompt like this: ```text We are going to generate this using .NET Aspire, using Postgres as the database. The frontend should use @@ -535,13 +535,13 @@ You can also ask Claude Code (if you have the [GitHub CLI](https://docs.github.c ### STEP 6: Implementation -Once ready, use the `/implement` command to execute your implementation plan: +Once ready, use the `/speckit.implement` command to execute your implementation plan: ```text -/implement +/speckit.implement ``` -The `/implement` command will: +The `/speckit.implement` command will: - Validate that all prerequisites are in place (constitution, spec, plan, and tasks) - Parse the task breakdown from `tasks.md` - Execute tasks in the correct order, respecting dependencies and parallel execution markers diff --git a/docs/installation.md b/docs/installation.md index b30b0948..ec3c2896 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -62,9 +62,9 @@ uvx --from git+https://github.com/github/spec-kit.git specify init &2 - echo "Run /specify first to create the feature structure." >&2 + echo "Run /speckit.specify first to create the feature structure." >&2 exit 1 fi if [[ ! -f "$IMPL_PLAN" ]]; then echo "ERROR: plan.md not found in $FEATURE_DIR" >&2 - echo "Run /plan first to create the implementation plan." >&2 + echo "Run /speckit.plan first to create the implementation plan." >&2 exit 1 fi # Check for tasks.md if required if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2 - echo "Run /tasks first to create the task list." >&2 + echo "Run /speckit.tasks first to create the task list." >&2 exit 1 fi diff --git a/scripts/powershell/check-prerequisites.ps1 b/scripts/powershell/check-prerequisites.ps1 index d61c3b99..d8ccd1d5 100644 --- a/scripts/powershell/check-prerequisites.ps1 +++ b/scripts/powershell/check-prerequisites.ps1 @@ -88,20 +88,20 @@ if ($PathsOnly) { # Validate required directories and files if (-not (Test-Path $paths.FEATURE_DIR -PathType Container)) { Write-Output "ERROR: Feature directory not found: $($paths.FEATURE_DIR)" - Write-Output "Run /specify first to create the feature structure." + Write-Output "Run /speckit.specify first to create the feature structure." exit 1 } if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) { Write-Output "ERROR: plan.md not found in $($paths.FEATURE_DIR)" - Write-Output "Run /plan first to create the implementation plan." + Write-Output "Run /speckit.plan first to create the implementation plan." exit 1 } # Check for tasks.md if required if ($RequireTasks -and -not (Test-Path $paths.TASKS -PathType Leaf)) { Write-Output "ERROR: tasks.md not found in $($paths.FEATURE_DIR)" - Write-Output "Run /tasks first to create the task list." + Write-Output "Run /speckit.tasks first to create the task list." exit 1 } diff --git a/spec-driven.md b/spec-driven.md index a932c2eb..0e546ff3 100644 --- a/spec-driven.md +++ b/spec-driven.md @@ -74,7 +74,7 @@ The key is treating specifications as the source of truth, with code as the gene The SDD methodology is significantly enhanced through three powerful commands that automate the specification → planning → tasking workflow: -### The `/specify` Command +### The `/speckit.specify` Command This command transforms a simple feature description (the user-prompt) into a complete, structured specification with automatic repository management: @@ -83,7 +83,7 @@ This command transforms a simple feature description (the user-prompt) into a co 3. **Template-Based Generation**: Copies and customizes the feature specification template with your requirements 4. **Directory Structure**: Creates the proper `specs/[branch-name]/` structure for all related documents -### The `/plan` Command +### The `/speckit.plan` Command Once a feature specification exists, this command creates a comprehensive implementation plan: @@ -93,7 +93,7 @@ Once a feature specification exists, this command creates a comprehensive implem 4. **Detailed Documentation**: Generates supporting documents for data models, API contracts, and test scenarios 5. **Quickstart Validation**: Produces a quickstart guide capturing key validation scenarios -### The `/tasks` Command +### The `/speckit.tasks` Command After a plan is created, this command analyzes the plan and related design documents to generate an executable task list: @@ -121,7 +121,7 @@ Total: ~12 hours of documentation work ```bash # Step 1: Create the feature specification (5 minutes) -/specify Real-time chat system with message history and user presence +/speckit.specify Real-time chat system with message history and user presence # This automatically: # - Creates branch "003-chat-system" @@ -129,10 +129,10 @@ Total: ~12 hours of documentation work # - Populates it with structured requirements # Step 2: Generate implementation plan (5 minutes) -/plan WebSocket for real-time messaging, PostgreSQL for history, Redis for presence +/speckit.plan WebSocket for real-time messaging, PostgreSQL for history, Redis for presence # Step 3: Generate executable tasks (5 minutes) -/tasks +/speckit.tasks # This automatically creates: # - specs/003-chat-system/plan.md diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index 58977938..a0652539 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -1031,11 +1031,11 @@ def init( steps_lines.append(f"{step_num}. Start using slash commands with your AI agent:") - steps_lines.append(" 2.1 [cyan]/constitution[/] - Establish project principles") - steps_lines.append(" 2.2 [cyan]/specify[/] - Create baseline specification") - steps_lines.append(" 2.3 [cyan]/plan[/] - Create implementation plan") - steps_lines.append(" 2.4 [cyan]/tasks[/] - Generate actionable tasks") - steps_lines.append(" 2.5 [cyan]/implement[/] - Execute implementation") + steps_lines.append(" 2.1 [cyan]/speckit.constitution[/] - Establish project principles") + steps_lines.append(" 2.2 [cyan]/speckit.specify[/] - Create baseline specification") + steps_lines.append(" 2.3 [cyan]/speckit.plan[/] - Create implementation plan") + steps_lines.append(" 2.4 [cyan]/speckit.tasks[/] - Generate actionable tasks") + steps_lines.append(" 2.5 [cyan]/speckit.implement[/] - Execute implementation") steps_panel = Panel("\n".join(steps_lines), title="Next Steps", border_style="cyan", padding=(1,2)) console.print() @@ -1044,9 +1044,9 @@ def init( enhancement_lines = [ "Optional commands that you can use for your specs [bright_black](improve quality & confidence)[/bright_black]", "", - f"○ [cyan]/clarify[/] [bright_black](optional)[/bright_black] - Ask structured questions to de-risk ambiguous areas before planning (run before [cyan]/plan[/] if used)", - f"○ [cyan]/analyze[/] [bright_black](optional)[/bright_black] - Cross-artifact consistency & alignment report (after [cyan]/tasks[/], before [cyan]/implement[/])", - f"○ [cyan]/checklist[/] [bright_black](optional)[/bright_black] - Generate quality checklists to validate requirements completeness, clarity, and consistency (after [cyan]/plan[/])" + f"○ [cyan]/speckit.clarify[/] [bright_black](optional)[/bright_black] - Ask structured questions to de-risk ambiguous areas before planning (run before [cyan]/speckit.plan[/] if used)", + f"○ [cyan]/speckit.analyze[/] [bright_black](optional)[/bright_black] - Cross-artifact consistency & alignment report (after [cyan]/speckit.tasks[/], before [cyan]/speckit.implement[/])", + f"○ [cyan]/speckit.checklist[/] [bright_black](optional)[/bright_black] - Generate quality checklists to validate requirements completeness, clarity, and consistency (after [cyan]/speckit.plan[/])" ] enhancements_panel = Panel("\n".join(enhancement_lines), title="Enhancement Commands", border_style="cyan", padding=(1,2)) console.print() diff --git a/templates/checklist-template.md b/templates/checklist-template.md index f0c23b20..806657da 100644 --- a/templates/checklist-template.md +++ b/templates/checklist-template.md @@ -4,13 +4,13 @@ **Created**: [DATE] **Feature**: [Link to spec.md or relevant documentation] -**Note**: This checklist is generated by the `/checklist` command based on feature context and requirements. +**Note**: This checklist is generated by the `/speckit.checklist` command based on feature context and requirements.