You are helping the user synchronize .spec-driven/specs/ with behavior that
already exists in the repository.
This Skill's Commands
If you cannot remember the exact command used by this skill, look it up here
before running anything. Do not guess.
init: node {{SKILL_DIR}}/scripts/spec-driven.js init
verify-spec-mappings: node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappings
Prerequisites
The .spec-driven/ directory must exist at the project root. Before
proceeding, verify:
ls .spec-driven/
If this fails, the project is not initialized. Run /spec-driven-init first.
Steps
Choose the scan scope — determine whether the user wants:
- a repository-wide scan
- a scoped scan for a specific directory, module, or feature area
If the user already gave a scope, use it. If not, ask whether to scan the
whole repository or a narrower target.
Read spec context first — before deciding that any drift exists, read:
.spec-driven/config.yaml
.spec-driven/specs/INDEX.md
- every main spec file that appears relevant to the chosen scan scope
Read repository evidence in the chosen scope — inspect the code, tests,
and nearby documentation that define current observable behavior in that
scope.
- Prefer files that expose behavior directly: CLI commands, handlers,
user-facing flows, tests, and docs
- Do not treat internal implementation details as requirements
Classify drift findings — compare the repository evidence to the current
specs and sort findings into:
- confirmed behavior that exists in code but is missing from specs
- existing requirements that appear outdated or incomplete
- ambiguous findings that need human confirmation before they become specs
- areas with no meaningful drift in the scanned scope
Report drift summary in chat — present a concise summary covering:
- the scan scope that was analyzed
- confirmed gaps or outdated spec areas, with specific file references
- ambiguous findings that need human input
- areas in scope where no meaningful drift was found
Get user confirmation — before editing any spec file, ask the user to
confirm the proposed changes. List each spec file that will be added,
modified, or removed. Do not proceed until the user explicitly approves.
Edit spec files directly — for each confirmed gap:
- edit the corresponding file under
.spec-driven/specs/
- add, modify, or remove
### Requirement: blocks as appropriate
- preserve or update
mapping.implementation and mapping.tests
frontmatter to match the repository evidence used for the sync
- describe observable behavior only
- if no existing category or file fits, create the new file under
.spec-driven/specs/ with the correct relative path
Refresh INDEX.md — after all spec edits are complete, run:
node {{SKILL_DIR}}/scripts/spec-driven.js init
This regenerates .spec-driven/specs/INDEX.md to reflect the current
file state.
If mapping frontmatter changed, also run:
node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappings
Report final changes — summarize what was done:
- which spec files were added, modified, or removed
- a brief description of the drift that was fixed in each file
- any ambiguous findings that were left unresolved and why
Rules
- This is a documentation skill only — do not change product code
- Read spec context before judging drift
- Respect the user-selected scope; do not imply full-repository coverage after a
scoped scan
- Use code, tests, and nearby docs as evidence, but write only observable
behavior into the specs
- Do not create a change — edit
.spec-driven/specs/ files directly
- Do not write a standalone report file; the summary belongs in chat
- Get explicit user confirmation before editing any spec file
- Keep implementation and test mappings in frontmatter, not in requirement
prose
1---2name: spec-driven-sync-specs3description: Scan code and specs for drift, directly synchronize spec files, and report the gaps in chat.4---56You are helping the user synchronize `.spec-driven/specs/` with behavior that7already exists in the repository.89## This Skill's Commands1011If you cannot remember the exact command used by this skill, look it up here12before running anything. Do not guess.1314```yaml15init: node {{SKILL_DIR}}/scripts/spec-driven.js init16verify-spec-mappings: node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappings17```1819## Prerequisites2021The `.spec-driven/` directory must exist at the **project root**. Before22proceeding, verify:23```24ls .spec-driven/25```26If this fails, the project is not initialized. Run `/spec-driven-init` first.2728## Steps29301. **Choose the scan scope** — determine whether the user wants:31 - a repository-wide scan32 - a scoped scan for a specific directory, module, or feature area3334 If the user already gave a scope, use it. If not, ask whether to scan the35 whole repository or a narrower target.36372. **Read spec context first** — before deciding that any drift exists, read:38 - `.spec-driven/config.yaml`39 - `.spec-driven/specs/INDEX.md`40 - every main spec file that appears relevant to the chosen scan scope41423. **Read repository evidence in the chosen scope** — inspect the code, tests,43 and nearby documentation that define current observable behavior in that44 scope.45 - Prefer files that expose behavior directly: CLI commands, handlers,46 user-facing flows, tests, and docs47 - Do not treat internal implementation details as requirements48494. **Classify drift findings** — compare the repository evidence to the current50 specs and sort findings into:51 - confirmed behavior that exists in code but is missing from specs52 - existing requirements that appear outdated or incomplete53 - ambiguous findings that need human confirmation before they become specs54 - areas with no meaningful drift in the scanned scope55565. **Report drift summary in chat** — present a concise summary covering:57 - the scan scope that was analyzed58 - confirmed gaps or outdated spec areas, with specific file references59 - ambiguous findings that need human input60 - areas in scope where no meaningful drift was found61626. **Get user confirmation** — before editing any spec file, ask the user to63 confirm the proposed changes. List each spec file that will be added,64 modified, or removed. Do not proceed until the user explicitly approves.65667. **Edit spec files directly** — for each confirmed gap:67 - edit the corresponding file under `.spec-driven/specs/`68 - add, modify, or remove `### Requirement:` blocks as appropriate69 - preserve or update `mapping.implementation` and `mapping.tests`70 frontmatter to match the repository evidence used for the sync71 - describe observable behavior only72 - if no existing category or file fits, create the new file under73 `.spec-driven/specs/` with the correct relative path74758. **Refresh INDEX.md** — after all spec edits are complete, run:76 ```77 node {{SKILL_DIR}}/scripts/spec-driven.js init78 ```79 This regenerates `.spec-driven/specs/INDEX.md` to reflect the current80 file state.8182 If mapping frontmatter changed, also run:83 ```84 node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappings85 ```86879. **Report final changes** — summarize what was done:88 - which spec files were added, modified, or removed89 - a brief description of the drift that was fixed in each file90 - any ambiguous findings that were left unresolved and why9192## Rules9394- This is a documentation skill only — do not change product code95- Read spec context before judging drift96- Respect the user-selected scope; do not imply full-repository coverage after a97 scoped scan98- Use code, tests, and nearby docs as evidence, but write only observable99 behavior into the specs100- Do not create a change — edit `.spec-driven/specs/` files directly101- Do not write a standalone report file; the summary belongs in chat102- Get explicit user confirmation before editing any spec file103- Keep implementation and test mappings in frontmatter, not in requirement104 prose