Spec-Driven Translation
This Skill executes a documentation-first, validation-driven workflow to translate or modernize a codebase. It turns the existing source into a Product Requirement Document (PRD), derives a Project Specification, Implementation Plan, and Task Execution Checklist, then iteratively implements the work in externally-validatable steps with a remediation loop until success.
High-level flow (from the provided diagram):
- Ingest -> PRD
- Plan translation
- Docs to guide AI (Project Spec, Implementation Plan, Task Checklist)
- Iterative task loop (choose task -> implement step -> run validation -> remediate w/ retry budget)
- Translated Source Code
Preconditions & Setup
- Identify the source tree and the target environment (runtime, language, framework versions, build tools).
- Ensure we have authority to read/write files and run the project’s build/test commands.
- If needed, ask to install or enable required tools (build system, linters, test runner, package managers).
Artifacts We Will Create
templates/PRD.md -> filled as Product_Requirement_Document.md
templates/Project-Specification.md -> Project_Specification.md
templates/Implementation-Plan.md -> Implementation_Plan.md
templates/Task-Execution-Checklist.md -> Task_Execution_Checklist.md
Keep these docs up-to-date as living sources of truth. They guide all subsequent steps.
Step-by-Step Instructions
1. Ingest -> PRD
- Read the existing codebase (entry points, modules, configs, CI, tests).
- Extract intent, behaviors, constraints, SLAs, non-functionals, and integration points.
- Populate and save
Product_Requirement_Document.md from templates/PRD.md.
- Call out unknowns, risks, and assumptions explicitly.
2. Plan Translation
- Define target state (language/framework versions, platform changes, build/test strategy, deployment).
- Fill in
Project_Specification.md grounding every requirement in the PRD.
- Draft
Implementation_Plan.md (milestones, work streams, sequencing, acceptance criteria).
- Create
Task_Execution_Checklist.md (repeatable per-task DoD & safety checks).
3. Choose-Implement-Validate Loop
For each iteration:
Choose next task
- Use rubric (below) to pick a task that yields an externally-verifiable delta (e.g., unit test passes, binary builds, CLI works, endpoint responds).
- Update the checklist with the task ID and success conditions.
# Pick-Next-Task Rubric
Score each candidate task 0–3 on:
- External verifiability (clear test/build signal)
- Risk isolation (blast radius if wrong)
- Unblocks others (dependency breaker)
- Knowledge gain (reduces uncertainty)
- Effort (fit in one iteration)
Choose the highest total; tie-break on verifiability.
Implement a minimal, verifiable step
- Make small changes scoped to one verifiable outcome.
- Prefer creating/updating tests that encode the desired behavior.
Validation
- Run validation.
- Treat builds/tests/lints/type-checks/formatters as the external oracle of success.
Remediation (bounded retries)
- On failure, capture logs; fix the smallest issue first; re-run validation.
- Limit to a local retry budget (e.g., 3 attempts) before escalating:
- Update docs with new facts found.
- Re-plan or split the task if necessary.
Commit
- When validation passes, commit with an evidence-rich message (what/why, tests affected, acceptance criteria met).
- Append outcomes/notes to the Implementation Plan.
Repeat until the milestone is complete, then proceed to the next milestone.
4. Exit Criteria
- All tasks in the current milestone have green validation.
- The translated artifact(s) function under the target environment with documented acceptance evidence.
- PRD, Spec, Plan, and Checklist are updated to reflect reality.
Pick-Next-Task Rubric (summary)
Prefer tasks that:
- Increase test coverage or convert implicit behavior into explicit tests.
- Deliver a user-visible or CI-visible signal (a test or build turns green).
- Reduce coupling or blockers for later tasks.
- Are reversible and low-risk when uncertain.
Full rubric in scripts/pick-next-task.md.
Notes
- Keep docs concise but always actionable. Treat them as contracts with the validator.
- When in doubt, shrink the task until it’s externally verifiable within a single iteration.
- Prefer to keep the human in the loop, stopping for confirmation on assumptions or changes to the plan.
1---2name: spec-driven-translation3description: Spec-driven source translation & modernization workflow for codebases. Use when asked to migrate/translate a project (e.g., framework/SDK/language upgrade), or when the user wants a structured, externally-validatable implementation loop with PRD + plans + checklists and iterative validation/remediation.4---5
6# Spec-Driven Translation
7
8This Skill executes a documentation-first, validation-driven workflow to translate or modernize a codebase. It turns the existing source into a **Product Requirement Document (PRD)**, derives a **Project Specification**, **Implementation Plan**, and **Task Execution Checklist**, then iteratively implements the work in **externally-validatable** steps with a remediation loop until success.
9
10> High-level flow (from the provided diagram):
11> 1. **Ingest -> PRD**
12> 2. **Plan translation**
13> 3. **Docs to guide AI** (Project Spec, Implementation Plan, Task Checklist)
14> 4. **Iterative task loop** (choose task -> implement step -> run validation -> remediate w/ retry budget)
15> 5. **Translated Source Code**
16
17## Preconditions & Setup
18
191. Identify the **source tree** and the **target environment** (runtime, language, framework versions, build tools).
202. Ensure we have authority to read/write files and run the project’s build/test commands.
213. If needed, ask to install or enable required tools (build system, linters, test runner, package managers).
22
23## Artifacts We Will Create
24
25- `templates/PRD.md` -> filled as `Product_Requirement_Document.md`
26- `templates/Project-Specification.md` -> `Project_Specification.md`
27- `templates/Implementation-Plan.md` -> `Implementation_Plan.md`
28- `templates/Task-Execution-Checklist.md` -> `Task_Execution_Checklist.md`
29
30Keep these docs up-to-date as living sources of truth. They guide all subsequent steps.
31
32## Step-by-Step Instructions
33
34### 1. Ingest -> PRD
35- Read the existing codebase (entry points, modules, configs, CI, tests).
36- Extract **intent, behaviors, constraints, SLAs, non-functionals**, and integration points.
37- Populate and save `Product_Requirement_Document.md` from `templates/PRD.md`.
38- Call out **unknowns, risks, and assumptions** explicitly.
39
40### 2. Plan Translation
41- Define **target state** (language/framework versions, platform changes, build/test strategy, deployment).
42- Fill in `Project_Specification.md` grounding every requirement in the PRD.
43- Draft `Implementation_Plan.md` (milestones, work streams, sequencing, acceptance criteria).
44- Create `Task_Execution_Checklist.md` (repeatable per-task DoD & safety checks).
45
46### 3. Choose-Implement-Validate Loop
47For each iteration:
48
491. **Choose next task**
50 - Use rubric (below) to pick a task that yields an **externally-verifiable** delta (e.g., unit test passes, binary builds, CLI works, endpoint responds).
51 - Update the checklist with the task ID and success conditions.
52
53 ```
54 # Pick-Next-Task Rubric
55
56 Score each candidate task 0–3 on:
57 - External verifiability (clear test/build signal)
58 - Risk isolation (blast radius if wrong)
59 - Unblocks others (dependency breaker)
60 - Knowledge gain (reduces uncertainty)
61 - Effort (fit in one iteration)
62
63 Choose the highest total; tie-break on verifiability.
64 ```
65
662. **Implement a minimal, verifiable step**
67 - Make small changes scoped to one verifiable outcome.
68 - Prefer creating/updating **tests** that encode the desired behavior.
69
703. **Validation**
71 - Run validation.
72 - Treat **builds/tests/lints/type-checks/formatters** as the external oracle of success.
73
744. **Remediation (bounded retries)**
75 - On failure, capture logs; fix the smallest issue first; re-run validation.
76 - Limit to a local retry budget (e.g., 3 attempts) before escalating:
77 - Update docs with new facts found.
78 - Re-plan or split the task if necessary.
79
805. **Commit**
81 - When validation passes, commit with an evidence-rich message (what/why, tests affected, acceptance criteria met).
82 - Append outcomes/notes to the Implementation Plan.
83
84Repeat until the milestone is complete, then proceed to the next milestone.
85
86### 4. Exit Criteria
87- All tasks in the current milestone have green validation.
88- The translated artifact(s) function under the target environment with documented acceptance evidence.
89- PRD, Spec, Plan, and Checklist are updated to reflect reality.
90
91## Pick-Next-Task Rubric (summary)
92
93Prefer tasks that:
94- Increase **test coverage** or convert implicit behavior into explicit tests.
95- Deliver a **user-visible or CI-visible** signal (a test or build turns green).
96- Reduce **coupling or blockers** for later tasks.
97- Are reversible and low-risk when uncertain.
98
99Full rubric in `scripts/pick-next-task.md`.
100
101## Notes
102
103- Keep docs concise but **always actionable**. Treat them as contracts with the validator.
104- When in doubt, **shrink the task** until it’s externally verifiable within a single iteration.
105- Prefer to **keep the human in the loop**, stopping for confirmation on assumptions or changes to the plan.