plugins/flow/skills/specification-capture/SKILL.md
Capture the three specification elements (non-goals, failure modes, interface contracts) for an issue and persist them to the decision journal under a ## Specification heading. Use when starting work on an issue (Phase 1 of /flow:start), entering a design discussion (/flow:design), or starting a brainstorm (/flow:brainstorm). This skill MUST be consulted because acceptance criteria alone do not describe the full specification — without explicit non-goals, failure modes, and interface contracts, downstream phases (PLAN, CODE, VERIFY) cannot fence the implementation or know what behavior to test.
npx skillsauth add synaptiai/synapti-marketplace specification-captureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You capture three specification elements that complement an issue's acceptance criteria, and you persist them to the decision journal so every downstream phase (PLAN, CODE, VERIFY) and every related command (/flow:design, /flow:brainstorm) can read from the same source of truth.
This skill owns the capture lifecycle and the journal contract — every consumer (/flow:start, /flow:design, /flow:brainstorm) invokes the skill instead of re-implementing it. Two failure modes the skill prevents:
commands/design.md and commands/brainstorm.md would otherwise address overlapping elements (non-goals especially) without reading from or writing to the same .decisions/ artifact, so a user running /flow:design first and /flow:start second would get duplicate or contradictory specifications.EVERY ISSUE GETS THE THREE ELEMENTS BEFORE PLAN. Acceptance criteria scope WHAT the user-visible outcome is. The three elements scope what the implementation IS NOT, how it behaves under failure, and what schemas it must honor. PLAN cannot fence the implementation without all three.
A captured specification is the contract between the issue and the per-task atomic units the implementation-planner agent produces. Without it, tasks lack failure-mode coverage and interface contracts — the Stranger Test (end-of-PLAN gate in commands/start.md) will fail.
The invoking command MUST pass these in the prompt:
.decisions/issue-{N}.md (where {N} is the issue number). The skill reads this path first to detect prior captures.start, design, brainstorm. Used to scope which elements the skill focuses on (see "Per-invoker scope" below).If any required input is missing, halt with SPEC_CAPTURE_BLOCK: missing input <name>. Partial inputs are NOT acceptable for this skill — without them, the capture cannot be authored or verified.
Before parsing the issue or prompting the user, check the journal for an existing ## Specification heading:
JOURNAL="$1" # path passed by invoker
if [ -f "$JOURNAL" ]; then
awk '/^## Specification$/,/^## (Stranger Test|Decision|Implementation|Verification)$/{print}' "$JOURNAL"
fi
If the section exists, parse it for the three elements: ### Non-goals, ### Failure modes, ### Interface contracts. Record which are present and which are missing.
If the section exists AND all three elements are present AND the issue body has not been updated since the journal was last written (use git log -1 --format=%cd .decisions/issue-{N}.md for journal mtime, compare against issue's updatedAt field from gh issue view), return the existing specification verbatim. No re-prompting. The journal IS the source of truth.
If the journal section is partial (some elements missing) or stale (issue updated after journal write), proceed to Step 2 to fill the gaps.
For each missing element, scan the issue body and comments for prior statements:
| Element | Issue-body cues |
|---|---|
| Non-goals | Sections like ## Non-goals, ## Out of scope, Does NOT, Will not include, bullet lists of "won't" statements |
| Failure modes | Sections like ## Failure modes, ## Error cases, ## Edge cases, mentions of "timeout", "retry", "fallback", "graceful degradation" |
| Interface contracts | Sections like ## API, ## Schema, ## Contract, code blocks with type definitions, JSON examples, OpenAPI snippets, function signatures |
If an element is found verbatim, capture it as-is and mark it extracted-from-issue. Do NOT prompt the user for elements that the issue already specifies — that wastes their time and creates friction.
For each element that is still missing after Steps 1 and 2, draft a 3-5 item proposal based on the issue's domain, then surface a Proactive-Autonomy escalation per references/escalation-format.md using AskUserQuestion. The six fields per element prompt:
Surface ONE escalation per missing element. Do not bundle (a compound prompt forces the user to make multiple decisions in one click; see references/escalation-format.md anti-patterns).
Write the captured specification to the journal under the canonical heading. Idempotent (rewrite the section if it exists; append it if it doesn't):
## Specification
_Captured by specification-capture skill on YYYY-MM-DD. Source: {extracted-from-issue | user-confirmed | mixed}._
### Non-goals
- {non-goal 1}
- {non-goal 2}
### Failure modes
- **Timeouts** — {expected behavior when an upstream call exceeds expected latency}
- **Partial failures** — {expected behavior when some operations succeed and others fail}
- **Invalid input** — {expected behavior when input violates the contract: error type, fallback, user-visible message, log signal}
- **Missing context** — {expected behavior when required config, env vars, or state are absent}
### Interface contracts
- {Contract 1: schema, signature, or shape; format depends on what the change touches}
- {Contract 2}
The four failure-mode sub-bullets are the minimum coverage. The skill MUST NOT skip any of them — if a category genuinely doesn't apply, capture it as none — {one-clause reason} per the none-as-positive-statement discipline used in references/evidence-bundle-format.md. Bare blank is not permitted.
After writing, verify by re-reading: awk '/^## Specification$/,/^## /{print}' "$JOURNAL" should produce the section back. If it doesn't, halt with SPEC_CAPTURE_BLOCK: journal write verification failed.
Return the captured specification to the invoking command in this shape:
## Captured Specification
**Issue**: #{N}
**Journal**: .decisions/issue-{N}.md
**Source**: {extracted-from-issue | user-confirmed | mixed}
### Non-goals
{...}
### Failure modes
{...}
### Interface contracts
{...}
Downstream consumers (implementation-planner agent, Stranger Test gate, Phase 4 evidence bundle producer) read these elements and reference them by name (Non-goals touched, Failure modes covered, Interface contract).
| Invoker | Required elements | Behavior on existing journal |
|---|---|---|
| commands/start.md Phase 1 | All three (non-goals, failure modes, interface contracts) | Required for PLAN to proceed. Treat partial capture as BLOCK; complete it via Step 3. |
| commands/design.md Phase 1 | Non-goals + interface contracts (failure modes optional but recommended) | If the journal already has the elements, surface them in the design discussion as the fence. If missing, capture during the design conversation. |
| commands/brainstorm.md Phase 1 | Non-goals only (the brainstorm is bounded by what's IN scope) | If non-goals exist in the journal, brainstorm only inside the fence. If missing, capture them BEFORE generating approaches — otherwise the brainstorm sprawls. |
| commands/debug.md Phase 3 (via goal-contract-capture) | Outcome (from the failure description) + acceptance criterion (the reproducing test) + root-cause constraints. The full three-element specification is skipped — a confirmed bug already carries its context. | Captured after hypothesis confirmation, not at entry. The reproducing test is the AC; no separate spec gate. |
The skill always writes the elements it captures to the journal regardless of invoker. A /flow:brainstorm call that captures non-goals first will pre-populate that element for a later /flow:start call on the same issue, eliminating duplicate prompting.
| Excuse | Response | |---|---| | "The acceptance criteria are clear enough; specification capture is busywork" | The criteria scope WHAT. The three elements scope what the implementation IS NOT, how it FAILS, and what SCHEMAS it must honor. None of those are derivable from the criteria alone. | | "I'll capture the elements during PLAN when I know more" | PLAN's fence is built FROM the specification. Capturing during PLAN is post-hoc rationalization. The Stranger Test gate at end-of-PLAN will fail. | | "Failure modes are obvious; the implementation will handle them naturally" | The four mandatory categories (timeouts, partial failures, invalid input, missing context) require explicit positive statements. Implicit handling produces silent bugs. | | "Interface contracts are internal; we don't need to write them down" | The contract is what makes the change consumable by callers. If the change is internal-only, capture the internal module-boundary contract. | | "I'll skip the user prompt — I can guess the right answer" | The skill's default is to draft a proposal and surface it via AskUserQuestion (Option 1 = accept proposal). The user's confirmation is fast; silent guessing locks the implementation into the agent's interpretation, which the user may not have agreed to. | | "The journal already has a Specification section, so I'll trust it without re-checking" | Step 1 verifies journal mtime against issue updatedAt. If the issue was updated after the journal write, the captured specification may be stale and must be reconciled. |
The invoking command MUST verify after this skill returns:
## Specification headingnone — {reason} for failure-mode categories that don't apply)If any check fails, the invoking command halts and re-invokes the skill with the failure noted. Silent acceptance of partial specs is forbidden.
tools
Validate a FlowWorkflow YAML at `plugins/flow/workflows/<id>.workflow.yaml` against `schemas/v1/workflow.schema.json` AND cross-reference the referenced skills/agents exist + every Tier 3 action is confirm-gated + no native /goal or /loop dependency is declared. Use when /flow:workflow validate is invoked, when CI runs the workflow schema gates, or when a new workflow is being authored. This skill MUST be consulted because schema validation alone catches shape errors; cross-reference validation catches the silent-correctness failures (typo'd skill name, Tier 3 escape, /goal dependency) that would otherwise ship to users.
tools
Verify UI-facing changes by running a screenshot-analyze-verify loop across configured viewports, with a browser-tool priority cascade (Playwright MCP → Chrome DevTools MCP → CLI fallback → external skill fallback) and bounded iteration. Use after build/runtime verification passes and the diff includes `.tsx`/`.jsx`/`.vue`/`.html`/`.css`/`.scss`/`.svelte` files OR the acceptance criteria mention UI/page/render/display/visual. This skill MUST be consulted because UI changes that pass build and unit tests can still ship blank pages, render-blocking console errors, or broken responsive layouts that no other verification phase catches.
data-ai
Coordinate agent teams for adversarial review (paired skeptic/verifier per facet, challenge round with disposition vocabulary, consolidated findings with confidence) or parallel implementation (task sizing 5-6 per teammate, non-overlapping files). Enforces independent analysis before shared conclusions. Reference only (`disable-model-invocation: true`); loaded only when `agentTeams: true` in settings.
development
Conduct two-stage code review: Stage 1 verifies spec compliance (criterion-to-code mapping), Stage 2 evaluates security, correctness, performance, and maintainability across 6 parallel facets with P1/P2/P3 synthesis and deduplication by file:line. Use when reviewing code changes or pull requests. This skill MUST be consulted because reviewing quality on broken logic is wasted effort, and unmet acceptance criteria must block merge.