--- name: triage description: Group open tickets into specs, create each spec's tracker group and branch after approval argument-hint: "[ticket-ids | tracker-query | discovery: | grouping]" --- # Spec Triage Group open tickets into specs. After the owner approves, create or find each spec's tracker group, link its tickets, append a `Spec: ` line to each, record the build order, and cut one `spec/` branch per spec from the default branch. This is the only command that forms new groups. It never changes a ticket's status, closes a ticket, or creates, comments on or reopens one. ## Unattended guard Attended only. Read `${CLAUDE_PLUGIN_ROOT}/references/specs/unattended.md`. When a goal is active, make no tracker write, branch or file edit: print the proposal read-only and end with `BLOCKED: spec:triage needs the owner's approval`. When `AskUserQuestion` is unavailable and no goal is active, take that file's wrong-session stop. ## Setup 1. Read `.claude/workflow-config.json`. When it is missing, run the config wizard in `${CLAUDE_PLUGIN_ROOT}/references/adapters/operations.md`. When the configured tracker's block is incomplete, name the missing key and stop. 2. Load the tracker's adapter file (listed in `${CLAUDE_PLUGIN_ROOT}/references/adapters/operations.md`). Every tracker call below goes through its operations. 3. Read `${CLAUDE_PLUGIN_ROOT}/references/specs/layout.md` and `/INDEX.md`. ## Step 1: Read the scope `$ARGUMENTS` is one optional free-form argument. Work out which it is: | Argument | Scope | |----------|-------| | Ticket IDs | Those tickets | | A tracker query | The tickets it returns | | `discovery:` | Tickets whose body says `Discovery: ` | | A grouping ("A, B and C together; D alone") | Those tickets, grouped as given | | Nothing | Open ungrouped tickets: `list-ungrouped`, or all open tickets minus those already in a group | For Jira and Linear, every list applies the `repoScope` filter, so only this repo's tickets are read. GitHub tickets carry their repo, and text tickets live in it. Read each ticket with `read`. For large sets, start `fullstack-dev-skills:code-reader` agents that summarize tickets and return text, all of them in one message so they run together. With no tickets in scope, say so, suggest `discovery:create`, and stop without writing. ## Step 2: Sort out what can't be grouped | Ticket | Handling | |--------|----------| | Closed or done | Excluded and listed | | In another repo (a Project spanning repos, cross-repo work) | Excluded. A ticket spanning repos: propose splitting it, one ticket per repo, through `discovery:create` or the owner | | Real unknowns (nobody can write acceptance criteria yet) | Named by the owner (IDs, a query, a topic or a grouping): grouped like the rest and flagged, suggesting `discovery:create `; `spec:create` marks it Blocked: needs-spec. Found by the no-argument sweep: left ungrouped, with the same suggestion | | Already in a spec that hasn't started | Shown under that spec; moving it needs its own named approval | | Already in a started spec (any Completion Status row past Pending, read from the plan on the `spec/` branch) | Refused: changes to a started spec go through `spec:create`. Say why | | Released (a Released line after its last `Spec:` line, see `references/adapters/operations.md`) | Eligible like an ungrouped ticket; show the old spec and the reason | | Open, in a spec that sits in `completed/`, not released (left by an older `spec:complete`) | Propose releasing it as `spec:complete` Step 7 does (`unlink`, then the Released line), in the same proposal; eligible once approved | | GitHub ticket with a parent issue | Attached only when the owner approves `replace_parent` by name | | Group set but no `Spec:` line, or the reverse | Reported, with the fix in the same proposal | | Grouped under a name that isn't a spec name (an old release group) | Reported; treated as ungrouped only if the owner says so | Flag, never close or skip: no update in `triage.staleDays` (30) days; files the ticket names that no longer exist (`git ls-files`); a merged PR or a completed spec that already mentions it (`gh pr list --state merged --search `, `git grep /completed`). ## Step 3: Propose specs A grouping the owner passed in the argument outranks every signal. Otherwise group by these signals, strongest first, and state the signals behind every grouping: 1. Explicit tracker links: grouping links (a parent issue or an existing group) and dependency links (blocks, relates) 2. A shared discovery topic 3. Shared labels or components 4. Shared files or feature areas, from `INDEX.md` plus a light read of the code 5. Wording Rules: - **Keep every ticket the owner asked about.** Every ticket in scope that the table in Step 2 doesn't exclude goes into a spec. By default the tickets the owner named form one spec, as the earlier build grouped them. Contradictions are `spec:create`'s job: tickets that contradict each other, the code or a settled decision stay in the group, and the proposal flags each contradiction for `spec:create`, whose Readiness marks the tickets Blocked until the owner settles it. Never leave a ticket out because it looks contradictory, unclear or out of place. - **Splits are suggestions.** A split into several specs (by feature area, size or build order) is shown beside the default grouping as a suggestion the owner can take in Step 4, never applied by dropping tickets. A split keeps every ticket in one of its specs. - **One repo per spec.** Refuse a group that would mix repos; propose one spec per repo. - **Names** are kebab-case (lowercase letters, numbers, hyphens), used unchanged for the folder, the branch suffix and the group title. Refuse a name already used in `todo/`, `completed/` or the tracker for a different set of tickets. - **Size:** above `triage.warnAboveTickets` (10) tickets, warn and suggest a split; allow it if the owner keeps it. A spec should fit one goal run. - **Build order:** with several specs, propose an order. Each later spec gets `After: ` naming its predecessor, plus a blocked-by link where the tracker has one. ## Step 4: Approval Show, before any write: - How you read the argument. - Each spec: name, tickets (ID and title), the signals behind it, and its `After:` predecessor. - Flags and exclusions with reasons, the contradictions flagged for `spec:create`, the size warnings and any suggested split. - The exact writes per spec: `ensure-group`, each `link`, each `update` appending `Spec: `, `link-groups`, and the branch `spec/`. Ask with `AskUserQuestion`: approve, edit (rename, move, drop, split, merge, reorder) or cancel. Edits return to this step. Moves out of an unstarted spec and `replace_parent` each need their own yes. ## Step 5: Write On approval, per spec in build order. When the project's `.claude/settings.json` holds the shared "ask" rules from `${CLAUDE_PLUGIN_ROOT}/references/specs/launch.md`, each tracker write raises their permission prompt. When it doesn't, which is usual on a first triage since `spec:create` proposes those rules later, confirm each tracker write with its own `AskUserQuestion` before making it: name the operation, the ticket or group, and the text it writes. A no skips that write and is reported. 1. `ensure-group `: exact name match; when two groups share it, stop and name both. 2. `link` each ticket to the group, skipping tickets already linked to it, so a rerun is idempotent. 3. `update` each ticket: append `Spec: ` when the body doesn't already have it. Never write a path, and never change any other text. 4. `link-groups` for `After:`, best effort; report when the tracker doesn't support it. With the text adapter, `After:` lives where the instructions say, else only in the spec's future `overview.md`. 5. GitHub Projects: add the spec issue and each ticket to the configured Project. 6. Cut the branch from the default branch, never from the current branch, and push nothing: ```bash git fetch origin 2>/dev/null; git branch spec/ origin/ || git branch spec/ ``` 7. Text adapter: check out the spec branch, commit the ticket-file edits there (`docs(): group tickets into spec`, with a `Ticket:` trailer per ticket), then return to the original branch. Local only, no push. When a write fails, stop and report what was written and what wasn't. A rerun with the same input finishes the rest and duplicates nothing. Write no triage record file: the group, the `Spec:` lines and the branch are the record. ## Report ```markdown ## Triage: specs | Order | Spec | Branch | Tickets | After | Group | |-------|------|--------|---------|-------|-------| ### Writes | Spec | Operation | Ticket | Tracker reference | Result | ### Left out | Ticket | Reason | ### Flags | Ticket | Flag | ### Next - `spec:create ` for each spec, in build order ``` [Documentation](https://jeffallan.github.io/claude-skills/workflows/spec-triage/)