sdtk-spec-kit 0.3.9 → 0.3.11

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 (52) hide show
  1. package/README.md +136 -106
  2. package/assets/manifest/toolkit-bundle.manifest.json +94 -80
  3. package/assets/manifest/toolkit-bundle.sha256.txt +41 -38
  4. package/assets/toolkit/toolkit/AGENTS.md +5 -4
  5. package/assets/toolkit/toolkit/README.md +50 -0
  6. package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +185 -0
  7. package/assets/toolkit/toolkit/install.ps1 +2 -2
  8. package/assets/toolkit/toolkit/scripts/init-feature.ps1 +4 -3
  9. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +32 -12
  10. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +33 -6
  11. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +84 -84
  12. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  13. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  14. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +127 -127
  15. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +85 -83
  16. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  17. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  18. package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +127 -127
  19. package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +108 -98
  20. package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +7 -4
  21. package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +7 -4
  22. package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +97 -81
  23. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +37 -30
  24. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +75 -52
  25. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  26. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md +30 -30
  27. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/figma-mcp.md +25 -25
  28. package/assets/toolkit/toolkit/skills/skills.catalog.yaml +4 -2
  29. package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +90 -90
  30. package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +3 -0
  31. package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +25 -53
  32. package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +16 -8
  33. package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +124 -121
  34. package/assets/toolkit/toolkit/templates/README.md +1 -0
  35. package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +81 -81
  36. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  37. package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +127 -127
  38. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +174 -174
  39. package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +106 -93
  40. package/assets/toolkit/toolkit/templates/docs/qa/CONTROLLER_ACCEPTANCE_TEMPLATE.md +90 -0
  41. package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +162 -61
  42. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  43. package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_QA.md +4 -0
  44. package/assets/toolkit/toolkit/templates/handoffs/QA_RELEASE_DECISION.md +5 -0
  45. package/package.json +16 -16
  46. package/src/commands/help.js +123 -101
  47. package/src/commands/init.js +10 -2
  48. package/src/commands/runtime.js +27 -5
  49. package/src/commands/update.js +11 -0
  50. package/src/index.js +62 -59
  51. package/src/lib/scope.js +19 -4
  52. package/src/lib/update.js +326 -0
@@ -1,220 +1,220 @@
1
- # Flow Action Spec Creation Rules for AI Agents
2
-
3
- This document defines reusable rules for creating and updating screen flow-action specifications
4
- (for example `docs/specs/*_FLOW_ACTION_SPEC.md`).
5
-
6
- ## 1. Scope and Goal
7
-
8
- - Produce a screen-level specification that is traceable from BA/ARCH to FE/BE implementation.
9
- - Keep one source of truth for:
10
- - screen flow
11
- - UI items and actions
12
- - API calls per action
13
- - screen-to-API mapping
14
- - Keep documentation implementation-aware and review-friendly.
15
-
16
- ## 2. Mandatory Document Structure
17
-
18
- A flow-action spec should include, at minimum:
19
-
20
- 1. `Abbreviations`
21
- 2. `Feature overview`
22
- 3. `Assumptions`
23
- 4. `Screen flow action` (with PlantUML)
24
- 5. `Screen layout spec by flow action`
25
- 6. `System processing flow`
26
- 7. `Open questions`
27
- 8. `Screen - API mapping`
28
- 9. `Document history`
29
-
30
- If a section is not in scope, keep the section and mark explicitly as `N/A` with reason.
31
-
32
- ## 3. Table Standards
33
-
34
- - Every table must include a `No` column (sequential numbering).
35
- - Use stable headers for action tables:
36
- - `No | Item Name | Item Type | Attribute | DB Column | Size | Default Value | Action | Description | Note`
37
- - Use stable headers for API mapping tables:
38
- - `No | Trigger/When | UI item (No / Item Name) | API to call | Data usage / Notes`
39
- - Use stable headers for screen mapping:
40
- - `No | Screen (section) | Screen ID | Read/Search APIs | Write APIs | Notes / Q&A refs`
41
- - Table rows must keep column count consistent with the header (no broken or merged rows).
42
- - Avoid single-line merged content that collapses multiple logical items into one table row.
43
-
44
- ### 3.1 Action Table Mapping Completion Rules
45
-
46
- - After API endpoint spec and database spec are available, the action-table columns `Attribute`, `DB Column`, `Size`, and `Default Value` must not be left blank when the mapping can be derived from current source-of-truth inputs.
47
- - Fill these four columns only after the relevant API contract and DB schema are stable enough to be treated as the current source of truth for the active phase.
48
- - Source priority for filling the four columns:
49
- 1. `docs/api/*_ENDPOINTS.md` and OpenAPI YAML for request/response contract
50
- 2. `docs/database/DATABASE_SPEC_*.md` for physical column names, nullability, storage shape, and query-source aliases
51
- 3. confirmed flow/business rules for default state and behavior
52
- 4. design source (Figma/Excel) for screen label and control type only
53
- - `Attribute` rules:
54
- - input item: use the canonical request payload path
55
- - display item: use the canonical response path
56
- - UI-only item: use `ui.*` namespace
57
- - `DB Column` rules:
58
- - use physical DB column names or query-source aliases from the API/database spec
59
- - if multiple columns participate, list them explicitly
60
- - if the control is UI-only, write `N/A`
61
- - `Size` rules:
62
- - document data format/type, not pixel width
63
- - prefer canonical forms such as `uuid`, `DATE (YYYY-MM-DD)`, `DATETIME`, `TIME (HH:mm)`, `boolean`, `array[uuid]`, `enum(...)`, `JSON string`
64
- - prefer DB storage type first; if not available, fall back to API schema type/format
65
- - `Default Value` rules:
66
- - use confirmed business, UI, or runtime defaults
67
- - if the default comes from settings or environment, state that clearly
68
- - if not finalized, use `TBD` and keep or raise an open-question reference in `Note`
69
- - If screen labels conflict with canonical API/DB naming, preserve the original screen label in the visible screen columns, but keep `Attribute` and `DB Column` aligned to API/DB source of truth and explain the mismatch in `Note`.
70
-
71
- ### 3.2 Language and Encoding Standards (EN Artifacts)
72
-
73
- - For EN artifacts (`docs/en/**` or explicitly requested EN version), narrative text must be English.
74
- - JP labels, if provided by the input, should be kept in a clearly marked appendix or note column, not in the default item table columns.
75
- - Do not leave mixed-language fragments in one sentence/cell (for example VI+EN mixed text).
76
- - If original VI/JP text is required for traceability, keep it in a clearly marked appendix block (`Original Text`), then provide EN translation.
77
- - Save files as UTF-8 and avoid mojibake/broken glyphs (`�`, `ↁE`, garbled sequences).
78
- - Keep canonical terminology stable across documents (for example: `bukken`, `sagyo`, `customer employee`).
79
-
80
- ### 3.3 Markdown Structure Hygiene
81
-
82
- - Keep each heading on its own line; do not concatenate multiple headings/sections on one line.
83
- - Keep metadata blocks (`Information`, `Note`, `Behavior notes`) as structured bullet blocks, not single compressed lines.
84
- - Keep image, table, and separator (`---`) boundaries explicit to preserve parser/render stability.
85
-
86
- ### 3.4 Assumptions Section
87
-
88
- - Every flow-action spec must include a top-level `## Assumptions` section.
89
- - Use this table format exactly: `# | Assumption | Verified | Risk if wrong`.
90
- - Keep assumptions explicit when downstream mapping or behavior depends on an unresolved decision.
91
- - If an assumption affects UI behavior, API mapping, or DB mapping, reflect the risk in `Note` and keep or raise the related `OQ-xx` item.
92
-
93
- ## 4. Item Numbering and Duplication Rules
94
-
95
- - Use one numbering mode only: `global across document`.
96
- - Number values must increase across all action tables in the document.
97
- - DESIGN_LAYOUT wireframe markers are a separate screen-local visual system. They may reset per screen and do not need to numerically equal the global action-table `No`.
98
- - Avoid duplicate item descriptions for the same UI control across screens unless behavior differs.
99
- - If duplicate number is intentional (rare), annotate reason in `Note`.
100
-
101
- ## 5. Screen Section Rules
102
-
103
- For each screen section:
104
-
105
- - Provide metadata:
106
- - official screen name
107
- - Screen ID
108
- - Design Source Type
109
- - Design Source Reference
110
- - Embed one representative image per screen (from Figma, screenshot, or generated layout).
111
- - Provide one action table.
112
- - Provide one API mapping table.
113
- - If a screen has dialogs, create explicit dialog sub-sections with their own tables and API mapping.
114
-
115
- ## 5.1 Design Source Modes
116
-
117
- Each screen section must declare a design source using one of these modes:
118
-
119
- | Mode | When | Design Source Reference |
120
- |------|------|----------------------|
121
- | `source-backed` | Figma URL or screenshot is available | Figma URL or screenshot path |
122
- | `generated-draft` | No Figma/screenshot, but feature has UI scope | Section reference in `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` |
123
- | `none` | Feature has no UI scope for this screen | State `N/A - no UI scope` |
124
-
125
- Rules:
126
- - For UI-scope features, `none` is only valid when the specific screen truly has no visual layout.
127
- - When using `generated-draft`, the `DESIGN_LAYOUT_[FEATURE_KEY].md` must exist before the flow-action spec is finalized.
128
- - The flow-action spec and the design-layout doc must remain separate documents.
129
- - When Figma becomes available later, update the source mode from `generated-draft` to `source-backed`.
130
-
131
- ## 5.2 Wireframe Marker Mapping for Generated-Draft Screens
132
-
133
- For generated-draft screens with rendered design-layout images:
134
-
135
- - Treat wireframe markers as screen-local visual references only.
136
- - Keep action-table `No` global across the document per section 4.
137
- - Add a wireframe marker mapping table directly under the screen image.
138
- - Use this stable header:
139
- - `No | Wireframe Marker | Action Table No | Item Name | Notes`
140
- - Map only the items visibly present on the wireframe image.
141
- - If an action-table row is not visible on the wireframe, state `Not shown on wireframe` in `Notes` instead of inventing a marker.
142
- - If the wireframe label and the action-table label differ slightly, keep the action-table item name and explain the label difference in `Notes`.
143
-
144
- ## 6. API Traceability Rules
145
-
146
- - Every actionable UI event that changes state must map to a write API.
147
- - Every data-loading UI event must map to a read/search API.
148
- - If one endpoint serves multiple actions (initial load, search, refresh), state this explicitly.
149
- - If no API is called for an action, state `No API` and explain why.
150
-
151
- ## 7. PlantUML Rules for Screen Flow
152
-
153
- - Use new-style PlantUML activity diagram syntax only for screen-flow diagrams.
154
- - Allowed activity constructs include: `start`, `stop`, `partition "..." {}`, `:Activity;`, `->`, `if/then/else/endif`, `fork`, `fork again`, `end fork`, and `note right/left`.
155
- - Do not mix legacy activity syntax such as `(*)`, `-->`, or `[edge label]` with new-style activity actions like `:Activity;`.
156
- - Validate renderability before handoff. If a renderer is unavailable in the current environment, at minimum keep the block internally consistent with new-style activity syntax only.
157
- - Use `\\n` for multi-line labels in activity nodes and notes.
158
- - Keep diagram at navigation/action level (not low-level SQL or backend internals).
159
- - Ensure screen names in PlantUML match section names in layout spec.
160
-
161
- ## 8. Data Source and Asset Rules
162
-
163
- - Prioritize source order:
164
- 1. Confirmed design source (for example Figma)
165
- 2. Confirmed requirement files (Excel/spec)
166
- 3. User-provided screenshots
167
- - Store images in repository-relative filesystem paths.
168
- - Reference images in markdown using file-relative paths from the spec file's directory.
169
- - Do not keep temporary local absolute paths in markdown.
170
-
171
- ### 8.1 Rendered Screen Images for Generated-Draft Screens
172
-
173
- When `Design Source Type` is `generated-draft`:
174
- - Screen preview images may be rendered from `DESIGN_LAYOUT_[FEATURE_KEY].md` PlantUML SALT wireframes.
175
- - Renderer: `toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py`
176
- - Expected output path (filesystem): `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
177
- - Markdown image path (file-relative from `docs/specs/*_FLOW_ACTION_SPEC.md`): `assets/<feature_snake>/screens/<screen_id>.svg`
178
- - DESIGN_LAYOUT markers inside the image are screen-local visual references and may reset per screen; use the wireframe mapping table to bridge them to the global action-table `No`.
179
- - If the rendered `.svg` file exists, use the file-relative markdown path in the `Screen image:` reference.
180
- - If rendering is unavailable or the `.svg` does not exist, replace the image line with:
181
- `> Screen image not rendered in this environment. See Design Source Reference for layout.`
182
- - Do not leave a broken image reference pointing to a non-existent file.
183
-
184
- ## 9. Consistency with Other Specs
185
-
186
- - Align terms with:
187
- - BA spec glossary
188
- - API endpoints spec
189
- - Database spec
190
- - If terminology differs across docs, raise an open question and add a temporary mapping note.
191
- - Keep endpoint paths in flow-action spec consistent with API endpoint spec.
192
-
193
- ## 10. Open Questions and Uncertainty Handling
194
-
195
- - Capture unresolved items in `Open questions` table.
196
- - Do not invent UI behavior or API contracts when source is ambiguous.
197
- - Mark uncertain mappings as `Draft` and include impacted files/sections.
198
-
199
- ## 11. Change Management
200
-
201
- - On each update:
202
- - update impacted screen sections
203
- - update API mapping tables
204
- - update screen-to-API mapping summary
205
- - append one row in document history
206
- - Never overwrite past history rows.
207
-
208
- ## 12. Final Checklist Before Handoff
209
-
210
- - PlantUML renders successfully.
211
- - All mandatory sections exist.
212
- - All tables include `No`.
213
- - Numbering is global across the document (no resets).
214
- - No broken image links (for `generated-draft` screens: `.svg` exists or render-skipped note is present).
215
- - Screen/API mappings are consistent with `*_ENDPOINTS.md`.
216
- - Assumptions section exists and unresolved assumptions are traceable.
217
- - Open questions are explicit and traceable.
218
- - For EN artifact: no leftover VI text outside allowed `Original Text` appendix blocks.
219
- - No mojibake/encoding corruption markers.
220
- - Headings/tables are structurally clean (no merged lines that break readability/traceability).
1
+ # Flow Action Spec Creation Rules for AI Agents
2
+
3
+ This document defines reusable rules for creating and updating screen flow-action specifications
4
+ (for example `docs/specs/*_FLOW_ACTION_SPEC.md`).
5
+
6
+ ## 1. Scope and Goal
7
+
8
+ - Produce a screen-level specification that is traceable from BA/ARCH to FE/BE implementation.
9
+ - Keep one source of truth for:
10
+ - screen flow
11
+ - UI items and actions
12
+ - API calls per action
13
+ - screen-to-API mapping
14
+ - Keep documentation implementation-aware and review-friendly.
15
+
16
+ ## 2. Mandatory Document Structure
17
+
18
+ A flow-action spec should include, at minimum:
19
+
20
+ 1. `Abbreviations`
21
+ 2. `Feature overview`
22
+ 3. `Assumptions`
23
+ 4. `Screen flow action` (with PlantUML)
24
+ 5. `Screen layout spec by flow action`
25
+ 6. `System processing flow`
26
+ 7. `Open questions`
27
+ 8. `Screen - API mapping`
28
+ 9. `Document history`
29
+
30
+ If a section is not in scope, keep the section and mark explicitly as `N/A` with reason.
31
+
32
+ ## 3. Table Standards
33
+
34
+ - Every table must include a `No` column (sequential numbering).
35
+ - Use stable headers for action tables:
36
+ - `No | Item Name | Item Type | Attribute | DB Column | Size | Default Value | Action | Description | Note`
37
+ - Use stable headers for API mapping tables:
38
+ - `No | Trigger/When | UI item (No / Item Name) | API to call | Data usage / Notes`
39
+ - Use stable headers for screen mapping:
40
+ - `No | Screen (section) | Screen ID | Read/Search APIs | Write APIs | Notes / Q&A refs`
41
+ - Table rows must keep column count consistent with the header (no broken or merged rows).
42
+ - Avoid single-line merged content that collapses multiple logical items into one table row.
43
+
44
+ ### 3.1 Action Table Mapping Completion Rules
45
+
46
+ - After API endpoint spec and database spec are available, the action-table columns `Attribute`, `DB Column`, `Size`, and `Default Value` must not be left blank when the mapping can be derived from current source-of-truth inputs.
47
+ - Fill these four columns only after the relevant API contract and DB schema are stable enough to be treated as the current source of truth for the active phase.
48
+ - Source priority for filling the four columns:
49
+ 1. `docs/api/*_ENDPOINTS.md` and OpenAPI YAML for request/response contract
50
+ 2. `docs/database/DATABASE_SPEC_*.md` for physical column names, nullability, storage shape, and query-source aliases
51
+ 3. confirmed flow/business rules for default state and behavior
52
+ 4. design source (Figma/Excel) for screen label and control type only
53
+ - `Attribute` rules:
54
+ - input item: use the canonical request payload path
55
+ - display item: use the canonical response path
56
+ - UI-only item: use `ui.*` namespace
57
+ - `DB Column` rules:
58
+ - use physical DB column names or query-source aliases from the API/database spec
59
+ - if multiple columns participate, list them explicitly
60
+ - if the control is UI-only, write `N/A`
61
+ - `Size` rules:
62
+ - document data format/type, not pixel width
63
+ - prefer canonical forms such as `uuid`, `DATE (YYYY-MM-DD)`, `DATETIME`, `TIME (HH:mm)`, `boolean`, `array[uuid]`, `enum(...)`, `JSON string`
64
+ - prefer DB storage type first; if not available, fall back to API schema type/format
65
+ - `Default Value` rules:
66
+ - use confirmed business, UI, or runtime defaults
67
+ - if the default comes from settings or environment, state that clearly
68
+ - if not finalized, use `TBD` and keep or raise an open-question reference in `Note`
69
+ - If screen labels conflict with canonical API/DB naming, preserve the original screen label in the visible screen columns, but keep `Attribute` and `DB Column` aligned to API/DB source of truth and explain the mismatch in `Note`.
70
+
71
+ ### 3.2 Language and Encoding Standards (EN Artifacts)
72
+
73
+ - For EN artifacts (`docs/en/**` or explicitly requested EN version), narrative text must be English.
74
+ - JP labels, if provided by the input, should be kept in a clearly marked appendix or note column, not in the default item table columns.
75
+ - Do not leave mixed-language fragments in one sentence/cell (for example VI+EN mixed text).
76
+ - If original VI/JP text is required for traceability, keep it in a clearly marked appendix block (`Original Text`), then provide EN translation.
77
+ - Save files as UTF-8 and avoid mojibake/broken glyphs (`�`, `ↁE`, garbled sequences).
78
+ - Keep canonical terminology stable across documents (for example: `resource`, `task`, `external member`).
79
+
80
+ ### 3.3 Markdown Structure Hygiene
81
+
82
+ - Keep each heading on its own line; do not concatenate multiple headings/sections on one line.
83
+ - Keep metadata blocks (`Information`, `Note`, `Behavior notes`) as structured bullet blocks, not single compressed lines.
84
+ - Keep image, table, and separator (`---`) boundaries explicit to preserve parser/render stability.
85
+
86
+ ### 3.4 Assumptions Section
87
+
88
+ - Every flow-action spec must include a top-level `## Assumptions` section.
89
+ - Use this table format exactly: `# | Assumption | Verified | Risk if wrong`.
90
+ - Keep assumptions explicit when downstream mapping or behavior depends on an unresolved decision.
91
+ - If an assumption affects UI behavior, API mapping, or DB mapping, reflect the risk in `Note` and keep or raise the related `OQ-xx` item.
92
+
93
+ ## 4. Item Numbering and Duplication Rules
94
+
95
+ - Use one numbering mode only: `global across document`.
96
+ - Number values must increase across all action tables in the document.
97
+ - DESIGN_LAYOUT wireframe markers are a separate screen-local visual system. They may reset per screen and do not need to numerically equal the global action-table `No`.
98
+ - Avoid duplicate item descriptions for the same UI control across screens unless behavior differs.
99
+ - If duplicate number is intentional (rare), annotate reason in `Note`.
100
+
101
+ ## 5. Screen Section Rules
102
+
103
+ For each screen section:
104
+
105
+ - Provide metadata:
106
+ - official screen name
107
+ - Screen ID
108
+ - Design Source Type
109
+ - Design Source Reference
110
+ - Embed one representative image per screen (from Figma, screenshot, or generated layout).
111
+ - Provide one action table.
112
+ - Provide one API mapping table.
113
+ - If a screen has dialogs, create explicit dialog sub-sections with their own tables and API mapping.
114
+
115
+ ## 5.1 Design Source Modes
116
+
117
+ Each screen section must declare a design source using one of these modes:
118
+
119
+ | Mode | When | Design Source Reference |
120
+ |------|------|----------------------|
121
+ | `source-backed` | Figma URL or screenshot is available | Figma URL or screenshot path |
122
+ | `generated-draft` | No Figma/screenshot, but feature has UI scope | Section reference in `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` |
123
+ | `none` | Feature has no UI scope for this screen | State `N/A - no UI scope` |
124
+
125
+ Rules:
126
+ - For UI-scope features, `none` is only valid when the specific screen truly has no visual layout.
127
+ - When using `generated-draft`, the `DESIGN_LAYOUT_[FEATURE_KEY].md` must exist before the flow-action spec is finalized.
128
+ - The flow-action spec and the design-layout doc must remain separate documents.
129
+ - When Figma becomes available later, update the source mode from `generated-draft` to `source-backed`.
130
+
131
+ ## 5.2 Wireframe Marker Mapping for Generated-Draft Screens
132
+
133
+ For generated-draft screens with rendered design-layout images:
134
+
135
+ - Treat wireframe markers as screen-local visual references only.
136
+ - Keep action-table `No` global across the document per section 4.
137
+ - Add a wireframe marker mapping table directly under the screen image.
138
+ - Use this stable header:
139
+ - `No | Wireframe Marker | Action Table No | Item Name | Notes`
140
+ - Map only the items visibly present on the wireframe image.
141
+ - If an action-table row is not visible on the wireframe, state `Not shown on wireframe` in `Notes` instead of inventing a marker.
142
+ - If the wireframe label and the action-table label differ slightly, keep the action-table item name and explain the label difference in `Notes`.
143
+
144
+ ## 6. API Traceability Rules
145
+
146
+ - Every actionable UI event that changes state must map to a write API.
147
+ - Every data-loading UI event must map to a read/search API.
148
+ - If one endpoint serves multiple actions (initial load, search, refresh), state this explicitly.
149
+ - If no API is called for an action, state `No API` and explain why.
150
+
151
+ ## 7. PlantUML Rules for Screen Flow
152
+
153
+ - Use new-style PlantUML activity diagram syntax only for screen-flow diagrams.
154
+ - Allowed activity constructs include: `start`, `stop`, `partition "..." {}`, `:Activity;`, `->`, `if/then/else/endif`, `fork`, `fork again`, `end fork`, and `note right/left`.
155
+ - Do not mix legacy activity syntax such as `(*)`, `-->`, or `[edge label]` with new-style activity actions like `:Activity;`.
156
+ - Validate renderability before handoff. If a renderer is unavailable in the current environment, at minimum keep the block internally consistent with new-style activity syntax only.
157
+ - Use `\\n` for multi-line labels in activity nodes and notes.
158
+ - Keep diagram at navigation/action level (not low-level SQL or backend internals).
159
+ - Ensure screen names in PlantUML match section names in layout spec.
160
+
161
+ ## 8. Data Source and Asset Rules
162
+
163
+ - Prioritize source order:
164
+ 1. Confirmed design source (for example Figma)
165
+ 2. Confirmed requirement files (Excel/spec)
166
+ 3. User-provided screenshots
167
+ - Store images in repository-relative filesystem paths.
168
+ - Reference images in markdown using file-relative paths from the spec file's directory.
169
+ - Do not keep temporary local absolute paths in markdown.
170
+
171
+ ### 8.1 Rendered Screen Images for Generated-Draft Screens
172
+
173
+ When `Design Source Type` is `generated-draft`:
174
+ - Screen preview images may be rendered from `DESIGN_LAYOUT_[FEATURE_KEY].md` PlantUML SALT wireframes.
175
+ - Renderer: `toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py`
176
+ - Expected output path (filesystem): `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
177
+ - Markdown image path (file-relative from `docs/specs/*_FLOW_ACTION_SPEC.md`): `assets/<feature_snake>/screens/<screen_id>.svg`
178
+ - DESIGN_LAYOUT markers inside the image are screen-local visual references and may reset per screen; use the wireframe mapping table to bridge them to the global action-table `No`.
179
+ - If the rendered `.svg` file exists, use the file-relative markdown path in the `Screen image:` reference.
180
+ - If rendering is unavailable or the `.svg` does not exist, replace the image line with:
181
+ `> Screen image not rendered in this environment. See Design Source Reference for layout.`
182
+ - Do not leave a broken image reference pointing to a non-existent file.
183
+
184
+ ## 9. Consistency with Other Specs
185
+
186
+ - Align terms with:
187
+ - BA spec glossary
188
+ - API endpoints spec
189
+ - Database spec
190
+ - If terminology differs across docs, raise an open question and add a temporary mapping note.
191
+ - Keep endpoint paths in flow-action spec consistent with API endpoint spec.
192
+
193
+ ## 10. Open Questions and Uncertainty Handling
194
+
195
+ - Capture unresolved items in `Open questions` table.
196
+ - Do not invent UI behavior or API contracts when source is ambiguous.
197
+ - Mark uncertain mappings as `Draft` and include impacted files/sections.
198
+
199
+ ## 11. Change Management
200
+
201
+ - On each update:
202
+ - update impacted screen sections
203
+ - update API mapping tables
204
+ - update screen-to-API mapping summary
205
+ - append one row in document history
206
+ - Never overwrite past history rows.
207
+
208
+ ## 12. Final Checklist Before Handoff
209
+
210
+ - PlantUML renders successfully.
211
+ - All mandatory sections exist.
212
+ - All tables include `No`.
213
+ - Numbering is global across the document (no resets).
214
+ - No broken image links (for `generated-draft` screens: `.svg` exists or render-skipped note is present).
215
+ - Screen/API mappings are consistent with `*_ENDPOINTS.md`.
216
+ - Assumptions section exists and unresolved assumptions are traceable.
217
+ - Open questions are explicit and traceable.
218
+ - For EN artifact: no leftover VI text outside allowed `Original Text` appendix blocks.
219
+ - No mojibake/encoding corruption markers.
220
+ - Headings/tables are structurally clean (no merged lines that break readability/traceability).
@@ -1,51 +1,51 @@
1
- # Export anh tu Excel (sheet co hinh/shape) - tranh vo layout & loi anh trang
1
+ # Export images from Excel sheets with pictures or shapes
2
2
 
3
- ## Khi nao can
3
+ ## When to use this
4
4
 
5
- - Sheet `画面遷移` hoac `画面|...` chua hinh (picture/shape) thay vi text trong cell.
6
- - Can anh de embed vao markdown hoac overlay so.
5
+ - The source sheet contains pictures or shapes instead of plain cell text.
6
+ - You need a real image export for markdown embedding or numbered overlays.
7
7
 
8
- ## Loi da gap & nguyen nhan
8
+ ## Known issues and root causes
9
9
 
10
- 1) `Chart.Export()` ra PNG trang (~1.3KB)
11
- - Nguyen nhan: Excel COM export chart/picture khong on dinh voi group/picture phuc tap.
10
+ 1) `Chart.Export()` produces a blank PNG (~1.3KB)
11
+ - Root cause: Excel COM chart/picture export is unreliable for complex grouped objects or pictures.
12
12
 
13
- 2) Sai duong dan thu muc anh khi SaveAs HTML
14
- - Excel tao folder anh theo quy uoc: `<basename>.files`
15
- - Vi du: `export.html` -> folder `export.files` (khong phai `export.html.files`).
13
+ 2) Wrong image folder path when using Save As HTML
14
+ - Excel writes image assets to a folder named `<basename>.files`
15
+ - Example: `export.html` -> folder `export.files` (not `export.html.files`).
16
16
 
17
17
  3) Excel COM crash / OLE error `0x800a01a8`
18
- - Nguyen nhan pho bien: goi `Quit()` nham instance Excel dang duoc attach boi COM (dac biet khi dung `Dispatch`).
18
+ - Common root cause: calling `Quit()` on the wrong Excel instance, especially when using `Dispatch`.
19
19
 
20
- 4) Marker 2 chu so bi mat digit (10 hien thi nhu 1)
21
- - Nguyen nhan: oval qua nho + wrap/align khong chuan.
20
+ 4) Two-digit markers lose one digit (`10` displays like `1`)
21
+ - Root cause: the oval is too small and the wrap/alignment settings are not appropriate.
22
22
 
23
- ## Cach lam khuyen nghi (tu dong)
23
+ ## Recommended automated approach
24
24
 
25
- Dung script trong repo, vi du:
25
+ Use the repo script, for example:
26
26
  `Requirements/_generate_numbered_screen_images.py`
27
27
 
28
- Script nen dam bao:
29
- - Flatten group + SaveAs HTML de lay PNG that (tranh PNG trang).
30
- - Dung `DispatchEx` khi mo Excel rieng de overlay len PNG (tranh crash do Quit nham instance).
31
- - Tang size oval + tat WordWrap de hien thi du 2-3 chu so.
32
- - Su dung dung quy uoc `.files` folder khi export HTML.
28
+ The script should ensure:
29
+ - Flatten grouped content and use Save As HTML to get a real PNG export and avoid blank PNG output.
30
+ - Use `DispatchEx` when opening a dedicated Excel instance for overlay work to avoid quitting the wrong instance.
31
+ - Increase oval size and disable `WordWrap` so 2-3 digit markers remain visible.
32
+ - Use the correct `.files` folder convention when exporting HTML.
33
33
 
34
- Chay (vi du, tai project root):
34
+ Run it from the project root, for example:
35
35
  ```powershell
36
36
  python Requirements\_generate_numbered_screen_images.py
37
37
  ```
38
38
 
39
- ## Cach lam thu cong (fallback)
39
+ ## Manual fallback approach
40
40
 
41
- 1) Mo Excel -> chon vung UI can export (picture/group) -> Copy as Picture.
42
- 2) Paste sang sheet trong hoac workbook moi.
41
+ 1) Open Excel -> select the UI area to export (picture/group) -> Copy as Picture.
42
+ 2) Paste it into a blank sheet or a new workbook.
43
43
  3) Save As -> "Web Page (*.htm; *.html)".
44
- 4) Vao folder `<basename>.files` -> chon file `imageXXX.png` co kich thuoc phu hop nhat.
45
- 5) Copy sang `docs/specs/assets/[feature_snake]/screens/` va dat ten theo convention.
44
+ 4) Open the `<basename>.files` folder -> choose the `imageXXX.png` file with the most appropriate size.
45
+ 5) Copy it into `docs/specs/assets/[feature_snake]/screens/` and rename it according to the naming convention.
46
46
 
47
- ## Luu y khi script fail do ten Picture thay doi
47
+ ## If the script fails because Excel renamed a picture
48
48
 
49
- Neu script tham chieu theo `picture_name` (vd: `Picture 4`, `Picture 7`), khi Excel doi ten:
50
- - Mo Excel -> chon picture -> xem/doi ten trong Selection Pane, hoac
51
- - Cap nhat lai `picture_name` trong script.
49
+ If the script references a `picture_name` such as `Picture 4` or `Picture 7`, and Excel renamed it:
50
+ - Open Excel -> select the picture -> inspect or rename it in the Selection Pane, or
51
+ - Update the `picture_name` in the script.
@@ -1,54 +1,54 @@
1
- # Figma MCP: lay layout/style/tokens + export anh
1
+ # Figma MCP: extract layout, styling, tokens, and screen images
2
2
 
3
- ## Parse URL Figma
3
+ ## Parse the Figma URL
4
4
 
5
- Mau URL:
5
+ Example URL:
6
6
  `https://www.figma.com/design/<fileKey>/<fileName>?node-id=<nodeId>&m=dev&t=...`
7
7
 
8
- - `fileKey` = segment sau `/design/`.
8
+ - `fileKey` = the segment after `/design/`.
9
9
  - `nodeId`:
10
10
  - query param `node-id=1-2695`
11
- - chuyen sang format API: `1:2695` (thay `-` bang `:`).
11
+ - convert to API format: `1:2695` (replace `-` with `:`).
12
12
 
13
- ## Lay du lieu layout/style (uu tien)
13
+ ## Fetch layout and styling data first
14
14
 
15
- Dung MCP:
15
+ Use MCP:
16
16
  - `mcp__figma__get_figma_data`
17
17
  - Input: `fileKey`, `nodeId`
18
- - Goi y: thu `depth=2` hoac `depth=3` (tang dan neu thieu thong tin).
18
+ - Recommendation: try `depth=2` or `depth=3` first, then increase only if data is missing.
19
19
 
20
- Khi tong hop vao `docs/specs/[FEATURE_KEY]_FIGMA_LAYOUT.md`, giu khung:
20
+ When summarizing into `docs/specs/[FEATURE_KEY]_FIGMA_LAYOUT.md`, keep this structure:
21
21
  - Design Structure: frame dimensions, components/instances, key layers, variants/properties.
22
22
  - Styling Data: color (Hex/RGB), typography (font/size/weight/line-height), shadow/opacity/border.
23
23
  - Layout Information: padding/gap/alignment, width/height, border radius.
24
- - Design Tokens: color/typography/spacing tokens neu co ten style (vd: `style_...`).
24
+ - Design Tokens: color/typography/spacing tokens when named styles exist (for example `style_...`).
25
25
 
26
- ## Rate-limit 429 / du lieu thieu
26
+ ## Handle `429` and partial data
27
27
 
28
- Neu gap `429 Too Many Requests`:
29
- 1) Giam `depth` va thu lai.
30
- 2) Cho va retry (backoff 20s -> 40s -> 80s).
31
- 3) Neu van fail: de trong cac muc khong lay duoc va ghi note ro ly do 429.
28
+ If you hit `429 Too Many Requests`:
29
+ 1) Reduce `depth` and try again.
30
+ 2) Wait and retry with backoff (20s -> 40s -> 80s).
31
+ 3) If it still fails, leave the unavailable sections blank and record a clear note that the omission is due to `429`.
32
32
 
33
- Khong tu bịa mau/typography/token khi khong co du lieu.
33
+ Do not invent colors, typography, or tokens when the source data is unavailable.
34
34
 
35
- ## Export anh man hinh
35
+ ## Export screen images
36
36
 
37
- Dung MCP:
37
+ Use MCP:
38
38
  - `mcp__figma__download_figma_images`
39
- - Input: `fileKey`, danh sach `nodes` (nodeId), `fileName` (png), `pngScale` (thuong 2).
39
+ - Input: `fileKey`, list of `nodes` (`nodeId`), `fileName` (`png`), `pngScale` (usually `2`).
40
40
 
41
- Luu y ve `localPath`:
42
- - Mot so moi truong chan duong dan tuyet doi.
43
- - Dung thu muc tuong doi trong repo (vd: `Requirements/_tmp/figma_downloads`) roi copy anh ve:
41
+ Notes for `localPath`:
42
+ - Some environments block absolute paths.
43
+ - Use a repo-relative temp folder first, for example `Requirements/_tmp/figma_downloads`, then copy the images into:
44
44
  - `docs/specs/assets/[feature_snake]/screens/`
45
45
 
46
- ## Quy uoc dat ten file anh
46
+ ## Image naming convention
47
47
 
48
- Khuyen nghi dat ten on dinh de embed lau dai, vi du:
48
+ Use stable filenames so markdown embeds do not need frequent updates, for example:
49
49
  - `screen_3_1_main.png`
50
50
  - `screen_3_2_search.png`
51
51
  - `screen_3_3_dialog.png`
52
52
  - `screen_3_3_dialog_numbered.png`
53
53
 
54
- Neu dung anh tu Excel thay the, van giu cung naming de tranh sua nhieu link trong markdown.
54
+ If an image is later replaced by an Excel-derived export, keep the same filename to avoid rewriting multiple markdown links.