← Work with SpecDD skills guides

How to trace specs to code, tests, and gaps (specdd-trace)

How-To Work with SpecDD skills Intermediate 1091004HOWTO-1091004

HOWTO-1091004Work with SpecDD skillsIntermediate

This guide shows you how to use specdd-trace to connect spec-driven development contracts to code, tests, docs, changed files, and coverage gaps.

Tracing is useful when you need to understand whether the repository actually satisfies the specs. It is not a write authority expansion. Referenced files remain read context unless another active spec grants modification authority.

Short answer

Use specdd-trace when you need a map from specs to implementation and verification. The agent should identify why each spec, file, test, or doc was included, what constraints it contributes, what code or tests satisfy those constraints, and where gaps, stale specs, unclear authority, or missing checks remain.

When to use this guide

Use this guide when:

Steps

1. Choose the trace target

Use a focused prompt:

Trace the Itinerary validation behavior.

or:

Trace the Itinerary change to tests.

The target can be a spec, feature, behavior, changed file, or review concern. Keep it narrow enough that the trace is useful.

2. Map why each item is included

For every relevant item, the trace should say why it is included:

This prevents nearby files from becoming relevant just because they have similar names.

3. Connect constraints to implementation

For each important spec entry, map the implementation evidence.

Example:

Spec entry: Itinerary must reject missing place names.
Implementation: itinerary validation checks place name before storing an item.
Gap: no check covers unchanged itinerary state after validation failure.

The trace should connect behavior, not merely list files.

4. Connect scenarios to verification

SpecDD scenarios are good trace anchors:

Scenario: missing place name
  Given the place name is empty
  When the person adds the itinerary item
  Then validation fails
  And no itinerary item is stored

The trace should identify whether a test, check, or review step covers the scenario. If not, it should name that as a coverage gap.

A useful trace can reveal:

Do not hide gaps by stretching the interpretation of a spec entry.

6. Keep trace read-only unless edits are requested

specdd-trace should explain relationships. It should not edit files unless you explicitly ask for follow-up changes.

Use a separate prompt after reviewing the trace:

Add the missing Itinerary validation test.

or:

Update the Itinerary spec for the reviewed behavior.

Example trace shape

Item: src/trips/itinerary.sdd
Why included: nearest local spec for Itinerary behavior.
Contributes: missing-place validation rule, destination-search boundary, Done when criteria.
Satisfied by: itinerary validation code and missing-place test.
Gap: no regression check for unchanged itinerary state after validation failure.

Common mistakes

How to verify the result

The trace worked when:

← Work with SpecDD skills guides