plugins/stv/skills/trace/SKILL.md
STV Phase 2: spec.md -> vertical trace + RED contract tests. Traces every API scenario through all layers with 7-section format and parameter transformation arrows. Supports Delta Specs change tracking for trace evolution over time.
npx skillsauth add 2lab-ai/oh-my-claude traceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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("[email protected]") → 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.mddevelopment
Problem space exploration mode. Stance, not workflow. Read-only codebase investigation before committing to spec. Triggers on 'explore this', 'investigate', 'understand the problem', 'what are we dealing with', 'before we spec this'.
tools
유저의 요구가 불명확할때 트리거. 애매한 요청, 다의적 지시, 범위 불분명한 작업에서 Context Brief를 생성하여 명확화한다.
development
STV Phase 3: Implementation (GREEN) + Trace Verify loop. Implements code to pass contract tests, then verifies implementation matches trace document. Supports non-linear flow — returning to spec/trace when implementation reveals errors in earlier artifacts.
testing
Triggers on "check the PR", "is it implemented per the issue", "compare spec vs implementation", "compare JIRA and PR", "verify", "validate". Final checkpoint before PR merge using 3-dimensional verification (Completeness, Correctness, Coherence).