plugins/flow/skills/goal-contract-capture/SKILL.md
Capture a FlowGoal contract as a project-local `.flow/goals/<id>.goal.yaml` file with outcome, acceptance criteria (with verification commands), specification elements (non-goals, failure modes, interface contracts), constraints, evaluator binding, continuation policy, and lifecycle frontmatter. Use when /flow:start passes the Spec Validation Gate, when /flow:goal create is invoked, or when /flow:review and /flow:address need a completion contract for a PR. This skill MUST be consulted because acceptance criteria alone do not constitute a contract — without an evaluator binding, boundaries, and lifecycle state, downstream phases cannot detect premature completion, the Stop hook cannot enforce evidence, and goals cannot resume across sessions.
npx skillsauth add synaptiai/synapti-marketplace goal-contract-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 produce a FlowGoal contract — a durable completion contract that turns acceptance criteria + specification into a machine-readable, file-backed artifact. This skill is the 5th invoker of the existing specification-capture pattern; it wraps that skill (does NOT replace it) and adds the goal-specific fields needed for evaluator/Stop-hook enforcement.
No /flow:goal create without a complete contract. No .flow/goals/<id>.goal.yaml without an evaluator binding. The contract is the source of truth for the Stop hook and /flow:goal evaluate; gaps here cascade into silent premature completion.
This skill is a wrapper, not a fork:
| Existing skill | What it gives us | What this skill adds |
|---|---|---|
| specification-capture | non-goals, failure modes, interface contracts | the specification block in the goal YAML |
| criterion-verification-map | per-AC verification commands + expected evidence | the objective.acceptance_criteria[].verification_command field |
| evidence-based-development | ASSERTION/EVIDENCE/VERIFIED discipline | the evidence_ref linking the AC back to a FlowEvidence sidecar |
If those skills have already produced their outputs (decision journal manifest entries), this skill reads from them rather than re-asking the user.
The invoking command MUST pass:
issue-{N}, pr-{N}-review, pr-{N}-address, or an ad-hoc slug. Validated against the schema's ^[a-z0-9][a-z0-9-]{0,63}$ pattern.repo, branch, optionally issue and/or pr, optionally a journal path (.decisions/issue-{N}.md).start | goal-create | review | address. Used to choose the right outcome template and the right evaluator.type.Single file: .flow/goals/<id>.goal.yaml conforming to plugins/flow/schemas/v1/goal.schema.json. Written via bin/flow-goal-record.sh (atomic, O_NOFOLLOW-defended).
Plus: one goal-created artifact appended to the linked decision journal via bin/journal-record.sh --type goal-created --metadata goal_id=<id> --metadata source=<src>.
Pre-flight check — refuse if .flow/goals/<id>.goal.yaml already exists and lifecycle.status is not in {cancelled, failed}. Surface the existing goal to the user via the six-field escalation; never silently overwrite an active goal.
Compose metadata:
metadata:
id: <derived-from-invocation>
created_at: <ISO-8601 UTC now>
created_by: <invoking command, e.g. /flow:start>
owner: <git user.email or @me>
Compose scope — from inputs. Set journal to the linked decision journal path. Leave run_id empty until run-state-management wires FlowRun creation.
Compose objective — pull AC text + verification commands from the existing criterion-verification-map output. Each AC is one entry with status: pending and evidence_ref: null initially. The outcome is a one-sentence statement derived from invocation reason:
start → "Issue #{N} is implemented and verified."goal-create → user-supplied via AskUserQuestion.review → "PR #{N} review completed with findings posted or no-finding evidence recorded."address → "All unresolved findings on PR #{N} are resolved, commented, or escalated."Compose specification — lift from specification-capture's journal entries:
non_goals from the ## Specification > ### Non-goals bodyfailure_modes from ### Failure modesinterface_contracts from ### Interface contractsIf any block is empty, raise the six-field escalation per references/escalation-format.md — do NOT silently fill with placeholders.
Compose constraints — default to tdd_required: true, require_all_pass: true, no_calendar_estimates: true, no_tier3_without_confirmation: true. Add denied_paths from settings (flow.goals.denied_paths cascade key); add allowed_paths only if the goal narrows the tier model (e.g., a focused refactor).
Compose evaluator:
evaluator:
type: flow_verdict_judge # hybrid for fuzzy criteria; deterministic for command-only
command: /flow:goal evaluate
judge_agent: goal-evaluator-judge
evidence_bundle_format: plugins/flow/references/evidence-bundle-format.md
denied_context:
- implementation_rationale
- self_review_findings
Compose continuation — defaults: mode: flow_managed, on_incomplete: continue_next_activity, on_blocked: six_field_escalation, on_complete: mark_achieved, max_iterations: <from settings, default 20>.
Compose lifecycle — initial state:
lifecycle:
status: active
current_phase: <derived; start→explore, review→fan-out, address→categorize>
current_activity: <first activity id>
turns_evaluated: 0
last_evaluation:
result: incomplete
reason: "Goal created; evidence not yet collected."
at: <now>
Write atomically — call bin/flow-goal-record.sh with the composed YAML. Verify exit 0; surface stderr on any failure.
Record journal artifact — bin/journal-record.sh --issue {N} --type goal-created --metadata goal_id=<id> --metadata source=<src>.
Verify the artifact — read back .flow/goals/<id>.goal.yaml and validate against the schema (Python jsonschema if available). A schema mismatch here means the skill or the schema is broken; fail hard.
| Invoker | Captures | Skips |
|---|---|---|
| start | All blocks; outcome derived from issue title | nothing |
| goal-create | All blocks; outcome from AskUserQuestion | journal manifest if no issue |
| review | Outcome + AC (= review checklist) + constraints | specification (use issue's existing capture) |
| address | Outcome + AC (= one per unresolved PR comment) + constraints | specification (inherit from review goal) |
bin/flow-goal-record.sh for "speed" — atomicity + symlink defense matters.lifecycle.status: achieved at creation — the only way to achieved is through /flow:goal evaluate.plugins/flow/skills/specification-capture/SKILL.md — read the per-invoker scope table; this skill adds row 5 (goal-create).plugins/flow/skills/criterion-verification-map/SKILL.md — read for the AC verification-command shape.plugins/flow/schemas/v1/goal.schema.json — the canonical schema this skill writes against.plugins/flow/bin/flow-goal-record.sh — atomic writer.plugins/flow/bin/journal-record.sh — for the goal-created manifest artifact.plugins/flow/references/escalation-format.md — six-field escalation for any empty/ambiguous block.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.