trace
Skill0 starsChanged 3 months agoMITView on GitHub
Generate bidirectional traceability matrix from spec annotations
28 other projects use a version of this.
Adopted by
Most recently taken up by
- Yeachan-Heo/oh-my-claudecodetheir own version, first seen Nov 9, 2026
- thoughtbot/rails-consultanttheir own version, first seen Nov 8, 2026
- myths-labs/musetheir own version, first seen Nov 6, 2026
- pahlevikun/levistacktheir own version, first seen Nov 1, 2026
- lza6/claw-code-tingfengtheir own version, first seen Nov 1, 2026
- RoleModel/skillstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use ai-slop-cleaner, ralplan and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Jurel89Skillai-slop-cleaner
Clean AI-generated code slop with a regression-safe, deletion-first workflow and optional reviewer-only mode
Also in 4 projects that use this
ibahgatSkillralplan
Create a strict, quality-first execution plan with explicit gates and rollback-ready sequencing.
Also in 4 projects that use this
woosikkimSkilldeepinit
Generate hierarchical AGENTS.md codebase maps for agent context
Also in 3 projects that use this
klauswgSkilldeep-interview
在明确批准执行之前,通过数学化歧义门控进行苏格拉底式深度访谈
Also in 4 projects that use this
AWSSkillmap
Map verified service capabilities against customer-provided control framework and threat model. Produces mapping-results.json, controls-catalog.md, and framework-mapping.md. Supports pluggable frameworks: CCMv4, NIST 800-53, CIS Benchmarks, ISO 27001, etc. Split into 4 focused sub-skills for better accuracy; this skill orchestrates them.
Also in 4 projects that use this
buddyhSkilldeep-dive
Deep dive on any topic. Decomposes into subtopics, researches each in parallel with thorough source gathering, then synthesizes into a comprehensive report (4,000-10,000+ words, 40-100+ sources). Scales depth dynamically based on topic complexity. Use when asked for a deep dive, deep research, comprehensive analysis, or thorough investigation of a topic.
Also in 3 projects that use this
Other versions28 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 28
- Yeachan-Heo/oh-my-claudecode★ 41ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 41ksame name
- zereight/gitlab-mcp★ 2.1ksame name
- ai-analyst-lab/ai-analyst★ 304same name
- Soul-Brews-Studio/arra-oracle-skills-cli★ 121same name
- unlearndev/skills★ 101same name
- petrowsky/agentic-fm★ 96same name
- simota/agent-skills★ 96same name
- mbwsims/claude-universe★ 71same name
- myths-labs/muse★ 38same name
18 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
30 rules. 0 are common, 4 are distinctive, and 26 are very specific to this project.
0
Common
Most of the 24 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
26
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
If $ARGUMENTS is ? or help: Print:
- Distinctive: line 59
Stop — do not execute any further steps.
- Very specific: line 67
If --artifacts is present: set MODE = artifacts.
- Very specific: line 68
If --rebuild is present: set REBUILD = true.
- Very specific: line 70
If MODE is artifacts: jump to Step A1 (Cross-Artifact Relationship Index).
- Very specific: line 78
If SPEC_FILTER is set: only that spec.
- Very specific: line 94
If a spec has no ## Traceability Links section: record it as unlinked (relevant for gap analysis).
- Very specific: line 255
Create docs/compliance/ if it does not exist.
- Very specific: line 256
Add docs/compliance/traceability-*.html and docs/compliance/traceability-*.csv to .gitignore (generated artifacts — markdown is kept for …
- Very specific: line 264
If gaps found: "Next: annotate the flagged specs with ## Traceability Links sections, then re-run /trace."
- Very specific: line 265
If coverage is 100%: "Next: run /close or attach docs/compliance/traceability-YYYY-MM-DD.md to your compliance gate message."
- Very specific: line 266
If no specs have traceability links yet: "Next: add ## Traceability Links sections to your implemented specs.
- Distinctive: line 278
If REBUILD is true: proceed to Step A2 (full rebuild).
- Very specific: line 279
If .forge/state/artifact-links.json does not exist: proceed to Step A2 (initial build).
- Very specific: line 280
If .forge/state/artifact-links.json exists and ARTIFACT_QUERY is set: proceed to Step A4 (query).
- Very specific: line 281
If .forge/state/artifact-links.json exists and ARTIFACT_QUERY is empty: proceed to Step A4 (summary).
- Very specific: line 306
Use case-insensitive matching for the keyword prefix (e.g., spec, Spec, SPEC all match).
- Distinctive: line 322
If a file cannot be read: skip it, log a warning, continue to the next file.
- Very specific: line 323
If a reference pattern is malformed (e.g., Spec abc): skip it silently.
- Distinctive: line 324
Never crash on parse errors — always continue scanning remaining files.
- Very specific: line 350
Write the index to .forge/state/artifact-links.json:
- Very specific: line 360
Create .forge/state/ directory if it does not exist.
- Very specific: line 399
If numeric (e.g., 099 or 99): search for spec-099 (zero-padded to 3 digits).
- Very specific: line 400
If matches SIG-NNN-XX: search as-is.
- Very specific: line 401
If matches CI-NNN, EA-NNN, ADR-NNN: search as-is.
- Very specific: line 402
If matches YYYY-MM-DD-NNN: search for session-YYYY-MM-DD-NNN.
- Very specific: line 425
If no links found for the queried artifact: "No relationships found for <artifact-id>.
- Very specific: line 431
If index was just built: "Artifact index ready.
- Very specific: line 432
If query returned results: "Explore further with /trace --artifacts <related-id> or rebuild with /trace --artifacts --rebuild."
- Very specific: line 433
If no results: "Run /trace --artifacts --rebuild to regenerate, or check that the artifact ID is correct."
“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- forge:paths-note (Spec 575): process-state paths in this command (docs/specs,
docs/sessions, docs/decisions, docs/research, docs/process-kit, docs/backlog.md) are the
CLASSIC-DEFAULT spellings, not fixed locations. When the project configures forge.paths
(e.g. the `contained` layout), resolve each key before use — bash: `forge_path <key>`
(source ${CLAUDE_PLUGIN_ROOT:-.}/.forge/lib/config.sh, forge_config_load AGENTS.md);
python: `${CLAUDE_PLUGIN_ROOT:-.}/.forge/bin/forge-py .../runtime_config.py path <key>`. -->Framework: FORGE
Model-Tier: sonnet
Generate a bidirectional traceability matrix from spec traceability link annotations.
If $ARGUMENTS is ? or help:
Print:
/trace — Generate bidirectional traceability matrix (FORGE Spec 036). Lane B.
Usage: /trace [--forward] [--backward] [--gaps] [--format md|csv|json|html] [--spec NNN]
[--artifacts [ID]] [--rebuild]
Arguments:
(none) Full report: forward trace + backward trace + gap analysis (markdown)
--forward Forward trace only: requirement → spec → code → test → evidence
--backward Backward trace only: code → requirement → test coverage
--gaps Gap analysis only: missing links across all specs
--format <fmt> Output format: md (default), csv, json, html
--spec NNN Limit analysis to a single spec number
Cross-Artifact Relationship Index (Spec 108):
--artifacts [ID] Query cross-artifact relationships. ID is optional:
/trace --artifacts Show full relationship index summary
/trace --artifacts 099 Show all artifacts linked to Spec 099
/trace --artifacts SIG-045 Show all artifacts linked to signal SIG-045
/trace --artifacts 2026-03-25-001 Show artifacts linked to session
--rebuild Rebuild the full artifact-links index from scratch (use with --artifacts)
Data source:
Each spec file's ## Traceability Links section (YAML-structured annotations).
Only specs with Status: implemented or closed are included by default.
Output: Rendered inline as markdown, or saved to docs/compliance/traceability-YYYY-MM-DD.md
Annotation format (add to spec files):
## Traceability Links
requirements:
- REQ-001: <requirement text or external reference>
code:
- src/path/to/file.py::function_name
tests:
- tests/test_file.py::test_function_name
evidence:
- tmp/evidence/SPEC-NNN-YYYYMMDD/test-run.txt
See: docs/specs/036-bidirectional-traceability.md, docs/process-kit/mcp-setup.mdStop — do not execute any further steps.
Parse $ARGUMENTS:
- Set MODE =
full(default), orforward,backward,gaps,artifactsfrom flags. - Set FORMAT =
md(default), orcsv,json,htmlfrom--format. - Set SPEC_FILTER = spec number from
--spec NNN, else empty (all specs). - If
--artifactsis present: set MODE =artifacts. Set ARTIFACT_QUERY = the next argument if present (spec number, signal ID, or session ID), else empty. - If
--rebuildis present: set REBUILD = true.
If MODE is artifacts: jump to Step A1 (Cross-Artifact Relationship Index).
[mechanical] Step 1 — Collect specs
Read docs/specs/README.md.
Build a list of specs to analyze:
- If SPEC_FILTER is set: only that spec.
- Otherwise: all specs with status
implementedorclosed.
For each spec in the list, read the spec file (docs/specs/NNN-*.md).
[mechanical] Step 2 — Extract traceability links
For each spec file, find the ## Traceability Links section.
Parse the YAML-structured content:
requirements:— list of REQ-NNN:<text>entriescode:— list of file::symbol pathstests:— list of test file::function pathsevidence:— list of artifact paths
If a spec has no ## Traceability Links section: record it as unlinked (relevant for gap analysis).
Build an in-memory index:
SPECS[NNN] = {
title, status, lane,
requirements: [...],
code: [...],
tests: [...],
evidence: [...]
}[mechanical] Step 3 — Build forward trace
For each spec with requirements: For each requirement: Forward chain: requirement → spec (NNN) → code files → tests → evidence
Structure:
REQ-NNN (<spec NNN — title>)
→ Code: src/path/to/file.py::function
→ Tests: tests/test_file.py::test_function
→ Evidence: tmp/evidence/SPEC-NNN-YYYYMMDD/test-run.txt[mechanical] Step 4 — Build backward trace
For each code file::symbol referenced across all specs: Backward chain: code → which spec claimed it → which requirement drove it → which test covers it
Structure:
src/path/to/file.py::function
← Spec NNN — <title>
← REQ-NNN: <requirement text>
← Tests: tests/test_file.py::test_function[mechanical] Step 5 — Gap analysis
Identify and flag:
- Requirements without code: specs with requirements entries but empty code list.
- Code without tests: specs with code entries but empty tests list.
- Tests without evidence: specs with tests entries but empty evidence list.
- Unlinked specs: implemented/closed specs with no
## Traceability Linkssection at all. - Orphaned code claims: code paths in traceability links that do not exist in the repo (use file existence check).
Severity:
systemic— 3+ gaps of the same typerecurring— 2 gaps of the same typeisolated— 1 gap
[mechanical] Step 6 — Render report
Render based on MODE and FORMAT.
Markdown output (FORMAT=md)
# FORGE Traceability Matrix
Generated: YYYY-MM-DD
Specs analyzed: N | Requirements: N | Code links: N | Tests: N | Evidence: N
---
## Forward Trace
(omit if MODE=backward or MODE=gaps)
### Spec NNN — <Title>
| Requirement | Code | Test | Evidence |
|------------|------|------|----------|
| REQ-001: <text> | `src/file.py::fn` | `tests/test.py::test_fn` | `tmp/evidence/…` |
| REQ-002: <text> | *(gap — no code)* | *(gap)* | *(gap)* |
---
## Backward Trace
(omit if MODE=forward or MODE=gaps)
### src/path/to/file.py
| Symbol | Spec | Requirement | Test |
|--------|------|-------------|------|
| `function_name` | Spec NNN — <Title> | REQ-001: <text> | `tests/test.py::test_fn` |
---
## Gap Analysis
(always included unless MODE=forward or MODE=backward)
### ⚠ Requirements without code coverage (N)
- Spec NNN REQ-001: <text> — no code link recorded
### ⚠ Code without test coverage (N)
- Spec NNN `src/file.py::fn` — no test link recorded
### ⚠ Tests without evidence (N)
- Spec NNN `tests/test.py::test_fn` — no evidence artifact linked
### ⚠ Unlinked specs (N)
- Spec NNN — <Title>: no ## Traceability Links section
### ⚠ Orphaned code paths (N)
- Spec NNN `src/missing_file.py::fn` — file not found in repo
---
## Summary
Total gaps: N | Systemic: N | Recurring: N | Isolated: N
Coverage: N% of implemented specs fully linkedCSV output (FORMAT=csv)
Emit a flat table:
spec_id,spec_title,requirement_id,requirement_text,code_path,test_path,evidence_path,gapsJSON output (FORMAT=json)
Emit structured JSON:
{
"generated": "YYYY-MM-DD",
"specs": [
{
"id": "NNN",
"title": "...",
"requirements": [...],
"code": [...],
"tests": [...],
"evidence": [...],
"gaps": [...]
}
],
"summary": { "total_specs": N, "total_gaps": N, "coverage_pct": N }
}HTML output (FORMAT=html)
Emit an HTML table with alternating row colors, sortable columns, and gap rows highlighted in amber.
[mechanical] Step 7 — Save artifact
Save the rendered output to:
docs/compliance/traceability-YYYY-MM-DD.md (or .csv / .json / .html by format).
Create docs/compliance/ if it does not exist.
Add docs/compliance/traceability-*.html and docs/compliance/traceability-*.csv to .gitignore (generated artifacts — markdown is kept for audit trail).
Report: "Traceability matrix saved to docs/compliance/traceability-YYYY-MM-DD.<ext>"
[mechanical] Next action
- If gaps found: "Next: annotate the flagged specs with
## Traceability Linkssections, then re-run/trace." - If coverage is 100%: "Next: run
/closeor attachdocs/compliance/traceability-YYYY-MM-DD.mdto your compliance gate message." - If no specs have traceability links yet: "Next: add
## Traceability Linkssections to your implemented specs. See the annotation format in/trace ?."
Cross-Artifact Relationship Index (Spec 108)
The following steps execute when MODE = artifacts.
[mechanical] Step A1 — Determine index action
- If REBUILD is true: proceed to Step A2 (full rebuild).
- If
.forge/state/artifact-links.jsondoes not exist: proceed to Step A2 (initial build). - If
.forge/state/artifact-links.jsonexists and ARTIFACT_QUERY is set: proceed to Step A4 (query). - If
.forge/state/artifact-links.jsonexists and ARTIFACT_QUERY is empty: proceed to Step A4 (summary).
[mechanical] Step A2 — Scan artifacts for cross-references
Parse the following artifact sources for cross-references:
- Spec files (
docs/specs/*.md): Read each file. Extract references to other artifacts. - Session logs (
docs/sessions/*.md, excluding_template.md,README.md,signals.md,context-snapshot.md,registry.md): Read each file. Extract references. - Signals file (
docs/sessions/signals.md): Read the file. Extract references in each signal entry. - ADR files (
docs/decisions/*.md, if the directory exists): Read each file. Extract references. - Scratchpad (
docs/sessions/scratchpad.md, if it exists): Read the file. Extract references.
Reference patterns to detect
| Pattern | Example | Artifact type |
Spec NNN or spec NNN or Spec-NNN | Spec 099 | spec |
SIG-NNN-XX | SIG-045-01 | signal |
CI-NNN | CI-036 | content-insight |
EA-NNN | EA-020 | evolution-anchor |
ADR-NNN | ADR-005 | adr |
session YYYY-MM-DD-NNN or YYYY-MM-DD-NNN (in session context) | session 2026-03-25-001 | session |
Use case-insensitive matching for the keyword prefix (e.g., spec, Spec, SPEC all match).
Relationship type classification
Determine the relationship type from the surrounding context:
| Context pattern | Relationship type |
Trigger: or Triggered by or triggered by | triggered-by |
Depends on or Dependencies: or blocked by | depends-on |
Closed in or closed via or closed in session | closed-in |
Signal in source + spec in target (or vice versa) | signal-from |
| All other references | references |
Error handling
- If a file cannot be read: skip it, log a warning, continue to the next file.
- If a reference pattern is malformed (e.g.,
Spec abc): skip it silently. - Never crash on parse errors — always continue scanning remaining files.
[mechanical] Step A3 — Build and write index
Build the relationship index as a JSON array. Each entry:
{
"source": "<artifact-id of the file containing the reference>",
"target": "<artifact-id of the referenced artifact>",
"type": "<relationship type>",
"context": "<the sentence or line containing the reference>"
}Artifact ID format:
- Specs:
spec-NNN(e.g.,spec-099) - Signals:
SIG-NNN-XX(e.g.,SIG-045-01) - Content insights:
CI-NNN(e.g.,CI-036) - Evolution anchors:
EA-NNN(e.g.,EA-020) - ADRs:
ADR-NNN(e.g.,ADR-005) - Sessions:
session-YYYY-MM-DD-NNN(e.g.,session-2026-03-25-001)
Deduplicate: if the same source-target-type triple already exists, keep the first occurrence only.
Write the index to .forge/state/artifact-links.json:
{
"generated": "YYYY-MM-DDTHH:MM:SS",
"version": "1.0",
"total_links": <count>,
"links": [ <array of link objects> ]
}Create .forge/state/ directory if it does not exist.
Report: "Artifact relationship index built: <count> links from <file count> artifacts. Saved to .forge/state/artifact-links.json"
Proceed to Step A4 if ARTIFACT_QUERY is set, otherwise stop.
[mechanical] Step A4 — Query and display
Read .forge/state/artifact-links.json.
If ARTIFACT_QUERY is empty — display summary
Show an overview:
# Artifact Relationship Index
Generated: <timestamp>
Total links: <count>
## Link type distribution
| Type | Count |
|------|-------|
| references | N |
| triggered-by | N |
| depends-on | N |
| closed-in | N |
| signal-from | N |
## Most-connected artifacts (top 10)
| Artifact | Inbound | Outbound | Total |
|----------|---------|----------|-------|
| spec-099 | 5 | 3 | 8 |
| ... | | | |If ARTIFACT_QUERY is set — display relationships for a specific artifact
Normalize the query:
- If numeric (e.g.,
099or99): search forspec-099(zero-padded to 3 digits). - If matches
SIG-NNN-XX: search as-is. - If matches
CI-NNN,EA-NNN,ADR-NNN: search as-is. - If matches
YYYY-MM-DD-NNN: search forsession-YYYY-MM-DD-NNN.
Find all links where the queried artifact is either source or target.
Display:
# Artifact Relationships: <artifact-id>
## Outbound (this artifact references)
| Target | Type | Context |
|--------|------|---------|
| spec-036 | depends-on | "Dependencies: 036 (closed) — Bidirectional Traceability" |
## Inbound (referenced by)
| Source | Type | Context |
|--------|------|---------|
| session-2026-03-25-001 | closed-in | "Closed Spec 099 in this session" |
| SIG-045-01 | triggered-by | "Trigger: SIG-045-01 — performance regression" |
## Summary
Outbound: N | Inbound: N | Total: NIf no links found for the queried artifact: "No relationships found for <artifact-id>. Run /trace --artifacts --rebuild to regenerate the index."
[mechanical] Step A5 — Next action (artifacts mode)
- If index was just built: "Artifact index ready. Query with
/trace --artifacts <ID>to explore relationships." - If query returned results: "Explore further with
/trace --artifacts <related-id>or rebuild with/trace --artifacts --rebuild." - If no results: "Run
/trace --artifacts --rebuildto regenerate, or check that the artifact ID is correct."
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

