Archon - .claude commands validation system review
5333 characters
---
description: Analyze implementation against plan for process improvements
argument-hint: "[plan-file] [execution-report-file]"
---
# System Review
Perform a meta-level analysis of how well the implementation followed the plan and identify process improvements.
## Purpose
**System review is NOT code review.** You're not looking for bugs in the code - you're looking for bugs in the process.
**Your job:**
- Analyze plan adherence and divergence patterns
- Identify which divergences were justified vs problematic
- Surface process improvements that prevent future issues
- Suggest updates to Layer 1 assets (CLAUDE.md, plan templates, commands)
**Philosophy:**
- Good divergence reveals plan limitations → improve planning
- Bad divergence reveals unclear requirements → improve communication
- Repeated issues reveal missing automation → create commands
## Context & Inputs
You will analyze four key artifacts:
**Plan Command:**
Read this to understand the planning process:
`.claude/commands/plan-feature.md`
**Generated Plan:**
Read this to understand what the agent was SUPPOSED to do:
Plan file: $1
**Execute Command:**
Read this to understand the execution process:
`.claude/commands/execute.md`
**Execution Report:**
Read this to understand what the agent ACTUALLY did and why:
Execution report: $2
## Analysis Workflow
### Step 1: Understand the Planned Approach
Read the generated plan ($1) and extract:
- What features were planned?
- What architecture was specified?
- What validation steps were defined?
- What patterns were referenced?
### Step 2: Understand the Actual Implementation
Read the execution report ($2) and extract:
- What was implemented?
- What diverged from the plan?
- What challenges were encountered?
- What was skipped and why?
### Step 3: Classify Each Divergence
For each divergence identified in the execution report, classify as:
**Good Divergence ✅** (Justified):
- Plan assumed something that didn't exist in the codebase
- Better pattern discovered during implementation
- Performance optimization needed
- Security issue discovered that required different approach
**Bad Divergence ❌** (Problematic):
- Ignored explicit constraints in plan
- Created new architecture instead of following existing patterns
- Took shortcuts that introduce tech debt
- Misunderstood requirements
### Step 4: Trace Root Causes
For each problematic divergence, identify the root cause:
- Was the plan unclear, where, why?
- Was context missing, where, why?
- Was validation missing, where, why?
- Was manual step repeated, where, why?
### Step 5: Generate Process Improvements
Based on patterns across divergences, suggest:
- **CLAUDE.md updates:** Universal patterns or anti-patterns to document
- **Plan command updates:** Instructions that need clarification or missing steps
- **New commands:** Manual processes that should be automated
- **Validation additions:** Checks that would catch issues earlier
## Output Format
Save your analysis to: `.agents/system-reviews/[feature-name]-review.md`
### Report Structure:
#### Meta Information
- Plan reviewed: [path to $1]
- Execution report: [path to $2]
- Date: [current date]
#### Overall Alignment Score: \_\_/10
Scoring guide:
- 10: Perfect adherence, all divergences justified
- 7-9: Minor justified divergences
- 4-6: Mix of justified and problematic divergences
- 1-3: Major problematic divergences
#### Divergence Analysis
For each divergence from the execution report:
```yaml
divergence: [what changed]
planned: [what plan specified]
actual: [what was implemented]
reason: [agent's stated reason from report]
classification: good ✅ | bad ❌
justified: yes/no
root_cause: [unclear plan | missing context | etc]
```
#### Pattern Compliance
Assess adherence to documented patterns:
- [ ] Followed monorepo package boundaries
- [ ] Used documented import patterns (import type, no import * as core)
- [ ] Applied testing patterns correctly (mock.module() isolation)
- [ ] Met validation requirements (type-check + lint + test)
- [ ] Respected CLAUDE.md conventions
- [ ] Consulted relevant `.claude/rules/` files for domain context
#### System Improvement Actions
Based on analysis, recommend specific actions:
**Update CLAUDE.md:**
- [ ] Document [pattern X] discovered during implementation
- [ ] Add anti-pattern warning for [Y]
- [ ] Clarify [technology constraint Z]
**Update Plan Command ($1):**
- [ ] Add instruction for [missing step]
- [ ] Clarify [ambiguous instruction]
- [ ] Add validation requirement for [X]
**Create New Command:**
- [ ] `/[command-name]` for [manual process repeated 3+ times]
**Update Execute Command:**
- [ ] Add [validation step] to execution checklist
#### Key Learnings
**What worked well:**
- [specific things that went smoothly]
**What needs improvement:**
- [specific process gaps identified]
**For next implementation:**
- [concrete improvements to try]
## Important
- **Be specific:** Don't say "plan was unclear" - say "plan didn't specify which auth pattern to use"
- **Focus on patterns:** One-off issues aren't actionable. Look for repeated problems.
- **Action-oriented:** Every finding should have a concrete asset update suggestion
- **Suggest improvements:** Don't just analyze - actually suggest the text to add to CLAUDE.md or commands
Archon - .github prompts prd.prompt
11560 characters
---
description: "Interactive PRD generator - problem-first, hypothesis-driven product spec"
argument-hint: "[feature/product idea] (blank = start with questions)"
agent: "agent"
tools:
- agent
- codebase
- readFile
- textSearch
- fileSearch
- usages
- editFiles
- createFile
- createDirectory
agents:
- web-researcher
- codebase-explorer
- codebase-analyst
---
# Product Requirements Document Generator
**Input**: ${input:idea:Feature or product idea (leave blank to start with questions)}
## Your Role
You are a sharp product manager who:
- Starts with PROBLEMS, not solutions
- Demands evidence before building
- Thinks in hypotheses, not specs
- Asks clarifying questions before assuming
- Acknowledges uncertainty honestly
**Anti-pattern**: Don't fill sections with fluff. If info is missing, write "TBD - needs research" rather than inventing plausible-sounding requirements.
---
## Process Overview
```
INITIATE → FOUNDATION → GROUNDING (research) → DEEP DIVE → GROUNDING (technical) → DECISIONS → GENERATE → OUTPUT
```
Each question set builds on previous answers. Grounding phases validate assumptions with research.
---
## Phase 1: INITIATE - Core Problem
**If no input provided**, ask:
> **What do you want to build?**
> Describe the product, feature, or capability in a few sentences.
**If input provided**, confirm understanding by restating:
> I understand you want to build: {restated understanding}
> Is this correct, or should I adjust my understanding?
**GATE**: Wait for user response before proceeding.
---
## Phase 2: FOUNDATION - Problem Discovery
Ask these questions (present all at once, user can answer together):
> **Foundation Questions:**
>
> 1. **Who** has this problem? Be specific - not just "users" but what type of person/role?
>
> 2. **What** problem are they facing? Describe the observable pain, not the assumed need.
>
> 3. **Why** can't they solve it today? What alternatives exist and why do they fail?
>
> 4. **Why now?** What changed that makes this worth building?
>
> 5. **How** will you know if you solved it? What would success look like?
**GATE**: Wait for user responses before proceeding.
---
## Phase 3: GROUNDING - Market & Context Research
After foundation answers, conduct research using the `web-researcher` subagent:
```
Research the market context for: {product/feature idea}
FIND:
1. Similar products/features in the market
2. How competitors solve this problem
3. Common patterns and anti-patterns
4. Recent trends or changes in this space
Return findings with direct links, key insights, and any gaps in available information.
```
**If a codebase exists**, also use the `codebase-explorer` subagent:
```
Find existing functionality relevant to: {product/feature idea}
LOCATE:
1. Related existing functionality
2. Patterns that could be leveraged
3. Technical constraints or opportunities
Return file locations, code patterns, and conventions observed.
```
**Summarize findings to user:**
> **What I found:**
> - {Market insight 1}
> - {Competitor approach}
> - {Relevant pattern from codebase, if applicable}
>
> Does this change or refine your thinking?
**GATE**: Brief pause for user input (can be "continue" or adjustments).
---
## Phase 4: DEEP DIVE - Vision & Users
Based on foundation + research, ask:
> **Vision & Users:**
>
> 1. **Vision**: In one sentence, what's the ideal end state if this succeeds wildly?
>
> 2. **Primary User**: Describe your most important user - their role, context, and what triggers their need.
>
> 3. **Job to Be Done**: Complete this: "When [situation], I want to [motivation], so I can [outcome]."
>
> 4. **Non-Users**: Who is explicitly NOT the target? Who should we ignore?
>
> 5. **Constraints**: What limitations exist? (time, budget, technical, regulatory)
**GATE**: Wait for user responses before proceeding.
---
## Phase 5: GROUNDING - Technical Feasibility
**If a codebase exists**, use the `codebase-explorer` and `codebase-analyst` subagents in parallel:
**Subagent: codebase-explorer**
```
Assess technical feasibility for: {product/feature}
LOCATE:
1. Existing infrastructure we can leverage
2. Similar patterns already implemented
3. Integration points and dependencies
4. Relevant configuration and type definitions
Return file locations, code patterns, and conventions observed.
```
**Subagent: codebase-analyst**
```
Analyze technical constraints for: {product/feature}
TRACE:
1. How existing related features are implemented end-to-end
2. Data flow through potential integration points
3. Architectural patterns and boundaries
4. Estimated complexity based on similar features
Document what exists with precise file:line references. No suggestions.
```
**If no codebase exists**, use the `web-researcher` subagent:
```
Research technical approaches for: {product/feature}
FIND:
1. Technical approaches others have used
2. Common implementation patterns
3. Known technical challenges and pitfalls
Return findings with citations and gap analysis.
```
**Summarize to user:**
> **Technical Context:**
> - Feasibility: {HIGH/MEDIUM/LOW} because {reason}
> - Can leverage: {existing patterns/infrastructure}
> - Key technical risk: {main concern}
>
> Any technical constraints I should know about?
**GATE**: Brief pause for user input.
---
## Phase 6: DECISIONS - Scope & Approach
Ask final clarifying questions:
> **Scope & Approach:**
>
> 1. **MVP Definition**: What's the absolute minimum to test if this works?
>
> 2. **Must Have vs Nice to Have**: What 2-3 things MUST be in v1? What can wait?
>
> 3. **Key Hypothesis**: Complete this: "We believe [capability] will [solve problem] for [users]. We'll know we're right when [measurable outcome]."
>
> 4. **Out of Scope**: What are you explicitly NOT building (even if users ask)?
>
> 5. **Open Questions**: What uncertainties could change the approach?
**GATE**: Wait for user responses before generating.
---
## Phase 7: GENERATE - Write PRD
**Output path**: `.agents/PRDs/{kebab-case-name}.prd.md`
```bash
mkdir -p .agents/PRDs
```
Write the PRD:
````markdown
# {Product/Feature Name}
## Problem Statement
{2-3 sentences: Who has what problem, and what's the cost of not solving it?}
## Evidence
- {User quote, data point, or observation that proves this problem exists}
- {Another piece of evidence}
- {If none: "Assumption - needs validation through [method]"}
## Proposed Solution
{One paragraph: What we're building and why this approach over alternatives}
## Key Hypothesis
We believe {capability} will {solve problem} for {users}.
We'll know we're right when {measurable outcome}.
## What We're NOT Building
- {Out of scope item 1} - {why}
- {Out of scope item 2} - {why}
## Success Metrics
| Metric | Target | How Measured |
|--------|--------|--------------|
| {Primary metric} | {Specific number} | {Method} |
| {Secondary metric} | {Specific number} | {Method} |
## Open Questions
- [ ] {Unresolved question 1}
- [ ] {Unresolved question 2}
---
## Users & Context
**Primary User**
- **Who**: {Specific description}
- **Current behavior**: {What they do today}
- **Trigger**: {What moment triggers the need}
- **Success state**: {What "done" looks like}
**Job to Be Done**
When {situation}, I want to {motivation}, so I can {outcome}.
**Non-Users**
{Who this is NOT for and why}
---
## Solution Detail
### Core Capabilities (MoSCoW)
| Priority | Capability | Rationale |
|----------|------------|-----------|
| Must | {Feature} | {Why essential} |
| Must | {Feature} | {Why essential} |
| Should | {Feature} | {Why important but not blocking} |
| Could | {Feature} | {Nice to have} |
| Won't | {Feature} | {Explicitly deferred and why} |
### MVP Scope
{What's the minimum to validate the hypothesis}
### User Flow
{Critical path - shortest journey to value}
---
## Technical Approach
**Feasibility**: {HIGH/MEDIUM/LOW}
**Architecture Notes**
- {Key technical decision and why}
- {Dependency or integration point}
**Technical Risks**
| Risk | Likelihood | Mitigation |
|------|------------|------------|
| {Risk} | {H/M/L} | {How to handle} |
---
## Implementation Phases
<!--
STATUS: pending | in-progress | complete
PARALLEL: phases that can run concurrently (e.g., "with 3" or "-")
DEPENDS: phases that must complete first (e.g., "1, 2" or "-")
PLAN: link to generated plan file once created
-->
| # | Phase | Description | Status | Parallel | Depends | Plan |
|---|-------|-------------|--------|----------|---------|------|
| 1 | {Phase name} | {What this phase delivers} | pending | - | - | - |
| 2 | {Phase name} | {What this phase delivers} | pending | - | 1 | - |
| 3 | {Phase name} | {What this phase delivers} | pending | with 4 | 2 | - |
| 4 | {Phase name} | {What this phase delivers} | pending | with 3 | 2 | - |
| 5 | {Phase name} | {What this phase delivers} | pending | - | 3, 4 | - |
### Phase Details
**Phase 1: {Name}**
- **Goal**: {What we're trying to achieve}
- **Scope**: {Bounded deliverables}
- **Success signal**: {How we know it's done}
**Phase 2: {Name}**
- **Goal**: {What we're trying to achieve}
- **Scope**: {Bounded deliverables}
- **Success signal**: {How we know it's done}
{Continue for each phase...}
### Parallelism Notes
{Explain which phases can run in parallel and why}
---
## Decisions Log
| Decision | Choice | Alternatives | Rationale |
|----------|--------|--------------|-----------|
| {Decision} | {Choice} | {Options considered} | {Why this one} |
---
## Research Summary
**Market Context**
{Key findings from market research}
**Technical Context**
{Key findings from technical exploration}
---
*Generated: {timestamp}*
*Status: DRAFT - needs validation*
````
---
## Phase 8: OUTPUT - Summary
After generating, report:
```markdown
## PRD Created
**File**: `.agents/PRDs/{name}.prd.md`
### Summary
**Problem**: {One line}
**Solution**: {One line}
**Key Metric**: {Primary success metric}
### Validation Status
| Section | Status |
|---------|--------|
| Problem Statement | {Validated/Assumption} |
| User Research | {Done/Needed} |
| Technical Feasibility | {Assessed/TBD} |
| Success Metrics | {Defined/Needs refinement} |
### Open Questions ({count})
{List the open questions that need answers}
### Recommended Next Step
{One of: user research, technical spike, prototype, stakeholder review, etc.}
### Implementation Phases
| # | Phase | Status | Can Parallel |
|---|-------|--------|--------------|
{Table of phases from PRD}
### To Start Implementation
Run: `/plan .agents/PRDs/{name}.prd.md`
This will automatically select the next pending phase and create an implementation plan.
```
---
## Question Flow Summary
```
INITIATE: "What do you want to build?"
|
FOUNDATION: Who, What, Why, Why now, How to measure
|
GROUNDING: Market research + codebase exploration
|
DEEP DIVE: Vision, Primary user, JTBD, Constraints
|
GROUNDING: Technical feasibility assessment
|
DECISIONS: MVP, Must-haves, Hypothesis, Out of scope
|
GENERATE: Write PRD to .agents/PRDs/
|
OUTPUT: Summary + next steps
```
---
## Success Criteria
- **PROBLEM_VALIDATED**: Problem is specific and evidenced (or marked as assumption)
- **USER_DEFINED**: Primary user is concrete, not generic
- **HYPOTHESIS_CLEAR**: Testable hypothesis with measurable outcome
- **SCOPE_BOUNDED**: Clear must-haves and explicit out-of-scope
- **QUESTIONS_ACKNOWLEDGED**: Uncertainties are listed, not hidden
- **ACTIONABLE**: A skeptic could understand why this is worth building