← Work with SpecDD skills guides

How to debug against the governing spec (specdd-debug)

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

HOWTO-1091008Work with SpecDD skillsIntermediate

This guide shows you how to use specdd-debug to diagnose and fix bugs against the governing SpecDD spec in a spec-driven development workflow.

Debugging with SpecDD starts from a simple question: what does the active contract say should happen, and how does the observed behavior differ?

Short answer

Use specdd-debug when a failure should be diagnosed against active specs. The agent should reproduce or inspect the failure when practical, compare observed behavior with Must, Must not, Scenario, Handles, Returns, and Raises, identify whether the issue is implementation drift, test drift, spec ambiguity, or missing spec coverage, fix the smallest root cause inside write authority, and add focused regression verification when appropriate.

When to use this guide

Use this guide when:

Steps

1. Start from the failure

Use a focused prompt:

Debug the Itinerary validation failure.

The agent should reproduce the failure when practical, or inspect available logs, tests, screenshots, or reports. It should not edit code before understanding the observed behavior.

2. Compare behavior to the spec

The agent should compare the failure with relevant spec entries:

Example:

Must:
  Reject itinerary items without a place name.

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

If code accepts an empty place name, the code has drifted from the contract.

3. Classify the problem

Common categories:

The fix depends on the category. Do not change specs to match broken behavior unless the user asks for a spec change.

4. Fix the smallest root cause

If the bug is implementation drift, fix the smallest root cause inside write authority.

Do not broaden error handling, add dependencies, or change public behavior beyond the governing spec. If the fix would violate Must not, Forbids, write authority, or public contracts, stop and ask for direction.

5. Add regression verification

When appropriate, add or update a focused test so the bug cannot return silently.

Regression checks should map to the spec:

Missing place name fails validation and does not store an item.

If test authority is unclear, ask before editing test files.

6. Report the contract and result

A good specdd-debug report includes:

Common mistakes

How to verify the result

Debugging worked when:

← Work with SpecDD skills guides