From stv
Implements code from trace.md to pass contract tests (GREEN), verifies against trace document, and supports non-linear flow back to spec/trace for fixes.
npx claudepluginhub 2lab-ai/oh-my-claude --plugin stvThis skill uses the workspace's default tool permissions.
> STV Phase 3: trace.md → GREEN implementation + Trace Verify
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.
STV Phase 3: trace.md → GREEN implementation + Trace Verify Write code that passes contract tests, then verify implementation matches the trace document.
stv:trace firstRepeat for each scenario:
for each scenario in trace.md:
1. Re-read the scenario's trace
2. Implement code based on the trace's 7 sections
- Follow Layer Flow parameter transformation rules exactly
- Follow Side Effects exactly
- Follow Error Paths exactly
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:
### Scenario {N} Verify: {title}
**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 exist):
1. Select next unverified scenario
2. Read code and compare against trace using 7-section criteria
3. Mismatch → apply Mismatch Handling Protocol
4. After fixes, re-run related tests
5. GREEN + trace aligned → mark as Verified
After all scenarios pass the 7-section verify:
git 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
{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
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