Manual trace-through verification for code, skills, workflows, and documents - catch logic errors that automated testing misses
Manual trace-through verification to catch logic errors that automated testing misses. Based on industry best practices:
When to use:
/trace code:<file>/trace code:<file>/trace operates in 4 domain modes:
| Mode | Description | When to Use |
|---|---|---|
| code | Resource management, exception paths, race conditions | File I/O, locking, concurrency |
| skill | Intent detection, tool selection, fallback logic | Skill development, /av analysis |
| workflow | Step dependencies, error handling, rollback | Flow verification, orchestration review |
| document | Consistency, completeness, cross-references | Doc review, CLAUDE.md verification |
TRACE reports include automatic visualization generation: Mermaid flowcharts, call graph recommendations (pyan), program slicing recommendations, and pre-built templates.
See references/visualization-features.md for full details on all 4 visualization types and usage instructions.
TRACE integrates with debugRCA for enhanced root cause analysis: evidence saturation detection, red flag detection, ACH scenario generation, timeline visualization, call graph hypothesis generation, CKS findings persistence, and differential TRACE.
See references/debugrca-integration.md for all 7 integration features with code examples and benefits table.
Extract domain and target from invocation:
/trace code:src/handoff.py -> domain=code, target=src/handoff.py
/trace skill:skill-development -> domain=skill, target=skill-development
/trace workflow:flows/feature.md -> domain=workflow, target=flows/feature.md
/trace document:CLAUDE.md -> domain=document, target=CLAUDE.md
Default invocation (no domain specified):
.py file -> code domainSKILL.md -> skill domainflows/ -> workflow domaindocument domainADAPTERS = {
'code': CodeTracer,
'skill': SkillTracer, # Future: Extension point
'workflow': WorkflowTracer, # Future: Extension point
'document': DocumentTracer, # Future: Extension point
}
CRITICAL: Read the target file before creating trace tables.
For each target, define 3 scenarios:
| Step | Operation | State/Variables | Resources | Notes |
|------|-----------|-----------------|-----------|-------|
| 1 | Initial state | var1=None, var2=[] | fd=None | Setup |
| 2 | Open file | var1=<fileobj> | fd=3 | File opened |
| 3 | Process data | var1=<data>, var2=[1,2,3] | fd=3 | Data processed |
| 4 | Close file | var1=None | fd=None | Cleanup |
Step through the code/content line-by-line:
See references/workflow-and-report-format.md for the full TRACE report template with executive summary, findings format, and results structure.
For /trace requests, execute this workflow:
cd P:/.claude/skills/trace && python __main__.py "domain:target"
# Examples
python __main__.py "code:src/handoff.py"
python __main__.py "skill:skill-development"
python __main__.py "workflow:flows/feature.md"
python __main__.py "document:CLAUDE.md"
Each domain has specific focus areas, trace table columns, checklists, and example invocations.
See references/domain-adapters.md for detailed checklists and trace table formats for all 4 domains (code, skill, workflow, document).
The /code skill Phase 3.5 (TRACE) delegates to /trace code:<file>. The delegation pattern and references to TRACE methodology, templates, and checklists are documented in references/integrations-and-usage.md.
# Code TRACE (fully implemented)
/trace code:src/handoff.py # Manual code trace-through
/trace code:src/handoff.py --template 2 # Use specific template
/trace code:src/handoff.py --no-tot # Disable ToT enhancement
# Skill / Workflow / Document TRACE (extension points - future)
/trace skill:skill-development # Intent detection review
/trace workflow:flows/feature.md # Dependency verification
/trace document:CLAUDE.md # Consistency check
# Auto-detect domain (default behavior)
/trace src/handoff.py # Detects: code
/trace SKILL.md # Detects: skill
/trace flows/feature.md # Detects: workflow
SKILL.md - Skill definition (this file)__main__.py - Entry point with CLI argument parsingcore/tracer.py - Core TRACE methodologycore/state_table.py - State table creationadapters/code_tracer.py - Code TRACE adapter (implemented)adapters/skill_tracer.py - Skill TRACE adapter (extension point)adapters/workflow_tracer.py - Workflow TRACE adapter (extension point)adapters/document_tracer.py - Document TRACE adapter (extension point)templates/TRACE_METHODOLOGY.md - Domain-agnostic TRACE guidetemplates/code/TRACE_TEMPLATES.md - Code TRACE templates (5 templates)templates/code/TRACE_CHECKLIST.md - Code TRACE checklist (100+ checks)templates/code/TRACE_CASE_STUDIES.md - Real-world bug examples| File | Contents |
|---|---|
references/visualization-features.md | Mermaid flowcharts, call graphs, program slicing, templates |
references/debugrca-integration.md | 7 debugRCA integration features with code examples |
references/domain-adapters.md | Domain-specific checklists and trace table formats |
references/workflow-and-report-format.md | Workflow steps, state tables, TRACE report template |
references/integrations-and-usage.md | /code integration, CLI examples, version history |