sdtk-spec-kit 0.9.2 → 0.11.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 (88) hide show
  1. package/README.md +1 -1
  2. package/assets/manifest/toolkit-bundle.manifest.json +370 -35
  3. package/assets/manifest/toolkit-bundle.sha256.txt +84 -17
  4. package/assets/toolkit/toolkit/AGENTS.md +2 -1
  5. package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +11 -3
  6. package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +7 -0
  7. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +46 -0
  8. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +19 -0
  9. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +1 -1
  10. package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +1 -1
  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-orchestrator/SKILL.md +2 -0
  18. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +1 -1
  19. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/SKILL.md +104 -0
  20. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/REVIEW_AND_MISTAKES.md +63 -0
  21. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SCR01.json +46 -0
  22. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SCR01.png +0 -0
  23. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SPEC_SCHEMA.md +208 -0
  24. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/example_spec.yaml +115 -0
  25. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/build_design_xlsx.py +550 -0
  26. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/design_spec.py +305 -0
  27. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/export_preview.py +111 -0
  28. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/export_spec_md.py +181 -0
  29. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/make_template.py +113 -0
  30. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/test_screen_design.py +198 -0
  31. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/uia_dump.py +64 -0
  32. package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/validate_spec.py +260 -0
  33. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/SKILL.md +76 -0
  34. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/references/HANDOFF_TEMPLATE.md +63 -0
  35. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/references/MOVING_A_PROJECT.md +18 -0
  36. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/scripts/dirty_files.py +133 -0
  37. package/assets/toolkit/toolkit/skills/sdtk-session-handoff/scripts/test_dirty_files.py +94 -0
  38. package/assets/toolkit/toolkit/skills/sdtk-smoke-test-spec/SKILL.md +69 -0
  39. package/assets/toolkit/toolkit/skills/sdtk-smoke-test-spec/scripts/test_validate_smoke_test.py +58 -0
  40. package/assets/toolkit/toolkit/skills/sdtk-smoke-test-spec/scripts/validate_smoke_test.py +152 -0
  41. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/SKILL.md +297 -0
  42. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/prompts/agent_brief_template.md +59 -0
  43. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/check_coverage.py +50 -0
  44. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/extract_sources.py +224 -0
  45. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/merge_parts.py +78 -0
  46. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/render_testcase.py +421 -0
  47. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/template_set.py +57 -0
  48. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/test_write_results.py +89 -0
  49. package/assets/toolkit/toolkit/skills/sdtk-test-case-xlsx/scripts/write_results.py +126 -0
  50. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/SKILL.md +149 -0
  51. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/pictures.py +68 -0
  52. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/test_metadata.py +76 -0
  53. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/test_pictures.py +55 -0
  54. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/xlsafe.py +137 -0
  55. package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/xlsx_xml_edit.py +217 -0
  56. package/assets/toolkit/toolkit/skills/skills.catalog.yaml +172 -0
  57. package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +1 -1
  58. package/assets/toolkit/toolkit/skills-claude/ba/SKILL.md +1 -1
  59. package/assets/toolkit/toolkit/skills-claude/customer-qa-sheet/SKILL.md +115 -0
  60. package/assets/toolkit/toolkit/skills-claude/db-design/SKILL.md +128 -0
  61. package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +1 -1
  62. package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +1 -1
  63. package/assets/toolkit/toolkit/skills-claude/screen-design-xlsx/SKILL.md +101 -0
  64. package/assets/toolkit/toolkit/skills-claude/session-handoff/SKILL.md +74 -0
  65. package/assets/toolkit/toolkit/skills-claude/smoke-test-spec/SKILL.md +66 -0
  66. package/assets/toolkit/toolkit/skills-claude/test-case-xlsx/SKILL.md +294 -0
  67. package/assets/toolkit/toolkit/skills-claude/xlsx-safe-edit/SKILL.md +146 -0
  68. package/assets/toolkit/toolkit/templates/README.md +11 -1
  69. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +14 -0
  70. package/assets/toolkit/toolkit/templates/screen-design-xlsx/ja-default/TEMPLATE.md +247 -0
  71. package/assets/toolkit/toolkit/templates/screen-design-xlsx/ja-default/template.xlsx +0 -0
  72. package/assets/toolkit/toolkit/templates/smoke-test/PROFILE_TEMPLATE.md +36 -0
  73. package/assets/toolkit/toolkit/templates/smoke-test/vi-default/AUTHORING_RULES.md +32 -0
  74. package/assets/toolkit/toolkit/templates/smoke-test/vi-default/SMOKE_TEST_TEMPLATE.md +147 -0
  75. package/assets/toolkit/toolkit/templates/smoke-test/vi-default/TEMPLATE.md +25 -0
  76. package/assets/toolkit/toolkit/templates/test-case-xlsx/PROFILE_TEMPLATE.md +78 -0
  77. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/TEMPLATE.md +28 -0
  78. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/README.md +73 -0
  79. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/_template.xlsx +0 -0
  80. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/common/common.xlsx +0 -0
  81. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/mobile_app.xlsx +0 -0
  82. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/smartphone_web.xlsx +0 -0
  83. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/web.xlsx +0 -0
  84. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default/viewpoints/platform/windows_app.xlsx +0 -0
  85. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default//343/203/206/343/202/271/343/203/210/344/273/225/346/247/230/346/233/270/344/275/234/346/210/220/343/203/253/343/203/274/343/203/253.md +514 -0
  86. package/assets/toolkit/toolkit/templates/test-case-xlsx/ja-default//343/203/206/343/202/271/343/203/210/344/273/225/346/247/230/346/233/270/351/233/233/345/236/213.xlsx +0 -0
  87. package/package.json +1 -1
  88. package/src/lib/scope.js +6 -4
@@ -0,0 +1,82 @@
1
+ # Database design review process
2
+
3
+ Use this process for a new schema, a material schema change, a legacy replacement, or a release that can touch real user data. Produce an evidence-backed review for the product owner before changing the schema of record.
4
+
5
+ ## 1. Gather sources
6
+
7
+ Read rather than recall:
8
+
9
+ - numbered requirements and approved product decisions;
10
+ - current DDL and every INSERT, UPDATE, DELETE, upsert, transaction, and migration path;
11
+ - legacy schemas and write paths when replacing an application;
12
+ - external API/schema/source contracts that provide stored values;
13
+ - platform facilities that already retain the fact, such as filesystem metadata or upstream change history.
14
+
15
+ Cite each material claim by file/line or document section. Count rows and writers; do not estimate them.
16
+
17
+ ## 2. Inventory the facts
18
+
19
+ Create one row per current or proposed column:
20
+
21
+ | Table.column | Type/example | Writer | Reader | Crash/recovery purpose | Requirement | Verdict |
22
+ |---|---|---|---|---|---|---|
23
+
24
+ For workflow tables, also document the state transition:
25
+
26
+ | Operation | Durable intent written | External/local effect | Confirmation | Cleanup | Restart behavior |
27
+ |---|---|---|---|---|---|
28
+
29
+ An empty Writer column means the field is dead or planned; state which.
30
+
31
+ ## 3. Challenge every field
32
+
33
+ For each field, ask in this order:
34
+
35
+ 1. Which present requirement fails without it? If none, **cut** or **defer**.
36
+ 2. Is the fact already durable and available at recovery time elsewhere? If yes, **derive** it.
37
+ 3. Is it exactly derivable from fields already retained? If yes, **derive** it.
38
+ 4. Is it a one-to-one side table? If yes, normally **fold** it into the owner row.
39
+ 5. Does it need to survive process loss? If no, keep it in memory.
40
+ 6. Is it externally owned? If yes, use the source's type, value semantics, and defaults.
41
+ 7. Does every enum value have a writer and every writer a named state?
42
+ 8. Is its key stable, non-empty, and distinct from mutable location/display fields?
43
+ 9. Does each index name its constraint or hot query?
44
+ 10. Does another column hold the same meaning under a different name, or the same name with a different meaning?
45
+
46
+ Record the first failing test and the replacement or trigger that would reopen the proposal.
47
+
48
+ ## 4. Map legacy data and external authority
49
+
50
+ When replacing a legacy database, list every field once:
51
+
52
+ | Legacy table.column | New fact/table.column | Mapped or obsolete, and why |
53
+ |---|---|---|
54
+
55
+ For externally controlled values, record source, accepted format, default, and failure behavior. Do not turn an unverified backend response into a permanent local conclusion.
56
+
57
+ ## 5. Verify write safety
58
+
59
+ For every multi-table or multi-step operation, identify the atomic boundary and test failure after each step.
60
+
61
+ - One transaction for state changes that must agree.
62
+ - Verify affected rows for critical UPDATE/DELETE commands.
63
+ - Leave durable intent/manifest on every incomplete path.
64
+ - Do not delete local data or queue/state records before independent confirmation.
65
+ - Identify any server-success/local-commit crash window and state whether backend idempotency is required.
66
+
67
+ ## 6. Decide migration policy
68
+
69
+ Ask whether any machine running the build can hold data that exists nowhere else. If yes, require upgrade steps, engine backup, downgrade protection, and recovery tests. If no, record the exact precondition and expiry point of any rebuild policy.
70
+
71
+ ## 7. Present and synchronize records of truth
72
+
73
+ Present proposals, evidence, trade-offs, and genuine product open questions to the owner. After approval update: design source of truth -> ERD/DBML -> definition sheet -> code -> tests. Keep a dated decision log; mark superseded text with its reason instead of silently deleting it.
74
+
75
+ Customer-facing copies contain only approved schema facts and behavior; omit internal implementation notes and release status.
76
+
77
+ ## 8. Document conventions
78
+
79
+ - Per column: meaning in plain words, an example value, and why it exists.
80
+ - Mark each column as in use or planned, with the version or task that adds it.
81
+ - Explain each index in plain language: an index is a lookup structure, not a field; say whether it enforces uniqueness or serves a named query.
82
+ - Ask the owner instead of guessing what a field in a customer-mandated template should contain.
@@ -109,6 +109,8 @@ sdtk-spec generate --feature-key YOUR_FEATURE --feature-name "Your Feature"
109
109
  - `auto` (default): run `sdtk-test-case-spec` when QA phase requires reusable test-case artifact.
110
110
  - `on`: always run `sdtk-test-case-spec` for QA phase (fail fast if required inputs are missing).
111
111
  - `off`: skip test-case spec generation unless user explicitly requests it.
112
+ - `xlsx`: the test-case artifact is an Excel workbook built from the customer's template — route test-case requests
113
+ to `sdtk-test-case-xlsx` instead of `sdtk-test-case-spec` (run it when QA requires the artifact, as `auto`).
112
114
 
113
115
  ## Optional: Mailbox Dispatch
114
116
  - Use `sdtk-mailbox-dispatch` when one bounded controller-owned phase should be delegated to Claude or Codex.
@@ -25,7 +25,7 @@ description: QA workflow for SDTK-SPEC. Use when you need to validate downstream
25
25
  1. Validate prerequisites: `FEATURE_IMPL_PLAN`, `CODE_HANDOFF`, `REVIEW_PACKET`, `OPS_HANDOFF`, downstream implementation evidence, and downstream operational evidence are available and reference the same feature scope.
26
26
  2. Treat SDTK-CODE workflow evidence as the normal bridge into QA. In the current formal suite flow, `docs/dev/OPS_HANDOFF_[FEATURE_KEY].json` plus downstream operational evidence are also required before final release approval.
27
27
  3. Create test strategy mapped to UC/AC.
28
- 4. If test-case specification artifact is required, invoke `sdtk-test-case-spec` and align counts/coverage with release testing scope. Keep the structured TEST_CASE total consistent with the release-report baseline; track E2E separately if needed.
28
+ 4. If test-case specification artifact is required, invoke `sdtk-test-case-spec` (`sdtk-test-case-xlsx` when `orchestration.testCaseSpecMode = xlsx`) and align counts/coverage with release testing scope. Keep the structured TEST_CASE total consistent with the release-report baseline; track E2E separately if needed.
29
29
  5. Apply `governance/ai/core/SDTK_BENCHMARK_QA_MODE_POLICY.md` for benchmark-mode verdict rules when no executable build exists.
30
30
  6. If acceptance criteria / expected behavior is unclear, record OQ-xx in QA report and preserve benchmark-expected ambiguity per `governance/ai/core/SDTK_BENCHMARK_OQ_POLICY.md`; escalate to `@pm` if still missing info.
31
31
  7. Execute the required checks, record the commands used, and capture the actual results (unit/integration/e2e or document review evidence as applicable).
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: sdtk-screen-design-xlsx
3
+ description: Use when a Japanese 画面設計書 Excel workbook (表紙 / 改訂記事 / 機能概要 / 画面流れ / 処理) must be built, updated or reviewed from the screen flow-action spec and other sources, via a reviewable YAML spec rendered by Excel COM; also for read-only coverage audits of such a workbook. Windows + Excel + pywin32 to render.
4
+ ---
5
+
6
+ # SDTK-SPEC Screen Design Workbook (画面設計書 .xlsx)
7
+
8
+ `sdtk-screen-design-spec` owns the content (screens, UI items, actions, APIs). This skill renders it into a
9
+ customer's 画面設計書 house format, through a YAML spec that is reviewed, diffed and re-rendered:
10
+
11
+ ```
12
+ flow-action spec + sources ──(you)──▶ design_spec.yaml ──(build_design_xlsx.py)──▶ .xlsx
13
+ ```
14
+
15
+ Never hand-write Excel-building code for this format; the YAML is the artifact.
16
+
17
+ **REQUIRED SUB-SKILL:** `sdtk-xlsx-safe-edit` — preflight, backup, final mode, metadata scan.
18
+
19
+ <!-- neutral-only -->
20
+ > **Installed as a runtime skill** (for example under `.codex/skills/`): read `toolkit/skills/sdtk-<name>/` in the
21
+ > paths below as the installed skill folder of that name (this one or a sibling) and `toolkit/templates/` as
22
+ > `references/templates/` inside this skill's folder.
23
+ <!-- /neutral-only -->
24
+
25
+ ## Critical Constraints
26
+
27
+ 1. **Rendering wipes and rebuilds each named sheet.** On an existing workbook `--sheets` is mandatory and names
28
+ only the sheets you changed; the renderer refuses otherwise.
29
+ 2. **A workbook the person finalized by hand is never re-rendered.** Mark it `workbook.final: true`; changes go
30
+ through `sdtk-xlsx-safe-edit` final mode (surgical edit + change table). A workbook that changed after this
31
+ skill's last render (render stamp beside the spec) is rendered only with `--accept-hand-edits`, after the person
32
+ confirmed the named sheets hold nothing to keep.
33
+ 3. **Never save it with `openpyxl`** (drawings vanish) and **never attach to the person's Excel** — the scripts use
34
+ a private instance (`DispatchEx`); preflight stops when the workbook or one of the same name is open.
35
+ 4. **Validate before rendering and look after it.** `validate_spec.py` exits 0; then export PNGs and read every page —
36
+ clipped shape text and overlaps are only visible in the render.
37
+ 5. **Cite real identifiers only** (API numbers, tables, columns, screen ids from the sources). Never invent one: it
38
+ survives into the customer's issue log.
39
+ 6. **Before the workbook leaves the team**, `xlsx_xml_edit.py scan-metadata <file> --name <customer> …` exits 0
40
+ (author, saved path, external links, old defined names, names in any part).
41
+
42
+ ## Inputs
43
+
44
+ - the screen flow-action spec (`sdtk-screen-design-spec`), design layout, API list, DB spec; the implementation when
45
+ the document must describe real behaviour;
46
+ - the template set: `toolkit/templates/screen-design-xlsx/<set>/` (`ja-default` shipped; a customer's own set in
47
+ `docs/templates/screen-design-xlsx/<set>/` of the project wins) — `TEMPLATE.md` is the format the renderer assumes;
48
+ - screenshots, and for markers either measured fractions or a UI Automation dump (`scripts/uia_dump.py`).
49
+
50
+ ## Process
51
+
52
+ 1. Read the template set's `TEMPLATE.md` and `toolkit/skills/sdtk-screen-design-xlsx/references/SPEC_SCHEMA.md`
53
+ (a complete fictional spec: `toolkit/skills/sdtk-screen-design-xlsx/references/example_spec.yaml`).
54
+ 2. Write or extend the spec YAML (default `docs/screen_design/design_spec.yaml`). Map the flow-action spec's UI item
55
+ table onto `screens[].items` (項目名 / 部品の種類 / 属性 / DBカラム / 桁数 / 初期値 / 必須 / 特記事項); one flow
56
+ block per process, detail pages for API calls and rules. Count flowchart nodes before adding one (max 6, a
57
+ decision spends two markers).
58
+ 3. `python toolkit/skills/sdtk-screen-design-xlsx/scripts/validate_spec.py --spec <spec>` — fix every error. It checks
59
+ shape text, annotation widths, page overflow (flow end, terminating branches, screenshot + <備考>), sub-process
60
+ and `…を参照` targets, marker ↔ item counts, UI Automation markers.
61
+ 4. **Read-only requests stop here** (audit, "is it complete?"): see
62
+ `toolkit/skills/sdtk-screen-design-xlsx/references/REVIEW_AND_MISTAKES.md` §1. No Excel, no render.
63
+ 5. `build_design_xlsx.py --spec <spec> --sheets <changed sheets> --check` (no Excel needed) says what would be
64
+ rendered or why not. Render — Windows + Excel:
65
+ `python toolkit/skills/sdtk-screen-design-xlsx/scripts/build_design_xlsx.py --spec <spec> --sheets <changed sheets>`.
66
+ It preflights, backs up to `_backup/`, renders in a private Excel, closes without saving on any error, and writes
67
+ the render stamp. A refusal names the reason (final, hand edits, missing `--sheets`): report it, do not work
68
+ around it. `--out <copy.xlsx>` renders a preview copy without touching the workbook.
69
+ 6. `python toolkit/skills/sdtk-screen-design-xlsx/scripts/export_preview.py --spec <spec> --sheets <same>` and read
70
+ every PNG. Iterate on the YAML until the pages are clean.
71
+ 7. Add a `改訂記事` entry for the change and render that sheet.
72
+ 8. Optional: `export_spec_md.py --spec <spec>` writes the process sheets as Markdown (Mermaid + notes) for the
73
+ architecture docs — generated, never edited by hand.
74
+
75
+ ## Numbering conventions
76
+
77
+ - `画面ID`: `<PREFIX><nn>` per screen (`SCR01`), stable forever; new screens append.
78
+ - `処理番号`: screen-driven processes reuse the screen id (`SCR03-1`); background processes get their own series
79
+ (`PRC01-1`) with the trigger in `画面名`; sub-processes append a level (`PRC01-1-1`). Never renumber a series.
80
+ - Step markers `①②③…` match the right-hand explanation list one-for-one.
81
+
82
+ ## Content conventions
83
+
84
+ - Confirmed-but-unimplemented design is still documented, prefixed `【現行未実装】…(〜の確定後)` on every sheet
85
+ that mentions it (`機能概要` included).
86
+ - Sources that disagree with each other or with the code are decisions for the person, not text to copy across.
87
+
88
+ ## When To Stop Or Escalate
89
+
90
+ - Not Windows, or no desktop Excel: stop before rendering and say so (validate / audit / Markdown still work).
91
+ - The workbook is open, final, or changed since the last render: stop and report (constraint 2).
92
+ - A flow needs more than 6 main-column nodes: split it into a parent flow + a sub-process page — ask if unsure.
93
+ - Marker positions cannot be derived from markdown: ask for a screenshot + UI Automation dump, or coordinates.
94
+
95
+ ## Scripts
96
+
97
+ | Script | Needs | Does |
98
+ |---|---|---|
99
+ | `validate_spec.py --spec` | PyYAML | schema, layout budgets, overflow, references, UIA markers |
100
+ | `build_design_xlsx.py --spec --sheets [--out] [--accept-hand-edits] [--check]` | Windows, Excel, pywin32 | render (safe-edit preflight / backup, stamp) |
101
+ | `export_preview.py --spec [--sheets] [--outdir]` | Windows, Excel | one PNG per printed page |
102
+ | `export_spec_md.py --spec [--sheet]` | PyYAML | process sheets as Markdown |
103
+ | `uia_dump.py --title --out [--inset]` | Windows, pywinauto, Pillow | screenshot + element rectangles of one window |
104
+ | `make_template.py --from --out` | Windows, Excel | blank template.xlsx for a (customer's) template set |
@@ -0,0 +1,63 @@
1
+ # Reviewing a 画面設計書 workbook, and the mistakes that cost a page
2
+
3
+ Read-only audits and the layout mistakes seen in practice. Workflow and gates are in `../SKILL.md`.
4
+
5
+ ## 1. Reviewing an existing workbook (read-only)
6
+
7
+ Auditing what a workbook currently says — coverage against the sources, whether a revision
8
+ landed, what a proposed change would cost — is a first-class use of this skill. It needs no
9
+ Excel and no render, but it still needs the format rules: a proposal that ignores them is not
10
+ buildable (see the flowchart-capacity row under Common Mistakes).
11
+
12
+ **Reading with `openpyxl` is safe.** The ban is on *saving* — `openpyxl` drops every drawing on
13
+ every sheet it does not rewrite. Loading a workbook to read cell values does no harm.
14
+
15
+ ```python
16
+ # dump every non-empty cell of one sheet as coordinate=value
17
+ import openpyxl
18
+ ws = openpyxl.load_workbook(PATH, data_only=True)["処理"]
19
+ for row in ws.iter_rows():
20
+ cells = [(c.coordinate, str(c.value).replace("\n", "\\n")) for c in row if c.value not in (None, "")]
21
+ if cells:
22
+ print(" | ".join(f"{k}={v}" for k, v in cells))
23
+ ```
24
+
25
+ `openpyxl` sees cell text only. Flowchart shapes, screenshots and step markers are drawings and
26
+ never appear in that dump — read flow structure from `design_spec.yaml`, which is the source of
27
+ truth for every rendered sheet. Do not reverse-engineer the layout from a cell dump; it is
28
+ already written down in the template set's `TEMPLATE.md`.
29
+
30
+ ### 1.1 Coverage audit
31
+
32
+ When the question is "is this still complete after the sources changed", work the matrix
33
+ instead of reading page by page:
34
+
35
+ 1. **Version skew.** `workbook.meta` 版数 against the version header of each source `.md`.
36
+ The gap tells you how many revisions of content to go looking for.
37
+ 2. **Section ↔ block matrix.** One row per source section (e.g. each `## 11.x` sequence), one
38
+ column: which `処理番号` covers it. The empty cells are the finding.
39
+ 3. **Identifier sweep.** Every API number / table / screen id named in the sources versus the
40
+ ones named in the spec — `grep -oE "[AB]-[0-9]+"` over both sides. This is the check that
41
+ catches a whole missing feature rather than a missing sentence.
42
+ 4. **The other direction.** Features asserted in `機能概要`, or screens listed in `画面流れ`,
43
+ that no process block covers; and blocks describing behaviour no source document states.
44
+ Both are findings; the second is worse.
45
+ 5. **Sources that disagree with each other, or with the code.** Report these as decisions to be
46
+ made, not as text to be copied across. Writing a block from a source that contradicts the
47
+ implementation ships the contradiction to the customer.
48
+ 6. **Run `validate_spec.py` before extending the spec.** Warnings already present are now
49
+ yours — they mean the delivered workbook has clipped text on those pages.
50
+
51
+
52
+ ## 2. Common mistakes
53
+
54
+ | Mistake | Why it is wrong | Do instead |
55
+ |---|---|---|
56
+ | Saving the workbook with `openpyxl` | Drops every shape and image on all sheets | Use the COM renderer; surgical edits via sdtk-xlsx-safe-edit |
57
+ | Long text in a `decision` shape | A diamond only paints text in its inscribed 50%×50% box — extra lines are clipped with no error | ≤2 lines × ≤7 full-width chars; put detail in the branch label or notes |
58
+ | Writing values into the grid without normalising the font | The template grid mixes 8pt and 11pt columns, so a table looks ragged | The renderer forces 8pt on block bodies; do not fight it |
59
+ | Annotation lines longer than the page | Text past column BI is cut off when printed | Keep ≤38 full-width chars from column AH, ≤52 from column X |
60
+ | One flowchart node per requirement sentence | Overflows the 40-row block | Merge steps; move detail to `notes` or a `detail` page |
61
+ | Adding a step to an existing flowchart | A mature block already sits at 5 of the 6 available nodes and a `decision` spends two markers, so "just one more step" overflows the 40-row block — or pushes `ann_col` to `AH` and silently clips every annotation to 38 fw chars | Read `nodes` out of the spec and count first. Prefer hanging the new logic off an existing node with `sub:` + a detail page: detail pages are cheap, flowchart rows are not |
62
+ | Re-rendering every sheet to change one | Wipes hand-tuned sheets | `--sheets <only the ones you changed>` |
63
+ | Trusting a re-render without looking at the PNGs | The stamp copies values, so a stale first block silently bleeds into every later page | Always `export_preview.py` and read the images, on re-renders especially |
@@ -0,0 +1,46 @@
1
+ {
2
+ "window": {
3
+ "rect": [
4
+ 100,
5
+ 200,
6
+ 900,
7
+ 700
8
+ ],
9
+ "inset": 0
10
+ },
11
+ "elements": [
12
+ {
13
+ "automation_id": "SearchBox",
14
+ "name": "注文番号・顧客名",
15
+ "control_type": "Edit",
16
+ "rect": [
17
+ 120,
18
+ 260,
19
+ 400,
20
+ 290
21
+ ]
22
+ },
23
+ {
24
+ "automation_id": "SearchButton",
25
+ "name": "検索",
26
+ "control_type": "Button",
27
+ "rect": [
28
+ 420,
29
+ 260,
30
+ 520,
31
+ 290
32
+ ]
33
+ },
34
+ {
35
+ "automation_id": "OrderGrid",
36
+ "name": "注文一覧",
37
+ "control_type": "DataGrid",
38
+ "rect": [
39
+ 120,
40
+ 310,
41
+ 880,
42
+ 660
43
+ ]
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,208 @@
1
+ # design_spec.yaml schema
2
+
3
+ One YAML file describes the whole workbook. `build_design_xlsx.py` renders it; nothing else in
4
+ the pipeline knows about the Excel format.
5
+
6
+ Every top-level content key is optional — render only what you have, and pass `--sheets` to
7
+ rebuild a subset. Column references are Excel letters (`"AH"`), row references are 1-based.
8
+
9
+ ---
10
+
11
+ ## `workbook` (required)
12
+
13
+ ```yaml
14
+ workbook:
15
+ path: docs/screen_design/受注管理_画面設計書.xlsx
16
+ template_set: ja-default # optional; template set folder name or path (default ja-default). Its TEMPLATE.md
17
+ # names the blank workbook used when `path` does not exist yet.
18
+ template: null # optional; an explicit .xlsx instead of the template set's
19
+ final: false # true once the person finalized the workbook by hand: the renderer refuses,
20
+ # changes go through sdtk-xlsx-safe-edit final mode
21
+ block_rows: 40 # page height in rows; do not change unless the house format does
22
+ meta: # written into rows 1-2 of every block sheet
23
+ title: 画面設計書
24
+ user: ○○○○○○○○○○○○ 様
25
+ business: 受注管理システム
26
+ version: "0.1"
27
+ author: <作成者>
28
+ created: "2026-08-25"
29
+ updater: ""
30
+ updated: ""
31
+ process_sheet: null # optional; the tab `processes:` renders to (default 処理)
32
+ process_sheet_was: null # optional; the tab's former name: it is renamed, not left beside a new one
33
+ ```
34
+
35
+ `process_sheets[].was` does the same for an extra process sheet that was renamed.
36
+
37
+ ## `cover` — sheet 表紙
38
+
39
+ ```yaml
40
+ cover:
41
+ title: |-
42
+ 【受注管理システム】
43
+ 画面設計書
44
+ 設計書
45
+ 第0.03版
46
+ date: "2026-08-25"
47
+ ```
48
+
49
+ ## `history` — sheet 改訂記事
50
+
51
+ Newest last. The renderer lays entries out top-down with a blank row between them.
52
+
53
+ ```yaml
54
+ history:
55
+ - date: 2026年8月25日
56
+ version: "0.01"
57
+ items:
58
+ - ・初期作成
59
+ - date: 2026年9月7日
60
+ version: "0.03"
61
+ items:
62
+ - ・処理シートを作成し、主要処理のフローチャートを追加
63
+ -  (SCR01-1 注文の検索/PRC01-1 夜間の注文データ出力)
64
+ ```
65
+
66
+ ## `overview` — sheet 機能概要
67
+
68
+ ```yaml
69
+ overview:
70
+ - heading: "[機能概要]" # column A
71
+ items: # column B
72
+ - ・注文を検索し、内容を確認・修正する
73
+ - sub: (出荷済みの注文は修正できない) # column C
74
+ - heading: "[実装方針]"
75
+ groups: # a named group renders its name in column B, then its items
76
+ - name: 注文一覧
77
+ items:
78
+ - ・検索条件は注文番号または顧客名の部分一致とする
79
+ ```
80
+
81
+ ## `screens` — sheet 画面流れ
82
+
83
+ One entry per 40-row block.
84
+
85
+ ```yaml
86
+ screens:
87
+ - id: SCR01
88
+ name: 注文一覧画面
89
+ summary: 注文を検索し、一覧から選んだ注文の編集画面を開く。
90
+ source_label: Figma # printed at column A, row S+2
91
+ image: docs/screen_design/_preview/SCR01_注文一覧画面.png
92
+ image_width_pt: 571 # optional; height follows the file's aspect ratio
93
+ markers: # x/y are fractions of the image's bounding box
94
+ - {n: 1, x: 0.115, y: 0.055}
95
+ - {n: 2, x: 0.085, y: 0.230}
96
+ items: # right page table, one row each, in marker order
97
+ - name: ①検索条件
98
+ kind: テキスト # 部品の種類
99
+ attr: "-" # 属性
100
+ db: "" # DBカラム
101
+ len: "" # 桁数
102
+ default: "" # 初期値
103
+ required: "" # 必須
104
+ note: 注文番号または顧客名の一部を入力する。
105
+ note_alt: Enter part of … # optional, goes to column BZ (off-page working notes, e.g. a translation)
106
+ remarks: # <備考> block at the bottom of the left page
107
+ - text: ・アプリ起動後の既定画面。メニューの「注文」からも表示する。
108
+ alt:  Default screen after start-up… # optional second line
109
+ ```
110
+
111
+ `markers` must be consistent with `items`: marker *n* explains `items[n-1]`.
112
+
113
+ Markers can come from a UI Automation dump instead of being measured by eye (`scripts/uia_dump.py` writes the
114
+ screenshot and the dump of one window; see `example_spec.yaml` beside this file). Give `uia` **instead of** `markers`:
115
+
116
+ ```yaml
117
+ image: _uia/SCR01.png
118
+ uia:
119
+ dump: _uia/SCR01.json # window rect + element rects, screen coordinates
120
+ anchor: center # or left (a point just inside the element's left edge)
121
+ markers:
122
+ - {n: 1, id: SearchBox} # by automation id …
123
+ - {n: 2, name: 検索} # … or by element name; each must match exactly one element
124
+ ```
125
+
126
+ The loader turns each element's rectangle into x/y fractions of the captured window, so the markers follow the
127
+ UI when it moves. An element missing from the dump, or found twice, is a validation error.
128
+
129
+ ## `processes` — sheet 処理
130
+
131
+ Two block kinds. Blocks render in list order, one 40-row page each.
132
+
133
+ ### `kind: flow`
134
+
135
+ ```yaml
136
+ processes:
137
+ - kind: flow
138
+ id: SCR01-1 # 処理番号 (key is `id`; `no` is a YAML boolean, do not use it)
139
+ screen: 注文一覧画面 # 画面名 — where it is triggered from
140
+ summary: 検索条件に一致する注文を一覧に表示する
141
+ trigger: [検索ボタンを, 押す] # 1-2 lines beside the start terminator
142
+ ann_col: AH # X for linear flows, AH when there is a side branch
143
+ nodes: # main column, max 6
144
+ - type: box
145
+ n: "①"
146
+ text: "検索条件を取得し、\n前後の空白を除く"
147
+ sub: null # optional sub-process id shown next to the marker
148
+ - type: decision
149
+ n: "②"
150
+ text: "条件が\n空か" # HARD LIMIT: 2 lines x 7 full-width chars
151
+ else_label: 条件あり # label on the fall-through (downward) path
152
+ branch: # the side path, drawn to the right
153
+ n: "③"
154
+ label: 空 # label on the horizontal arrow
155
+ text: "「検索条件を入力して\nください」を表示する"
156
+ terminate: false # true = the branch ends in its own ◎ instead of merging back
157
+ notes: # right-hand explanation list
158
+ - mark: "①"
159
+ lines:
160
+ - 検索条件の前後の空白を取り除き、
161
+ - 空なら検索しない
162
+ - mark: "※"
163
+ lines: [API の失敗時はエラーメッセージを表示して一覧を変えない]
164
+ ```
165
+
166
+ `\n` inside `text` is a hard line break inside the shape.
167
+
168
+ ### `kind: detail`
169
+
170
+ ```yaml
171
+ - kind: detail
172
+ id: SCR01-1 # the parent's 処理番号, repeated in the header
173
+ screen: 注文一覧画面
174
+ summary: 検索条件に一致する注文を一覧に表示する
175
+ sub_no: SCR01-1-1
176
+ sub_name: 注文を検索する
177
+ sections:
178
+ - head: 呼び出しAPI
179
+ columns: # col = first grid column, span = width in grid columns
180
+ - {title: "No", col: E, span: 2}
181
+ - {title: API番号, col: G, span: 4}
182
+ - {title: メソッド・パス, col: K, span: 30}
183
+ - {title: 用途, col: AO, span: 20}
184
+ rows:
185
+ - ["1", API-01, "GET /api/v1/orders?q={条件}", 注文を検索する]
186
+ notes: [] # optional "・" lines under the table
187
+ - head: 補足
188
+ notes: # a section may be notes-only (no table)
189
+ - 閲覧権限のない顧客の注文はサーバー側で除外される。
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Layout budgets enforced by `validate_spec.py`
195
+
196
+ | Item | Limit |
197
+ |---|---|
198
+ | `flow.nodes` (main column) | 6 |
199
+ | `box.text` | 4 lines × 17 full-width chars |
200
+ | `decision.text` | 2 lines × 7 full-width chars |
201
+ | branch `text` | 4 lines × 17 full-width chars |
202
+ | `notes` total height | `sum(len(lines) + 1) ≤ block_rows - 10` |
203
+ | `notes` line width | ≤ 52 fw chars at `ann_col: X`, ≤ 38 at `AH`, ≤ 31 at `AO` |
204
+ | `detail` total height | `≤ block_rows - 6` |
205
+ | `screens.items` | `≤ block_rows - 3` |
206
+ | `screens.remarks` | must fit between the image and the block end |
207
+
208
+ "full-width chars" = East-Asian W/F/A characters count 1, everything else 0.5.
@@ -0,0 +1,115 @@
1
+ # Fictional example for sdtk-screen-design-xlsx: an order-management app of a made-up company (ACME).
2
+ # Validate: python <skill>/scripts/validate_spec.py --spec example_spec.yaml
3
+ workbook:
4
+ path: out/ACME_受注管理_画面設計書.xlsx
5
+ template_set: ja-default
6
+ block_rows: 40
7
+ meta:
8
+ title: 画面設計書
9
+ user: ACME商事 様
10
+ business: 受注管理システム
11
+ version: "0.01"
12
+ author: <作成者>
13
+ created: "2026-11-22"
14
+
15
+ cover:
16
+ title: |-
17
+ 【受注管理システム】
18
+ 画面設計書
19
+ 第0.01版
20
+ date: "2026-11-22"
21
+
22
+ history:
23
+ - date: 2026年11月22日
24
+ version: "0.01"
25
+ items:
26
+ - ・初期作成
27
+
28
+ overview:
29
+ - heading: "[機能概要]"
30
+ items:
31
+ - ・注文を検索し、内容を確認・修正する
32
+ - sub: (出荷済みの注文は修正できない)
33
+ - heading: "[実装方針]"
34
+ groups:
35
+ - name: 注文一覧
36
+ items:
37
+ - ・検索条件は注文番号または顧客名の部分一致とする
38
+
39
+ screens:
40
+ - id: SCR01
41
+ name: 注文一覧画面
42
+ summary: 注文を検索し、一覧から選んだ注文の編集画面を開く。
43
+ source_label: 試作アプリ
44
+ image: SCR01.png
45
+ image_width_pt: 520
46
+ uia: # markers placed from the UI Automation dump (uia_dump.py)
47
+ dump: SCR01.json
48
+ markers:
49
+ - {n: 1, id: SearchBox}
50
+ - {n: 2, id: SearchButton}
51
+ - {n: 3, id: OrderGrid}
52
+ items:
53
+ - {name: ①検索条件, kind: テキスト, attr: 入力, db: "", len: "50", default: "", required: "", note: 注文番号または顧客名の一部を入力する。}
54
+ - {name: ②検索, kind: ボタン, attr: "-", db: "", len: "", default: "", required: "", note: 条件に一致する注文を一覧に表示する。}
55
+ - {name: ③注文一覧, kind: グリッド, attr: 表示, db: orders, len: "", default: "", required: "", note: 行をダブルクリックすると注文編集画面を開く。}
56
+ remarks:
57
+ - text: ・アプリ起動後の既定画面。
58
+
59
+ processes:
60
+ - kind: flow
61
+ id: SCR01-1
62
+ screen: 注文一覧画面
63
+ summary: 検索条件に一致する注文を一覧に表示する
64
+ trigger: [検索ボタンを, 押す]
65
+ ann_col: AH
66
+ nodes:
67
+ - type: box
68
+ n: "①"
69
+ text: "検索条件を取得し、\n前後の空白を除く"
70
+ - type: decision
71
+ n: "②"
72
+ text: "条件が\n空か"
73
+ else_label: 条件あり
74
+ branch:
75
+ n: "③"
76
+ label: 空
77
+ text: "「検索条件を入力して\nください」を表示する"
78
+ terminate: true
79
+ - type: box
80
+ n: "④"
81
+ text: "注文を検索する"
82
+ sub: SCR01-1-1
83
+ - type: box
84
+ n: "⑤"
85
+ text: "結果を一覧に表示する"
86
+ notes:
87
+ - mark: "①"
88
+ lines: [検索条件の前後の空白を取り除く]
89
+ - mark: "②"
90
+ lines: [条件が空のときは検索しない]
91
+ - mark: "③"
92
+ lines: [メッセージを表示して処理を終える]
93
+ - mark: "④"
94
+ lines: [SCR01-1-1 を参照]
95
+ - mark: "⑤"
96
+ lines: [新しい注文から順に最大 200 件を表示する]
97
+
98
+ - kind: detail
99
+ id: SCR01-1
100
+ screen: 注文一覧画面
101
+ summary: 検索条件に一致する注文を一覧に表示する
102
+ sub_no: SCR01-1-1
103
+ sub_name: 注文を検索する
104
+ sections:
105
+ - head: 呼び出しAPI
106
+ columns:
107
+ - {title: "No", col: E, span: 2}
108
+ - {title: API番号, col: G, span: 4}
109
+ - {title: メソッド・パス, col: K, span: 30}
110
+ - {title: 用途, col: AO, span: 20}
111
+ rows:
112
+ - ["1", API-01, "GET /api/v1/orders?q={条件}&limit=200", 注文を検索する]
113
+ - head: 補足
114
+ notes:
115
+ - 顧客名の比較では全角・半角の違いを無視する。