sdtk-spec-kit 0.3.10 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +219 -197
  2. package/assets/manifest/toolkit-bundle.manifest.json +72 -57
  3. package/assets/manifest/toolkit-bundle.sha256.txt +30 -27
  4. package/assets/toolkit/toolkit/README.md +50 -0
  5. package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +185 -0
  6. package/assets/toolkit/toolkit/install.ps1 +347 -310
  7. package/assets/toolkit/toolkit/scripts/init-feature.ps1 +2 -1
  8. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +84 -84
  9. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  10. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  11. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +127 -127
  12. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +85 -83
  13. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  14. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  15. package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +127 -127
  16. package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +108 -102
  17. package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +97 -81
  18. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +37 -30
  19. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +75 -61
  20. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  21. package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +90 -90
  22. package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +25 -53
  23. package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +12 -6
  24. package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +124 -124
  25. package/assets/toolkit/toolkit/templates/README.md +1 -0
  26. package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +81 -81
  27. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  28. package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +127 -127
  29. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +174 -174
  30. package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +106 -96
  31. package/assets/toolkit/toolkit/templates/docs/qa/CONTROLLER_ACCEPTANCE_TEMPLATE.md +90 -0
  32. package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +162 -95
  33. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  34. package/package.json +20 -20
  35. package/src/commands/help.js +26 -10
  36. package/src/commands/init.js +108 -105
  37. package/src/commands/update.js +11 -0
  38. package/src/index.js +62 -59
  39. package/src/lib/project-target-guard.js +53 -0
  40. package/src/lib/update.js +333 -0
@@ -1,128 +1,128 @@
1
- # YAML CREATION RULES FINAL
2
-
3
- This file is the canonical rule set for designing and maintaining feature-level OpenAPI YAML.
4
-
5
- Use this file for:
6
- - OpenAPI YAML contract design
7
- - endpoint path/method decisions
8
- - request/response schema design
9
- - endpoint summary and contract consistency checks
10
-
11
- Do not use this file as the primary rule source for:
12
- - flowchart writing details
13
- - API design detail markdown layout
14
-
15
- Use `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` for those.
16
-
17
- ## 1. Rule Precedence
18
- - Priority 1: follow the existing system's real route, method, payload, and response conventions.
19
- - Priority 2: match the current source code and runtime behavior.
20
- - Priority 3: apply the reusable standards in this document.
21
- - If a reusable rule conflicts with the target system, keep the system rule and document the exception explicitly.
22
-
23
- ## 2. API Scope Classification
24
- - Every endpoint must be classified as one of:
25
- - `New`
26
- - `Deferred`
27
- - `Existing (reuse)`
28
- - Do not silently create a new feature-local API if an existing system API already provides the same behavior with a compatible contract.
29
- - If the existing API is close in purpose but payload or response is incompatible with the feature need, create a bounded new API.
30
-
31
- ## 3. Endpoint Path Design
32
- - Use singular resource names in endpoint paths.
33
- - Use explicit action segments only when needed by system convention:
34
- - `list`
35
- - `search`
36
- - `edit`
37
- - `delete`
38
- - `multi-create`
39
- - Prefer stable system-style patterns such as:
40
- - list: `GET /{resource}/list/{company_uuid}/{parent_uuid}`
41
- - search: `POST /{resource}/search/{company_uuid}`
42
- - view-specific search: `POST /{resource}/bukken-view/search/{company_uuid}`
43
- - create: `POST /{resource}/{company_uuid}`
44
- - detail: `GET /{resource}/{company_uuid}/{resource_uuid}`
45
- - edit: `POST /{resource}/edit/{company_uuid}/{resource_uuid}`
46
- - delete: `POST /{resource}/delete/{company_uuid}/{resource_uuid}`
47
- - Separate namespaces by bounded context.
48
- - Do not repeat namespace meaning in child path segments.
49
-
50
- ## 4. Request Contract Rules
51
- - For feature-owned POST search and write APIs, prefer a stable wrapper:
52
- - `data: { ... }`
53
- - For complex filters, place fields under:
54
- - `data.info`
55
- - If reusing an existing system API, keep the owning module's contract shape exactly as-is.
56
- - Do not force reused APIs into the feature wrapper pattern.
57
- - If a payload field changes behavior, the field must be explicit in the schema and must not remain only in examples.
58
-
59
- ## 5. Response Contract Rules
60
- - Success responses must include `status` at minimum.
61
- - Create APIs should return the minimum new identifier required by the caller.
62
- - Example: `status + sagyo_assign_uuid`
63
- - Edit and delete APIs should return status-only unless the target system has a stronger standard.
64
- - Pre-check or validation helper APIs should return only the minimum boolean or status needed by the UI.
65
- - Do not return detail payloads the UI does not consume.
66
- - Do not add FE-only visual helper payloads when the client can derive them safely.
67
- - Example: remove `timeline_backgrounds` if the frontend renders timeline lines from existing data.
68
-
69
- ## 6. Naming and Field Mapping Rules
70
- - Use canonical business-domain terminology from the system glossary and database.
71
- - Prefer actual system terms such as:
72
- - `bukken`
73
- - `sagyo`
74
- - `sagyoin`
75
- - `certification`
76
- - Avoid legacy aliases when an official term already exists.
77
- - Field names should align with database semantics when they represent the same concept.
78
- - If the DB uses a string state code, the API field must not be modeled as an integer.
79
- - If a field is date-only (`format: date`), include the display format in the description.
80
- - Example: `Start date (YYYYMMDD)`
81
-
82
- ## 7. Search and List API Rules
83
- - One search API may serve multiple UI actions when the logic is the same:
84
- - initial load
85
- - search button
86
- - refresh after mode/date change
87
- - If one endpoint serves multiple UI actions, document that explicitly in YAML description and endpoint docs.
88
- - Search APIs must define filter combination semantics clearly:
89
- - AND across different fields
90
- - OR within each `*_uuids` array
91
- - If UI rendering depends on stable order, the YAML description must state the confirmed ORDER BY logic.
92
-
93
- ## 8. Split vs Reuse Rules
94
- - Split read/search endpoints when the FE needs materially different grouped or view-shaped datasets.
95
- - Merge or remove helper payloads when they add maintenance cost without business value.
96
- - Reuse existing platform APIs when behavior already exists and only a feature-level mapping layer is needed.
97
- - Example: reuse shared environment setting APIs instead of creating feature-local setting APIs.
98
-
99
- ## 9. Sample Data Rules
100
- - For fields declared as `format: uuid`, use canonical UUID samples.
101
- - Example: `123e4567-e89b-12d3-a456-426614174000`
102
- - Do not use placeholder UUID-like labels such as:
103
- - `customer-uuid-001`
104
- - `assign-uuid-001`
105
- - Keep sample data deterministic and internally consistent across request and response examples.
106
-
107
- ## 10. Cross-Artifact Consistency Rules
108
- - The YAML contract is the source of truth for:
109
- - endpoint path
110
- - method
111
- - request wrapper
112
- - response shape
113
- - After any YAML contract change, sync these artifacts:
114
- - endpoint markdown
115
- - flow list
116
- - PlantUML flow assets
117
- - API design detail markdown
118
- - If any artifact cannot yet be synced, note the mismatch explicitly rather than leaving stale content.
119
-
120
- ## 11. Minimum YAML Quality Gate
121
- - Path/method follow the target system convention.
122
- - API type is classified (`New`, `Deferred`, `Existing (reuse)`).
123
- - Request/response wrappers are stable and explicit.
124
- - FE-only helper payloads are removed.
125
- - Field names and types match DB semantics.
126
- - UUID examples are valid UUIDs.
127
- - Date descriptions include display format where needed.
1
+ # YAML CREATION RULES FINAL
2
+
3
+ This file is the canonical rule set for designing and maintaining feature-level OpenAPI YAML.
4
+
5
+ Use this file for:
6
+ - OpenAPI YAML contract design
7
+ - endpoint path/method decisions
8
+ - request/response schema design
9
+ - endpoint summary and contract consistency checks
10
+
11
+ Do not use this file as the primary rule source for:
12
+ - flowchart writing details
13
+ - API design detail markdown layout
14
+
15
+ Use `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` for those.
16
+
17
+ ## 1. Rule Precedence
18
+ - Priority 1: follow the existing system's real route, method, payload, and response conventions.
19
+ - Priority 2: match the current source code and runtime behavior.
20
+ - Priority 3: apply the reusable standards in this document.
21
+ - If a reusable rule conflicts with the target system, keep the system rule and document the exception explicitly.
22
+
23
+ ## 2. API Scope Classification
24
+ - Every endpoint must be classified as one of:
25
+ - `New`
26
+ - `Deferred`
27
+ - `Existing (reuse)`
28
+ - Do not silently create a new feature-local API if an existing system API already provides the same behavior with a compatible contract.
29
+ - If the existing API is close in purpose but payload or response is incompatible with the feature need, create a bounded new API.
30
+
31
+ ## 3. Endpoint Path Design
32
+ - Use singular resource names in endpoint paths.
33
+ - Use explicit action segments only when needed by system convention:
34
+ - `list`
35
+ - `search`
36
+ - `edit`
37
+ - `delete`
38
+ - `multi-create`
39
+ - Prefer stable system-style patterns such as:
40
+ - list: `GET /{resource}/list/{organization_uuid}/{parent_uuid}`
41
+ - search: `POST /{resource}/search/{organization_uuid}`
42
+ - view-specific search: `POST /{resource}/resource-view/search/{organization_uuid}`
43
+ - create: `POST /{resource}/{organization_uuid}`
44
+ - detail: `GET /{resource}/{organization_uuid}/{resource_uuid}`
45
+ - edit: `POST /{resource}/edit/{organization_uuid}/{resource_uuid}`
46
+ - delete: `POST /{resource}/delete/{organization_uuid}/{resource_uuid}`
47
+ - Separate namespaces by bounded context.
48
+ - Do not repeat namespace meaning in child path segments.
49
+
50
+ ## 4. Request Contract Rules
51
+ - For feature-owned POST search and write APIs, prefer a stable wrapper:
52
+ - `data: { ... }`
53
+ - For complex filters, place fields under:
54
+ - `data.info`
55
+ - If reusing an existing system API, keep the owning module's contract shape exactly as-is.
56
+ - Do not force reused APIs into the feature wrapper pattern.
57
+ - If a payload field changes behavior, the field must be explicit in the schema and must not remain only in examples.
58
+
59
+ ## 5. Response Contract Rules
60
+ - Success responses must include `status` at minimum.
61
+ - Create APIs should return the minimum new identifier required by the caller.
62
+ - Example: `status + task_assignment_uuid`
63
+ - Edit and delete APIs should return status-only unless the target system has a stronger standard.
64
+ - Pre-check or validation helper APIs should return only the minimum boolean or status needed by the UI.
65
+ - Do not return detail payloads the UI does not consume.
66
+ - Do not add FE-only visual helper payloads when the client can derive them safely.
67
+ - Example: remove `timeline_backgrounds` if the frontend renders timeline lines from existing data.
68
+
69
+ ## 6. Naming and Field Mapping Rules
70
+ - Use canonical business-domain terminology from the system glossary and database.
71
+ - Prefer actual system terms such as:
72
+ - `resource`
73
+ - `task`
74
+ - `assignee`
75
+ - `certification`
76
+ - Avoid legacy aliases when an official term already exists.
77
+ - Field names should align with database semantics when they represent the same concept.
78
+ - If the DB uses a string state code, the API field must not be modeled as an integer.
79
+ - If a field is date-only (`format: date`), include the display format in the description.
80
+ - Example: `Start date (YYYYMMDD)`
81
+
82
+ ## 7. Search and List API Rules
83
+ - One search API may serve multiple UI actions when the logic is the same:
84
+ - initial load
85
+ - search button
86
+ - refresh after mode/date change
87
+ - If one endpoint serves multiple UI actions, document that explicitly in YAML description and endpoint docs.
88
+ - Search APIs must define filter combination semantics clearly:
89
+ - AND across different fields
90
+ - OR within each `*_uuids` array
91
+ - If UI rendering depends on stable order, the YAML description must state the confirmed ORDER BY logic.
92
+
93
+ ## 8. Split vs Reuse Rules
94
+ - Split read/search endpoints when the FE needs materially different grouped or view-shaped datasets.
95
+ - Merge or remove helper payloads when they add maintenance cost without business value.
96
+ - Reuse existing platform APIs when behavior already exists and only a feature-level mapping layer is needed.
97
+ - Example: reuse shared environment setting APIs instead of creating feature-local setting APIs.
98
+
99
+ ## 9. Sample Data Rules
100
+ - For fields declared as `format: uuid`, use canonical UUID samples.
101
+ - Example: `123e4567-e89b-12d3-a456-426614174000`
102
+ - Do not use placeholder UUID-like labels such as:
103
+ - `customer-uuid-001`
104
+ - `assign-uuid-001`
105
+ - Keep sample data deterministic and internally consistent across request and response examples.
106
+
107
+ ## 10. Cross-Artifact Consistency Rules
108
+ - The YAML contract is the source of truth for:
109
+ - endpoint path
110
+ - method
111
+ - request wrapper
112
+ - response shape
113
+ - After any YAML contract change, sync these artifacts:
114
+ - endpoint markdown
115
+ - flow list
116
+ - PlantUML flow assets
117
+ - API design detail markdown
118
+ - If any artifact cannot yet be synced, note the mismatch explicitly rather than leaving stale content.
119
+
120
+ ## 11. Minimum YAML Quality Gate
121
+ - Path/method follow the target system convention.
122
+ - API type is classified (`New`, `Deferred`, `Existing (reuse)`).
123
+ - Request/response wrappers are stable and explicit.
124
+ - FE-only helper payloads are removed.
125
+ - Field names and types match DB semantics.
126
+ - UUID examples are valid UUIDs.
127
+ - Date descriptions include display format where needed.
128
128
  - Search/list APIs document filter semantics and ordering when relevant.
@@ -1,102 +1,108 @@
1
- ---
2
- name: sdtk-dev
3
- description: Developer planning workflow for SDTK-SPEC. Use when you need to convert ARCH_DESIGN plus BACKLOG into a scoped implementation plan, readiness decision, and formal SDTK-CODE handoff.
4
- ---
5
-
6
- # SDTK-SPEC DEV (Planning + SDTK-CODE Handoff)
7
-
8
- ## Critical Constraints
9
- - I do not emit `READY_FOR_SDTK_CODE` until the current `FEATURE_IMPL_PLAN` scope is approved and all required upstream refs are explicit.
10
- - I do not claim downstream implementation is complete from within `/dev`.
11
-
12
- ## Outputs
13
- - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
14
- - `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
15
-
16
- ## Legacy Prompt Templates
17
- - `./prompts/implementer.md`
18
- - `./prompts/spec-reviewer.md`
19
- - `./prompts/code-quality-reviewer.md`
20
-
21
- These prompt templates remain in the repo as transition-only manual helper assets.
22
- They are not the default `/dev` workflow in this wave.
23
- Use them only when the user explicitly requests a manual legacy review or delegated implementation experiment outside the normal `/dev -> SDTK-CODE` path.
24
-
25
- ## Process
26
- 1. Read `ARCH_DESIGN_*` + backlog.
27
- 2. Read `sdtk-spec.config.json` for project stack + test/lint commands.
28
- 3. Write or refine `FEATURE_IMPL_PLAN_*`:
29
- - implementation slices
30
- - required refs
31
- - optional refs
32
- - test obligations
33
- - blockers and open questions
34
- 4. If anything is unclear: record OQ-xx in `FEATURE_IMPL_PLAN` and escalate to `@pm` for a decision.
35
- 5. Decide readiness:
36
- - `READY_FOR_SDTK_CODE` when the current slice is concrete enough for downstream coding
37
- - `BLOCKED_FOR_SDTK_CODE` when blockers remain
38
- 6. Generate `CODE_HANDOFF_*` with `toolkit/scripts/generate-code-handoff.ps1`.
39
- - Canonical writer rule: the machine-readable JSON is generator-owned; do not hand-author or patch the JSON shape manually.
40
- - If an existing `CODE_HANDOFF_*` file is non-canonical, regenerate it with the script and `-Force` instead of editing keys by hand.
41
- - Use the script-owned snake_case contract only. Do not emit legacy camelCase keys such as `featureKey`, `requiredRefs`, `optionalRefs`, `openBlockers`, `implementationSlices`, `testObligations`, or `suggestedNextCommand`.
42
- 7. Mirror the same readiness decision in the final `SDTK-CODE Handoff` section of `FEATURE_IMPL_PLAN`.
43
- 8. Update `SHARED_PLANNING.md` + `QUALITY_CHECKLIST.md` Phase 4 to show planning/handoff completion status.
44
- 9. Handoff:
45
- - if ready: suggest the exact `sdtk-code start --feature-key <KEY> --lane <feature|bugfix> --project-path .` command
46
- - if blocked: list blockers and keep the work in `/dev`
47
-
48
- ## Delegated Execution Contract
49
- - The implementer subagent receives the full task text directly in the prompt when the user explicitly requests manual legacy execution.
50
- - Required implementer status values:
51
- - `DONE`
52
- - `DONE_WITH_CONCERNS`
53
- - `NEEDS_CONTEXT`
54
- - `BLOCKED`
55
- - `DONE_WITH_CONCERNS` means the task is complete but the controller must read the concerns before review.
56
- - `NEEDS_CONTEXT` means the controller must supply missing information and re-dispatch.
57
- - `BLOCKED` means do not retry the same task unchanged; resolve the blocker first.
58
- - The spec reviewer must verify real artifacts, not trust implementer claims.
59
- - The code-quality reviewer is a second-stage review and must not run before spec compliance passes.
60
- - This legacy review loop is optional and manual in this wave; it is not the default `/dev` contract.
61
-
62
- ## Model Selection Guidance
63
- Choose the cheapest model that can safely complete the task without creating avoidable rework.
64
-
65
- | Task type | Recommended model tier | Why |
66
- |---|---|---|
67
- | Single-file mechanical change with a clear spec | Fast model | Useful for legacy/manual helper tasks, not the default handoff path |
68
- | Multi-file integration that follows an approved plan | Standard model | Useful when manually validating scope or reviewing downstream constraints |
69
- | Architecture or design tradeoff for the current implementation slice | Most capable model | Requires judgment and ambiguity handling |
70
- | Stage 1 artifact/spec review | Standard model | Legacy/manual review aid only |
71
- | Stage 2 code-quality review | Standard or most capable model | Legacy/manual review aid only |
72
- | Cross-artifact consistency investigation | Most capable model | Requires broader synthesis across docs and handoff inputs |
73
-
74
- Blocked-task rule:
75
- - If an implementer returns `BLOCKED`, do not force the same model to retry the same task unchanged.
76
- - First resolve missing context or reduce task scope.
77
- - Escalate to a stronger model only when the blocker is judgment or synthesis bound, not because the prompt was incomplete.
78
-
79
- ## Verification Before Completion
80
- Apply `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md`.
81
-
82
- Do not:
83
- - say the handoff is ready without validating the current refs, blockers, slices, and obligations
84
- - cite downstream readiness without fresh verification evidence for the claim
85
- - use `should`, `probably`, or `seems` in place of executed checks
86
- - rely on partial output, stale command runs, or unchecked agent reports
87
- - manually compose `CODE_HANDOFF` JSON when the canonical generator script is available
88
-
89
- If validation fails or cannot be run, report the handoff as blocked and explain the blocker.
90
-
91
- ## Order-Critical Hard Gate
92
- Do not emit `READY_FOR_SDTK_CODE` until `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md` exists and the current execution scope is explicitly approved in that plan for downstream implementation.
93
-
94
- If the plan is missing, incomplete, or still awaiting approval for the current task slice, stop and update the plan first. Do not emit the handoff first and backfill the plan later.
95
-
96
- ## Common Mistakes
97
-
98
- | Mistake | Why it is wrong | Do instead |
99
- |---|---|---|
100
- | Treat `/dev` as the place where final code and QA handoff happen | Collapses the boundary between SDTK-SPEC and SDTK-CODE | Stop `/dev` at `FEATURE_IMPL_PLAN + CODE_HANDOFF` |
101
- | Emit `READY_FOR_SDTK_CODE` with missing refs or vague slices | Pushes ambiguity downstream and weakens handoff quality | Make refs, slices, obligations, and blockers explicit before the handoff |
102
- | Retry a `BLOCKED` manual helper prompt with the same context | Repeats the same failure mode | Add missing context, split the task, or keep the handoff blocked |
1
+ ---
2
+ name: sdtk-dev
3
+ description: Developer planning workflow for SDTK-SPEC. Use when you need to convert ARCH_DESIGN plus BACKLOG into a scoped implementation plan, readiness decision, and formal SDTK-CODE handoff.
4
+ ---
5
+
6
+ # SDTK-SPEC DEV (Planning + SDTK-CODE Handoff)
7
+
8
+ ## Critical Constraints
9
+ - I do not emit `READY_FOR_SDTK_CODE` until the current `FEATURE_IMPL_PLAN` scope is approved and all required upstream refs are explicit.
10
+ - I do not claim downstream implementation is complete from within `/dev`.
11
+
12
+ ## Outputs
13
+ - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
14
+ - `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
15
+
16
+ ## Legacy Prompt Templates
17
+ - `./prompts/implementer.md`
18
+ - `./prompts/spec-reviewer.md`
19
+ - `./prompts/code-quality-reviewer.md`
20
+
21
+ These prompt templates remain in the repo as transition-only manual helper assets.
22
+ They are not the default `/dev` workflow in this wave.
23
+ Use them only when the user explicitly requests a manual legacy review or delegated implementation experiment outside the normal `/dev -> SDTK-CODE` path.
24
+
25
+ ## Process
26
+ 1. Read `ARCH_DESIGN_*` + backlog.
27
+ 2. Read `sdtk-spec.config.json` for project stack + test/lint commands.
28
+ 3. Write or refine `FEATURE_IMPL_PLAN_*`:
29
+ - issue summary and scope
30
+ - explicit non-goals
31
+ - implementation slices
32
+ - required refs
33
+ - optional refs
34
+ - issue-specific test obligations using real executable commands
35
+ - blockers and open questions
36
+ 4. If anything is unclear: record OQ-xx in `FEATURE_IMPL_PLAN` and escalate to `@pm` for a decision.
37
+ 5. Decide readiness:
38
+ - `READY_FOR_SDTK_CODE` when the current slice is concrete enough for downstream coding
39
+ - `BLOCKED_FOR_SDTK_CODE` when blockers remain
40
+ 6. Generate `CODE_HANDOFF_*` with `toolkit/scripts/generate-code-handoff.ps1`.
41
+ - Canonical writer rule: the machine-readable JSON is generator-owned; do not hand-author or patch the JSON shape manually.
42
+ - If an existing `CODE_HANDOFF_*` file is non-canonical, regenerate it with the script and `-Force` instead of editing keys by hand.
43
+ - Use the script-owned snake_case contract only. Do not emit legacy camelCase keys such as `featureKey`, `requiredRefs`, `optionalRefs`, `openBlockers`, `implementationSlices`, `testObligations`, or `suggestedNextCommand`.
44
+ 7. Mirror the same readiness decision in the final `SDTK-CODE Handoff` section of `FEATURE_IMPL_PLAN`.
45
+ - Do not copy placeholder `UPDATE_ME` commands from `sdtk-spec.config.json` into the handoff plan as if they were executable proof.
46
+ 8. Update `SHARED_PLANNING.md` + `QUALITY_CHECKLIST.md` Phase 4 to show planning/handoff completion status.
47
+ 9. Handoff:
48
+ - if ready: suggest the exact `sdtk-code start --feature-key <KEY> --lane <feature|bugfix> --project-path .` command
49
+ - if blocked: list blockers and keep the work in `/dev`
50
+
51
+ ## Delegated Execution Contract
52
+ - The implementer subagent receives the full task text directly in the prompt when the user explicitly requests manual legacy execution.
53
+ - Required implementer status values:
54
+ - `DONE`
55
+ - `DONE_WITH_CONCERNS`
56
+ - `NEEDS_CONTEXT`
57
+ - `BLOCKED`
58
+ - `DONE_WITH_CONCERNS` means the task is complete but the controller must read the concerns before review.
59
+ - `NEEDS_CONTEXT` means the controller must supply missing information and re-dispatch.
60
+ - `BLOCKED` means do not retry the same task unchanged; resolve the blocker first.
61
+ - The spec reviewer must verify real artifacts, not trust implementer claims.
62
+ - The code-quality reviewer is a second-stage review and must not run before spec compliance passes.
63
+ - This legacy review loop is optional and manual in this wave; it is not the default `/dev` contract.
64
+
65
+ ## Model Selection Guidance
66
+ Choose the cheapest model that can safely complete the task without creating avoidable rework.
67
+
68
+ | Task type | Recommended model tier | Why |
69
+ |---|---|---|
70
+ | Single-file mechanical change with a clear spec | Fast model | Useful for legacy/manual helper tasks, not the default handoff path |
71
+ | Multi-file integration that follows an approved plan | Standard model | Useful when manually validating scope or reviewing downstream constraints |
72
+ | Architecture or design tradeoff for the current implementation slice | Most capable model | Requires judgment and ambiguity handling |
73
+ | Stage 1 artifact/spec review | Standard model | Legacy/manual review aid only |
74
+ | Stage 2 code-quality review | Standard or most capable model | Legacy/manual review aid only |
75
+ | Cross-artifact consistency investigation | Most capable model | Requires broader synthesis across docs and handoff inputs |
76
+
77
+ Blocked-task rule:
78
+ - If an implementer returns `BLOCKED`, do not force the same model to retry the same task unchanged.
79
+ - First resolve missing context or reduce task scope.
80
+ - Escalate to a stronger model only when the blocker is judgment or synthesis bound, not because the prompt was incomplete.
81
+
82
+ ## Verification Before Completion
83
+ Apply `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md`.
84
+
85
+ Do not:
86
+ - say the handoff is ready without validating the current refs, blockers, slices, and obligations
87
+ - cite downstream readiness without fresh verification evidence for the claim
88
+ - use `should`, `probably`, or `seems` in place of executed checks
89
+ - rely on partial output, stale command runs, or unchecked agent reports
90
+ - manually compose `CODE_HANDOFF` JSON when the canonical generator script is available
91
+
92
+ If validation fails or cannot be run, report the handoff as blocked and explain the blocker.
93
+
94
+ ## Order-Critical Hard Gate
95
+ Do not emit `READY_FOR_SDTK_CODE` until `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md` exists and the current execution scope is explicitly approved in that plan for downstream implementation.
96
+
97
+ If the plan is missing, incomplete, or still awaiting approval for the current task slice, stop and update the plan first. Do not emit the handoff first and backfill the plan later.
98
+
99
+ Do not let placeholder commands, vague slice names, or missing required refs stand in for real downstream readiness.
100
+
101
+ ## Common Mistakes
102
+
103
+ | Mistake | Why it is wrong | Do instead |
104
+ |---|---|---|
105
+ | Treat `/dev` as the place where final code and QA handoff happen | Collapses the boundary between SDTK-SPEC and SDTK-CODE | Stop `/dev` at `FEATURE_IMPL_PLAN + CODE_HANDOFF` |
106
+ | Emit `READY_FOR_SDTK_CODE` with missing refs or vague slices | Pushes ambiguity downstream and weakens handoff quality | Make refs, slices, obligations, and blockers explicit before the handoff |
107
+ | Retry a `BLOCKED` manual helper prompt with the same context | Repeats the same failure mode | Add missing context, split the task, or keep the handoff blocked |
108
+ | Copy `UPDATE_ME` placeholder commands into the plan as if they were executable verification | Fakes downstream readiness and weakens verification-before-completion | Replace placeholders with issue-specific real commands or state truthfully that a project-level command is unknown |