# Tracing Requirements

> Validates the SYS→PRD→SW requirement traceability chain by reconciling database entries with code docstring tags. Use when checking requirement coverage, finding orphaned code, or generating a coverage matrix.

- Skill: `qte77/tracing-requirements` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add qte77/tracing-requirements`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qte77/tracing-requirements/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: qte77 (https://skillmd.com/u/qte77)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/qte77/tracing-requirements

---


# Requirement Traceability Validation

**Target**: $ARGUMENTS

Validate the full requirement hierarchy by reconciling the requirements source with code docstring tags.

## References (MUST READ)

Read these before proceeding:

- `references/requirement-tagging.md` — `@requirement`/`@parent`/`@test` spec, reconciliation algorithm

## Workflow

1. **Grep all C files** for `@requirement`, `@parent`, and `@test` tags → build tag inventory
2. **Read requirements source** — `docs/requirements.md`, CSV, or SQL dump
3. **Validate 3-level hierarchy:**
   - Every SW-REQ has a `@parent` PRD-REQ
   - Every PRD-REQ traces to a SYS-REQ
   - No broken parent links
4. **Generate findings report** with categories:
   - **Unimplemented:** SW-REQ in database but no `@requirement` tag in code
   - **Orphaned code:** `@requirement` tag in code but no matching DB entry
   - **Broken parents:** `@parent` references a non-existent PRD-REQ
   - **Untested:** SW-REQ without matching `@test` tag
   - **Dead code candidates:** Functions without any requirement tag
5. **Output coverage matrix:**

   ```
   | Requirement | Code File:Line | Test ID | Status |
   |-------------|---------------|---------|--------|
   | SW-REQ-001  | src/emv.c:42  | TEST-001| OK     |
   | SW-REQ-002  | —             | —       | MISSING|
   ```

## Output Format

```markdown
# Traceability Report

## Summary
- Total SW-REQ: N
- Implemented: N (N%)
- Tested: N (N%)
- Orphaned code tags: N
- Broken parent links: N

## Unimplemented Requirements
...

## Orphaned Code
...

## Coverage Matrix
...
```

## Rules

- Scan all `*.c` and `*.h` files, not just `src/`
- Report findings — do not auto-fix requirement files
- Include file path and line number for every code finding
- Sort coverage matrix by requirement ID

