claude-code-orchestrator-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/.claude/agents/database/workers/api-builder.md +155 -0
  2. package/.claude/agents/database/workers/database-architect.md +193 -0
  3. package/.claude/agents/database/workers/supabase-auditor.md +1070 -0
  4. package/.claude/agents/development/workers/code-reviewer.md +968 -0
  5. package/.claude/agents/development/workers/cost-calculator-specialist.md +683 -0
  6. package/.claude/agents/development/workers/llm-service-specialist.md +999 -0
  7. package/.claude/agents/development/workers/skill-builder-v2.md +480 -0
  8. package/.claude/agents/development/workers/typescript-types-specialist.md +649 -0
  9. package/.claude/agents/development/workers/utility-builder.md +582 -0
  10. package/.claude/agents/documentation/workers/technical-writer.md +152 -0
  11. package/.claude/agents/frontend/workers/fullstack-nextjs-specialist.md +206 -0
  12. package/.claude/agents/frontend/workers/visual-effects-creator.md +159 -0
  13. package/.claude/agents/health/orchestrators/bug-orchestrator.md +1045 -0
  14. package/.claude/agents/health/orchestrators/dead-code-orchestrator.md +1045 -0
  15. package/.claude/agents/health/orchestrators/dependency-orchestrator.md +1045 -0
  16. package/.claude/agents/health/orchestrators/security-orchestrator.md +1045 -0
  17. package/.claude/agents/health/workers/bug-fixer.md +525 -0
  18. package/.claude/agents/health/workers/bug-hunter.md +649 -0
  19. package/.claude/agents/health/workers/dead-code-hunter.md +446 -0
  20. package/.claude/agents/health/workers/dead-code-remover.md +437 -0
  21. package/.claude/agents/health/workers/dependency-auditor.md +379 -0
  22. package/.claude/agents/health/workers/dependency-updater.md +436 -0
  23. package/.claude/agents/health/workers/security-scanner.md +700 -0
  24. package/.claude/agents/health/workers/vulnerability-fixer.md +524 -0
  25. package/.claude/agents/infrastructure/workers/infrastructure-specialist.md +156 -0
  26. package/.claude/agents/infrastructure/workers/orchestration-logic-specialist.md +1260 -0
  27. package/.claude/agents/infrastructure/workers/qdrant-specialist.md +503 -0
  28. package/.claude/agents/infrastructure/workers/quality-validator-specialist.md +984 -0
  29. package/.claude/agents/meta/workers/meta-agent-v3.md +503 -0
  30. package/.claude/agents/research/workers/problem-investigator.md +507 -0
  31. package/.claude/agents/research/workers/research-specialist.md +423 -0
  32. package/.claude/agents/testing/workers/accessibility-tester.md +813 -0
  33. package/.claude/agents/testing/workers/integration-tester.md +188 -0
  34. package/.claude/agents/testing/workers/mobile-fixes-implementer.md +252 -0
  35. package/.claude/agents/testing/workers/mobile-responsiveness-tester.md +180 -0
  36. package/.claude/agents/testing/workers/performance-optimizer.md +262 -0
  37. package/.claude/agents/testing/workers/test-writer.md +800 -0
  38. package/.claude/commands/health-bugs.md +297 -0
  39. package/.claude/commands/health-cleanup.md +297 -0
  40. package/.claude/commands/health-deps.md +297 -0
  41. package/.claude/commands/health-metrics.md +747 -0
  42. package/.claude/commands/health-security.md +297 -0
  43. package/.claude/commands/push.md +21 -0
  44. package/.claude/commands/speckit.analyze.md +184 -0
  45. package/.claude/commands/speckit.checklist.md +294 -0
  46. package/.claude/commands/speckit.clarify.md +178 -0
  47. package/.claude/commands/speckit.constitution.md +78 -0
  48. package/.claude/commands/speckit.implement.md +182 -0
  49. package/.claude/commands/speckit.plan.md +87 -0
  50. package/.claude/commands/speckit.specify.md +250 -0
  51. package/.claude/commands/speckit.tasks.md +137 -0
  52. package/.claude/commands/translate-doc.md +95 -0
  53. package/.claude/commands/worktree-cleanup.md +382 -0
  54. package/.claude/commands/worktree-create.md +287 -0
  55. package/.claude/commands/worktree-list.md +239 -0
  56. package/.claude/commands/worktree-remove.md +339 -0
  57. package/.claude/schemas/base-plan.schema.json +82 -0
  58. package/.claude/schemas/bug-plan.schema.json +71 -0
  59. package/.claude/schemas/dead-code-plan.schema.json +71 -0
  60. package/.claude/schemas/dependency-plan.schema.json +74 -0
  61. package/.claude/schemas/security-plan.schema.json +71 -0
  62. package/.claude/scripts/gates/check-bundle-size.sh +47 -0
  63. package/.claude/scripts/gates/check-coverage.sh +67 -0
  64. package/.claude/scripts/gates/check-security.sh +46 -0
  65. package/.claude/scripts/release.sh +740 -0
  66. package/.claude/settings.local.json +21 -0
  67. package/.claude/settings.local.json.example +20 -0
  68. package/.claude/skills/calculate-priority-score/SKILL.md +229 -0
  69. package/.claude/skills/calculate-priority-score/scoring-matrix.json +83 -0
  70. package/.claude/skills/extract-version/SKILL.md +228 -0
  71. package/.claude/skills/format-commit-message/SKILL.md +189 -0
  72. package/.claude/skills/format-commit-message/template.md +64 -0
  73. package/.claude/skills/format-markdown-table/SKILL.md +202 -0
  74. package/.claude/skills/format-markdown-table/examples.md +84 -0
  75. package/.claude/skills/format-todo-list/SKILL.md +222 -0
  76. package/.claude/skills/format-todo-list/template.json +30 -0
  77. package/.claude/skills/generate-changelog/SKILL.md +258 -0
  78. package/.claude/skills/generate-changelog/commit-mapping.json +47 -0
  79. package/.claude/skills/generate-report-header/SKILL.md +228 -0
  80. package/.claude/skills/generate-report-header/template.md +66 -0
  81. package/.claude/skills/parse-error-logs/SKILL.md +286 -0
  82. package/.claude/skills/parse-error-logs/patterns.json +26 -0
  83. package/.claude/skills/parse-git-status/SKILL.md +164 -0
  84. package/.claude/skills/parse-package-json/SKILL.md +151 -0
  85. package/.claude/skills/parse-package-json/schema.json +43 -0
  86. package/.claude/skills/render-template/SKILL.md +245 -0
  87. package/.claude/skills/rollback-changes/SKILL.md +582 -0
  88. package/.claude/skills/rollback-changes/changes-log-schema.json +101 -0
  89. package/.claude/skills/run-quality-gate/SKILL.md +404 -0
  90. package/.claude/skills/run-quality-gate/gate-mappings.json +97 -0
  91. package/.claude/skills/validate-plan-file/SKILL.md +327 -0
  92. package/.claude/skills/validate-plan-file/schema.json +35 -0
  93. package/.claude/skills/validate-report-file/SKILL.md +256 -0
  94. package/.claude/skills/validate-report-file/schema.json +67 -0
  95. package/.env.example +49 -0
  96. package/.github/BRANCH_PROTECTION.md +137 -0
  97. package/.github/workflows/build.yml +70 -0
  98. package/.github/workflows/claude-code-review.yml +255 -0
  99. package/.github/workflows/claude.yml +79 -0
  100. package/.github/workflows/deploy-staging.yml +90 -0
  101. package/.github/workflows/test.yml +104 -0
  102. package/.gitignore +116 -0
  103. package/CLAUDE.md +137 -0
  104. package/LICENSE +72 -0
  105. package/README.md +1098 -0
  106. package/docs/ARCHITECTURE.md +746 -0
  107. package/docs/Agents Ecosystem/AGENT-ORCHESTRATION.md +568 -0
  108. package/docs/Agents Ecosystem/AI-AGENT-ECOSYSTEM-README.md +658 -0
  109. package/docs/Agents Ecosystem/ARCHITECTURE.md +606 -0
  110. package/docs/Agents Ecosystem/QUALITY-GATES-SPECIFICATION.md +1315 -0
  111. package/docs/Agents Ecosystem/REPORT-TEMPLATE-STANDARD.md +1324 -0
  112. package/docs/Agents Ecosystem/spec-kit-comprehensive-updates.md +478 -0
  113. package/docs/FAQ.md +572 -0
  114. package/docs/MIGRATION-GUIDE.md +542 -0
  115. package/docs/PERFORMANCE-OPTIMIZATION.md +494 -0
  116. package/docs/ROADMAP.md +439 -0
  117. package/docs/TUTORIAL-CUSTOM-AGENTS.md +2041 -0
  118. package/docs/USE-CASES.md +706 -0
  119. package/index.js +96 -0
  120. package/mcp/.mcp.base.json +21 -0
  121. package/mcp/.mcp.frontend.json +29 -0
  122. package/mcp/.mcp.full.json +67 -0
  123. package/mcp/.mcp.local.example.json +7 -0
  124. package/mcp/.mcp.local.json +7 -0
  125. package/mcp/.mcp.n8n.json +45 -0
  126. package/mcp/.mcp.supabase-full.json +35 -0
  127. package/mcp/.mcp.supabase-only.json +28 -0
  128. package/package.json +78 -0
  129. package/postinstall.js +71 -0
  130. package/switch-mcp.sh +101 -0
@@ -0,0 +1,297 @@
1
+ ---
2
+ description: Security vulnerability detection and remediation workflow with full cycle management
3
+ ---
4
+
5
+ # Security Health Check
6
+
7
+ > **PATTERN**: Agent-based orchestration (see `docs/Agents Ecosystem/AGENT-ORCHESTRATION.md` for details)
8
+
9
+ Complete security scanning and vulnerability fixing workflow with orchestrator-worker coordination.
10
+
11
+ **What it does:**
12
+ - Full security scan (SQL injection, XSS, auth issues, RLS policies, secrets)
13
+ - Staged fixing (critical → high → medium → low)
14
+ - Quality gates after each stage
15
+ - Verification scan
16
+ - Up to 3 iterations if issues remain
17
+ - Comprehensive final report
18
+
19
+ **No configuration needed** - runs comprehensive security audit always.
20
+
21
+ ---
22
+
23
+ ## Your Task
24
+
25
+ ### Step 1: Phase 0 - Invoke Orchestrator (Pre-flight)
26
+
27
+ Use Task tool to invoke security-orchestrator for pre-flight validation:
28
+
29
+ ```
30
+ subagent_type: "security-orchestrator"
31
+ description: "Security orchestrator pre-flight"
32
+ prompt: "Execute Phase 0: Pre-flight Validation
33
+
34
+ Tasks:
35
+ 1. Validate environment (package.json, scripts, git status)
36
+ 2. Initialize progress tracking via TodoWrite
37
+ 3. Initialize iteration tracking (iteration=1, max=3)
38
+ 4. Create .tmp/current/plans/security-detection.json for rollback tracking
39
+ 5. Report pre-flight status
40
+
41
+ IMPORTANT: After completing pre-flight, create .tmp/current/plans/security-detection.json and return control to main session.
42
+
43
+ Return the following information:
44
+ - Pre-flight status (✅/⛔)
45
+ - Environment validation results
46
+ - Plan file path created
47
+ - Ready for next phase: true/false
48
+ "
49
+ ```
50
+
51
+ **Then**: Wait for orchestrator to return.
52
+
53
+ ---
54
+
55
+ ### Step 2: Phase 1 - Invoke security-scanner (Detection)
56
+
57
+ After orchestrator returns:
58
+
59
+ 1. **Read plan file** to confirm it was created:
60
+ ```
61
+ Use Read tool: .tmp/current/plans/security-detection.json
62
+ Verify nextAgent === "security-scanner"
63
+ ```
64
+
65
+ 2. **Invoke security-scanner** using Task tool:
66
+ ```
67
+ subagent_type: "security-scanner"
68
+ description: "Security detection phase"
69
+ prompt: "Execute vulnerability detection based on plan file: .tmp/current/plans/security-detection.json
70
+
71
+ Read the plan file and execute comprehensive vulnerability detection:
72
+ - Scan entire codebase
73
+ - Categorize by priority (critical → high → medium → low)
74
+ - Generate security-scan-report.md
75
+
76
+ Return to main session when complete."
77
+ ```
78
+
79
+ **Then**: Wait for security-scanner to return with report.
80
+
81
+ ---
82
+
83
+ ### Step 3: Quality Gate 1 - Resume Orchestrator (Validate Detection)
84
+
85
+ After security-scanner returns:
86
+
87
+ 1. **Resume orchestrator** for validation using Task tool:
88
+ ```
89
+ subagent_type: "security-orchestrator"
90
+ description: "Validate vulnerability detection"
91
+ prompt: "Execute Quality Gate 1: Detection Validation
92
+
93
+ Phase: Validate security-scanner output
94
+
95
+ Tasks:
96
+ 1. Verify security-scan-report.md exists
97
+ 2. Validate report structure (required sections)
98
+ 3. Parse vulnerability counts by priority
99
+ 4. Run type-check validation (non-blocking warning)
100
+ 5. Report gate results
101
+
102
+ IMPORTANT: After validation, if vulnerabilitys found:
103
+ - Create .tmp/current/plans/security-fixing-{priority}.json for critical priority (or highest available)
104
+ - Return control to main session
105
+
106
+ If no vulnerabilitys found or all gates fail:
107
+ - Skip to final summary
108
+ - Return control
109
+
110
+ Return the following:
111
+ - Gate status (✅ PASSED / ⛔ FAILED / ⚠️ WARNINGS)
112
+ - Security counts by priority
113
+ - Next phase: fixing-critical / fixing-high / final-summary
114
+ - Plan file created (if applicable)
115
+ "
116
+ ```
117
+
118
+ **Then**: Wait for orchestrator validation results.
119
+
120
+ ---
121
+
122
+ ### Step 4: Phase 2-5 - Fixing Stages (Iterative)
123
+
124
+ After orchestrator returns with fixing plan:
125
+
126
+ **For each priority level** (critical → high → medium → low):
127
+
128
+ 1. **Check if this priority has vulnerabilitys**:
129
+ - Read orchestrator response
130
+ - If orchestrator says "skip to next priority" → continue loop
131
+ - If orchestrator says "final summary" → go to Step 5
132
+
133
+ 2. **Read fixing plan**:
134
+ ```
135
+ Use Read tool: .tmp/current/plans/security-fixing-{priority}.json
136
+ Verify nextAgent === "vulnerability-fixer"
137
+ Verify config.priority === "{current-priority}"
138
+ ```
139
+
140
+ 3. **Invoke vulnerability-fixer** using Task tool:
141
+ ```
142
+ subagent_type: "vulnerability-fixer"
143
+ description: "Fix {priority} vulnerabilitys"
144
+ prompt: "Execute vulnerability fixing based on plan file: .tmp/current/plans/security-fixing-{priority}.json
145
+
146
+ Read the plan file and fix vulnerabilitys for priority: {priority}
147
+ - Read security-scan-report.md for vulnerability list
148
+ - Fix vulnerabilitys one by one
149
+ - Log changes to .vulnerability-changes.json
150
+ - Update security-fixes-implemented.md (consolidated report)
151
+
152
+ Return to main session when complete."
153
+ ```
154
+
155
+ 4. **Resume orchestrator** for validation:
156
+ ```
157
+ subagent_type: "security-orchestrator"
158
+ description: "Validate {priority} fixes"
159
+ prompt: "Execute Quality Gate 2: Fixes Validation for priority={priority}
160
+
161
+ Tasks:
162
+ 1. Verify security-fixes-implemented.md exists
163
+ 2. Run type-check (BLOCKING)
164
+ 3. Run build (BLOCKING)
165
+ 4. Parse fix success rate
166
+ 5. Check if retry needed (if < 80% success)
167
+
168
+ If validation PASSES and more priorities remain:
169
+ - Create next .tmp/current/plans/security-fixing-{priority}.json
170
+ - Return control
171
+
172
+ If validation FAILS:
173
+ - Provide rollback instructions
174
+ - Return control with error
175
+
176
+ If all priorities complete:
177
+ - Proceed to verification phase
178
+ - Return control
179
+
180
+ Return:
181
+ - Gate status
182
+ - Fix success rate
183
+ - Next phase: fixing-{next-priority} / verification / final-summary
184
+ "
185
+ ```
186
+
187
+ 5. **Repeat** for next priority level.
188
+
189
+ ---
190
+
191
+ ### Step 5: Phase 6 - Verification
192
+
193
+ After all fixing stages complete:
194
+
195
+ 1. **Resume orchestrator** for verification:
196
+ ```
197
+ subagent_type: "security-orchestrator"
198
+ description: "Create verification plan"
199
+ prompt: "Execute Phase 6: Verification Preparation
200
+
201
+ Create .tmp/current/plans/security-verification.json for re-scanning codebase.
202
+
203
+ Return control with plan file path."
204
+ ```
205
+
206
+ 2. **Invoke security-scanner** for verification:
207
+ ```
208
+ subagent_type: "security-scanner"
209
+ description: "Verification scan"
210
+ prompt: "Execute verification scan based on: .tmp/current/plans/security-verification.json
211
+
212
+ Re-scan codebase to verify fixes. Overwrites security-scan-report.md.
213
+
214
+ Return when complete."
215
+ ```
216
+
217
+ 3. **Resume orchestrator** for verification validation:
218
+ ```
219
+ subagent_type: "security-orchestrator"
220
+ description: "Validate verification"
221
+ prompt: "Execute Quality Gate 3: Verification Validation
222
+
223
+ Compare original security-scan-report.md (baseline) with new scan:
224
+ - Count vulnerabilitys fixed
225
+ - Check if new vulnerabilitys introduced
226
+ - Determine if iteration needed
227
+
228
+ Return:
229
+ - Verification status
230
+ - Securitys remaining
231
+ - Iteration decision: iterate / complete
232
+ "
233
+ ```
234
+
235
+ ---
236
+
237
+ ### Step 6: Final Summary
238
+
239
+ After all phases complete:
240
+
241
+ 1. **Resume orchestrator** for final summary:
242
+ ```
243
+ subagent_type: "security-orchestrator"
244
+ description: "Generate final summary"
245
+ prompt: "Execute Phase 8: Final Summary
246
+
247
+ Generate comprehensive security-orchestration-summary.md:
248
+ - All vulnerabilitys detected
249
+ - All vulnerabilitys fixed
250
+ - Success rates by priority
251
+ - Validation results
252
+ - Iteration summary
253
+ - Cleanup instructions
254
+
255
+ Return final summary."
256
+ ```
257
+
258
+ 2. **Display results** to user:
259
+ ```
260
+ Read security-orchestration-summary.md
261
+ Display key metrics
262
+ Show validation status
263
+ List next steps
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Example Usage
269
+
270
+ ```bash
271
+ # Run complete vulnerability workflow
272
+ /health-vulnerabilitys
273
+ ```
274
+
275
+ ---
276
+
277
+ ## Architecture Notes
278
+
279
+ **Orchestrator Role**:
280
+ - Creates plan files
281
+ - Validates worker outputs
282
+ - Returns control to main session
283
+ - NO direct worker invocation
284
+
285
+ **Main Session Role** (this command):
286
+ - Reads plan files
287
+ - Invokes workers via Task tool
288
+ - Resumes orchestrator for validation
289
+ - Manages full cycle
290
+
291
+ **Worker Role**:
292
+ - Reads plan file
293
+ - Executes work
294
+ - Generates report
295
+ - Returns to main session
296
+
297
+ This pattern follows Claude Code's actual capabilities (no auto-invoke).
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Automated release management with version bumping and changelog updates
3
+ argument-hint: [patch|minor|major]
4
+ ---
5
+
6
+ Execute the release automation script with auto-confirmation for Claude Code.
7
+
8
+ **Features:**
9
+ - Auto-syncs package.json versions with latest git tag (prevents version conflicts)
10
+ - Analyzes commits since last release
11
+ - Auto-detects version bump type from conventional commits
12
+ - Generates CHANGELOG entries
13
+ - Updates all package.json files
14
+ - Creates git tag and pushes to GitHub
15
+ - Full rollback support on errors
16
+
17
+ **Usage:**
18
+
19
+ # Navigate to project root first
20
+ PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")
21
+ cd "$PROJECT_ROOT" && bash .claude/scripts/release.sh $ARGUMENTS --yes
@@ -0,0 +1,184 @@
1
+ ---
2
+ description: Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
3
+ ---
4
+
5
+ ## User Input
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ You **MUST** consider the user input before proceeding (if not empty).
12
+
13
+ ## Goal
14
+
15
+ Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/speckit.tasks` has successfully produced a complete `tasks.md`.
16
+
17
+ ## Operating Constraints
18
+
19
+ **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).
20
+
21
+ **Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/speckit.analyze`.
22
+
23
+ ## Execution Steps
24
+
25
+ ### 1. Initialize Analysis Context
26
+
27
+ Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
28
+
29
+ - SPEC = FEATURE_DIR/spec.md
30
+ - PLAN = FEATURE_DIR/plan.md
31
+ - TASKS = FEATURE_DIR/tasks.md
32
+
33
+ Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
34
+ For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
35
+
36
+ ### 2. Load Artifacts (Progressive Disclosure)
37
+
38
+ Load only the minimal necessary context from each artifact:
39
+
40
+ **From spec.md:**
41
+
42
+ - Overview/Context
43
+ - Functional Requirements
44
+ - Non-Functional Requirements
45
+ - User Stories
46
+ - Edge Cases (if present)
47
+
48
+ **From plan.md:**
49
+
50
+ - Architecture/stack choices
51
+ - Data Model references
52
+ - Phases
53
+ - Technical constraints
54
+
55
+ **From tasks.md:**
56
+
57
+ - Task IDs
58
+ - Descriptions
59
+ - Phase grouping
60
+ - Parallel markers [P]
61
+ - Referenced file paths
62
+
63
+ **From constitution:**
64
+
65
+ - Load `.specify/memory/constitution.md` for principle validation
66
+
67
+ ### 3. Build Semantic Models
68
+
69
+ Create internal representations (do not include raw artifacts in output):
70
+
71
+ - **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`)
72
+ - **User story/action inventory**: Discrete user actions with acceptance criteria
73
+ - **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
74
+ - **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
75
+
76
+ ### 4. Detection Passes (Token-Efficient Analysis)
77
+
78
+ Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
79
+
80
+ #### A. Duplication Detection
81
+
82
+ - Identify near-duplicate requirements
83
+ - Mark lower-quality phrasing for consolidation
84
+
85
+ #### B. Ambiguity Detection
86
+
87
+ - Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
88
+ - Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
89
+
90
+ #### C. Underspecification
91
+
92
+ - Requirements with verbs but missing object or measurable outcome
93
+ - User stories missing acceptance criteria alignment
94
+ - Tasks referencing files or components not defined in spec/plan
95
+
96
+ #### D. Constitution Alignment
97
+
98
+ - Any requirement or plan element conflicting with a MUST principle
99
+ - Missing mandated sections or quality gates from constitution
100
+
101
+ #### E. Coverage Gaps
102
+
103
+ - Requirements with zero associated tasks
104
+ - Tasks with no mapped requirement/story
105
+ - Non-functional requirements not reflected in tasks (e.g., performance, security)
106
+
107
+ #### F. Inconsistency
108
+
109
+ - Terminology drift (same concept named differently across files)
110
+ - Data entities referenced in plan but absent in spec (or vice versa)
111
+ - Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
112
+ - Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
113
+
114
+ ### 5. Severity Assignment
115
+
116
+ Use this heuristic to prioritize findings:
117
+
118
+ - **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
119
+ - **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
120
+ - **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
121
+ - **LOW**: Style/wording improvements, minor redundancy not affecting execution order
122
+
123
+ ### 6. Produce Compact Analysis Report
124
+
125
+ Output a Markdown report (no file writes) with the following structure:
126
+
127
+ ## Specification Analysis Report
128
+
129
+ | ID | Category | Severity | Location(s) | Summary | Recommendation |
130
+ |----|----------|----------|-------------|---------|----------------|
131
+ | A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
132
+
133
+ (Add one row per finding; generate stable IDs prefixed by category initial.)
134
+
135
+ **Coverage Summary Table:**
136
+
137
+ | Requirement Key | Has Task? | Task IDs | Notes |
138
+ |-----------------|-----------|----------|-------|
139
+
140
+ **Constitution Alignment Issues:** (if any)
141
+
142
+ **Unmapped Tasks:** (if any)
143
+
144
+ **Metrics:**
145
+
146
+ - Total Requirements
147
+ - Total Tasks
148
+ - Coverage % (requirements with >=1 task)
149
+ - Ambiguity Count
150
+ - Duplication Count
151
+ - Critical Issues Count
152
+
153
+ ### 7. Provide Next Actions
154
+
155
+ At end of report, output a concise Next Actions block:
156
+
157
+ - If CRITICAL issues exist: Recommend resolving before `/speckit.implement`
158
+ - If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
159
+ - Provide explicit command suggestions: e.g., "Run /speckit.specify with refinement", "Run /speckit.plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
160
+
161
+ ### 8. Offer Remediation
162
+
163
+ Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
164
+
165
+ ## Operating Principles
166
+
167
+ ### Context Efficiency
168
+
169
+ - **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
170
+ - **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
171
+ - **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
172
+ - **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
173
+
174
+ ### Analysis Guidelines
175
+
176
+ - **NEVER modify files** (this is read-only analysis)
177
+ - **NEVER hallucinate missing sections** (if absent, report them accurately)
178
+ - **Prioritize constitution violations** (these are always CRITICAL)
179
+ - **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
180
+ - **Report zero issues gracefully** (emit success report with coverage statistics)
181
+
182
+ ## Context
183
+
184
+ $ARGUMENTS