From stv
Generates vertical traces and RED contract tests from spec.md, tracing API scenarios through layers (API→Handler→Service→DB) with parameter transformations. Supports delta updates for spec changes.
npx claudepluginhub 2lab-ai/oh-my-claude --plugin stvThis skill uses the workspace's default tool permissions.
> STV Phase 2: spec.md → `docs/{feature}/trace.md` + RED contract tests
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 2: spec.md →
docs/{feature}/trace.md+ RED contract tests Traces each scenario from API entry → Handler → Service → DB at parameter-level granularity, then derives contract tests from the trace.
Read ${CLAUDE_PLUGIN_ROOT}/prompts/decision-gate.md and apply it to every decision in this workflow.
Apply this gate to every decision. switching cost < small → autonomous judgment, == small → autonomous decision + report, >= medium → ask the user.
stv:spec firstInterview to confirm the concrete flow for each scenario. Apply Decision Gate: tiny/small → autonomous judgment, medium+ only → ask.
If a trace.md already exists for this feature:
Document the complete call stack per scenario in 7-Section Vertical Trace Minimum Field Spec format.
Format is flexible (Markdown, YAML, JSON, etc.), but if any of the following fields are missing, bugs can hide in the gaps. All sections must be included.
## Trace: [Scenario Name]
### 1. API Entry
- HTTP Method: [GET/POST/PUT/DELETE/PATCH]
- Path: [/api/resource]
- Auth/AuthZ: [Required permissions or auth method]
### 2. Input (Request)
- Request payload:
```json
{
"field1": "type (required/optional) - description",
"field2": "type (required/optional) - description"
}
{
"id": "generated ID",
"field1": "original or transformed value",
"createdAt": "ISO 8601"
}
### Parameter Transformation Arrows (MANDATORY)
**All Layer Flows must explicitly specify parameter transformation arrows:**
Request.X → Command.Y → Entity.Z → table.col
Without these arrows, bugs in the parameter transformation process can be missed.
No future-tense expressions like "will implement." Use present/definitive tense: "transforms," "maps to," "converts."
### Required content in each trace
1. **API Entry** — HTTP method, path, auth/authz
2. **Input** — Request payload + validation rules
3. **Layer Flow** — Including parameter transformation arrows, per-layer flow
4. **Side Effects** — DB INSERT/UPDATE/DELETE, events, cache
5. **Error Paths** — Condition → error → HTTP status
6. **Output** — Success response schema
7. **Observability** — Logs, traces, metrics (optional)
## Phase 4: Contract Tests (RED)
Derive tests from each scenario in the trace document.
### Test Categories
| Category | Derived from trace | Test form |
|----------|-------------------|-----------|
| **Happy Path** | Normal flow Request→Response + Side Effects | Input → Expected Output + DB state change verification |
| **Sad Path** | Error Paths (validation failure, auth failure, conflict, etc.) | Invalid input → Expected Error + verify no DB change |
| **Side-Effect** | Side Effects (DB, events, cache) | Independent verification of state changes after invocation |
| **Contract** | Layer Flow parameter transformation rules | End-to-end transformation chain verification (Request→DB) |
### Test Writing Rules
1. **Reflect trace scenario name in test class/method name**
- Trace: "Stage 1 — Root Partner Creation" → Test: `RootPartnerCreate_HappyPath`
2. **Include trace reference comment in each test**
// Trace: Stage 1, Section 3 — Layer Flow, Controller→Service transformation
3. **Confirm RED state** — Verify all tests fail
4. **Contract tests verify parameter transformation arrows end-to-end through DB**
// Request.contactEmail("UPPER@CASE.COM") → Command.ContactEmail → Entity.Email → partner.email // Transformation rule: lowercase conversion
## Phase 5: Output
### Output Files
1. **`docs/{feature}/trace.md`** — Vertical Trace document
2. **Test files** — RED contract tests in the project's test directory
### trace.md Structure
```markdown
# {Feature Name} — Vertical Trace
> STV Trace | Created: {date}
> Spec: docs/{feature}/spec.md
## Table of Contents
1. [Scenario 1 — {title}](#scenario-1)
2. [Scenario 2 — {title}](#scenario-2)
...
---
## Scenario 1 — {title}
### 1. API Entry
- HTTP Method: {method}
- Path: {path}
- Auth/AuthZ: {auth}
### 2. Input
- Request payload:
{payload schema}
- Validation rules:
{validation rules}
### 3. Layer Flow
#### 3a. Controller/Handler
- Transformation: Request.X → Command.Y
- {class.method, file:line}
#### 3b. Service
- Domain decisions: {business rules}
- Transformation: Command.Y → Entity.Z
- Derived: {computed fields}
#### 3c. Repository/DB
- Transaction: {boundary}
- Mapping: Entity.Z → table.column
### 4. Side Effects
- DB INSERT: {table} ({columns})
- {other side effects}
### 5. Error Paths
| Condition | Error | HTTP Status |
|-----------|-------|-------------|
| ... | ... | ... |
### 6. Output
- Success: {status code}
- Response: {response schema}
### 7. Observability [Optional]
- Logs: {log fields}
- Spans: {span naming}
### Contract Tests (RED)
| Test Name | Category | Trace Reference |
|-----------|----------|-----------------|
| {test method} | Happy Path | Scenario 1, Section 3 |
| {test method} | Sad Path | Scenario 1, Section 5, Error 1 |
| {test method} | Side-Effect | Scenario 1, Section 4 |
| {test method} | Contract | Scenario 1, Section 3, Request.X→table.col |
---
## Auto-Decisions
{Content autonomously decided via Decision Gate}
## Implementation Status
| Scenario | Trace | Tests (RED) | Status |
|----------|-------|-------------|--------|
| 1. {title} | done | RED | Ready for stv:work |
| 2. {title} | done | RED | Ready for stv:work |
## Changelog
{Change history when trace is updated. Empty on initial creation.}
## Next Step
→ Proceed with implementation + Trace Verify via `stv:work`
When an existing trace.md needs updating (new requirements, changed scenarios, removed features), apply the Delta Specs protocol to maintain change history.
Append a ## Changelog section at the end of trace.md. Each evolution is a dated entry with typed changes:
## Changelog
### {date} — {summary}
#### ADDED Scenarios
- **Scenario N — {title}**: {reason for addition}
- Linked spec requirement: {requirement reference}
- Contract tests: {test names added}
#### MODIFIED Scenarios
- **Scenario M — {title}**: {what changed and why}
- Before: {brief description of previous behavior}
- After: {brief description of new behavior}
- Affected sections: {list of 7-section parts that changed}
- Contract tests updated: {test names}
#### REMOVED Scenarios
- **Scenario K — {title}**: {reason for removal}
- Migration: {what replaces this, or "N/A — feature deprecated"}
- Contract tests removed: {test names}
#### RENAMED Scenarios
- **FROM**: Scenario J — {old title}
**TO**: Scenario J — {new title}
Reason: {why renamed}
When stv:work encounters a trace with MODIFIED scenarios (Status: "Trace Updated — Re-verify needed"):
When stv:work encounters ADDED scenarios:
Skill(skill="stv:work") or guide user to use stv:work docs/{feature}/trace.md