sdtk-spec-kit 0.10.0 → 0.12.0

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 (65) hide show
  1. package/README.md +1 -1
  2. package/assets/manifest/toolkit-bundle.manifest.json +207 -47
  3. package/assets/manifest/toolkit-bundle.sha256.txt +54 -22
  4. package/assets/toolkit/toolkit/AGENTS.md +2 -1
  5. package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +5 -1
  6. package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +4 -0
  7. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +18 -0
  8. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +1 -0
  9. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +2 -2
  10. package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +2 -2
  11. package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/SKILL.md +117 -0
  12. package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/references/PROFILE_TEMPLATE.md +60 -0
  13. package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/scripts/oq_sync.py +349 -0
  14. package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/scripts/test_oq_sync.py +175 -0
  15. package/assets/toolkit/toolkit/skills/sdtk-db-design/SKILL.md +130 -0
  16. package/assets/toolkit/toolkit/skills/sdtk-db-design/references/REVIEW_PROCESS.md +82 -0
  17. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +1 -1
  18. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/SKILL.md +104 -0
  19. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/REVIEW_AND_MISTAKES.md +63 -0
  20. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SCR01.json +46 -0
  21. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SCR01.png +0 -0
  22. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SPEC_SCHEMA.md +208 -0
  23. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/example_spec.yaml +115 -0
  24. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/build_design_xlsx.py +550 -0
  25. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/design_spec.py +305 -0
  26. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/export_preview.py +111 -0
  27. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/export_spec_md.py +181 -0
  28. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/make_template.py +113 -0
  29. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/test_screen_design.py +198 -0
  30. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/uia_dump.py +64 -0
  31. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/validate_spec.py +260 -0
  32. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/SKILL.md +76 -0
  33. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/references/HANDOFF_TEMPLATE.md +63 -0
  34. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/references/MOVING_A_PROJECT.md +18 -0
  35. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/scripts/dirty_files.py +133 -0
  36. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/scripts/test_dirty_files.py +94 -0
  37. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/SKILL.md +4 -1
  38. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/test_metadata.py +76 -0
  39. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/xlsx_xml_edit.py +65 -1
  40. package/assets/toolkit/toolkit/skills/skills.catalog.yaml +96 -0
  41. package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +15 -2
  42. package/assets/toolkit/toolkit/skills-claude/ba/SKILL.md +8 -4
  43. package/assets/toolkit/toolkit/skills-claude/customer-qa-sheet/SKILL.md +115 -0
  44. package/assets/toolkit/toolkit/skills-claude/db-design/SKILL.md +128 -0
  45. package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +33 -2
  46. package/assets/toolkit/toolkit/skills-claude/dev-backend/SKILL.md +10 -0
  47. package/assets/toolkit/toolkit/skills-claude/dev-frontend/SKILL.md +10 -0
  48. package/assets/toolkit/toolkit/skills-claude/pm/SKILL.md +14 -3
  49. package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +40 -2
  50. package/assets/toolkit/toolkit/skills-claude/screen-design-xlsx/SKILL.md +101 -0
  51. package/assets/toolkit/toolkit/skills-claude/session-handoff/SKILL.md +74 -0
  52. package/assets/toolkit/toolkit/skills-claude/test-case-spec/SKILL.md +6 -0
  53. package/assets/toolkit/toolkit/skills-claude/xlsx-safe-edit/SKILL.md +4 -1
  54. package/assets/toolkit/toolkit/templates/README.md +3 -0
  55. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +14 -0
  56. package/assets/toolkit/toolkit/templates/screen-design-xlsx/ja-default/TEMPLATE.md +247 -0
  57. package/assets/toolkit/toolkit/templates/screen-design-xlsx/ja-default/template.xlsx +0 -0
  58. package/package.json +1 -1
  59. package/src/commands/help.js +7 -2
  60. package/src/lib/args.js +5 -2
  61. package/src/lib/design-handoff-provenance.js +30 -5
  62. package/src/lib/office-ingest.js +376 -0
  63. package/src/lib/requirement-analysis.js +77 -41
  64. package/src/lib/requirement-sources.js +259 -0
  65. package/src/lib/scope.js +4 -4
@@ -373,6 +373,102 @@ skills:
373
373
  runtime_support: [claude, codex]
374
374
  dependencies: []
375
375
  pack: core
376
+ - name: sdtk-session-handoff
377
+ phase: orchestration
378
+ role_tag: /session-handoff
379
+ use_when: A session ends, is compacted or hands over to a new session or person, or a moved project folder must keep its old sessions; packages memory, local instructions, a handoff document, a classification of every uncommitted file and a first prompt.
380
+ primary_inputs:
381
+ - git worktrees and their uncommitted files
382
+ - the session's decisions, released versions and open work
383
+ primary_outputs:
384
+ - .sdtk/handoff/session-<date>-<topic>/HANDOFF.md, STATUS.md, FILES.md (git-ignored)
385
+ - CLAUDE.local.md (Claude Code, git-excluded) and runtime memory entries
386
+ hard_gates:
387
+ - Every uncommitted file in every worktree is classified PR / LOCAL / STASH / DROP and dirty_files.py check exits 0 before the handoff is called done.
388
+ - Never git add -A; DROP only after the person said so; the handoff stays out of the repository.
389
+ references:
390
+ - toolkit/skills/sdtk-session-handoff/references/HANDOFF_TEMPLATE.md
391
+ - toolkit/skills/sdtk-session-handoff/references/MOVING_A_PROJECT.md
392
+ prompts: []
393
+ scripts:
394
+ - toolkit/skills/sdtk-session-handoff/scripts/dirty_files.py
395
+ runtime_support: [claude, codex]
396
+ dependencies: []
397
+ pack: core
398
+ - name: sdtk-customer-qa-sheet
399
+ phase: ba
400
+ role_tag: /customer-qa-sheet
401
+ use_when: Open questions (OQ-xx) go to a customer through their hand-maintained Q&A / issue-tracking Excel sheet, the customer's answers are read back into the spec and decision log, or a reply to the customer's question is written into that sheet.
402
+ primary_inputs:
403
+ - qa_sheet_profile.md of the project
404
+ - BA_SPEC open questions (OQ-xx) and the customer's Q&A workbook
405
+ primary_outputs:
406
+ - review draft of rows, then the approved rows in the customer's sheet
407
+ - spec / decision-log update proposal keyed by OQ id
408
+ hard_gates:
409
+ - Nothing is written before the person approves the exact row values or reply text.
410
+ - Never overwrite a cell holding text; never edit the customer's answer; writes go through the XML route of sdtk-xlsx-safe-edit.
411
+ - Rows and OQs are matched by id, never by position; candidates are checked against existing rows first.
412
+ references:
413
+ - toolkit/skills/sdtk-customer-qa-sheet/references/PROFILE_TEMPLATE.md
414
+ prompts: []
415
+ scripts:
416
+ - toolkit/skills/sdtk-customer-qa-sheet/scripts/oq_sync.py
417
+ runtime_support: [claude, codex]
418
+ dependencies: [sdtk-xlsx-safe-edit]
419
+ pack: core
420
+ - name: sdtk-db-design
421
+ phase: arch
422
+ role_tag: /db-design
423
+ use_when: A new table or column is proposed, a schema is reviewed / trimmed before release, a legacy database is replaced, or a schema change can reach machines holding real user data; decides what sdtk-arch's DATABASE_SPEC contains.
424
+ primary_inputs:
425
+ - requirements and approved decisions; current DDL and every write path
426
+ - legacy schema and external contracts when replacing or syncing
427
+ primary_outputs:
428
+ - fact inventory with a verdict per column (DATABASE_SPEC section 8)
429
+ - legacy column map, upgrade ladder and migration policy when data may exist
430
+ hard_gates:
431
+ - Every durable field names a writer, a reader, a recovery purpose and the requirement that fails without it.
432
+ - Read the DDL and all write paths before stating meaning; once real data can exist, never drop and recreate.
433
+ - Product semantics are the owner's decision; the schema of record changes only after sign-off.
434
+ references:
435
+ - toolkit/skills/sdtk-db-design/references/REVIEW_PROCESS.md
436
+ - toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md
437
+ prompts: []
438
+ scripts: []
439
+ runtime_support: [claude, codex]
440
+ dependencies: [sdtk-arch]
441
+ pack: core
442
+ - name: sdtk-screen-design-xlsx
443
+ phase: arch
444
+ role_tag: /screen-design-xlsx
445
+ use_when: A Japanese 画面設計書 Excel workbook (表紙 / 改訂記事 / 機能概要 / 画面流れ / 処理) must be built, updated or audited from the screen flow-action spec and other sources, through a reviewable YAML spec rendered by Excel COM.
446
+ primary_inputs:
447
+ - screen flow-action spec, design layout, API list, DB spec; screenshots or UI Automation dumps
448
+ - template set toolkit/templates/screen-design-xlsx/<set> (or the project's own)
449
+ primary_outputs:
450
+ - docs/screen_design/design_spec.yaml (the reviewed artifact)
451
+ - the 画面設計書 workbook, PNG previews, optional Markdown of the process sheets
452
+ hard_gates:
453
+ - validate_spec.py exits 0 before rendering; every rendered page is looked at as PNG.
454
+ - On an existing workbook only the changed sheets are rendered (--sheets); a finalized or hand-edited workbook is never re-rendered without the person's confirmation (final mode via sdtk-xlsx-safe-edit).
455
+ - Never save with openpyxl, never attach to the person's Excel; cite only identifiers that exist in the sources.
456
+ references:
457
+ - toolkit/skills/sdtk-screen-design-xlsx/references/SPEC_SCHEMA.md
458
+ - toolkit/skills/sdtk-screen-design-xlsx/references/REVIEW_AND_MISTAKES.md
459
+ - toolkit/templates/screen-design-xlsx/ja-default/TEMPLATE.md
460
+ prompts: []
461
+ scripts:
462
+ - toolkit/skills/sdtk-screen-design-xlsx/scripts/design_spec.py
463
+ - toolkit/skills/sdtk-screen-design-xlsx/scripts/validate_spec.py
464
+ - toolkit/skills/sdtk-screen-design-xlsx/scripts/build_design_xlsx.py
465
+ - toolkit/skills/sdtk-screen-design-xlsx/scripts/export_preview.py
466
+ - toolkit/skills/sdtk-screen-design-xlsx/scripts/export_spec_md.py
467
+ - toolkit/skills/sdtk-screen-design-xlsx/scripts/uia_dump.py
468
+ - toolkit/skills/sdtk-screen-design-xlsx/scripts/make_template.py
469
+ runtime_support: [claude, codex]
470
+ dependencies: [sdtk-screen-design-spec, sdtk-xlsx-safe-edit]
471
+ pack: core
376
472
  - name: sdtk-smoke-test-spec
377
473
  phase: qa
378
474
  role_tag: /smoke-test-spec
@@ -32,12 +32,12 @@ $ARGUMENTS
32
32
  - `docs/api/[FEATURE_KEY]_ENDPOINTS.md`
33
33
  - `docs/api/[FEATURE_KEY]_API_DESIGN_DETAIL.md`
34
34
  - `docs/api/[feature_snake]_api_flow_list.txt`
35
- - `docs/database/DATABASE_SPEC_[FEATURE_KEY].md`
35
+ - `docs/database/DATABASE_SPEC_[FEATURE_KEY].md` (a new table, a legacy replacement or a migration that can meet real data: run `/db-design` first)
36
36
  - `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md`
37
37
  - `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md`
38
38
 
39
39
  ## Process
40
- 1. Read BA spec and PRD/backlog.
40
+ 1. Read BA spec and PRD/backlog. For source evidence use the readable paths and line ranges in `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` when it exists (cite `source_path` when it lists more than one source).
41
41
  2. Read `sdtk-spec.config.json` for project stack assumptions.
42
42
  3. If architecture output includes API contracts or flows, read and apply:
43
43
  - `./references/YAML_CREATION_RULES.md`
@@ -57,3 +57,16 @@ $ARGUMENTS
57
57
  9. If anything is unclear, record OQ-xx in `ARCH_DESIGN` and escalate to PM.
58
58
  10. Update shared state and Phase 3 checklist.
59
59
  11. Handoff: suggest `/dev` to prepare `FEATURE_IMPL_PLAN + CODE_HANDOFF` after the design is complete.
60
+
61
+ ## Order-Critical Hard Gate
62
+ For UI-scope features, do not generate or update `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md` until `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` already exists and is current enough to serve as the design source for the same scope.
63
+
64
+ If the layout is missing, stale, or cannot support the flow-action spec, stop and fix the layout first. Do not reverse the order and repair it later.
65
+
66
+ ## Common Mistakes
67
+ | Mistake | Why it is wrong | Do instead |
68
+ |---|---|---|
69
+ | Generate `FLOW_ACTION_SPEC` before `DESIGN_LAYOUT` for UI scope | Forces the spec to invent screen behavior without a design source | Create or refresh the layout first, then derive the flow-action spec |
70
+ | Treat API YAML, API detail, and flow-action outputs as independent documents | Causes naming and traceability drift across artifacts | Keep ARCH outputs linked through shared requirements and path policy |
71
+ | Close open questions silently during ARCH | Hides unresolved design decisions from downstream roles | Record `OQ-xx` explicitly and escalate through `/pm` |
72
+ | Hand off a workflow/tooling hardening batch without a validator matrix or exact DEV surface list | Leaves `/dev` and SDTK-CODE with an under-specified contract boundary | Lock the validator matrix, exact DEV surfaces, exact out-of-scope list, and stop-before-`/dev` wording before handoff |
@@ -19,8 +19,8 @@ If prerequisites are not met, report which gate is missing and suggest user run
19
19
 
20
20
  ## Current Context
21
21
  - Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
22
- - Pipeline: !`node -e "try{process.stdout.write(require('fs').readFileSync('SHARED_PLANNING.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
23
- - Gates: !`node -e "try{process.stdout.write(require('fs').readFileSync('QUALITY_CHECKLIST.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
22
+ - Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
23
+ - Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
24
24
  - State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
25
25
 
26
26
  ## Input
@@ -30,6 +30,10 @@ If no arguments are provided, read current feature context from SHARED_PLANNING.
30
30
 
31
31
  # SDTK-SPEC BA (Business Analysis)
32
32
 
33
+ ## Critical Constraints
34
+ - I do not mark BA analysis complete until `REQ`, `UC`, `BR`, and `AC` traceability is explicit.
35
+ - I do not silently resolve business ambiguities that belong to PM or the user.
36
+
33
37
  ## Output
34
38
  - `docs/specs/BA_SPEC_[FEATURE_KEY].md`
35
39
 
@@ -51,7 +55,7 @@ questions from the Open Questions For Human Review section must be carried
51
55
  forward as explicit OQ-xx items in BA_SPEC rather than silently resolved.
52
56
 
53
57
  ## Process
54
- 1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` and any source requirements.
58
+ 1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` and any source requirements. When `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` exists (from `sdtk-spec analyze`), read it first and open only the readable sources and line ranges it lists: Office files are already extracted to Markdown there, so never parse the binary copies.
55
59
  2. Produce:
56
60
  - Glossary
57
61
  - BR-xx (numbered)
@@ -62,6 +66,6 @@ forward as explicit OQ-xx items in BA_SPEC rather than silently resolved.
62
66
  - Traceability summary table (REQ -> UC/BR/AC)
63
67
  3. If source requirements are VI/JP, preserve the original text and add a literal EN translation in appendices.
64
68
  4. For benchmark runs, apply `governance/ai/core/SDTK_BENCHMARK_OQ_POLICY.md`: keep benchmark-expected open questions explicitly OPEN and do not silently resolve them in BA output.
65
- 5. If anything is unclear, record OQ-xx in BA_SPEC "Open Questions" and escalate to PM.
69
+ 5. If anything is unclear, record OQ-xx in BA_SPEC "Open Questions" and escalate to PM. OQs the customer must answer through their Q&A Excel sheet go there with `/customer-qa-sheet` (answers come back keyed by OQ id).
66
70
  6. Update `SHARED_PLANNING.md` + `QUALITY_CHECKLIST.md` Phase 2.
67
71
  7. Handoff: suggest user run `/pm` to proceed with PRD planning.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: customer-qa-sheet
3
+ description: Use when open questions (OQ-xx, 確認事項, 仕様確認) must go to a customer through their hand-maintained Q&A or issue-tracking Excel sheet (one numbered question per row, an answer column), when reading the customer's answers back into the spec / decision log, or when writing replies to questions the customer asked in that sheet.
4
+ ---
5
+
6
+ ## Input
7
+ $ARGUMENTS
8
+
9
+ # SDTK-SPEC Customer Q&A Sheet: questions, answers, replies
10
+
11
+ The sheet is a customer-facing record. Every row you add is read by the customer and answered in
12
+ writing, so a row must be correct, not a duplicate, in the sheet's own style, and approved by the
13
+ person before it lands. The workbook itself is hand-maintained.
14
+
15
+ **REQUIRED SUB-SKILL:** `sdtk-xlsx-safe-edit` — preflight, backup, XML route for every write. Never save
16
+ this workbook through Excel or openpyxl: that rewrites fonts and row heights on every other sheet.
17
+
18
+ ## Critical Constraints
19
+
20
+ 1. **Nothing is written before the person approves the exact row values** (or the exact reply text).
21
+ "The PM approved the wording" is not approval of row values, placement or numbering.
22
+ 2. **Never overwrite a cell that holds text.** New questions go into empty rows; replies are appended
23
+ after existing answer text. The customer's answer text is never edited.
24
+ 3. **Search before asking.** Every candidate is checked against the existing rows; overlap with an
25
+ unanswered row → reference it or drop the question; answered already → do not ask again.
26
+ 4. **Rows and OQs are matched by id** — the `OQ-xx` in an OQ column or in the question text, and the
27
+ sheet's No — never by row position.
28
+ 5. **Facts stated to the customer come from the code that runs, logs or a measurement**, not from
29
+ comments or design documents.
30
+
31
+ ## Project profile (read first)
32
+
33
+ Project facts live in the project repository, not here: find `qa_sheet_profile.md` by file search over the
34
+ working tree (it may be untracked; `git ls-files` misses it). It names the workbook, sheet, header row,
35
+ column map, our contact name, the customer's, category values, numbering format, answer-block format,
36
+ ordering rule, and a ```json block the script reads. No profile → build one from
37
+ `.claude/skills/customer-qa-sheet/references/PROFILE_TEMPLATE.md` by reading the sheet, and confirm it with
38
+ the person.
39
+
40
+ Script: `.claude/skills/customer-qa-sheet/scripts/oq_sync.py` (`oqs`, `sheet`, `export`, `answers`, `write`).
41
+ It reads the workbook from a copy with openpyxl and writes only through `sdtk-xlsx-safe-edit`'s `xlsx_xml_edit`
42
+ (the sheet part changes, every other part stays byte-identical, a `.bak` is kept).
43
+
44
+ ## Process
45
+
46
+ Read the profile, then follow the section that matches the request: A (adding questions), B (reading answers)
47
+ or C (replying to the customer). Each ends with a draft for the person before anything is written.
48
+
49
+ ### A. Adding questions
50
+
51
+ 1. **Read the sheet read-only** (`oq_sync.py sheet --profile …`): the last 5–10 filled rows for style, the
52
+ first empty number, pre-numbered empty rows, where data validation / conditional formatting end.
53
+ 2. **Collect the candidates.** From the spec: `oq_sync.py export --profile … --spec docs/specs/BA_SPEC_<KEY>.md
54
+ --out <draft>.md` lists every OPEN OQ not yet in the sheet with a proposed No and row, and the rows that share
55
+ words with it ("possibly related" — rows written before OQ ids were used carry no id); OQs already in the
56
+ sheet are shown with their No (answered or not). Other candidates come from the person or the work.
57
+ 3. **Check every candidate against existing rows.** Search the question, detail and function columns for
58
+ the same topic. Overlap with an unanswered row → reference it (e.g. "関連 No024") or drop the question.
59
+ 4. **Keep only questions that block work:** the spec leaves a user-visible or data-affecting behaviour
60
+ undefined, or the spec cannot be built as written and a deviation needs consent. Do not ask what the spec
61
+ states clearly. A mockup is an illustration, not a decision; when a cell and a mockup disagree, quote
62
+ both. Before asking about a limit or rule in your own system, read the code that enforces it and state
63
+ what it really counts.
64
+ 5. **Write each row's text in this shape** (the customer's language and the sheet's style):
65
+ 1. context, 1–2 sentences: the spec sheet / section it comes from, and the current behaviour stated plainly
66
+ ("not implemented yet", "limited to 20 in total");
67
+ 2. the question; several points → one numbered item each — (1), (2)… — each answerable alone;
68
+ 3. choices when they help: (A), (B)… with our proposal marked as the profile says (e.g. "… 弊社案");
69
+ 4. a closing ask (e.g. "どちらがよろしいでしょうか。").
70
+ Each row carries its `OQ-xx` (OQ column, or the profile's `oq_tag` at the start of the text). Customer text
71
+ carries no code paths, no internal ticket ids, and no apology or correction of an earlier document unless
72
+ the person asks for one.
73
+ 6. **Draft for review:** the export draft completed with, per row, every column value exactly as it will be
74
+ written, the existing rows on the same topic (or "none"), and a translation for the reviewer (not written to
75
+ Excel). End with the open choices and a default for each (start number, one row vs one row per point,
76
+ order, column values, date).
77
+ 7. **Write only after the person approves.** Save the approved rows as JSON (`[{"row", "oq", "values": {<profile
78
+ column key>: text}}]`), run `oq_sync.py write --profile … --rows <file>` (dry run), then with `--apply`.
79
+ The script refuses rows that already hold a question, OQs already in the sheet, unknown columns, and any
80
+ value in the answer column. Report: rows written, No, backup path.
81
+
82
+ ### B. Reading the customer's answers
83
+
84
+ 1. `oq_sync.py answers --profile … --snapshot <last>.json --save-snapshot <new>.json` — rows whose answer is
85
+ non-empty and changed since the last snapshot, each with its `OQ-xx` ids (`unmatched: true` when the row
86
+ names none). Keep the snapshot next to the profile.
87
+ 2. Per row: question, answer verbatim, the decision it implies, the specs or tasks it changes, and whether it
88
+ is ambiguous. Ambiguous → draft a follow-up row ("関連 No…") under section A. Any statement about how your
89
+ system works follows constraint 5.
90
+ 3. **Propose** the spec update, keyed by OQ id: in BA_SPEC §5.2 the row's Status → `RESOLVED`, Resolution →
91
+ the decision + `(<sheet> No<n>, <answer date>)`; a dated row in the decision log. Show the patch; apply it
92
+ after the person agrees. Unmatched rows are reported, never guessed onto an OQ.
93
+
94
+ ### C. Replying to a question the customer asked
95
+
96
+ 1. Establish every fact you will state from the code that executes, logs or a measurement; note which of
97
+ these each fact rests on. Behaviour you did not measure is stated as design, not as observed.
98
+ 2. When the person's statement contradicts the code (for example which version uses which path), write what
99
+ the code does and say so explicitly in the draft.
100
+ 3. Draft the reply in the answer-block format from the profile (e.g. `YYYY/MM/DD <our name>` + newline +
101
+ text), in the sheet's existing style: 1–2 lines per item; several product versions → "path 1 / path 2"
102
+ with one note on top; commands short, one per line. Show the draft unless the person approved this exact
103
+ text.
104
+ 4. Write it **after** any existing text in the answer cell (XML route of `sdtk-xlsx-safe-edit`), never over it.
105
+
106
+ ## Red flags — stop
107
+
108
+ | Thought | Reality |
109
+ |---|---|
110
+ | "The PM approved the wording, just write it" | Approved wording ≠ approved row values / placement / a reply you composed. Show what you will write unless it was approved verbatim. |
111
+ | "Save once through Excel, it's quicker" | Every other sheet's layout changes. XML route. |
112
+ | "This question is new" | You have not searched the existing rows yet. |
113
+ | "The answers are in the same order as our OQs" | Match by OQ id; report rows without one. |
114
+ | "The mockup shows it, so it's required" | Ask only if the spec text is silent or contradicts it. |
115
+ | "I know how the app behaves" / "the design doc says so" | Read the code path that runs; quote what it counts or returns. |
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: db-design
3
+ description: Use when designing, reviewing, trimming or migrating a database schema or durable app state (tables, columns, keys, indexes, enums, queues, recovery records) - a new table or column is proposed, a legacy database is replaced, or a schema change may reach machines holding real user data.
4
+ ---
5
+
6
+ ## Input
7
+ $ARGUMENTS
8
+
9
+ # SDTK-SPEC Database Design, Review and Migration
10
+
11
+ A schema is a set of claims about what must be remembered. Keep the smallest schema that serves a present, evidenced requirement. Every durable field needs a named writer, reader, recovery purpose, and owner-approved meaning.
12
+
13
+ The product owner decides product semantics. Establish evidence, distinguish product policy from implementation mechanics, propose the smallest safe design, and obtain sign-off before changing the schema of record.
14
+
15
+ ## Critical Constraints
16
+
17
+ 1. **Every durable field names a writer, a reader, a recovery purpose and the requirement that fails without it.**
18
+ No such requirement → cut or defer it, and record what would reopen it.
19
+ 2. **Read the DDL and every write path** before stating what a column means or which states exist; never infer a
20
+ rule from a table's shape.
21
+ 3. **Once any build can hold data that exists nowhere else, a schema change never drops and recreates.** Upgrade
22
+ ladder, engine backup, one transaction per step, refuse to open a newer database with an older client.
23
+ 4. **The product owner decides product semantics** (ownership, retention, recovery, conflict policy, external
24
+ field meaning). Stop and ask for those; propose the smallest design for everything else.
25
+ 5. **The schema of record changes only after sign-off**; superseded design text is marked with date and reason,
26
+ never deleted.
27
+
28
+ ## Modes and outputs
29
+
30
+ `sdtk-arch` writes `docs/database/DATABASE_SPEC_[FEATURE_KEY].md` from the toolkit's DATABASE_SPEC template.
31
+ This skill decides **what goes into it** and how it may change:
32
+
33
+ | Mode | When | Output |
34
+ |---|---|---|
35
+ | **design** | a new table / column is proposed, or a feature has DB impact | the fact inventory (section 8 of the DATABASE_SPEC template) with a verdict per column, then the tables of the spec |
36
+ | **review / trim** | an existing schema, before a release or a refactor | the inventory of the current DDL **and all write paths**, a verdict per column (keep / derive / fold / defer / cut), the evidence |
37
+ | **migration** | a schema change, a legacy replacement, or any build that can meet real data | the legacy column map, the upgrade ladder, the migration policy and its stop point |
38
+
39
+ Every mode follows `.claude/skills/db-design/references/REVIEW_PROCESS.md` for the evidence it needs, and ends
40
+ with proposals for the owner — the schema of record changes only after sign-off.
41
+
42
+ Examples in this skill come from two kinds of systems; apply the rule, not the domain:
43
+ - a **web application** (orders, order lines, customers): "store inputs, not rendered output" → keep `amount` and
44
+ `currency`, not `amount_display`; "stable identity" → an order is keyed by its id, never by its order number
45
+ when that number can be re-issued; "one meaning, one name" → `status` of an order and `status` of a payment are
46
+ different value sets, named `order_status` / `payment_status`;
47
+ - a **local client that syncs with a server** (files, queues, recovery records): the durable-workflow rules below.
48
+
49
+ ## Core principles
50
+
51
+ 1. **Start from durable facts, not feature names.** For each table and column, name the requirement that fails without it. Otherwise cut or defer it.
52
+ 2. **Do not duplicate or cache durable truth without a failure reason.** Prefer filesystem state, upstream records, or values derivable from stored facts when they remain available at recovery time. The other store must hold the *same* fact: a read-only attribute on disk does not say whether this app set it or the user did, so ownership of a change is still a fact worth one column.
53
+ 3. **Keep an object's attributes on its own row.** Avoid one-to-one side tables unless lifecycle, access, or retention genuinely differs.
54
+ 4. **Persist only what must survive restart or crash.** Keep process-only coordination in memory; persist the minimal recovery fact.
55
+ 5. **Preserve external semantics.** Copy externally owned IDs, timestamps, bitmasks, names, defaults, and error meanings verbatim. Do not invent a local enum over an upstream contract.
56
+ 6. **Make identity stable.** Do not use mutable names, paths, parents, or nullable values as an object's identity key. Treat a path as location, not identity.
57
+ 7. **Derive states from real writers.** Every enum value must have a writer; every writer must have a documented value. A queue that deletes successful rows does not have a durable `Done` state.
58
+ 8. **Give indexes one explicit job.** Each index enforces a named invariant or accelerates a named query. Match collation to the platform's identity rules, such as case-insensitive Windows paths.
59
+ 9. **Preserve real user data from the first shared-system build.** "Dev only" ends when any build can contain a user's only copy of queued work, edits, or settings.
60
+ 10. **One meaning, one name; different meanings, different names.** Unify columns that hold the same domain and value set. Never merge columns whose same numbers mean different things in each table.
61
+ 11. **Store inputs, not rendered output.** Do not persist a display string that is fully derivable from other columns; store only what the UI cannot rebuild (an error reason, a conflict copy's name).
62
+ 12. **Keep some data outside the database.** Secrets stay in an encrypted store unless the database is encrypted at rest. Anything needed after the database file is deleted (an uninstaller's cleanup path) lives elsewhere too.
63
+ 13. **No schema for unspecified features.** When a feature's spec has not been delivered, defer its tables and columns and record the trigger that reopens them.
64
+
65
+ ## Durable workflows, queues, and synchronization
66
+
67
+ Use these rules whenever a database coordinates local files, background work, or an external service.
68
+
69
+ - Treat a queue row as **durable intent**, not merely a log. Complete it only after the external system has confirmed the requested effect.
70
+ - When state, queue, and protection records must agree, update them in **one transaction**. Check affected-row counts: a successful SQLite commit can still contain an UPDATE or DELETE that matched zero rows.
71
+ - Do not assume "no exception" means success. Repositories that log and return zero require callers to verify their result.
72
+ - A missing local row is not evidence that an item is new. Guard the "empty DB + populated workspace" shape; suspend or require recovery rather than mass-uploading existing content.
73
+ - Preserve the authoritative baseline needed for conflict detection. Do not overwrite a server baseline with local timestamps, malformed external values, or a refresh that races with a locally modified item.
74
+ - For a crash-recoverable multi-step operation, write a durable manifest or intent before the first irreversible external/local step; make each step idempotent; verify independently before cleanup; remove the manifest last.
75
+ - Do not adopt an external object by name alone. Name collisions cannot prove ownership.
76
+ - A retry ID is safe as an idempotency key only when it identifies one immutable operation and payload. A queue ID reused after a payload rewrite must not be sent as such a key.
77
+ - Identify client/server atomicity gaps explicitly. A server success before the local commit cannot be made exactly-once by client-side preflight alone; require an upstream idempotency contract if exact-once is a requirement.
78
+
79
+ ## Migration and write safety
80
+
81
+ - Once real user data can exist, schema mismatch must not mean drop-and-recreate. Use an explicit upgrade ladder, one atomic transaction per step, and a backup made through the database engine before risky changes.
82
+ - Commit DDL and the schema-version bump together. Test that a version change has a corresponding upgrade step, and refuse to open a newer database with an older client.
83
+ - A rebuild-on-change policy is acceptable only while its written precondition is true: no machine can hold data worth preserving. Record when that policy expires.
84
+ - Preserve legacy behavior by mapping required facts column by column, not by copying legacy table shapes. Every unmapped field needs an explicit reason it is obsolete.
85
+
86
+ ## Process
87
+
88
+ 1. Pick the mode (table above) and gather the evidence REVIEW_PROCESS.md names for it.
89
+ 2. Inventory and challenge every field (core principles, durable-workflow rules).
90
+ 3. For migrations: answer "can real data exist?" first, then the ladder (migration rules).
91
+ 4. Stop for the owner on the questions under "Stop and clarify"; present proposals with evidence.
92
+ 5. After sign-off: update the DATABASE_SPEC (section 8 included), then code and tests.
93
+
94
+ ### Review workflow
95
+
96
+ For a new schema, a material change, a legacy replacement, or release to machines with data, read `.claude/skills/db-design/references/REVIEW_PROCESS.md` and produce the relevant evidence before implementation.
97
+
98
+ At minimum, inspect the DDL **and all write paths**. Schema shape alone does not establish a field's meaning, state transitions, or recovery guarantees.
99
+
100
+ ## Stop and clarify
101
+
102
+ Stop for owner or backend confirmation when any of these is unknown:
103
+
104
+ - a user-visible ownership, retention, recovery, or conflict policy;
105
+ - the semantic meaning/default of an external field or response;
106
+ - whether a migration may encounter real data;
107
+ - whether a backend accepts a client idempotency key and its exact replay/concurrency contract.
108
+
109
+ Do not stop merely because an internal transaction boundary, naming convention, or retry implementation is undecided; propose the smallest design consistent with the approved product policy.
110
+
111
+ ## Red flags - stop and re-check
112
+
113
+ - "Add the table now so we don't have to migrate later."
114
+ - A local enum invented over values that come from another system.
115
+ - A status value no code path writes, or a written value with no status name.
116
+ - A design rule inferred from a table's shape ("it has no parent column, so...") without grepping who writes the table.
117
+ - A column justified only by "might help debugging/UI" with no requirement or screen named.
118
+ - "It's only on dev machines" - check whether any build points at a shared server.
119
+ - Design doc, ERD, definition sheet and code disagreeing about a name or value.
120
+
121
+ ## Common mistakes
122
+
123
+ | Mistake | Fix |
124
+ |---|---|
125
+ | Proposing tables from requirement titles | Map each requirement to the facts it must remember across restarts |
126
+ | Renaming columns in docs and code in many small rounds | Agree names with stakeholders first, then change code once |
127
+ | Deleting superseded design text | Mark it superseded with date and reason; keep it under the current version |
128
+ | Showing internal notes or implementation status in customer copies | Strip to PK, defaults and enum values |
@@ -19,8 +19,8 @@ If prerequisites are not met: report which gate is missing, suggest user run `/a
19
19
 
20
20
  ## Current Context
21
21
  - Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
22
- - Pipeline: !`node -e "try{process.stdout.write(require('fs').readFileSync('SHARED_PLANNING.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
23
- - Gates: !`node -e "try{process.stdout.write(require('fs').readFileSync('QUALITY_CHECKLIST.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
22
+ - Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
23
+ - Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
24
24
  - State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
25
25
 
26
26
  ## Input
@@ -30,6 +30,10 @@ If no arguments provided, read current feature context from SHARED_PLANNING.md.
30
30
 
31
31
  # SDTK-SPEC DEV (Planning + SDTK-CODE Handoff)
32
32
 
33
+ ## Critical Constraints
34
+ - I do not emit `READY_FOR_SDTK_CODE` until the current `FEATURE_IMPL_PLAN` scope is approved and all required upstream refs are explicit.
35
+ - I do not claim downstream implementation is complete from within `/dev`.
36
+
33
37
  ## Outputs
34
38
  - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
35
39
  - `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
@@ -57,3 +61,30 @@ If no arguments provided, read current feature context from SHARED_PLANNING.md.
57
61
  8. If ready, suggest:
58
62
  - `sdtk-code start --feature-key <KEY> --lane <feature|bugfix> --project-path .`
59
63
  9. Do not claim that `/dev` executed downstream code, build, verify, ship, or QA handoff.
64
+
65
+ ## Verification Before Completion
66
+ Apply `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md`.
67
+
68
+ Do not:
69
+ - say the handoff is ready without validating the current refs, blockers, slices, and obligations
70
+ - cite downstream readiness without fresh verification evidence for the claim
71
+ - use `should`, `probably`, or `seems` in place of executed checks
72
+ - rely on partial output, stale command runs, or unchecked agent reports
73
+ - manually compose `CODE_HANDOFF` JSON when the canonical generator script is available
74
+
75
+ If validation fails or cannot be run, report the handoff as blocked and explain the blocker.
76
+
77
+ ## Order-Critical Hard Gate
78
+ 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.
79
+
80
+ 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.
81
+
82
+ Do not let placeholder commands, vague slice names, or missing required refs stand in for real downstream readiness.
83
+
84
+ ## Common Mistakes
85
+ | Mistake | Why it is wrong | Do instead |
86
+ |---|---|---|
87
+ | 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` |
88
+ | 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 |
89
+ | 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 |
90
+ | 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 |
@@ -71,3 +71,13 @@ Do not declare a slice done without verifying the generated endpoints satisfy th
71
71
  | Omit `transaction.atomic()` on multi-step writes | Risk of partial writes and data corruption | Wrap every write sequence in an atomic block |
72
72
  | Use a different module pattern than the existing repo reference | Inconsistency that maintainers must correct | Read the reference module and match its structure exactly |
73
73
  | Treat this skill as a replacement for `sdtk-dev` | Collapses bounded specialist scope into general DEV ownership | Keep scope explicitly bounded to the current slice |
74
+
75
+ ## Reference Loading Guidance
76
+ Read at slice start:
77
+ - `docs/api/[FeaturePascal]_API.yaml` (required)
78
+ - `docs/api/[FEATURE_KEY]_ENDPOINTS.md` (required)
79
+ - `docs/specs/BA_SPEC_[FEATURE_KEY].md` or `docs/architecture/ARCH_DESIGN_[FEATURE_KEY].md` (required)
80
+
81
+ Read on demand:
82
+ - Existing backend reference module in `src/backend/` (match its patterns)
83
+ - `sdtk-spec.config.json` for stack-specific test/lint commands
@@ -71,3 +71,13 @@ Do not declare a slice done without verifying all implemented screens satisfy th
71
71
  | Use a different structure than the existing frontend reference | Inconsistency maintainers must correct | Read the reference module and match its structure exactly |
72
72
  | Treat this skill as a replacement for `sdtk-dev` | Collapses bounded specialist scope into general DEV ownership | Keep scope explicitly bounded to the current slice |
73
73
  | Add field labels from memory | Labels drift from the spec | Copy field label text exactly from the layout or flow-action doc |
74
+
75
+ ## Reference Loading Guidance
76
+ Read at slice start:
77
+ - `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` (required)
78
+ - `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md` (required)
79
+ - `docs/api/[FEATURE_KEY]_ENDPOINTS.md` (required)
80
+
81
+ Read on demand:
82
+ - Existing frontend reference module in `src/frontend/` (match its patterns)
83
+ - `sdtk-spec.config.json` for stack-specific commands
@@ -20,8 +20,8 @@ If prerequisites NOT met: report which gate is missing, suggest user run the pre
20
20
 
21
21
  ## Current Context
22
22
  - Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
23
- - Pipeline: !`node -e "try{process.stdout.write(require('fs').readFileSync('SHARED_PLANNING.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
24
- - Gates: !`node -e "try{process.stdout.write(require('fs').readFileSync('QUALITY_CHECKLIST.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
23
+ - Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
24
+ - Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
25
25
  - State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
26
26
 
27
27
  ## Input
@@ -31,12 +31,17 @@ If no arguments provided, read current feature context from SHARED_PLANNING.md.
31
31
 
32
32
  # SDTK-SPEC PM (Entry Point + Planning)
33
33
 
34
+ ## Critical Constraints
35
+ - I do not hand off PM work until `SHARED_PLANNING.md` and `QUALITY_CHECKLIST.md` reflect the current phase.
36
+ - I do not hide unresolved scope or decision gaps; I record them as `OQ-xx` items for downstream roles.
37
+ - I do not write `committed`, `pushed`, `publish-ready`, or `ship complete` closure wording without exact git and downstream-phase evidence to support it.
38
+
34
39
  ## Outputs
35
40
  - Phase 1: `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md`
36
41
  - Phase 2+ (after BA spec): `docs/product/PRD_[FEATURE_KEY].md` + `docs/product/BACKLOG_[FEATURE_KEY].md`
37
42
 
38
43
  ## Process
39
- 1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out.
44
+ 1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out. Requirement sources from `sdtk-spec analyze`: read `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` first, then only the readable sources it lists.
40
45
  2. Create/update PM artifact(s).
41
46
  3. Ensure REQ-xx list is clear and testable.
42
47
  4. If requirements are provided in VI/JP: keep the original text in an appendix and add an EN translation (literal) for traceability.
@@ -86,3 +91,9 @@ Rules:
86
91
  - Try to resolve OQ-xx using existing docs and reasonable product/tech decisions.
87
92
  - If still missing information from the original input: ask the user (final stakeholder) and record the answer as the resolution.
88
93
  - Record decisions in PRD `Decision Log` and update OQ-xx `Resolution` fields in the originating docs.
94
+
95
+ ## Phase 6 Closure Truth
96
+ - Review the final QA and controller decisions before closing the issue.
97
+ - Treat `SHARED_PLANNING.md`, `QUALITY_CHECKLIST.md`, and `governance/ai/core/IMPROVEMENT_BACKLOG.md` as closure-state surfaces that must stay synchronized.
98
+ - Before using `committed` or `pushed` wording, verify the actual git state that supports the claim.
99
+ - Do not turn issue closeout into a fake standalone publish or release-wave claim unless that separate evidence truly exists.
@@ -22,8 +22,8 @@ If prerequisites are not met, report which gate or downstream evidence is missin
22
22
 
23
23
  ## Current Context
24
24
  - Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
25
- - Pipeline: !`node -e "try{process.stdout.write(require('fs').readFileSync('SHARED_PLANNING.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
26
- - Gates: !`node -e "try{process.stdout.write(require('fs').readFileSync('QUALITY_CHECKLIST.md','utf8'))}catch{process.stdout.write('Not initialized')}"`
25
+ - Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
26
+ - Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
27
27
  - State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
28
28
 
29
29
  ## Input
@@ -33,6 +33,15 @@ If no arguments are provided, read current feature context from SHARED_PLANNING.
33
33
 
34
34
  # SDTK-SPEC QA (Testing + Release Decision)
35
35
 
36
+ ## Critical Constraints
37
+ - I do not start QA handoff or release decision work until downstream implementation evidence exists, normally from SDTK-CODE.
38
+ - I do not approve without exact specification quotes and fresh verification evidence.
39
+ - `docs/dev/REVIEW_PACKET_[FEATURE_KEY].md` is a required QA input when `SDTK-CODE verify` has run.
40
+ - `OPS_HANDOFF_[FEATURE_KEY].json` alone is not sufficient final release evidence.
41
+ - When operationalization is in scope, I require both CODE evidence and OPS evidence before I can issue `APPROVED`.
42
+ - I remain the final release authority for the QA verdict and do not hand final release-status ownership back to PM after QA approval.
43
+ - `docs/qa/QA_RELEASE_REPORT_[FEATURE_KEY].md` remains the primary QA output even when `docs/qa/CONTROLLER_ACCEPTANCE_[FEATURE_KEY].md` exists.
44
+
36
45
  ## Output
37
46
  - `docs/qa/QA_RELEASE_REPORT_[FEATURE_KEY].md`
38
47
  - `docs/qa/CONTROLLER_ACCEPTANCE_[FEATURE_KEY].md` remains a separate downstream controller artifact and does not replace the primary QA output
@@ -56,3 +65,32 @@ If no arguments are provided, read current feature context from SHARED_PLANNING.
56
65
  14. Decide: APPROVED vs REJECTED (with reasons). `OPS_HANDOFF` alone is not sufficient final release evidence, and missing required OPS evidence blocks approval.
57
66
  15. Update shared state + Phase 5 checklist.
58
67
  16. Handoff: notify PM and stakeholders of the QA verdict and follow-up without reassigning final QA release authority.
68
+
69
+ ## Verification Before Completion
70
+ Apply `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md` and require fresh verification evidence before any QA verdict or handoff.
71
+
72
+ Do not:
73
+ - issue an APPROVED verdict without fresh verification evidence
74
+ - infer PASS from expected behavior, partial logs, or missing runtime access
75
+ - overstate benchmark-mode results as if they were live execution results
76
+ - let severity ordering, verdict wording, or release-gate wording drift out of sync
77
+
78
+ If the environment cannot run the proving checks, follow the benchmark QA mode policy explicitly and state that the result is not fully verified at runtime.
79
+
80
+ ## Specification Quoting
81
+ When validating a requirement, quote the exact source text before judging the evidence.
82
+
83
+ Use this format:
84
+ - `Spec says: "[exact quote]" -> Evidence: [match/mismatch + file reference]`
85
+
86
+ Apply it to BA, PRD or BACKLOG, ARCH, API, DB, and flow-action sources whenever they define the expected behavior.
87
+
88
+ ## Order-Critical Hard Gate
89
+ Do not start QA handoff, release testing, or release decision work until downstream implementation evidence is documented for the current feature, normally from SDTK-CODE `verify`/`ship` outputs or equivalent coding-review evidence.
90
+
91
+ If downstream implementation evidence is missing or stale, keep the work blocked and request a refreshed downstream handoff before QA starts.
92
+
93
+ Block final QA approval until:
94
+ - `docs/dev/OPS_HANDOFF_[FEATURE_KEY].json` exists and matches the current feature scope
95
+ - downstream OPS evidence is present and current
96
+ - QA release notes show `REVIEW_PACKET`, CODE evidence, and OPS evidence as separate first-class inputs