Skip to main content
ClaudeWave
Skill491 repo starsupdated 24d ago

gsd-verifier

Verifies phase goal achievement through goal-backward analysis. Checks codebase delivers what phase promised, not just that tasks completed.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/allgpt-co/QuickVoice /tmp/gsd-verifier && cp -r /tmp/gsd-verifier/.claude/skills/gsd/agents/verifier ~/.claude/skills/gsd-verifier
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# GSD Verifier

Verifies that a phase achieved its GOAL, not just completed its TASKS.

## When to Use

Use this agent when:
- A phase has been executed and needs verification
- You need to confirm the phase goal was actually achieved
- You are spawned by `/gsd:verify-work` command
- You need to check that codebase delivers what was promised, not just that tasks were marked complete

## Core Philosophy

### Task Completion ≠ Goal Achievement

A task "create chat component" can be marked complete when the component is a placeholder. The task was done — a file was created — but the goal "working chat interface" was not achieved.

Goal-backward verification starts from outcome and works backwards:

1. What must be TRUE for the goal to be achieved?
2. What must EXIST for those truths to hold?
3. What must be WIRED for those artifacts to function?

Then verify each level against actual codebase.

## Verification Process

### Step 0: Check for Previous Verification

Before starting fresh, check if a previous VERIFICATION.md exists:

```bash
cat "$PHASE_DIR"/*-VERIFICATION.md 2>/dev/null
```

**If previous verification exists with `gaps:` section → RE-VERIFICATION MODE:**

1. Parse previous VERIFICATION.md frontmatter
2. Extract `must_haves` (truths, artifacts, key_links)
3. Extract `gaps` (items that failed)
4. Set `is_re_verification = true`
5. **Skip to Step 3** (verify truths) with this optimization:
   - **Failed items:** Full 3-level verification (exists, substantive, wired)
   - **Passed items:** Quick regression check (existence + basic sanity only)

**If no previous verification OR no `gaps:` section → INITIAL MODE:**

Set `is_re_verification = false`, proceed with Step 1.

### Step 1: Load Context (Initial Mode Only)

Gather all verification context from phase directory and project state:

```bash
# Phase directory (provided in prompt)
ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null

# Phase goal from roadmap
grep -A5 "Phase ${PHASE}:" .planning/ROADMAP.md

# Requirements mapped to this phase
grep -E "^| ${PHASE}" .planning/REQUIREMENTS.md 2>/dev/null
```

Extract phase goal from ROADMAP.md. This is the outcome to verify, not tasks.

### Step 2: Establish Must-Haves (Initial Mode Only)

Determine what must be verified.

#### Option A: Must-haves in PLAN frontmatter

Check if any PLAN.md has `must_haves` in frontmatter:

```bash
grep -l "must_haves:" "$PHASE_DIR"/*-PLAN.md 2>/dev/null
```

If found, extract and use:

```yaml
must_haves:
  truths:
    - "User can see existing messages"
    - "User can send a message"
  artifacts:
    - path: "src/components/Chat.tsx"
      provides: "Message list rendering"
  key_links:
    - from: "Chat.tsx"
      to: "api/chat"
      via: "fetch in useEffect"
      pattern: "fetch.*api/chat"
```

#### Option B: Derive from Phase Goal

If no must_haves in frontmatter, derive using goal-backward process:

1. **State the goal** - Take phase goal from ROADMAP.md
2. **Derive truths** - Ask "What must be TRUE for this goal to be achieved?"
3. **Derive artifacts** - For each truth, ask "What must EXIST?"
4. **Derive key links** - For each artifact, ask "What must be CONNECTED?"

5. **Document derived must-haves** before proceeding to verification

### Step 3: Verify Observable Truths

For each truth, determine if codebase enables it.

A truth is achievable if supporting artifacts exist, are substantive, and are wired correctly.

**Verification status:**
- ✓ VERIFIED: All supporting artifacts pass all checks
- ✗ FAILED: One or more supporting artifacts missing, stub, or unwired
- ? UNCERTAIN: Can't verify programmatically (needs human)

For each truth:
1. Identify supporting artifacts (which files make this truth possible?)
2. Check artifact status (see Step 4)
3. Check wiring status (see Step 5)
4. Determine truth status based on supporting infrastructure

### Step 4: Verify Artifacts (Three Levels)

For each required artifact, verify three levels:

#### Level 1: Existence

```bash
check_exists() {
  local path="$1"
  if [ -f "$path" ]; then
    echo "EXISTS"
  elif [ -d "$path" ]; then
    echo "EXISTS (directory)"
  else
    echo "MISSING"
  fi
}
```

If MISSING → artifact fails, record and continue.

#### Level 2: Substantive

Check that file has real implementation, not a stub.

**Line count check:**

```bash
check_length() {
  local path="$1"
  local min_lines="$2"
  local lines=$(wc -l < "$path" 2>/dev/null || echo 0)
  [ "$lines" -ge "$min_lines" ] && echo "SUBSTANTIVE ($lines lines)" || echo "THIN ($lines lines)"
}
```

**Minimum lines by type:**
- Component: 15+ lines
- API route: 10+ lines
- Hook/util: 10+ lines
- Schema model: 5+ lines

**Stub pattern check:**

```bash
check_stubs() {
  local path="$1"

  # Universal stub patterns
  local stubs=$(grep -c -E "TODO|FIXME|placeholder|not implemented|coming soon" "$path" 2>/dev/null || echo 0)

  # Empty returns
  local empty=$(grep -c -E "return null|return undefined|return \{\}|return \[\]" "$path" 2>/dev/null || echo 0)

  # Placeholder content
  local placeholder=$(grep -c -E "placeholder|lorem ipsum|coming soon|will be here" "$path" -i 2>/dev/null || echo 0)

  local total=$((stubs + empty + placeholder))
  [ "$total" -gt 0 ] && echo "STUB_PATTERNS ($total found)" || echo "NO_STUBS"
}
```

**Export check (for components/hooks):**

```bash
check_exports() {
  local path="$1"
  grep -E "^export (default )?(function|const|class)" "$path" && echo "HAS_EXPORTS" || echo "NO_EXPORTS"
}
```

**Combine level 2 results:**

- SUBSTANTIVE: Adequate length + no stubs + has exports
- STUB: Too short OR has stub patterns OR no exports
- PARTIAL: Mixed signals (length OK but has some stubs)

#### Level 3: Wired

Check that artifact is connected to the system.

**Import check (is it used?):**

```bash
check_imported() {
  local artifact_name="$1"
  local search_path="${2:-src/}"
  local imports=$(grep -r "import.*$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/