← Adopt SpecDD on existing projects guides

How to generate draft specs from existing code

How-To Adopt SpecDD on existing projects Intermediate 1111004HOWTO-1111004

HOWTO-1111004Adopt SpecDD on existing projectsIntermediate

This guide shows you how to generate draft SpecDD specs for spec-driven development from existing code without turning generated text into accidental authority.

Generating a draft is useful because the agent can summarize current code quickly. The review step is still essential: current code may include old bugs, temporary workarounds, unclear ownership, or behavior the team does not want to preserve.

Short answer

Ask for a draft spec for one module, file, service, workflow, or folder. Keep the request limited to spec drafting. Review the draft for assumptions, ownership, write authority, intended behavior, accidental behavior, Must not, Forbids, tasks, and Done when. Approve the spec before implementation starts.

When to use this guide

Use this guide when:

Steps

1. Choose one draft target

Good targets:

Avoid:

Large drafts tend to mix inventory, behavior, implementation details, and guesses.

2. Ask for a draft only

Use one prompt:

Draft the Itinerary spec from current behavior.

If the result should include uncertainty, use a focused prompt:

Mark uncertain Itinerary assumptions.

Keep implementation as a separate step after review.

3. Label assumptions

Generated drafts should not present guesses as facts.

Review lines and classify them:

Represent uncertainty with tasks when useful:

Tasks:
  [?] Confirm whether duplicate itinerary places are allowed.

4. Review ownership and authority

Generated drafts often make authority too broad.

Good:

Owns:
  ./itinerary.js
  ./itinerary.test.js

Can read:
  ../storage/trip-storage.sdd

Too broad:

Owns:
  ../trips/*
  ../storage/*
  ../destinations/*

Use Can read or References for context outside the owned area. They do not grant edit permission.

5. Remove accidental behavior

Look for:

When the intended behavior is different from current behavior, describe the intended contract and leave an open task for implementation.

6. Add tasks and Done when

A useful generated spec should lead to reviewable work.

Example:

Tasks:
  [ ] Add missing-place validation.

Done when:
  Missing-place behavior is covered by a check.
  Existing itinerary ordering behavior still passes.

Tasks should be local. If a draft task requires another area’s files, split the work or update the owning spec through review.

7. Approve before use

Only treat the spec as authority after review.

Use separate prompts:

Revise the Itinerary draft spec.
Implement the approved Itinerary validation task.

This keeps draft generation, review, and implementation distinct.

Review checklist

Before approving a generated draft, ask:

Common mistakes

How to verify the result

The draft is useful when:

← Adopt SpecDD on existing projects guides