/stv:tracefrom stv
Generates vertical traces and RED contract tests from a spec.md, tracing each scenario from API entry to DB with parameter-level granularity. Updates existing traces via Delta Protocol.
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 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:
Files: list (File Map source) and opens with the marker line > Compact trace — granularity rule appliedDocument 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]
### 0. Client Surface [Conditional — MANDATORY when the feature has a UI/client]
- Entry: [screen/component + user action that fires the request]
- Client transformation: UI.fieldA → Request.fieldA (client-side formatting/validation)
- Response rendering: Response.field → UI state/display (the return leg of the round trip)
- Error display: each Section 5 error path → what the user sees
- Boundary: if the client lives in a separate repo, record client↔API as a CDC boundary
(contract defined here; the client repo owns its own trace)
### 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"
}
path/to/repository.ext — role (e.g. repository implementation)path/to/migration.sql — role (e.g. schema/migration)path/to/entity.ext — role (e.g. ORM entity/model)Files: list.){
"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
When Section 0 exists, extend the chain to the client on both legs: `UI.fieldA → Request.X → Command.Y → Entity.Z → table.col` and the return leg `table.col → Entity → Response.field → UI.render`. A trace that starts at API Entry lets a surface-only client fake the feature; the round trip is closed only when the client leg is specified.
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."
## Granularity Rule — Full vs Compact Trace (single source; README FAQ defers here)
Write a FULL trace (all sections) when ANY of: parameter transformations exist, DB
side-effects exist, error paths branch, or a client surface exists. A COMPACT trace
is allowed for simple read-only flows (e.g. an unfiltered list GET with no
transformation). When in doubt, full.
A COMPACT trace contains exactly:
- the opening marker line `> Compact trace — granularity rule applied`
- Sections 1 (API Entry), 2 (Input), 6 (Output)
- a one-line Layer Flow note
- a mandatory `Files:` list (backtick-quoted paths the scenario touches, with roles) —
this substitutes for Section 3c/4 as the File Map source, so the do-work/work
File Map gate applies to compact scenarios unchanged
Downstream gates are compact-aware: work implements and verifies a compact scenario
against Sections 1, 2, 6 + its `Files:` list only (no 7+1-section demand), and File
Map extraction reads `Files:` where Sections 3c/4 are absent.
Complete compact-trace fixture (a conforming compact scenario traverses trace
acceptance → do-work `Files:` extraction → work implementation/conformance →
Verified/Complete with no other sections):
```markdown
## Scenario 4 — Partner list query
> Compact trace — granularity rule applied
### 1. API Entry
- GET /api/partners · Auth: bearer, role=admin
### 2. Input
- Query: none (unfiltered list)
Layer Flow: Controller → Service passthrough → Repository `SELECT * FROM partner ORDER BY created_at DESC` (no transformation, no side effects).
### 6. Output
- 200, `[{ "id", "companyName", "email", "createdAt" }]`
Files:
- `src/api/PartnerController.cs` — list endpoint
- `src/services/PartnerService.cs` — passthrough query
Contract Tests (RED): `PartnerList_HappyPath` (Happy Path, §6)
Implementation Status row: `| 4. Partner list query | done | RED | — | Ready |`
→ after work: tests GREEN, both Files: entries in `git diff`, conformance §1/§2/§6 ✓
→ `| 4. Partner list query | done | GREEN | Verified | Complete |`
Derive tests from each scenario in the trace document.
| 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) |
RootPartnerCreate_HappyPath// Trace: Stage 1, Section 3 — Layer Flow, Controller→Service transformation
// Request.contactEmail("[email protected]") → Command.ContactEmail → Entity.Email → partner.email
// Transformation rule: lowercase conversion
docs/{feature}/trace.md — Vertical Trace document# {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 | Verify | Status |
|----------|-------|-------|--------|-------|
| 1. {title} | done | RED | — | Ready |
| 2. {title} | done | RED | — | Ready |
## Delta Log
{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 Protocol to maintain change history.
Append a ## Delta Log section at the end of trace.md. ("Delta Log" is the section heading; "Delta Protocol" refers to the change-tracking procedure below.) Each evolution is a dated entry with typed changes:
## Delta Log
### {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}
Scenario | Trace | Tests | Verify | Status; a missing Verify column is a schema mismatch to fix, not a variantWhen 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.mdWhat 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