/spwf:capturefrom spwf
Pre-phase orchestrator — accepts any input (issue tracker ticket, Slack message, file, or freeform description), classifies it as a bug or a change, then routes to the appropriate path. Bug path runs systematic root-cause investigation and produces todo/BUG-{slug}.md. Change path runs a lightweight qualification check and produces todo/{slug}.md. Both outputs feed /spwf:challenge.
Ships in spwf. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Accept any input, classify it, and produce an ideation file ready for /spwf:challenge.
Lightweight scan of the current git state. Hard warnings interrupt with one confirmation; soft notes print inline and continue. Clean state produces no output — pristine repos see nothing.
BRANCH=$(git branch --show-current)
DEFAULT_BASE=${DEFAULT_BASE:-main}
HAS_BASE=$(git show-ref --verify --quiet "refs/heads/$DEFAULT_BASE" && echo yes || echo no)
DIRTY_COUNT=$(git status --porcelain | wc -l | tr -d ' ')
LAST_COMMIT_DAYS=$(( ($(date +%s) - $(git log -1 --format=%ct 2>/dev/null || date +%s)) / 86400 ))
BEHIND=0
AHEAD=0
ALREADY_MERGED=no
if [ "$HAS_BASE" = "yes" ] && [ "$BRANCH" != "$DEFAULT_BASE" ] && [ "$BRANCH" != "master" ]; then
BEHIND=$(git rev-list --count "HEAD..$DEFAULT_BASE" 2>/dev/null || echo 0)
AHEAD=$(git rev-list --count "$DEFAULT_BASE..HEAD" 2>/dev/null || echo 0)
git merge-base --is-ancestor HEAD "$DEFAULT_BASE" 2>/dev/null && ALREADY_MERGED=yes || true
fi
If the repo has no commits at all (git log fails), skip this step entirely.
| Smell | Detection | Severity |
|---|---|---|
| Working tree has uncommitted changes | DIRTY_COUNT > 0 | Hard |
| Branch is already merged into base (and isn't the base) | ALREADY_MERGED == yes and AHEAD == 0 | Hard — the branch is leftover; new work should probably start fresh |
| Branch is very stale | LAST_COMMIT_DAYS > 30 AND BEHIND > 50 | Hard |
Currently on main / master / base | BRANCH == DEFAULT_BASE or master | Soft note — capture writes ideation only; spec will branch (or run /spwf:branch-rescue if commits already on main) |
| Branch is behind base | BEHIND > 0 (and not already covered by stale rule) | Soft note |
If any hard smells fire, print them stacked under one warning header and ask once:
⚠ Git smells detected:
• Working tree has 3 uncommitted changes
• Branch `old-feature` is already merged into main (29 commits behind)
Continue capture anyway? [Y/n]
Press enter / 'y' to proceed. 'n' aborts capture cleanly with no file written. The warning is one prompt regardless of how many smells fired — don't ask repeatedly.
For each soft note, print one line and continue:
ℹ On `main` — capture writes the ideation file; spec will branch (or run /spwf:branch-rescue if commits already on main).
ℹ Branch `feature/x` is 4 commits behind `main`.
Skip Step 0 entirely (no output, no checks) if:
git rev-parse --is-inside-work-tree non-zero), ORThis keeps brand-new projects and non-git contexts from tripping the smell checks.
Read $ARGUMENTS:
| Input pattern | Action |
|---|---|
| Empty | Ask: "What are you capturing? (issue tracker ticket key, file path, or describe it)" |
Tracker ticket key (e.g. ACAD-42, PROJ-123) or from {tracker} TICKET | Tracker — dispatch to the configured tracker's get_issue per _shared/tracker-dispatch.md |
File path ending .md | File — read existing file |
from slack or input explicitly attributed to a Slack message | Slack — treat body as freeform; record source as slack |
| Anything else | Freeform — treat as-is |
For tracker fetches, extract: summary, description, acceptance criteria, issue type, labels/tags, priority/state.
Fail fast on missing tracker. If the user supplied a ticket-shaped argument and
no tracker is available in this session, stop with the dispatch-resolved error and
do not silently fall back to freeform. "Available" depends on which kind of backend
is configured (see _shared/tracker-dispatch.md):
tracker: youtrack / jira, or unset and one of the MCPs is
configured): available iff the MCP's tools (mcp__youtrack__*,
mcp__atlassian__jira_*, etc.) respond. If neither responds and tracker: is
unset, halt with: "No issue tracker MCP configured. Add YouTrack or Atlassian MCP
in user settings, or set tracker: none in .spwf/tracker.yaml to skip tracker
steps. (For an in-repo tracker, set tracker: beads and install spwf-beadsify.)"tracker: beads and similar): available iff the backend
skill (spwf-beadsify:tracker-backend) is listed in this session. If tracker: beads is set but
spwf-beadsify is not installed, halt with the verbatim error from
_shared/tracker-dispatch.md § "Configured-but-not-installed error".Tracker selection: see _shared/tracker-dispatch.md. The default probe is YouTrack
→ Jira (MCP backends only — skill backends are never auto-probed; they require an
explicit tracker: setting in .spwf/tracker.yaml).
Apply in order — stop at the first confident match.
Bug signals:
Bug (YouTrack Type: Bug / Jira issuetype = Bug)error, exception, crash, traceback, not working, broken, failing, regression, wrong, incorrect, 500, null pointer, undefined is notBUG: or FIX:Change signals:
Feature / Task / Epic / Jira Story / Task / Epic / Improvement)add, implement, build, create, new feature, support, allow, as a userIf ambiguous — ask one question: "Is this something that's broken, or something new to build?" Then route accordingly.
Collect as much of the following as is available:
git log --oneline -20 -- {relevant paths}For multi-component systems, identify at which boundary the failure occurs before assuming a root cause.
Trace backward from the symptom:
git log --oneline -10 -- {file}Document every difference found, however minor.
Find working code structurally similar to the broken code. Compare completely:
Write a single, specific hypothesis:
Hypothesis: {The bug is caused by X, because Y. Evidence: Z.}
Rules:
Before writing the artefact, assess the fix type:
| Fix type | Signals | Recommendation |
|---|---|---|
| Content / config only | Root cause is in database content, CMS page copy, a config file, or an environment variable — no code change required | Direct edit — no spec needed |
| Trivial code fix | Single-line change, obvious typo, missing null check | Fix directly, no spec needed |
| Non-trivial code fix | Multiple files, logic change, risk of regression | /spwf:challenge → Spec → Build |
Record the fix type in the artefact's Rough scope section.
Generate todo/BUG-{slug}.md:
---
source: youtrack | jira | linear | slack | file | scratch
tracker: youtrack # omit if source is slack | file | scratch
ticket: ACAD-42 # tracker-agnostic id; omit if no tracker ticket
created: YYYY-MM-DD
status: ideation
type: bug
---
# BUG: {Title}
## Context
{What is broken: observed behaviour vs expected behaviour}
## Reproduction
{Steps to reproduce consistently; "cannot reproduce" if applicable}
## Root cause hypothesis
{The written hypothesis from Phase 4 — specific and evidenced}
## Evidence
{Stack traces, error messages, relevant git log, working vs broken comparison}
## Affected area
{Files, components, or systems involved}
## Open questions
{What remains unclear; gaps that Challenge will surface}
## Rough scope
{Fix type: content/config only | trivial code fix | non-trivial code fix. What a fix would touch.}
Lightweight check — catch obviously incomplete inputs before Challenge. Four checks:
| Check | Passes when |
|---|---|
| Problem clarity | There is a discernible problem or opportunity being addressed |
| Actor | There is at least one named or implied user/system affected |
| Scope boundary | It is roughly clear what is in scope (even if vague) |
| Motivation | There is a reason this matters (business value, user pain, technical debt) |
If .spwf/priorities.md exists, read it (per ../_shared/project-priorities.md)
and sanity-check Motivation against it: does this serve a stated priority, or
land on the ## Explicit non-goals list? Don't gate on it — a genuinely new
priority is fine — but if the input looks off-mission, surface that as the one
qualifying question rather than waving it through.
For each check that fails, ask one targeted question before continuing — never more than one per message.
Limit: After two clarifying questions, proceed regardless. Record remaining gaps as open questions — Challenge will surface them.
If the input clearly passes all four checks: proceed immediately, no questions.
Generate todo/{slug}.md:
---
source: youtrack | jira | linear | slack | file | scratch
tracker: youtrack # omit if source is slack | file | scratch
ticket: ACAD-42 # tracker-agnostic id; omit if no tracker ticket
created: YYYY-MM-DD
status: ideation
---
# {Title}
## Context
{Problem or opportunity — from description or qualify dialogue}
## What we know
{Concrete facts, constraints, or acceptance criteria from the input}
## Open questions
{Gaps that remain after qualify; may be empty if input was complete}
## Rough scope
{What's in scope; note anything explicitly out of scope}
After writing the artefact, if the source was not an issue tracker (i.e. slack,
file, or scratch), and a tracker is available for this project, ask whether to create
a ticket. The exact wording depends on which backend the tracker resolves to per
_shared/tracker-dispatch.md:
| Backend type | Tracker config | Prompt to user |
|---|---|---|
| MCP (YouTrack / Jira) | tracker: youtrack / tracker: jira (or unset + MCP responds) | "Is there a ticket for this? If not, I can create one — just give me the project key." |
| Skill (Beads via spwf-beadsify) | tracker: beads | "Is there a ticket for this? If not, I can create one in Beads. [Y/n]" (no project key — bd uses the project directory's prefix automatically) |
| None / unavailable | tracker: none, or the configured backend is not available in this session (MCP not responding, skill plugin not installed) | Skip this step entirely — no prompt, no error. The artefact is still written. |
If the user provides a project key (MCP backends) or says yes (skill backends):
create_issue operation per
_shared/tracker-dispatch.md. The dispatch contract is
create_issue(project, title, body):
project; artefact title
as title; ideation file body (Context + What we know, or BUG: Hypothesis +
Evidence) as body.project (Beads ignores it — the prefix
comes from the project directory at bd init time); same title and body.ticket: {ID},
tracker: {tracker-name}) and report the created ticket (URL for MCP backends; for
Beads, just the id — bd show <id> retrieves it locally).If the user says no or skips: proceed without creating a ticket.
Starting capture means work on the ticket has begun, so move it to the
project's start state. Applies whenever a ticket: is now linked — one fetched
in Step 1 or one just created in the Tracker prompt. This is the step the
SPWF lifecycle expects at capture time (stage → Doing); without it the board
silently lies about what's in flight.
Resolve start_state from .spwf/tracker.yaml (default In Progress; kanban /
YouTrack boards typically set Doing) and dispatch set_state per
_shared/tracker-dispatch.md.
| Condition | Action |
|---|---|
No ticket: linked (slack / file / scratch, no ticket created) | Skip silently. |
tracker: none, or start_state: none | Skip silently (opted out). |
Ticket already in start_state, or already in a later state (in-review / done / closed) | Skip — never move a ticket backward. Note "ticket already in {state}". |
| Otherwise | set_state(id="{ticket}", state="{start_state}"). |
Courtesy flip — never blocks capture. The ideation artefact is the deliverable. If the transition fails (auth, network, unknown state name), emit a single soft note and continue — do not halt:
ℹ Couldn't move {ticket} to "{start_state}" ({reason}). Set it manually, or
configure `start_state:` in .spwf/tracker.yaml (or `start_state: none` to skip).
(Contrast with close, whose done_state transition is load-bearing and halts
on failure — see _shared/tracker-dispatch.md.)
Bug path:
✓ Bug artefact created: todo/BUG-{slug}.md
Source: {youtrack ACAD-42 | jira PROJ-123 | slack | scratch}
{Ticket: {ticket} → {start_state} | ticket already {state} | omit if no ticket}
Classified as: bug ({signal that triggered classification})
Hypothesis: {one-line summary}
Fix type: {content/config only | trivial code fix | non-trivial code fix}
Open questions: {count}
Recommended next step:
{if content/config only} → Direct edit — no spec needed. Location: {where to edit}
{if trivial code fix} → Fix directly, then /spwf:retrospective
{if non-trivial} → /spwf:challenge todo/BUG-{slug}.md
Change path:
✓ Ideation file created: todo/{slug}.md
Source: {youtrack ACAD-42 | jira PROJ-123 | slack | file path | scratch}
{Ticket: {ticket} → {start_state} | ticket already {state} | omit if no ticket}
Classified as: change ({signal that triggered classification, or "confirmed by user"})
Qualify: {passed cleanly | 1 question asked | 2 questions asked — {N} gaps remain}
Open questions: {count}
Recommended next step: /spwf:challenge todo/{slug}.md
After the report (and after the tracker prompt if applicable), propose a commit:
Bug path message:
chore: capture bug — {title}
Source: {source}
Signal: {signal that triggered bug classification}
Fix type: {content/config only | trivial code fix | non-trivial code fix}
Hypothesis: {one-line root cause}
{if any notable finding during investigation, e.g. "found recent commit X may have introduced this"}
Change path message:
chore: capture — {title}
Source: {source}
{key qualification decisions or constraints surfaced during capture}
{open questions count if > 0: N open questions remain for challenge}
Show git status, then ask: "Ready to commit? Confirm with 'yes' or edit the message first."
After confirming, run:
git add todo/{slug}.md # or todo/BUG-{slug}.md
git commit -m "{confirmed message}"
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub simon-potter/spwf --plugin spwf38 skills in this plugin
/address-reviewPhase 6.5 — Address Review. Turn review feedback into action. Sources feedback from either a local report file (e.g. {branch}-review.md from /spwf:pr-review or {branch}-self-review.md from /spwf:simplify) or fetched human comments on an open PR/MR. For each item runs READ → VERIFY → EVALUATE → implement-or-push-back, in priority order (blocking → important → nit). Forbids performative agreement ("you're absolutely right"). Use after pr-review, or whenever a reviewer leaves comments./agent-optimiseCross-cutting — Audit both the project .claude/ and personal ~/.claude/ for quality issues. Covers CLAUDE.md scope and length, agent descriptions, skill frontmatter, and settings.json conflicts. Always audits both scopes. Produces a prioritised P1/P2/P3 fix list./approve-planPhase 2 — Approve plan. Reviews the task list from spec for quality (atomicity, testability, clarity), then applies four adversarial lenses (Skeptic, Architect, Minimalist, Security) as advisory input for the human reviewer. Quality issues are blocking; adversarial findings are advisory. Security lens identifies tasks touching auth, billing, user input, or secrets so the builder has explicit awareness before writing those tasks. Presents everything for explicit human go/no-go before building starts./branch-rescueRecovery skill — moves commits that landed on the base branch onto a proper feature branch and resets local base, without touching origin. Resolves the active OpenSpec change, detects the pre-spec base commit (subject-line grep with manual-confirm fallback), performs three local-only safe git operations, and surfaces the force-push command for the user to run manually. Run standalone; pr-create's rescue offer runs the same procedure inline (_shared/branch-management.md §4), because this skill is user-only./briefPhase 1.5 — Explain a planned change before it is built. Runs between spec and approve-plan, so a mismatch costs a conversation rather than a change. Five sections, expanding then summarising — what will be built, why this way, the choices you didn't make, what it touches, and a short summary. Never blocks: it prints, offers one skippable prompt, and returns. Calibrated via .spwf/learner.md. Companion to recap and understand, which teach after the fact; this teaches before. Runs on changes, not bug fixes./buildPhase 3 orchestrator — Full Red-Green-Refactor cycle. For each pending task: invokes write-tests (Red: write failing tests), then opsx:apply (Green: implement via OpenSpec), then run-tests (Verify: confirm green before moving on). Loops until all tasks complete. After all tasks complete, runs opsx:verify (spec sign-off), then recommends simplify (Refactor).