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.
- package/README.md +1 -1
- package/assets/manifest/toolkit-bundle.manifest.json +207 -47
- package/assets/manifest/toolkit-bundle.sha256.txt +54 -22
- package/assets/toolkit/toolkit/AGENTS.md +2 -1
- package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +5 -1
- package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +4 -0
- package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +18 -0
- package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +1 -0
- package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +2 -2
- package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +2 -2
- package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/SKILL.md +117 -0
- package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/references/PROFILE_TEMPLATE.md +60 -0
- package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/scripts/oq_sync.py +349 -0
- package/assets/toolkit/toolkit/skills/sdtk-customer-qa-sheet/scripts/test_oq_sync.py +175 -0
- package/assets/toolkit/toolkit/skills/sdtk-db-design/SKILL.md +130 -0
- package/assets/toolkit/toolkit/skills/sdtk-db-design/references/REVIEW_PROCESS.md +82 -0
- package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/SKILL.md +104 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/REVIEW_AND_MISTAKES.md +63 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SCR01.json +46 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SCR01.png +0 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/SPEC_SCHEMA.md +208 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/example_spec.yaml +115 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/build_design_xlsx.py +550 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/design_spec.py +305 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/export_preview.py +111 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/export_spec_md.py +181 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/make_template.py +113 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/test_screen_design.py +198 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/uia_dump.py +64 -0
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/scripts/validate_spec.py +260 -0
- package/assets/toolkit/toolkit/skills/sdtk-session-handoff/SKILL.md +76 -0
- package/assets/toolkit/toolkit/skills/sdtk-session-handoff/references/HANDOFF_TEMPLATE.md +63 -0
- package/assets/toolkit/toolkit/skills/sdtk-session-handoff/references/MOVING_A_PROJECT.md +18 -0
- package/assets/toolkit/toolkit/skills/sdtk-session-handoff/scripts/dirty_files.py +133 -0
- package/assets/toolkit/toolkit/skills/sdtk-session-handoff/scripts/test_dirty_files.py +94 -0
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/SKILL.md +4 -1
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/test_metadata.py +76 -0
- package/assets/toolkit/toolkit/skills/sdtk-xlsx-safe-edit/scripts/xlsx_xml_edit.py +65 -1
- package/assets/toolkit/toolkit/skills/skills.catalog.yaml +96 -0
- package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +15 -2
- package/assets/toolkit/toolkit/skills-claude/ba/SKILL.md +8 -4
- package/assets/toolkit/toolkit/skills-claude/customer-qa-sheet/SKILL.md +115 -0
- package/assets/toolkit/toolkit/skills-claude/db-design/SKILL.md +128 -0
- package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +33 -2
- package/assets/toolkit/toolkit/skills-claude/dev-backend/SKILL.md +10 -0
- package/assets/toolkit/toolkit/skills-claude/dev-frontend/SKILL.md +10 -0
- package/assets/toolkit/toolkit/skills-claude/pm/SKILL.md +14 -3
- package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +40 -2
- package/assets/toolkit/toolkit/skills-claude/screen-design-xlsx/SKILL.md +101 -0
- package/assets/toolkit/toolkit/skills-claude/session-handoff/SKILL.md +74 -0
- package/assets/toolkit/toolkit/skills-claude/test-case-spec/SKILL.md +6 -0
- package/assets/toolkit/toolkit/skills-claude/xlsx-safe-edit/SKILL.md +4 -1
- package/assets/toolkit/toolkit/templates/README.md +3 -0
- package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +14 -0
- package/assets/toolkit/toolkit/templates/screen-design-xlsx/ja-default/TEMPLATE.md +247 -0
- package/assets/toolkit/toolkit/templates/screen-design-xlsx/ja-default/template.xlsx +0 -0
- package/package.json +1 -1
- package/src/commands/help.js +7 -2
- package/src/lib/args.js +5 -2
- package/src/lib/design-handoff-provenance.js +30 -5
- package/src/lib/office-ingest.js +376 -0
- package/src/lib/requirement-analysis.js +77 -41
- package/src/lib/requirement-sources.js +259 -0
- package/src/lib/scope.js +4 -4
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""Tests for oq_sync.py on a fictional Q&A workbook built here (openpyxl only creates the fixture)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import sys
|
|
8
|
+
import tempfile
|
|
9
|
+
import unittest
|
|
10
|
+
import zipfile
|
|
11
|
+
|
|
12
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
13
|
+
sys.path.insert(0, HERE)
|
|
14
|
+
import oq_sync # noqa: E402
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
import openpyxl # noqa: F401
|
|
18
|
+
HAVE_OPENPYXL = True
|
|
19
|
+
except ImportError:
|
|
20
|
+
HAVE_OPENPYXL = False
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def read_bytes(path):
|
|
24
|
+
with open(path, "rb") as f:
|
|
25
|
+
return f.read()
|
|
26
|
+
|
|
27
|
+
SPEC = """# BA SPEC: DEMO
|
|
28
|
+
### 5.2 Open Questions
|
|
29
|
+
|
|
30
|
+
| No | Q-ID | Question | Type | Priority | Decision Owner (PM/User) | Status (OPEN/RESOLVED) | Notes/Options | Resolution |
|
|
31
|
+
| ---: | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
32
|
+
| 1 | OQ-01 | Maximum attachments per order? | Business | High | User | OPEN | 5 / 10 | TBD |
|
|
33
|
+
| 2 | OQ-02 | Keep deleted orders for audit? | Business | Med | User | OPEN | | TBD |
|
|
34
|
+
| 3 | OQ-03 | Currency format | Business | Low | PM | RESOLVED | | JPY only |
|
|
35
|
+
| 4 | OQ-04 | Export encoding? | Business | Low | User | OPEN | | TBD |
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
PROFILE = """# Q&A sheet profile: demo
|
|
39
|
+
```json
|
|
40
|
+
{"workbook": "qa.xlsx", "sheet": "QA", "header_row": 2, "first_data_row": 3, "no_format": "000",
|
|
41
|
+
"columns": {"no": "A", "category": "B", "question": "C", "answer": "D", "asked_by": "E"}}
|
|
42
|
+
```
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def make_workbook(path):
|
|
47
|
+
from openpyxl import Workbook
|
|
48
|
+
from openpyxl.worksheet.datavalidation import DataValidation
|
|
49
|
+
wb = Workbook()
|
|
50
|
+
ws = wb.active
|
|
51
|
+
ws.title = "QA"
|
|
52
|
+
ws["A1"] = "Q&A"
|
|
53
|
+
for col, head in zip("ABCDE", ("No", "Category", "Question", "Answer", "Asked by")):
|
|
54
|
+
ws[f"{col}2"] = head
|
|
55
|
+
ws.append(["001", "Spec", "[OQ-02] Keep deleted orders?", "Yes, 1 year.", "us"])
|
|
56
|
+
ws.append(["002", "Spec", "Login screen colour?", "", "us"])
|
|
57
|
+
ws.append(["003", "Spec", "", "", ""]) # pre-numbered empty row
|
|
58
|
+
dv = DataValidation(type="list", formula1='"Spec,Other"')
|
|
59
|
+
dv.add("B3:B5")
|
|
60
|
+
ws.add_data_validation(dv)
|
|
61
|
+
other = wb.create_sheet("Other")
|
|
62
|
+
other["A1"] = "owned by someone else"
|
|
63
|
+
wb.save(path)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@unittest.skipUnless(HAVE_OPENPYXL, "openpyxl not installed")
|
|
67
|
+
class OqSyncTests(unittest.TestCase):
|
|
68
|
+
def setUp(self):
|
|
69
|
+
self.tmp = tempfile.mkdtemp()
|
|
70
|
+
self.spec = os.path.join(self.tmp, "BA_SPEC_DEMO.md")
|
|
71
|
+
self.profile = os.path.join(self.tmp, "qa_sheet_profile.md")
|
|
72
|
+
self.book = os.path.join(self.tmp, "qa.xlsx")
|
|
73
|
+
for path, text in ((self.spec, SPEC), (self.profile, PROFILE)):
|
|
74
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
75
|
+
f.write(text)
|
|
76
|
+
make_workbook(self.book)
|
|
77
|
+
self.prof = oq_sync.load_profile(self.profile)
|
|
78
|
+
|
|
79
|
+
def tearDown(self):
|
|
80
|
+
shutil.rmtree(self.tmp, ignore_errors=True)
|
|
81
|
+
|
|
82
|
+
def test_reads_oq_rows_with_status(self):
|
|
83
|
+
oqs = oq_sync.read_oqs([self.spec])
|
|
84
|
+
self.assertEqual([o["id"] for o in oqs], ["OQ-01", "OQ-02", "OQ-03", "OQ-04"])
|
|
85
|
+
self.assertEqual(oqs[2]["status"], "RESOLVED")
|
|
86
|
+
|
|
87
|
+
def test_duplicate_oq_id_is_an_error(self):
|
|
88
|
+
with open(self.spec, "a", encoding="utf-8") as f:
|
|
89
|
+
f.write("| 5 | OQ-01 | again | B | L | PM | OPEN | | |\n")
|
|
90
|
+
with self.assertRaises(oq_sync.SyncError):
|
|
91
|
+
oq_sync.read_oqs([self.spec])
|
|
92
|
+
|
|
93
|
+
def test_export_proposes_only_open_oqs_not_in_sheet_starting_at_the_prenumbered_row(self):
|
|
94
|
+
text, proposed = oq_sync.cmd_export(self.prof, [self.spec], None)
|
|
95
|
+
self.assertEqual([p["oq"] for p in proposed], ["OQ-01", "OQ-04"])
|
|
96
|
+
self.assertEqual((proposed[0]["no"], proposed[0]["row"]), ("003", 5))
|
|
97
|
+
self.assertEqual((proposed[1]["no"], proposed[1]["row"]), ("004", 6))
|
|
98
|
+
self.assertIn("No 001 (row 3) — answered", text) # OQ-02 found by its tag, not by position
|
|
99
|
+
self.assertIn("not open", text) # OQ-03 resolved
|
|
100
|
+
|
|
101
|
+
def test_export_points_at_untagged_rows_on_the_same_topic(self):
|
|
102
|
+
with open(self.spec, "a", encoding="utf-8") as f:
|
|
103
|
+
f.write("| 5 | OQ-05 | Which colour does the login screen use? | UI | Low | User | OPEN | | TBD |\n")
|
|
104
|
+
text, proposed = oq_sync.cmd_export(self.prof, [self.spec], None)
|
|
105
|
+
by_id = {p["oq"]: p for p in proposed}
|
|
106
|
+
self.assertEqual(by_id["OQ-05"]["related"], ["002"])
|
|
107
|
+
self.assertEqual(by_id["OQ-04"]["related"], [])
|
|
108
|
+
self.assertIn("No 002 (open)", text)
|
|
109
|
+
|
|
110
|
+
def test_answers_are_keyed_by_oq_and_filtered_by_snapshot(self):
|
|
111
|
+
snap = os.path.join(self.tmp, "snap.json")
|
|
112
|
+
first = oq_sync.cmd_answers(self.prof, snap, snap)
|
|
113
|
+
self.assertEqual([(a["no"], a["oq_ids"]) for a in first], [("001", ["OQ-02"])])
|
|
114
|
+
self.assertEqual(oq_sync.cmd_answers(self.prof, snap, None), [])
|
|
115
|
+
|
|
116
|
+
def test_answer_without_oq_is_reported_unmatched(self):
|
|
117
|
+
rows = oq_sync.read_sheet(self.prof)
|
|
118
|
+
rec = dict(rows[1], answer="Blue.")
|
|
119
|
+
self.assertTrue(not rec["oq_ids"])
|
|
120
|
+
snap = os.path.join(self.tmp, "s.json")
|
|
121
|
+
oq_sync.cmd_answers(self.prof, None, snap)
|
|
122
|
+
with open(snap, encoding="utf-8") as f:
|
|
123
|
+
self.assertEqual(json.load(f).keys(), {"001"})
|
|
124
|
+
|
|
125
|
+
def _rows(self, items):
|
|
126
|
+
path = os.path.join(self.tmp, "rows.json")
|
|
127
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
128
|
+
json.dump(items, f)
|
|
129
|
+
return path
|
|
130
|
+
|
|
131
|
+
def test_write_dry_run_changes_nothing(self):
|
|
132
|
+
before = read_bytes(self.book)
|
|
133
|
+
res = oq_sync.cmd_write(self.prof, self._rows([{"row": 5, "oq": "OQ-01",
|
|
134
|
+
"values": {"no": "003", "question": "[OQ-01] Max attachments?"}}]), False)
|
|
135
|
+
self.assertTrue(res["dry_run"])
|
|
136
|
+
self.assertEqual(read_bytes(self.book), before)
|
|
137
|
+
|
|
138
|
+
def test_write_apply_changes_only_the_sheet_part_and_extends_validation(self):
|
|
139
|
+
with zipfile.ZipFile(self.book) as z:
|
|
140
|
+
other_before = z.read("xl/worksheets/sheet2.xml")
|
|
141
|
+
res = oq_sync.cmd_write(self.prof, self._rows([
|
|
142
|
+
{"row": 5, "oq": "OQ-01", "values": {"no": "003", "question": "[OQ-01] Max attachments?", "asked_by": "us"}},
|
|
143
|
+
{"row": 6, "oq": "OQ-04", "values": {"no": "004", "question": "[OQ-04] Export encoding?", "asked_by": "us"}},
|
|
144
|
+
]), True)
|
|
145
|
+
self.assertEqual(res["changed_parts"], ["xl/worksheets/sheet1.xml"])
|
|
146
|
+
self.assertTrue(os.path.exists(res["backup"]))
|
|
147
|
+
rows = {r["row"]: r for r in oq_sync.read_sheet(self.prof)}
|
|
148
|
+
self.assertEqual(rows[6]["oq_ids"], ["OQ-04"])
|
|
149
|
+
self.assertEqual(rows[3]["answer"], "Yes, 1 year.")
|
|
150
|
+
with zipfile.ZipFile(self.book) as z:
|
|
151
|
+
self.assertEqual(z.read("xl/worksheets/sheet2.xml"), other_before)
|
|
152
|
+
self.assertIn('sqref="B3:B6"', z.read("xl/worksheets/sheet1.xml").decode("utf-8"))
|
|
153
|
+
|
|
154
|
+
def test_write_refuses_unsafe_rows(self):
|
|
155
|
+
cases = [
|
|
156
|
+
{"row": 4, "oq": "OQ-01", "values": {"no": "002", "question": "[OQ-01] x"}}, # row holds a question
|
|
157
|
+
{"row": 5, "oq": "OQ-02", "values": {"no": "003", "question": "[OQ-02] x"}}, # OQ already in sheet
|
|
158
|
+
{"row": 5, "oq": "OQ-01", "values": {"no": "003", "question": "[OQ-01] x", "answer": "y"}},
|
|
159
|
+
{"row": 5, "oq": "OQ-01", "values": {"no": "003", "question": "no id here"}},
|
|
160
|
+
{"row": 5, "oq": "OQ-01", "values": {"no": "003", "question": "[OQ-01] x", "zzz": "?"}},
|
|
161
|
+
]
|
|
162
|
+
for item in cases:
|
|
163
|
+
with self.subTest(item=item), self.assertRaises(oq_sync.SyncError):
|
|
164
|
+
oq_sync.cmd_write(self.prof, self._rows([item]), True)
|
|
165
|
+
|
|
166
|
+
def test_write_refuses_when_the_workbook_is_open(self):
|
|
167
|
+
with open(os.path.join(self.tmp, "~$qa.xlsx"), "w"):
|
|
168
|
+
pass
|
|
169
|
+
with self.assertRaises(oq_sync.SyncError):
|
|
170
|
+
oq_sync.cmd_write(self.prof, self._rows([{"row": 5, "oq": "OQ-01",
|
|
171
|
+
"values": {"no": "003", "question": "[OQ-01] x"}}]), True)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
unittest.main()
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdtk-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
|
+
# SDTK-SPEC Database Design, Review and Migration
|
|
7
|
+
|
|
8
|
+
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.
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## Critical Constraints
|
|
13
|
+
|
|
14
|
+
1. **Every durable field names a writer, a reader, a recovery purpose and the requirement that fails without it.**
|
|
15
|
+
No such requirement → cut or defer it, and record what would reopen it.
|
|
16
|
+
2. **Read the DDL and every write path** before stating what a column means or which states exist; never infer a
|
|
17
|
+
rule from a table's shape.
|
|
18
|
+
3. **Once any build can hold data that exists nowhere else, a schema change never drops and recreates.** Upgrade
|
|
19
|
+
ladder, engine backup, one transaction per step, refuse to open a newer database with an older client.
|
|
20
|
+
4. **The product owner decides product semantics** (ownership, retention, recovery, conflict policy, external
|
|
21
|
+
field meaning). Stop and ask for those; propose the smallest design for everything else.
|
|
22
|
+
5. **The schema of record changes only after sign-off**; superseded design text is marked with date and reason,
|
|
23
|
+
never deleted.
|
|
24
|
+
|
|
25
|
+
<!-- neutral-only -->
|
|
26
|
+
> **Installed as a runtime skill** (for example under `.codex/skills/`): read `toolkit/skills/sdtk-<name>/` in the
|
|
27
|
+
> paths below as the installed skill folder of that name.
|
|
28
|
+
<!-- /neutral-only -->
|
|
29
|
+
|
|
30
|
+
## Modes and outputs
|
|
31
|
+
|
|
32
|
+
`sdtk-arch` writes `docs/database/DATABASE_SPEC_[FEATURE_KEY].md` from the toolkit's DATABASE_SPEC template.
|
|
33
|
+
This skill decides **what goes into it** and how it may change:
|
|
34
|
+
|
|
35
|
+
| Mode | When | Output |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| **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 |
|
|
38
|
+
| **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 |
|
|
39
|
+
| **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 |
|
|
40
|
+
|
|
41
|
+
Every mode follows `toolkit/skills/sdtk-db-design/references/REVIEW_PROCESS.md` for the evidence it needs, and ends
|
|
42
|
+
with proposals for the owner — the schema of record changes only after sign-off.
|
|
43
|
+
|
|
44
|
+
Examples in this skill come from two kinds of systems; apply the rule, not the domain:
|
|
45
|
+
- a **web application** (orders, order lines, customers): "store inputs, not rendered output" → keep `amount` and
|
|
46
|
+
`currency`, not `amount_display`; "stable identity" → an order is keyed by its id, never by its order number
|
|
47
|
+
when that number can be re-issued; "one meaning, one name" → `status` of an order and `status` of a payment are
|
|
48
|
+
different value sets, named `order_status` / `payment_status`;
|
|
49
|
+
- a **local client that syncs with a server** (files, queues, recovery records): the durable-workflow rules below.
|
|
50
|
+
|
|
51
|
+
## Core principles
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
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.
|
|
55
|
+
3. **Keep an object's attributes on its own row.** Avoid one-to-one side tables unless lifecycle, access, or retention genuinely differs.
|
|
56
|
+
4. **Persist only what must survive restart or crash.** Keep process-only coordination in memory; persist the minimal recovery fact.
|
|
57
|
+
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.
|
|
58
|
+
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.
|
|
59
|
+
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.
|
|
60
|
+
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.
|
|
61
|
+
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.
|
|
62
|
+
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.
|
|
63
|
+
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).
|
|
64
|
+
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.
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
## Durable workflows, queues, and synchronization
|
|
68
|
+
|
|
69
|
+
Use these rules whenever a database coordinates local files, background work, or an external service.
|
|
70
|
+
|
|
71
|
+
- Treat a queue row as **durable intent**, not merely a log. Complete it only after the external system has confirmed the requested effect.
|
|
72
|
+
- 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.
|
|
73
|
+
- Do not assume "no exception" means success. Repositories that log and return zero require callers to verify their result.
|
|
74
|
+
- 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.
|
|
75
|
+
- 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.
|
|
76
|
+
- 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.
|
|
77
|
+
- Do not adopt an external object by name alone. Name collisions cannot prove ownership.
|
|
78
|
+
- 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.
|
|
79
|
+
- 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.
|
|
80
|
+
|
|
81
|
+
## Migration and write safety
|
|
82
|
+
|
|
83
|
+
- 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.
|
|
84
|
+
- 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.
|
|
85
|
+
- 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.
|
|
86
|
+
- 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.
|
|
87
|
+
|
|
88
|
+
## Process
|
|
89
|
+
|
|
90
|
+
1. Pick the mode (table above) and gather the evidence REVIEW_PROCESS.md names for it.
|
|
91
|
+
2. Inventory and challenge every field (core principles, durable-workflow rules).
|
|
92
|
+
3. For migrations: answer "can real data exist?" first, then the ladder (migration rules).
|
|
93
|
+
4. Stop for the owner on the questions under "Stop and clarify"; present proposals with evidence.
|
|
94
|
+
5. After sign-off: update the DATABASE_SPEC (section 8 included), then code and tests.
|
|
95
|
+
|
|
96
|
+
### Review workflow
|
|
97
|
+
|
|
98
|
+
For a new schema, a material change, a legacy replacement, or release to machines with data, read `toolkit/skills/sdtk-db-design/references/REVIEW_PROCESS.md` and produce the relevant evidence before implementation.
|
|
99
|
+
|
|
100
|
+
At minimum, inspect the DDL **and all write paths**. Schema shape alone does not establish a field's meaning, state transitions, or recovery guarantees.
|
|
101
|
+
|
|
102
|
+
## Stop and clarify
|
|
103
|
+
|
|
104
|
+
Stop for owner or backend confirmation when any of these is unknown:
|
|
105
|
+
|
|
106
|
+
- a user-visible ownership, retention, recovery, or conflict policy;
|
|
107
|
+
- the semantic meaning/default of an external field or response;
|
|
108
|
+
- whether a migration may encounter real data;
|
|
109
|
+
- whether a backend accepts a client idempotency key and its exact replay/concurrency contract.
|
|
110
|
+
|
|
111
|
+
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.
|
|
112
|
+
|
|
113
|
+
## Red flags - stop and re-check
|
|
114
|
+
|
|
115
|
+
- "Add the table now so we don't have to migrate later."
|
|
116
|
+
- A local enum invented over values that come from another system.
|
|
117
|
+
- A status value no code path writes, or a written value with no status name.
|
|
118
|
+
- A design rule inferred from a table's shape ("it has no parent column, so...") without grepping who writes the table.
|
|
119
|
+
- A column justified only by "might help debugging/UI" with no requirement or screen named.
|
|
120
|
+
- "It's only on dev machines" - check whether any build points at a shared server.
|
|
121
|
+
- Design doc, ERD, definition sheet and code disagreeing about a name or value.
|
|
122
|
+
|
|
123
|
+
## Common mistakes
|
|
124
|
+
|
|
125
|
+
| Mistake | Fix |
|
|
126
|
+
|---|---|
|
|
127
|
+
| Proposing tables from requirement titles | Map each requirement to the facts it must remember across restarts |
|
|
128
|
+
| Renaming columns in docs and code in many small rounds | Agree names with stakeholders first, then change code once |
|
|
129
|
+
| Deleting superseded design text | Mark it superseded with date and reason; keep it under the current version |
|
|
130
|
+
| Showing internal notes or implementation status in customer copies | Strip to PK, defaults and enum values |
|
|
@@ -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.
|
|
@@ -15,7 +15,7 @@ description: Product Manager + meta-orchestrator workflow for SDTK-SPEC. Use whe
|
|
|
15
15
|
- Phase 2+ (after BA spec): `docs/product/PRD_[FEATURE_KEY].md` + `docs/product/BACKLOG_[FEATURE_KEY].md`
|
|
16
16
|
|
|
17
17
|
## Process
|
|
18
|
-
1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out.
|
|
18
|
+
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.
|
|
19
19
|
2. Create/update PM artifact(s) using `toolkit/templates/docs/product/*` as structure.
|
|
20
20
|
3. Ensure REQ-xx list is clear and testable.
|
|
21
21
|
4. If requirements are provided in VI/JP: keep the original text in an appendix and add an EN translation (literal) for traceability.
|
|
@@ -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 |
|
package/assets/toolkit/toolkit/skills/sdtk-screen-design-xlsx/references/REVIEW_AND_MISTAKES.md
ADDED
|
@@ -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
|
+
}
|