From dm-work
Transform ambiguous specs into implementable work items through adversarial refinement. Use when receiving specs, claiming epics, or starting complex (l/xl) tasks. Use /breakdown for spec→tasks decomposition, /refine for sharpening individual items.
npx claudepluginhub rbergman/dark-matter-marketplace --plugin dm-workThis skill uses the workspace's default tool permissions.
Surface hidden complexity before implementation through adversarial tension. A single reviewer tends toward over-engineering or over-simplification; opposing passes converge on correct scope.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Surface hidden complexity before implementation through adversarial tension. A single reviewer tends toward over-engineering or over-simplification; opposing passes converge on correct scope.
| Trigger | Action |
|---|---|
| Receiving external spec/PRD | /breakdown <spec.md> |
| Claiming an epic | /refine then /breakdown |
| Starting l/xl complexity task | /refine <task-id> |
| Spec feels "clear but big" | Run refinement—hidden complexity likely |
Before any simplification, identify items that must NOT be cut:
| Category | Description | Examples |
|---|---|---|
| Core Workflow | The minimal viable loop | CRUD operations, essential commands |
| Agent Primitives | Flags/features enabling agent autonomy | --json, --range, --auto, structured output |
| User-Requested Features | Explicitly requested by user | Items called out in original spec |
| Token Efficiency | Batch operations, context injection | Bulk APIs, pagination, streaming |
| Structured Output | Machine-parseable output | JSON on all commands, typed responses |
Tag protected items early. The Proposer phase should not propose cutting them.
Goal: Surface ambiguity and tag protected items.
Output: Detailed spec with gaps called out and protected items tagged.
Checkpoint: If significant unknowns remain (scope, architecture, must-have vs nice-to-have), ask 1-3 focused questions before proceeding.
HITL Clarification Protocol: When asking users, use AskUserQuestion with 2-4 concrete options and trade-offs (not open-ended). Structured questions prevent silent assumptions.
Goal: Identify candidates for simplification—propose, don't execute.
The Proposer suggests cuts with confidence levels. It does NOT produce a reduced spec; it produces a list of proposals for the Advocate to argue against.
Output Format:
## PROTECTED (never cut)
- [List items from protected categories with rationale]
## PROPOSED CUTS
### Strong Cut Candidates (high confidence)
- `<item>` — [Rationale: clearly deferrable or unnecessary]
### Moderate Cut Candidates (medium confidence)
- `<item>` — [Rationale: could defer, but note trade-offs]
### Weak Cut Candidates (low confidence, protect carefully)
- `<item>` — [Rationale: seems optional, but may have hidden value]
Key Constraint: Proposer argues for cuts but does NOT execute them. The Advocate reviews each proposal.
Goal: Argue against proposed cuts, restore what matters.
The Advocate receives the Proposer's proposals and responds to EACH one:
Output Format:
## ADVOCATE RESPONSES
### Strong Cuts — Agreed
- `<item>` — Agree: [brief reason]
### Strong Cuts — Contested
- `<item>` — Contest: [why this should stay]
### Moderate Cuts — Agreed
- `<item>` — Agree, defer to phase 2
### Moderate Cuts — Contested
- `<item>` — Contest: [hidden value / future cost of adding later]
### Weak Cuts — Recommendations
- `<item>` — [Keep/Cut with reasoning]
### Cheap Additions Missed
- [Items not in spec that are low-effort, high-impact]
Key Constraint: Advocate argues from the proposals, not from memory. Every proposal gets a response.
Goal: Verify essential scope before synthesis.
Before the Judge produces final output, verify:
| Check | Status | Action if Failed |
|---|---|---|
| Core workflow commands preserved | ✅/❌ | Restore from Phase 1 |
| Agent primitives preserved | ✅/❌ | Restore --json, ranges, etc. |
| User-requested features addressed | ✅/❌ | Review with user |
| Structured output on all commands | ✅/❌ | Add missing |
| Token efficiency considered | ✅/❌ | Review batch/bulk operations |
"Too Thin" Indicators:
--json)? ⚠️If 2+ indicators trigger, return to Phase 3 with guidance to restore scope.
Goal: Produce actionable, externally-reviewable spec with quality gates.
Standalone Context Requirement:
The final spec must be reviewable by an external agent without access to conversation history. Include:
Keep context token-efficient: enough for an external reviewer to assess readiness, not a full project overview.
Sprint Contract — Acceptance Criteria:
Phase 5 MUST produce specific, testable acceptance criteria. These are the contract between the agent doing work and the agent judging it. Vague criteria produce vague evaluation.
Good criteria are observable from outside the code — an evaluator using browser-qa should be able to verify each one by navigating the app, clicking, and checking results.
## Acceptance Criteria
1. User can navigate to /settings and see their profile
2. Email field rejects invalid format with visible error message
3. Save button is disabled while the form is submitting
4. Success toast appears within 2 seconds after save
5. No console errors during the entire flow
6. Settings persist after page reload
After synthesis, write the criteria into the bead:
bd update <id> --design="Acceptance criteria:
1. ...
2. ...
"
This is the sprint contract. The evaluator grades against it. The browser QA skill tests it. Without criteria in the bead, there is nothing to evaluate.
Spec Structure:
## Introduction
[What + Why in 2-3 sentences. If partial: "See Appendix A for project context."]
## Scope
[What's being built]
## Acceptance Criteria
[Testable outcomes — same criteria written to the bead]
## Out of Scope
[Explicit boundaries]
## Appendix A: Project Context (if needed)
[Token-efficient big picture: ~100-200 words max]
Synthesis Quality Check:
| Indicator | Status | Action if Failed |
|---|---|---|
| Commands/features ≥ minimum viable | ✅/❌ | Restore essentials |
| All commands have structured output | ✅/❌ | Add --json flags |
| Agent primitives present | ✅/❌ | Restore ranges, batching |
| User requests addressed | ✅/❌ | Review with user |
| Acceptance criteria testable | ✅/❌ | Add specifics |
| Spec standalone-reviewable | ✅/❌ | Add intro/context |
If 2+ indicators fail, output REVISE with specific gaps—don't ship a thin spec.
Quality Gate:
Not every spec needs all 5 phases:
| Complexity | Refinement |
|---|---|
| xs/s | Skip entirely |
| m | 2-phase (Formalize → Synthesize) |
| l/xl | Full 5-phase |
If the Proposer has no cuts and Advocate has no additions, skip Scope Lock and proceed to Synthesize.
| Level | Description | Refinement? |
|---|---|---|
| xs | Trivial, obvious | No |
| s | Small, well-understood | No |
| m | Some unknowns | 2-phase |
| l | Significant unknowns | 5-phase |
| xl | Many unknowns | 5-phase |
Rule of thumb: If you can't describe implementation in 2-3 sentences, it's l or higher.
/refine <target>Runs 5-phase refinement on a bead or spec file.
refined label/breakdown <target>Decomposes epic/spec into tasks. Also serves as the planner entry point — if given a vague brief instead of a refined spec, it refines first, then decomposes.
Vague-on-HOW principle: When decomposing, be ambitious about WHAT each task delivers but not prescriptive about HOW it's implemented. Granular implementation specs cascade errors — if you lock in a wrong library choice or API design at decomposition time, every dependent task inherits it. Let each task discover its own optimal implementation path when claimed.
Good: "Profile form component that edits name, email, avatar with client-side validation" Bad: "React component using useForm hook with Zod schema and shadcn/ui Input components"
Acceptance criteria per bead: Each child bead MUST have testable acceptance criteria written via bd update <id> --design="Acceptance criteria: 1) ... 2) ...". These are the sprint contracts. The evaluator grades against them. Vague criteria = vague evaluation.
| Task Complexity | Label | Rationale |
|---|---|---|
| xs/s | refined | Obvious enough to implement |
| m/l/xl | needs-refinement | Review at claim time |
Tasks get:
parent-child dep to source epicblocks for sequential dependencies--design field)# Find work needing refinement
bd list --labels needs-refinement
# Find refined work ready to implement
bd ready --labels refined
# Find epics needing breakdown
bd list --type epic --labels needs-breakdown
A spec is refined when:
Each phase agent receives only previous output + goals, not internal reasoning. This prevents self-reinforcing mistakes. The Proposer shouldn't remember why the Analyst included something—it should propose cuts from scratch. The Advocate shouldn't remember the Proposer's reasoning—it should challenge each proposal independently.
For examples and extended reference material, see:
references/examples.md — Before/after refinement examples