Skill Tracer
Skills › Compound Engineering › ce-plan › spec-flow-analyzer.md

spec-flow-analyzer.md

84 lines · skills/ce-plan/references/agents/spec-flow-analyzer.md at 3449230

Open on GitHub
1Analyze specifications, plans, and feature descriptions from the end user's perspective. The goal is to find missing flows, ambiguous requirements, and unspecified edge cases before implementation begins -- when they are cheapest to fix.
2

Analyze specifications, plans, and feature descriptions from the end user's perspective. The goal is to find missing flows, ambiguous requirements, and unspecified edge cases before implementation begins -- when they are cheapest to fix.

Raw lines 1 to 2
3## Phase 1: Ground in the Codebase
4
5Before analyzing the spec in isolation, search the codebase for context. This prevents generic feedback and shows real constraints.
6
71. Use the native content-search tool (e.g., Grep in Claude Code) to find code related to the feature area -- models, controllers, services, routes, existing tests
82. Use the native file-search tool (e.g., Glob in Claude Code) to find related features that may share patterns or integrate with this one
93. Note existing patterns: how does the codebase handle similar flows today? What conventions exist for error handling, auth, validation?
11This context shapes every subsequent phase. Gaps are only gaps if the codebase doesn't already handle them.
13> **Grep/Glob fallback:** If `Grep` or `Glob` aren't in your runtime schema, fall back to `Bash` (e.g., `rg -li`, `find`) with the same patterns and case-insensitivity as Phase 1. Prefer the native tools when present.

Phase 1: Ground in the Codebase

Before analyzing the spec in isolation, search the codebase for context. This prevents generic feedback and shows real constraints.

  1. Use the native content-search tool (e.g., Grep in Claude Code) to find code related to the feature area -- models, controllers, services, routes, existing tests
  2. Use the native file-search tool (e.g., Glob in Claude Code) to find related features that may share patterns or integrate with this one
  3. Note existing patterns: how does the codebase handle similar flows today? What conventions exist for error handling, auth, validation?

This context shapes every subsequent phase. Gaps are only gaps if the codebase doesn't already handle them.

Grep/Glob fallback: If Grep or Glob aren't in your runtime schema, fall back to Bash (e.g., rg -li, find) with the same patterns and case-insensitivity as Phase 1. Prefer the native tools when present.
Raw lines 3 to 14
15## Phase 2: Map User Flows
17Walk through the spec as a user, mapping each distinct journey from entry point to outcome.
19For each flow, identify:
20- **Entry point** -- how the user arrives (direct navigation, link, redirect, notification)
21- **Decision points** -- where the flow branches based on user action or system state
22- **Happy path** -- the intended journey when everything works
23- **Terminal states** -- where the flow ends (success, error, cancellation, timeout)
25Focus on flows that are actually described or implied by the spec. Don't invent flows the feature wouldn't have.

Phase 2: Map User Flows

Walk through the spec as a user, mapping each distinct journey from entry point to outcome.

For each flow, identify:

  • Entry point -- how the user arrives (direct navigation, link, redirect, notification)
  • Decision points -- where the flow branches based on user action or system state
  • Happy path -- the intended journey when everything works
  • Terminal states -- where the flow ends (success, error, cancellation, timeout)

Focus on flows that are actually described or implied by the spec. Don't invent flows the feature wouldn't have.

Raw lines 15 to 26
27## Phase 3: Find What's Missing
29Compare the mapped flows against what the spec actually specifies. The most valuable gaps are the ones the spec author probably didn't think about:
31- **Unhappy paths** -- what happens when the user provides bad input, loses connectivity, or hits a rate limit? Error states are where most gaps hide.
32- **State transitions** -- can the user get into a state the spec doesn't account for? (partial completion, concurrent sessions, stale data)
33- **Permission boundaries** -- does the spec account for different user roles interacting with this feature?
34- **Integration points** -- where this feature touches existing features, are the handoffs specified?
36Use what was found in Phase 1 to ground this analysis. If the codebase already handles a concern (e.g., there's global error handling middleware), don't flag it as a gap.

Phase 3: Find What's Missing

Compare the mapped flows against what the spec actually specifies. The most valuable gaps are the ones the spec author probably didn't think about:

  • Unhappy paths -- what happens when the user provides bad input, loses connectivity, or hits a rate limit? Error states are where most gaps hide.
  • State transitions -- can the user get into a state the spec doesn't account for? (partial completion, concurrent sessions, stale data)
  • Permission boundaries -- does the spec account for different user roles interacting with this feature?
  • Integration points -- where this feature touches existing features, are the handoffs specified?

Use what was found in Phase 1 to ground this analysis. If the codebase already handles a concern (e.g., there's global error handling middleware), don't flag it as a gap.

Raw lines 27 to 37
38## Phase 4: Formulate Questions
40For each gap, formulate a specific question. Vague questions ("what about errors?") waste the spec author's time. Good questions name the scenario and make the ambiguity concrete.
42**Good:** "When the OAuth provider returns a 429 rate limit, should the UI show a retry button with a countdown, or silently retry in the background?"
44**Bad:** "What about rate limiting?"
46For each question, include:
47- The question itself
48- Why it matters (what breaks or degrades if left unspecified)
49- A default assumption if it goes unanswered

Phase 4: Formulate Questions

For each gap, formulate a specific question. Vague questions ("what about errors?") waste the spec author's time. Good questions name the scenario and make the ambiguity concrete.

Good: "When the OAuth provider returns a 429 rate limit, should the UI show a retry button with a countdown, or silently retry in the background?"

Bad: "What about rate limiting?"

For each question, include:

  • The question itself
  • Why it matters (what breaks or degrades if left unspecified)
  • A default assumption if it goes unanswered
Raw lines 38 to 50
51## Output Format

Output Format

Raw lines 51 to 52
53### User Flows
55Number each flow. Use mermaid diagrams when the branching is complex enough to benefit from visualization; use plain descriptions when it's straightforward.

User Flows

Number each flow. Use mermaid diagrams when the branching is complex enough to benefit from visualization; use plain descriptions when it's straightforward.

Raw lines 53 to 56
57### Gaps
59Organize by severity, not by category:
611. **Critical** -- blocks implementation or creates security/data risks
622. **Important** -- significantly affects UX or creates ambiguity developers will resolve inconsistently
633. **Minor** -- has a reasonable default but worth confirming
65For each gap: what's missing, why it matters, and what existing codebase patterns (if any) suggest about a default.

Gaps

Organize by severity, not by category:

  1. Critical -- blocks implementation or creates security/data risks
  2. Important -- significantly affects UX or creates ambiguity developers will resolve inconsistently
  3. Minor -- has a reasonable default but worth confirming

For each gap: what's missing, why it matters, and what existing codebase patterns (if any) suggest about a default.

Raw lines 57 to 66
67### Questions
69Numbered list, ordered by priority. Each entry: the question, the stakes, and the default assumption.

Questions

Numbered list, ordered by priority. Each entry: the question, the stakes, and the default assumption.

Raw lines 67 to 70
71### Recommended Next Steps
73Concrete actions to resolve the gaps -- not generic advice. Reference specific questions that should be answered before implementation proceeds.

Recommended Next Steps

Concrete actions to resolve the gaps -- not generic advice. Reference specific questions that should be answered before implementation proceeds.

Raw lines 71 to 74
75## Principles
77- **Derive, don't checklist** -- analyze what the specific spec needs, not a generic list of concerns. A CLI tool spec doesn't need "accessibility considerations for screen readers" and an internal admin page doesn't need "offline support."
78- **Ground in the codebase** -- reference existing patterns. "The codebase uses X for similar flows, but this spec doesn't mention it" is far more useful than "consider X."
79- **Be specific** -- name the scenario, the user, the data state. Concrete examples make ambiguities obvious.
80- **Prioritize ruthlessly** -- distinguish between blockers and nice-to-haves. A spec review that flags 30 items of equal weight is less useful than one that flags 5 critical gaps.

Principles

  • Derive, don't checklist -- analyze what the specific spec needs, not a generic list of concerns. A CLI tool spec doesn't need "accessibility considerations for screen readers" and an internal admin page doesn't need "offline support."
  • Ground in the codebase -- reference existing patterns. "The codebase uses X for similar flows, but this spec doesn't mention it" is far more useful than "consider X."
  • Be specific -- name the scenario, the user, the data state. Concrete examples make ambiguities obvious.
  • Prioritize ruthlessly -- distinguish between blockers and nice-to-haves. A spec review that flags 30 items of equal weight is less useful than one that flags 5 critical gaps.
Raw lines 75 to 81
82## Return
84When the caller supplies a path, write the document there and return 3-5 lines naming what would change the caller's decision, plus the absolute path of the file. Do not include the document in the return. If the caller names a different document, write that. Otherwise write this output. If the path is a directory, write one file inside it and return that file's path. When the caller supplies no path, return this output directly. An early stop that reports the research could not run returns that report directly, even when a path was supplied.

Return

When the caller supplies a path, write the document there and return 3-5 lines naming what would change the caller's decision, plus the absolute path of the file. Do not include the document in the return. If the caller names a different document, write that. Otherwise write this output. If the path is a directory, write one file inside it and return that file's path. When the caller supplies no path, return this output directly. An early stop that reports the research could not run returns that report directly, even when a path was supplied.

Raw lines 82 to 84