/stv:workfrom stv
Implements code scenarios from a trace document to make contract tests GREEN while verifying trace conformance. Invoke with trace path and optional scenario IDs for targeted execution.
Ships in stv. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
STV Phase 3: trace.md → GREEN implementation + Trace Verify Write code that passes contract tests, then verify implementation matches the trace document.
Read ${CLAUDE_PLUGIN_ROOT}/prompts/decision-gate.md and apply it to every decision in this workflow.
Sizing Rubric: read ${CLAUDE_PLUGIN_ROOT}/prompts/decision-gate.md (single source — do not duplicate the table here). Sizes (tiny/small/medium/large/xlarge) refer to expected code change (added + deleted).
stv:trace firstscenario_ids were provided (bundle contract from do-work / what-we-have-to-work), the scenario loop operates ONLY on those rows (targetedRows[] → verifyQueue[]); if a provided id is not found in the trace, stop with a targeted-scope mismatch error. If omitted, all unfinished scenarios are in scope.Repeat for each scenario:
for each scenario in scope (scenario_ids if provided, else all unfinished):
1. Re-read the scenario's trace
2. Implement code based on the trace's sections
- FULL trace: all 7 sections (+ Section 0 if present) —
follow Layer Flow parameter transformation rules exactly,
follow Side Effects exactly, follow Error Paths exactly
- COMPACT trace (marker `> Compact trace`): Sections 1/2/6 +
the one-line Layer Flow note + touch exactly the `Files:` list
3. Run contract tests for this scenario
4. if GREEN → next scenario
5. if RED → fix based on trace, re-run (fix against trace)
Trace is the Source of Truth
GREEN one scenario at a time
Side-Effect accuracy
┌─────────────────────────────────────────────┐
│ Primary Gate (fast and stable) │
│ │
│ Trace-Driven Contract/Component Tests │
│ - Happy path, Sad path, Side-effect, │
│ Contract (parameter transformation) tests │
│ - Execution time: seconds to minutes │
│ - Stability: high (minimal external deps) │
│ - PR merge blocking criterion │
│ │
├─────────────────────────────────────────────┤
│ Secondary Gate (minimal count) │
│ │
│ E2E Tests │
│ - Only test what can only be verified in │
│ deployment env (network, permissions, │
│ deployment config, etc.) │
│ - Execution time: minutes to tens of mins │
│ - Stability: low (potentially flaky) │
│ - Pre-deployment check, not merge blocking │
│ │
└─────────────────────────────────────────────┘
Why Contract Tests are the primary gate: E2E tests are slow, fragile, flaky, and require dedicated environments. Contract Tests are fast, stable, and run locally.
After all scenarios are GREEN, verify alignment between trace document and actual implementation.
Before detailed trace verification, run a quick gap detection pass against the original spec:
assumption_injection: Added behavior not in spec?scope_creep: Features beyond what spec asked for?direction_drift: Overall approach diverges from spec intent?missing_core: Any spec requirement not implemented?over_engineering: Abstraction disproportionate to the problem?If gap detected:
Verify each scenario in trace.md against the 7-section criteria. COMPACT scenarios
(marker > Compact trace — granularity rule applied) are verified against Sections
1, 2, 6 + their Files: list only — do not demand the omitted sections:
### Scenario {N} Verify: {title}
**Section 0 — Client Surface (only if the trace has one):**
- [ ] The documented UI event/component actually fires the documented request
- [ ] Client-side transformation rules match (UI.field → Request.field)
- [ ] Response fields are rendered per the trace's return leg (Response.field → UI state/display)
- [ ] Each Section 5 error path produces the documented user-visible display
- [ ] If the client is a separate repo: the client↔API contract is recorded as a CDC boundary, not silently skipped — and `Verified` requires that contract to be validated (CDC tooling run, or a documented manual check against the live client); recording the boundary alone is NOT implementation proof
**Section 1 — API Entry:**
- [ ] HTTP method + route match
- [ ] Auth/authz method matches
**Section 2 — Input:**
- [ ] Request payload fields match
- [ ] Validation rules implemented
**Section 3 — Layer Flow:**
- [ ] Controller: Request → Command transformation rules match
- [ ] Service: Command → Entity transformation rules match
- Domain decision logic matches trace
- Derived values (ID generation, timestamps, etc.) follow trace rules
- [ ] Repository/DB: Entity → Row mapping matches
- Transaction boundaries match trace
- Constraints (FK, UNIQUE, etc.) exist in schema
- [ ] Parameter transformation arrow end-to-end verification
- Request.X → Command.Y → Entity.Z → table.col chain matches
**Section 4 — Side Effects:**
- [ ] All INSERT/UPDATE/DELETE specified in trace exist in code
- [ ] No unexpected DB changes beyond trace
- [ ] Event publishing/cache changes match trace
**Section 5 — Error Paths:**
- [ ] Each error condition → exception type matches
- [ ] Exception → HTTP status mapping matches
- [ ] DB rollback/no-change guaranteed on error
**Section 6 — Output:**
- [ ] Success status code matches
- [ ] Response DTO fields match
**Section 7 — Observability (if applicable):**
- [ ] Log fields included
- [ ] Span naming matches
When a mismatch is found, follow this protocol:
Mismatch found →
1. If trace is wrong (implementation is better):
→ Update trace.md → Update related tests → Re-verify
2. If code is wrong (trace is correct):
→ Fix code → Re-run tests → Re-verify
3. If judgment is difficult:
→ Ask the user
★ Either way, trace and code must always be synchronized.
★ Record modification history in the Trace Deviations section of trace.md.
while (unverified scenarios remain IN SCOPE):
1. Select next unverified in-scope scenario
2. Read code and compare against trace using the 7-section criteria
(COMPACT scenario → Sections 1, 2, 6 + `Files:` list only)
3. Mismatch → apply Mismatch Handling Protocol
4. After fixes, re-run related tests
5. GREEN + trace aligned → mark as Verified
After all in-scope scenarios pass the 7-section verify:
Files: list — across all in-scope scenarios (scenario_ids if provided, else all); files referenced only by out-of-scope scenarios must NOT enter the File Map, or targeted execution silently widens scopegit diff --name-only to confirm modification★ Tests are a subset of the spec. File Map is the full modification surface.
After all scenarios are GREEN + Verified:
## Implementation Status
| Scenario | Trace | Tests | Verify | Status |
|----------|-------|-------|--------|--------|
| 1. {title} | done | GREEN | Verified | Complete |
| 2. {title} | done | GREEN | Verified | Complete |
## Trace Deviations
{Parts that deviated from trace during implementation and reasons. "None" if empty}
## Verified At
{date} — All {N} scenarios GREEN + Verified
## STV Work Complete: {feature}
{N}/{N} scenarios GREEN
Scope: {all | targeted: scenario_ids}
{N}/{N} scenarios Trace Verified
{N} trace deviations (documented in trace.md)
### Test Results
- Total: {N} tests
- Passed: {N}
- Failed: 0
### Files Modified
{modified file list}
### File Map Coverage
- Trace File Map: {N} files
- Modified: {N}/{N}
- Unmodified: {list or "none"}
### Next Steps
- [ ] Code review
- [ ] Commit & PR
Files: list for COMPACT scenarios (File Map 100%)During implementation, you may discover that the trace or spec contains errors, missing scenarios, or wrong assumptions. Going back is not failure — it is the Feedback Loop invariant in action.
During implementation, if:
1. A spec assumption is wrong (business rule doesn't hold)
→ Backtrack to SPEC: re-invoke stv:spec in update mode
2. A trace section is wrong (transformation logic incorrect, missing error path)
→ Backtrack to TRACE: update trace.md in-place + apply Delta Protocol
3. A new scenario is discovered (not in trace)
→ Backtrack to TRACE: add scenario via Delta Protocol (ADDED)
4. The entire approach is wrong (architecture mismatch)
→ Backtrack to SPEC: Update vs New decision tree applies
Is the issue in trace only (implementation detail)?
├── YES → Fix trace.md in-place
│ ├── Apply Delta Protocol (MODIFIED)
│ ├── Update contract tests
│ └── Continue implementation
└── NO → Issue is in spec (requirement/architecture level)
├── Is it a small correction (switching cost < medium)?
│ ├── YES → Fix spec.md + trace.md in-place
│ └── Continue implementation
└── Is it a fundamental change (switching cost >= medium)?
├── Apply Update vs New decision tree
├── If UPDATE → re-invoke stv:spec, then stv:trace
└── If NEW → stop current work, start new spec
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub 2lab-ai/oh-my-claude --plugin stv15 skills in this plugin
/clarifyUse when the user's request is ambiguous — vague asks, polysemous instructions, unclear scope — BEFORE committing to a feature. Two-track loop (one question at a time + parallel codebase exploration) producing a Context Brief that becomes the SSOT for the follow-up work./debugUse when code behaves differently from expectations — 'why does this happen', 'find the bug', 'follow the callstack', symptom reports even without the word debugging. Blackbox methodology: AS-IS/TO-BE confirmation, callstack tracing recorded in a CWD-relative trace file, red-green fix./do-workUse when a trace.md with unfinished scenarios exists and the user wants autonomous implementation — 'continue the work', 'implement the traced feature', or after a bundle was selected. Accepts an explicit bundle contract (trace_path + scenario_ids); scans for ready scenarios only when no contract is given./excalidraw-diagramCreate Excalidraw diagram JSON files that make visual arguments. Use when the user wants to visualize workflows, architectures, or concepts./exploreUse when the problem is vague, the domain unfamiliar, multiple approaches are possible, or the user says 'investigate first' / 'before we spec this'. Read-only stance (not a workflow): no code changes, no mandatory artifacts; exits to spec/debug/clarify/direct implementation when insight crystallizes./new-taskUse when the user gives a vague or high-level feature request that needs decomposition into implementable work — new ideas, '~만들어줘' with implicit requirements, features with multiple possible approaches. NOT for specific 1-2 file changes, obvious bug fixes, quick questions, or when spec/trace already exist (use stv:do-work).Other plugins' skills for the same job