--- name: "spectre-validate" description: "πŸ‘» | Comprehensive post implementation requirement validation using subagents" user-invocable: true --- # validate ## Input Handling Treat the current command arguments as this workflow's input. When invoked from a slash command, use the forwarded `$ARGUMENTS` value. # validate: Scope delivery verification and gap analysis ## Description - **What** β€” Validate implementation against scope/tasks docs, dispatch parallel subagents per area, produce single actionable gap remediation document. - **Approach** β€” Primary agent chunks work by scope items or parent tasks, dispatches one @analyst per area IN PARALLEL. Each subagent validates their area including E2E UX accessibility. - **Outcome** β€” Single `validation_gaps.md` with actionable tasks ready for immediate implementation. ## Core Validation Principle > **"Definition β‰  Connection β‰  Reachability"** Three levels of implementation completeness: 1. **Defined**: Code exists in a file 2. **Connected**: Code is imported/called by other code 3. **Reachable**: A user action can trigger the code path Validation must verify all three levels. A feature with Level 1 but not Level 2 or 3 is NOT completeβ€”it's dead code that happens to match the requirement description. When verifying any implementation: - Don't stop at "function X exists in file Y" - Continue to "function X is called by Z at file:line" - Continue to "Z is triggered when user does W" ## ARGUMENTS Input **REQUIRED**: User must provide scope documents to validate against. <ARGUMENTS> $ARGUMENTS </ARGUMENTS> ## Step (1/4) - Gather Validation Inputs - **Action** β€” CheckArguments: Verify user provided scope documents. - **If** ARGUMENTS contains file paths or "use thread context" β†’ proceed - **Else** β†’ Immediately reply: > "What should I validate against? Please provide: > > - Path to scope document (e.g., `docs/tasks/main/scope.md`) > - Path to tasks document (e.g., `docs/tasks/main/tasks.md`) > - Or say 'use thread context' to validate against our conversation" - **Wait** β€” User provides validation inputs - **Action** β€” ReadScopeDocs: Read provided documents completely (no limits). - Extract all requirements, acceptance criteria, deliverables - Document scope boundaries (in-scope / out-of-scope) - Note constraints and success metrics - **Action** β€” ChunkIntoValidationAreas: Break scope into discrete validation areas. - **From tasks.md**: Each parent task (e.g., \[1.1\], \[1.2\]) = one validation area - **From scope.md**: Each "In Scope" item = one validation area - **From thread context**: Each discussed feature/requirement = one validation area - Aim for 3-8 validation areas (merge small items, split large ones) - **Action** β€” CreateValidationManifest: Document chunks before dispatch. ```plaintext Validation Areas: 1. {Area Name} β€” {What to validate} - Source: {requirement text from scope doc} - Expected: {what should exist} 2. ... ``` ## Step (2/4) - Dispatch Parallel Validation Agents **CRITICAL**: Dispatch ALL validation agents in parallel in a SINGLE message with multiple Task tool calls. Do NOT dispatch sequentially. - **Action** β€” DispatchValidators: Launch one @analyst per validation area IN PARALLEL. **Subagent Prompt Template**: ```plaintext You are validating scope delivery for ONE specific area. ## Context Documents - Scope: {path or "thread context"} - Tasks: {path if provided} - Branch: {branch_name} ## Your Validation Area **Area**: {area_name} **Source Requirement**: {exact text from scope/tasks doc} **Expected Deliverables**: {what should exist} ## Your Task 1. Investigate YOUR SPECIFIC AREA only 2. For each requirement, determine: - **Status**: βœ… Delivered | ⚠️ Partial | πŸ”Œ Dead Code | ❌ Missing - βœ… **Delivered**: Defined AND connected AND reachable from user action - ⚠️ **Partial**: Code exists but has broken/missing connections - πŸ”Œ **Dead Code**: Code exists but has zero usage sites - ❌ **Missing**: Code does not exist - **Evidence**: Must include BOTH: 1. Definition site: `file:line` where code is defined 2. Usage site: `file:line` where code is called/rendered - If you can only cite definition without usage β†’ status is ⚠️ or πŸ”Œ - **Gap**: What's missing (if any) 3. **CRITICAL - Reachability Verification**: - Trace the COMPLETE chain from user action to implementation: - Entry point: What user action triggers this? (click, route, event) - Call chain: How does execution flow to the implementation? - Terminal point: What side effect/UI change occurs? - A broken link at ANY point = ⚠️ NOT FULLY DELIVERED - For every function/component, grep for USAGE not just DEFINITION: - Functions: Search for `functionName(` to find invocations - Components: Search for `/dev/null || echo unknown)` - **If** user specifies path β†’ `OUT_DIR={that value}` - **Else** β†’ `OUT_DIR=docs/tasks/{branch_name}` - `mkdir -p "${OUT_DIR}/validation"` - **Action** β€” CreateValidationGapsDoc: Generate `{OUT_DIR}/validation/validation_gaps.md`. **Document Structure**: ```markdown # Validation Gaps: {task_name} *Generated: {timestamp}* ## Summary - **Overall Status**: {Complete | Needs Work | Significant Gaps} - **Requirements**: {X of Y} delivered - **Gaps Found**: {count} requiring remediation - **Scope Creep**: {count} items (document or remove) --- ## Gap Remediation Tasks ### πŸ“¦ Phase 1: Critical Gaps #### πŸ“‹ [1.1] {Gap Title - e.g., "Connect auth flow to login page"} **Requirement**: {original requirement text} **Current State**: {what exists now β€” definition site if code exists} **Gap**: {what's missing β€” broken link in the chain} - [ ] **1.1.1** {Specific action - e.g., "Wire LoginButton onClick to auth handler"} - **Produces**: {output this creates β€” e.g., "onClick handler calling authService.login()"} - **Consumed by**: {what uses this β€” e.g., "LoginButton component render"} - **Replaces**: {old code path β€” e.g., "inline console.log in onClick" or "N/A"} - [ ] {Verifiable outcome 1} - [ ] {Verifiable outcome 2} - [ ] **1.1.2** {Specific action - e.g., "Add login route to app router"} - **Produces**: {output β€” e.g., "/login route rendering LoginPage"} - **Consumed by**: {consumer β€” e.g., "App router, navigated via authService redirect"} - [ ] {Verifiable outcome 1} - [ ] {Verifiable outcome 2} #### πŸ“‹ [1.2] {Next Gap Title} ... ### πŸ“¦ Phase 2: Medium Priority Gaps ... ### πŸ“¦ Phase 3: Low Priority / Polish ... --- ## Scope Creep Review Items implemented beyond original scope: - [ ] **{Feature}**: {Keep and document | Remove | Discuss} - Evidence: {file:line} - Recommendation: {action} --- ## Validation Coverage | Area | Status | Definition | Usage | Render Chain | |------|--------|------------|-------|--------------| | {area 1} | βœ… | {file:line} | {file:line} | JSX ← var ← source βœ“ | | {area 2} | ⚠️ | {file:line} | {file:line} | Broken at {link} | | {area 3} | πŸ”Œ | {file:line} | NONE | Dead computation | | {area 4} | ❌ | β€” | β€” | β€” | ## Dead Computations Found | Variable | File | Computed By | Should Be Consumed By | |----------|------|-------------|----------------------| | {displayTasks} | {useKanbanFilters.ts} | {applyTaskFilters} | {KanbanBoard render} | ## Old Code Paths Still Active | Old Path | Location | Should Be Replaced By | Impact | |----------|----------|----------------------|--------| | {getTasksForBoard} | {useKanbanDrag:45} | {displayTasks from useKanbanFilters} | Bypasses new filter | ``` ## Step (4/4) - Present Results - **Action** β€” PresentResults: Show validation summary. > ## Validation Complete **> **Status**: {Complete | Needs Work | Significant Gaps} > > - {X of Y} requirements delivered > - {N} gaps requiring remediation > - {N} scope creep items to review **> **Gap Remediation Doc**: `{OUT_DIR}/validation/validation_gaps.md` > > {1-2 sentence summary of key findings} - **Action** β€” RenderFooter: Render Next Steps footer using `Skill(spectre-guide)` skill ## Next Steps See `Skill(spectre)` skill for footer format and command options.