wtf.refine
Refine
Update an existing Epic, Feature, or Task issue based on new insights. Core value: merges insights from any source, determines exactly which sections change, re-runs only the validations those changes require, shows you a precise diff before touching anything, and cascades to children so nothing goes stale.
Process
0. GitHub CLI setup
Run steps 1–2 of ../references/gh-setup.md (install check and auth check). Stop if gh is not installed or not authenticated. Note whether the extensions are available — they are used in step 1 (hierarchy fetch) and step 9 (cascade).
Skip this step if gh-setup was already confirmed this session.
1. Identify the issue and its hierarchy
If an issue number was passed in as context or a CLI argument, use it directly. Otherwise call AskUserQuestion (per ../references/questioning-style.md):
- question: "Which issue are you refining?"
- header: "Issue"
- options: from recently-updated open issues across all WTF labels (epic, feature, task), inferred from:
gh issue list --label "epic,feature,task" --state open --json number,title,labels --limit 10
Fetch the issue:
gh issue view <issue_number> --json number,title,body,labels,comments,updatedAt
Detect the issue type from its labels:
- Has label
epic→ type = Epic - Has label
feature→ type = Feature - Has label
task→ type = Task - None of the above → call
AskUserQuestion(per../references/questioning-style.md):- question: "I couldn't detect the type from the labels. What kind of issue is this?"
- header: "Issue type"
- options: Epic / Feature / Task
Fetch the hierarchy for context and cascade planning:
# Parent (always fetch — needed for context)
gh sub-issue list <issue_number> --relation parent
# Children (needed for cascade planning in step 9)
gh sub-issue list <issue_number>
For the parent issue, fetch its body to extract goal, bounded context, and success metrics — these inform whether a change in the child conflicts with the parent's intent.
2. Gather insights from all sources
Merge insights from every available source into a single consolidated list. Process all sources in parallel:
a. CLI argument / conversation context
If the user passed insight text in the invocation (e.g. refine #42 "scope changed — exclude mobile"), treat that as the primary insight. If nothing was passed, call AskUserQuestion (per ../references/questioning-style.md):
- question: "What changed or what new insight should I incorporate?"
- header: "Insight"
- options: from plausible changes inferred from recent issue comments (e.g. the last comment's key point)
b. GitHub comments since last body edit
Extract comments posted after the issue body was last edited:
gh issue view <issue_number> --json comments,updatedAt \
--jq '.updatedAt as $bodyUpdatedAt | .comments[] | select(.createdAt > $bodyUpdatedAt) | "[\(.author.login)] \(.body)"'
Read each comment and extract actionable insights — discard discussion noise ("+1", "agreed", "thanks"). Synthesise into concrete change signals (e.g. "Stakeholder comment: settlement must support multi-currency").
c. Referenced files
If the user referenced any file paths or URLs in the CLI argument or conversation, read them now:
- File paths → use the Read tool
- URLs → use the WebFetch tool (if available) or ask the user to paste the relevant content
Extract the relevant change signals from each document.
d. Consolidate
Merge all signals into a numbered list of insights. Present them briefly to the user:
"I found [n] insight(s) to incorporate:
- [insight summary]
- [insight summary] ..."
Call AskUserQuestion (per ../references/questioning-style.md):
- question: "Does this capture everything you want to incorporate?"
- header: "Insights"
- options:
- Yes — proceed → continue with these insights
- Add more → I have additional context to provide
- Remove one → some of these aren't relevant
Apply any adjustments before continuing.
3. Classify the changes
For each insight, determine which sections of the issue it affects and what type of change it is. This classification drives which validations run in step 4 and which sections are rewritten in step 5.
Change types and their affected sections:
| Change type | Affected (Epic) | Affected (Feature) | Affected (Task) |
|---|---|---|---|
| Scope narrowed / expanded | Goal, Success Metrics, Feature Breakdown | ACs, Edge Cases, Proposed Tasks | Gherkin, Functional Description |
| New constraint | Risks, Bounded Context | ACs, Edge Cases, Rollout | Contracts, Observability, Rollout |
| Domain language correction | Context, Goal, Bounded Context | Capability name, User Stories, ACs | Gherkin steps, Contracts |
| New stakeholder / actor | Context, Goal | Capability name, User Stories | — |
| New domain event | — | Domain Events | Gherkin (When steps), Contracts |
| Technical constraint | — | Edge Cases | Contracts, Technical Approach |
| Deadline / priority | Risks | — | — |
Produce a change map — a structured internal summary:
Change map:
scope changed: yes
DDD language changed: no
ACs changed: yes
Gherkin affected: yes (because ACs changed)
Contracts affected: no
Sections to rewrite: [Goal, Success Metrics] / [ACs, Edge Cases] / [Gherkin, Functional Description]
4. Re-run relevant validations only
Using the change map from step 3, run only the validations that apply. Skip the rest — do not re-validate unchanged sections.
Scope changed → Vertical slice + Scope gate
Re-run both stages defined in ../references/scope-gates.md on the refined intent, then on the rewritten sections. The per-level split signals live in the matching write-* skill:
- Epic →
wtf.write-epicstep 7 - Feature →
wtf.write-featurestep 9 - Task →
wtf.write-taskstep 9
If a split signal fires on the refined issue, present it as a refinement concern (not a blocker). Use the same keep / split / stop ask the write-* skill uses (see ../references/scope-gates.md).
Domain language changed → DDD Language Guard
Re-run the checks from ../references/ddd-writing-rules.md on any section whose text is being rewritten. Flag and correct violations silently; note corrections in the diff (step 5).
ACs changed (Feature or Task) → Gherkin re-derivation
If Feature ACs changed, mark the Proposed Tasks section as potentially stale — note which tasks may need re-scoping. Do not automatically update child Tasks here; that is handled in step 9 (cascade).
If Task ACs changed, re-derive only the Gherkin scenarios that map to the changed AC(s). Keep unchanged scenarios exactly as they are.
5. Draft the section updates and show a diff
Produce the updated content for each section in the change map. Do not touch sections that are not in the change map.
Present a section-by-section before/after diff for every changed section. Format each section's diff as:
## [Section name]
BEFORE:
[original text]
AFTER:
[updated text]
Then call AskUserQuestion (per ../references/questioning-style.md):
- question: "Does this diff look right?"
- header: "Diff review"
- options:
- Looks good — apply it → write the changes to the issue
- I have corrections → adjust one or more sections
- Start over → the insights were wrong; re-describe what changed
Apply any corrections, then proceed.
6. Lifecycle label check
Check the current labels on the issue:
gh issue view <issue_number> --json labels --jq '.labels[].name'
Stale label rules by change type:
| What changed | Stale labels (Task) | Stale labels (Feature) |
|---|---|---|
| Gherkin scenarios changed | implemented, verified |
— |
| ACs changed | verified |
DoR: "Acceptance criteria written and reviewed" unchecked |
| Contracts changed | implemented, verified |
— |
| Functional Description changed | — | — |
If any stale labels are present, call AskUserQuestion (per ../references/questioning-style.md):
- question: "The following labels may no longer be accurate after this refinement: [list]. How should I handle them?"
- header: "Stale labels"
- options:
- Strip stale labels → remove the labels that no longer reflect reality (recommended)
- Keep labels as-is → leave labels unchanged; I'll manage them manually
Record the decision for the audit comment in step 8.
7. Apply the changes
Read the current issue body, merge only the changed sections (preserving all unchanged content), and write the updated body:
gh issue view <issue_number> --json body -q .body > /tmp/wtf.refine-<issue_number>-body.md
Use the Edit tool to replace each changed section in /tmp/wtf.refine-<issue_number>-body.md with its updated content. Preserve all other sections verbatim.
gh issue edit <issue_number> --body-file /tmp/wtf.refine-<issue_number>-body.md
If stale labels should be stripped (from step 6):
gh issue edit <issue_number> --remove-label "implemented,verified"
# Only remove labels that were confirmed stale — use the actual list
Print the updated issue URL.
8. Post the audit trail comment
Post a structured comment summarising the refinement:
gh issue comment <issue_number> --body "<audit_comment>"
The audit comment must include:
## Refinement — <YYYY-MM-DD>
**Insights incorporated:**
- [insight 1]
- [insight 2]
**Sections updated:** [comma-separated list]
**Validations re-run:** [scope gate / DDD guard / Gherkin re-derivation — or "none required"]
**Labels affected:** [stripped: implemented, verified — or "none"]
**Children that may need refinement:** [list with issue numbers and reason — or "none identified"]
9. Cascade to affected children
Using the hierarchy fetched in step 1, determine which children are affected by this refinement:
Epic refined:
- Features whose scope overlaps the changed Goal or Success Metrics
- Features listed in the Feature Breakdown that reference changed bounded context terms
Feature refined:
- Tasks whose Gherkin scenarios directly test the changed ACs
- Tasks whose Proposed Tasks checklist entry was modified or removed
Present the affected children as a numbered list. Then call AskUserQuestion (per ../references/questioning-style.md):
-
question: "These child issues may be out of sync with the updated spec: [list]. How would you like to handle them?"
-
header: "Cascade"
-
options:
- Refine each one now → walk through
wtf.refinefor each affected child in order (default) - I'll handle them manually → exit; I'll open each child and update it myself
- Skip → leave children as-is
- Refine each one now → walk through
-
Refine each one now → partition the affected children into conflict-free sub-groups using
../references/conflict-graph.md(sub-groups here play the role of sub-phases). For each sub-group, spawn one sub-agent per child in parallel using the Agent tool, following../references/subagent-protocol.md— readskills/wtf.refine/SKILL.mdat spawn time and paste steps 2 onward into each sub-agent prompt. Pass in the child issue number and the parent insight as pre-loaded context so the user is not re-asked. Wait for all sub-agents in a sub-group to complete (resolving anyNEEDS_INPUTresponses) before starting the next sub-group. After all sub-groups complete, summarise results. -
I'll handle them manually / Skip → exit.
If no children are affected, skip this step entirely.
More from xiduzo/wtf
wtf.write-feature
This skill should be used when a user wants to create a GitHub Feature issue, break down an Epic into user-facing capabilities, write user stories in domain language, or capture what a domain actor can do — for example "create a feature", "write a feature for this epic", "add a feature to an epic", "break this epic into features", "write user stories for this feature", or "describe what this actor can do". Use this skill to write a single Feature; use `wtf.epic-to-features` to generate the full set of Features for an Epic at once. Not applicable to Tasks, Epics, or bug reports.
38wtf.write-task
This skill should be used when a user wants to create a task, write a ticket, decompose a feature into implementable work, break down a story, define a vertical slice for development, or write Gherkin scenarios — for example "create a task", "write a task for this feature", "break this feature into tasks", "define implementation work", or "add a sub-issue to this feature". Guides creation of a GitHub Task issue linked to a parent Feature and Epic, derives Gherkin acceptance scenarios from the Feature's ACs, enforces DDD ubiquitous language in scenarios, and checks for vertical-slice integrity and task dependencies.
38wtf.write-epic
This skill should be used when a user wants to create, draft, or plan a GitHub Epic issue — for example "write an epic", "I want to define a new initiative", "scope out this strategic project", "turn this idea into an epic", "plan work that spans multiple features", or "start from a bounded context". Also use when the user asks to define domain outcomes, capture a large initiative before breaking it into features, or describe work in terms of business goals rather than technical tasks.
38wtf.steer-design
This skill should be used when a team wants to create or refine the design guidelines document — for example "create the design steering doc", "document our design system", "write the design principles", "document our component patterns", "set up the design guidelines", or "update the design doc". Generates docs/steering/DESIGN.md as a living document capturing design principles, the design system, tokens, component patterns, and accessibility standards. Generated once and refined — not regenerated from scratch.
37wtf.reflect
This skill should be used when a developer wants to capture learnings from a difficult session, record what Claude got wrong, save implementation gotchas, or update the steering docs with hard-won knowledge — for example "let's reflect", "capture what we learned", "that was painful, save this", "update the steering docs with what went wrong", "I need to debrief", "what went wrong today", "log this lesson", "save this gotcha", "document this mistake", "I want to write this down before I forget", "add this to the steering docs", or when prompted by the intervention tracker after multiple corrections. Routes each learning into the right steering doc (TECH, QA, DESIGN, or VISION) under a "Hard-Won Lessons" section.
37wtf.verify-task
This skill should be used when a QA engineer wants to test or verify a completed task, run through acceptance criteria, check Gherkin scenarios against the implementation, record pass/fail results, or sign off on a ticket before merge. Triggers on phrases like "verify task #42", "run QA on this issue", "test the acceptance criteria", "sign off on task", "check if this task is ready to merge", "does this task meet its acceptance criteria", "run acceptance tests for task #X", "walk through the Gherkin for task #X", or "I want to test this task".
37