spec-driven-remap-specs
You are helping the user retrofit or repair spec-code mapping frontmatter in
.spec-driven/specs/ files.
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 remapping scope — determine whether the user wants to remap:
- all main spec files
- one spec category or file
- only specs reported by
verify-spec-mappingsas malformed or stale
If the user already gave a scope, use it. If not, ask which scope to repair.
-
Read spec context first — before proposing mapping edits, read:
.spec-driven/config.yaml.spec-driven/specs/INDEX.md- every main spec file in the selected scope
- any existing mapping frontmatter in those spec files
-
Run mapping validation — run:
node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappingsUse the JSON result to identify missing frontmatter, malformed mapping fields, non-string entries, and missing mapped files.
-
Inspect repository evidence — read relevant implementation, tests, skill prompts, scripts, and documentation needed to determine current file-level mappings. Keep implementation files separate from test files.
-
Classify findings — sort findings into:
- missing mapping frontmatter that can be confidently added
- malformed mapping frontmatter that can be repaired without changing requirement behavior
- stale paths that can be replaced with current implementation or test files
- behavior/spec drift that requires
/spec-driven-sync-specs,/spec-driven-spec-edit, or a normal change workflow - ambiguous mappings that require human input
-
Present proposed mapping edits — before editing any file, show the user:
- each spec file whose frontmatter will change
- the proposed
mapping.implementationpaths - the proposed
mapping.testspaths - any behavior/spec drift or ambiguous mapping that will not be edited by this skill
Wait for explicit confirmation before writing files.
-
Apply confirmed mapping repairs — after confirmation, edit only mapping frontmatter in the selected main spec files. Do not change implementation files. Do not rewrite requirement bodies unless the user switches to
/spec-driven-sync-specs,/spec-driven-spec-edit, or a normal change workflow. -
Validate after editing — rerun:
node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappingsFix safe frontmatter format issues immediately and rerun validation. If any remaining error needs human judgment, report it clearly.
-
Report final result — summarize:
- which spec files had mapping frontmatter added or repaired
- which stale paths were replaced
- whether mapping validation now passes
- any behavior/spec drift or ambiguity left for another workflow
Rules
- This is a planning/documentation skill only — do not change implementation code or tests
- Do not create, modify, archive, or cancel entries under
.spec-driven/changes/ - Do not rewrite requirement behavior while repairing mappings
- Keep
mapping.implementationandmapping.testsseparate - Use repo-relative file paths only
- Keep mappings at file granularity; do not use line numbers, ranges, or symbols
- Always run
verify-spec-mappingsbefore and after confirmed edits - Get explicit user confirmation before editing any spec file
- If mapping repair reveals behavior/spec drift, recommend the appropriate spec synchronization or change workflow instead of silently changing requirements
More from kw12121212/auto-spec-driven
spec-driven-auto
Run the full spec-driven workflow automatically. Proposes, implements, verifies, reviews, and archives a change without mandatory confirmation — only stops for user input when open questions need resolution.
36spec-driven-apply
Implement the tasks in a spec-driven change. Works through incomplete tasks one by one, marking each complete as it goes.
35spec-driven-cancel
Cancel and permanently delete an in-progress spec-driven change. Warns before deleting. Use this to abandon a change that will not be implemented.
35spec-driven-modify
Modify an existing spec-driven change artifact (proposal.md, specs/ delta files, design.md, tasks.md, or questions.md). Preserves completed task state.
35spec-driven-sync-specs
Scan code and specs for drift, directly synchronize spec files, and report the gaps in chat.
30