sdtk-kit 0.3.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 (75) hide show
  1. package/README.md +131 -0
  2. package/assets/manifest/toolkit-bundle.manifest.json +303 -0
  3. package/assets/manifest/toolkit-bundle.sha256.txt +59 -0
  4. package/assets/toolkit/toolkit/AGENTS.md +103 -0
  5. package/assets/toolkit/toolkit/install.ps1 +155 -0
  6. package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +32 -0
  7. package/assets/toolkit/toolkit/runtimes/codex/CODEX_TEMPLATE.md +32 -0
  8. package/assets/toolkit/toolkit/scripts/init-feature.ps1 +253 -0
  9. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +181 -0
  10. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +116 -0
  11. package/assets/toolkit/toolkit/sdtk.config.json +28 -0
  12. package/assets/toolkit/toolkit/sdtk.config.profiles.example.json +50 -0
  13. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +78 -0
  14. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +212 -0
  15. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/FLOWCHART_CREATION_RULES.md +397 -0
  16. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +565 -0
  17. package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +36 -0
  18. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/FLOWCHART_CREATION_RULES.md +397 -0
  19. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +43 -0
  20. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +212 -0
  21. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOWCHART_CREATION_RULES.md +397 -0
  22. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +136 -0
  23. package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +24 -0
  24. package/assets/toolkit/toolkit/skills/sdtk-design-layout/SKILL.md +21 -0
  25. package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +20 -0
  26. package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +17 -0
  27. package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +15 -0
  28. package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +44 -0
  29. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +26 -0
  30. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +22 -0
  31. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/SKILL.md +59 -0
  32. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +136 -0
  33. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md +51 -0
  34. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/figma-mcp.md +54 -0
  35. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/numbering-rules.md +76 -0
  36. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/renumber_flow_action_spec_global.py +136 -0
  37. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/validate_flow_action_spec_numbering.py +249 -0
  38. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/SKILL.md +65 -0
  39. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/references/TEST_CASE_CREATION_RULES.md +129 -0
  40. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/scripts/validate_test_case_spec.py +97 -0
  41. package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +124 -0
  42. package/assets/toolkit/toolkit/templates/README.md +56 -0
  43. package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +80 -0
  44. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +212 -0
  45. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +62 -0
  46. package/assets/toolkit/toolkit/templates/docs/api/API_ENDPOINTS_TEMPLATE.md +229 -0
  47. package/assets/toolkit/toolkit/templates/docs/api/FEATURE_API_TEMPLATE.yaml +20 -0
  48. package/assets/toolkit/toolkit/templates/docs/api/FLOWCHART_CREATION_RULES.md +397 -0
  49. package/assets/toolkit/toolkit/templates/docs/api/feature_api_flow_list_TEMPLATE.txt +12 -0
  50. package/assets/toolkit/toolkit/templates/docs/architecture/ARCH_DESIGN_TEMPLATE.md +109 -0
  51. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +175 -0
  52. package/assets/toolkit/toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md +49 -0
  53. package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +73 -0
  54. package/assets/toolkit/toolkit/templates/docs/product/BACKLOG_TEMPLATE.md +50 -0
  55. package/assets/toolkit/toolkit/templates/docs/product/PRD_TEMPLATE.md +66 -0
  56. package/assets/toolkit/toolkit/templates/docs/product/PROJECT_INITIATION_TEMPLATE.md +98 -0
  57. package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +61 -0
  58. package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_CREATION_RULES.md +129 -0
  59. package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_TEMPLATE.md +104 -0
  60. package/assets/toolkit/toolkit/templates/docs/specs/BA_SPEC_TEMPLATE.md +139 -0
  61. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +136 -0
  62. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_TEMPLATE.md +160 -0
  63. package/bin/sdtk.js +15 -0
  64. package/package.json +47 -0
  65. package/src/commands/auth.js +85 -0
  66. package/src/commands/generate.js +177 -0
  67. package/src/commands/help.js +69 -0
  68. package/src/commands/init.js +73 -0
  69. package/src/index.js +56 -0
  70. package/src/lib/args.js +116 -0
  71. package/src/lib/errors.js +41 -0
  72. package/src/lib/github-access.js +68 -0
  73. package/src/lib/powershell.js +85 -0
  74. package/src/lib/state.js +83 -0
  75. package/src/lib/toolkit-payload.js +99 -0
@@ -0,0 +1,397 @@
1
+ # Flowchart Creation Rules for AI Agents (PlantUML)
2
+
3
+ This document defines reusable rules for creating and updating API flowcharts in this project.
4
+ Target files are usually API flow list documents (for example `*_api.txt`) and API YAML files (for example `docs/api/*.yaml`).
5
+
6
+ ## 1. Scope and Goal
7
+
8
+ - Use PlantUML activity diagrams for API process flows.
9
+ - Keep diagrams readable, implementation-aware, and consistent with current backend logic.
10
+ - Prefer minimal-impact documentation changes when existing customer logic is already running.
11
+
12
+ ## 2. File and Diagram Structure
13
+
14
+ - One API flow = one `@startuml ... @enduml` block.
15
+ - If helper logic is extracted, add a separate `@startuml ... @enduml` block for that helper.
16
+ - Keep API title in `partition`:
17
+ - `partition "POST **/api/path/{company_uuid}** Japanese summary" { ... }`
18
+ - Optional helper flow style:
19
+ - `rectangle "Logic function name" { ... }`
20
+
21
+ ## 3. Mandatory Activity Syntax Rules
22
+
23
+ - Every action line must end with `;`
24
+ - Every `if (...) then (...)` must be closed by `endif`
25
+ - Use `else (no)` and `then (yes)` labels explicitly for branch readability.
26
+ - Use `repeat ... repeat while ...` only when loop behavior is required.
27
+
28
+ ## 4. Color/Highlight Rules (Non-deprecated)
29
+
30
+ Use stereotype-based color syntax (new style), not old prefix style.
31
+
32
+ - Correct:
33
+ - `:Return Error status = 100: Parameter invalid;<<#pink>>`
34
+ - `:Call query_search_by_keyword() function;<<#lightGreen>>`
35
+ - Avoid deprecated old style:
36
+ - `#pink:...`
37
+ - `#lightGreen:...`
38
+
39
+ ## 5. Standard API Flow Skeleton
40
+
41
+ ```plantuml
42
+ @startuml
43
+ partition "POST **/sample/path/{company_uuid}** API summary" {
44
+ start
45
+ :Process authentication\\nCommon auth process;
46
+ :Validate parameter;
47
+ if (is valid) then (no)
48
+ :Return Error status = 100: Parameter invalid;<<#pink>>
49
+ stop
50
+ else (yes)
51
+ endif
52
+ :Main process;
53
+ :Close DB connection;
54
+ :Create api response;
55
+ stop
56
+ }
57
+ @enduml
58
+ ```
59
+
60
+ ## 6. Query-Building Style Rules
61
+
62
+ When describing SQL-like logic in flowchart:
63
+
64
+ - Build query in steps:
65
+ 1. `Create search query and condition statement from request.data;`
66
+ 2. `query = "...";`
67
+ 3. `condition = "...";`
68
+ 4. optional condition append blocks
69
+ 5. `Compose full query: fullQuery = query + condition;`
70
+ 6. apply order/paging
71
+ 7. execute query
72
+
73
+ - Keyword pattern:
74
+ - `LIKE '%data.info.keyword%'`
75
+ - Order pattern:
76
+ - `Add order by data.info.order_flg data.info.order_type into fullQuery;`
77
+ - Paging pattern:
78
+ - `Add "LIMIT = data.info.limit OFFSET = data.info.offset" into fullQuery;`
79
+
80
+ ### 6.1 Endpoint-level Mapping Must Be Explicit
81
+
82
+ For keyword/order enhancements, always document mapping between request params and DB columns per endpoint.
83
+
84
+ - `keyword` must list all searchable columns/tables.
85
+ - `order_flg` must list allowed sort targets and mapped columns.
86
+ - `order_type` must be documented as `asc/desc`.
87
+ - If payload includes new fields that are not handled by current legacy code,
88
+ add explicit processing logic for those new fields in the helper flow.
89
+ Do not silently ignore newly introduced request fields.
90
+
91
+ Example (`/bukken-manager/regno/customer/search/{company_uuid}`):
92
+ - `keyword`:
93
+ - `CLD_DAT_CUSTOMER_REG_NO_INFO.customer_reg_no`
94
+ - `CLD_MST_LOCATION_INFO.location_name`
95
+ - `CLD_MST_REG_NO_TYPE_INFO.name`
96
+ - `order_flg`:
97
+ - `customer_reg_no` / `location_name` / `name`
98
+ - `order_type`:
99
+ - `asc` / `desc`
100
+
101
+ ## 7. Backward-Compatible Merge Pattern
102
+
103
+ When new requirements are added to an existing API:
104
+
105
+ - Keep current handler path for old request behavior.
106
+ - Add conditional branch for new logic only when required params exist.
107
+ - Recommended branch style:
108
+ - If all new params are null -> keep old logic
109
+ - Else -> call extracted helper function
110
+ - Use this exact "no-impact first" branch when preserving customer legacy handlers:
111
+ - `if (data.info.keyword null and data.info.order_flg null and data.info.order_type null) then (yes)`
112
+ - `:Keep the current search logic handler: <existing_handler>();`
113
+ - `else (no)` -> call helper for new query logic
114
+ - In the legacy branch, do not duplicate old internal sub-steps unless explicitly requested.
115
+ - Avoid extra lines like mapping/query detail when they are already part of existing handler behavior.
116
+ - Prefer one concise line:
117
+ - `:Keep the current search logic handler: <existing_handler>();`
118
+
119
+ Example:
120
+
121
+ ```plantuml
122
+ if (data.info.keyword null and data.info.order_flg null and data.info.order_type null) then (yes)
123
+ :Keep the current search logic handler: regno_search();
124
+ else (no)
125
+ :Call query_search_by_keyword() function;<<#lightGreen>>
126
+ endif
127
+ ```
128
+
129
+ ## 8. Helper Function Diagram Pattern
130
+
131
+ ```plantuml
132
+ @startuml
133
+ rectangle "Logic query search by keyword" {
134
+ :query_search_by_keyword();<<#lightGreen>>
135
+ :Create search query and condition statement from request.data;
136
+ :query = "...";
137
+ :condition = "...";
138
+ if (data.info.keyword not null) then (yes)
139
+ :condition += "...";
140
+ else (no)
141
+ endif
142
+ :Compose full query:\\nfullQuery = query + condition;
143
+ :Add order by data.info.order_flg data.info.order_type into fullQuery;
144
+ :Add "LIMIT = data.info.limit OFFSET = data.info.offset" into fullQuery;
145
+ :Execute fullQuery and get data;
146
+ :return return_datas;
147
+ }
148
+ @enduml
149
+ ```
150
+
151
+ ### 8.1 Helper Naming Rule
152
+
153
+ - Use helper names that include endpoint domain to avoid collisions across many APIs.
154
+ - Recommended:
155
+ - `query_search_by_keyword()` for generic case
156
+ - `query_search_by_keyword_customer_regno()` for customer-regno endpoint
157
+
158
+ ### 8.2 Legacy Fallback Rule (Search APIs)
159
+
160
+ - When modernizing an existing search endpoint, explicitly describe legacy fallback behavior:
161
+ - soft-delete flag fallback from existing code path (if any)
162
+ - default order fallback when `order_flg/order_type` is absent
163
+ - default filters applied when optional inputs are null
164
+ - Keep these fallback notes visible in flowchart text to avoid behavior drift.
165
+
166
+ ### 8.3 Extended Filter Branch/Response Rule
167
+
168
+ - If new optional filter fields are added, include all of them in the no-impact branch check.
169
+ - When relation-based filters are used, explicitly show join/filter logic in helper flow.
170
+ - If response contains multiple typed lists, keep each list explicit in flowchart/YAML (for example `data.<entity>_info[]`) and include summary metadata such as `count` when applicable.
171
+
172
+ ## 9. Path Canonicalization Rule
173
+
174
+ - If YAML path and actual route path are different, use the confirmed actual route path in flowchart.
175
+ - Always prioritize route path defined in backend code (`urls.py`) over YAML documentation.
176
+ - If route path cannot be found in code, fallback to YAML path and mark it as assumed/temporary.
177
+ - Always confirm this with user before finalizing.
178
+
179
+ ## 9A. API Endpoint Design Rules (Project Standard)
180
+
181
+ These rules must be applied when creating/updating API flowcharts and YAML in this project.
182
+
183
+ - Use singular object keyword in endpoint path:
184
+ - Correct: `/invoice`, `/assignment`, `/personal-schedule`
185
+ - Avoid: `/invoices`, `/assignments`
186
+ - Use canonical business-domain keywords from glossary/spec terminology.
187
+ - Avoid ambiguous aliases when official domain terms exist.
188
+ - Use action keywords that describe behavior clearly:
189
+ - List: `.../list/...`
190
+ - Update: `.../edit/...`
191
+ - Delete: `.../delete/...`
192
+ - Multi-create: `.../multi-create`
193
+ - Avoid vague action keyword `bulk` when behavior is multi-create.
194
+
195
+ ### 9A.1 Endpoint Pattern
196
+
197
+ - List API:
198
+ - `GET /{object}/list/{company_uuid}/{bukken_uuid}`
199
+ - Create API:
200
+ - `POST /{object}/{company_uuid}/{bukken_uuid}`
201
+ - Edit API:
202
+ - `POST /{object}/edit/{company_uuid}/{object_uuid}`
203
+ - Detail API:
204
+ - `GET /{object}/edit/{company_uuid}/{object_uuid}`
205
+ - Delete API:
206
+ - `POST /{object}/delete/{company_uuid}/{object_uuid}`
207
+
208
+ ### 9A.2 HTTP Method Policy
209
+
210
+ - Do not use `PUT` for update APIs. Use `POST .../edit/{uuid}`.
211
+ - Do not use `DELETE` method for delete APIs. Use `POST .../delete/{uuid}`.
212
+
213
+ ### 9A.3 Canonical Examples
214
+
215
+ - Invoice sample:
216
+ - `GET /invoice/list/{company_uuid}/{bukken_uuid}`
217
+ - `POST /invoice/{company_uuid}/{bukken_uuid}`
218
+ - `POST /invoice/edit/{company_uuid}/{invoice_uuid}`
219
+ - `GET /invoice/edit/{company_uuid}/{invoice_uuid}`
220
+ - `POST /invoice/delete/{company_uuid}/{bukken_uuid}`
221
+
222
+ ## 9B. General Design and Documentation Governance Rules
223
+
224
+ Apply the rules below as cross-project standards for API YAML and flowchart generation.
225
+ These rules complement section `9A` (path syntax + method policy) and avoid redefining it.
226
+
227
+ ### 9B.1 Rule Precedence and Consistency
228
+
229
+ - Endpoint naming/method conventions must follow section `9A`.
230
+ - If a feature needs an exception from `9A`, document the reason and get explicit confirmation before finalizing.
231
+ - Keep terminology consistent across path, request/response schema, flowchart labels, and API summary tables.
232
+
233
+ ### 9B.2 Parameter Placement Rule
234
+
235
+ - Path parameters: identity and routing keys (`{company_uuid}`, `{resource_uuid}`).
236
+ - Query parameters: lightweight filtering/sorting/paging.
237
+ - Request body: complex/multi-field search criteria.
238
+ - If retrieval requires many filter fields, prefer dedicated `POST .../search` over overloaded query strings.
239
+
240
+ ### 9B.3 Read Contract Shape Rule (List vs Search)
241
+
242
+ - Use list-style read API for simple retrieval contracts.
243
+ - Use search-style read API when filter logic is complex or payload-based.
244
+ - If one endpoint forces heavy client-side matching/filtering for different screen modes, split read endpoints by view purpose.
245
+
246
+ ### 9B.4 Endpoint Split vs Merge Decision Rule
247
+
248
+ - Split endpoints when:
249
+ - view/use-case shaping is materially different
250
+ - one endpoint causes excessive client orchestration
251
+ - Merge endpoints/datasets when:
252
+ - data is always consumed together under the same filter context
253
+ - separate endpoints only add latency and maintenance cost
254
+ - Record split/merge rationale in API description and flowchart notes.
255
+
256
+ ### 9B.5 Reuse vs New Endpoint Rule
257
+
258
+ - Reuse existing endpoints only when request/response contract is truly compatible with target screen logic.
259
+ - If existing API is semantically close but contract-incompatible, create a bounded new endpoint for that use case.
260
+ - Mark endpoint lifecycle in docs via `API Type` classification (see `9B.8`).
261
+
262
+ ### 9B.6 Namespace and Path Redundancy Rule
263
+
264
+ - Separate namespaces by bounded context/domain.
265
+ - Avoid repeating parent namespace meaning in child path segments.
266
+ - Keep paths concise but semantically clear.
267
+
268
+ ### 9B.7 Screen-to-API Traceability Rule
269
+
270
+ - Every UI flow/action section must map:
271
+ - trigger/action
272
+ - called API
273
+ - response fields used for rendering
274
+ - Explicitly mark when a single endpoint serves multiple actions (initial load, search, refresh, etc.).
275
+
276
+ ### 9B.8 API List Governance Rule (Markdown Specs)
277
+
278
+ - API summary tables must include at least:
279
+ - `No`
280
+ - `Method`
281
+ - `Endpoint`
282
+ - `API Type`
283
+ - `Description`
284
+ - Group APIs by delivery status for planning visibility:
285
+ 1. `New`
286
+ 2. `Deferred`
287
+ 3. `Existing (reuse)`
288
+ - After regrouping, renumber `No` sequentially.
289
+
290
+ ### 9B.9 Change Management Rule
291
+
292
+ - For every endpoint rename/add/remove/merge:
293
+ - update endpoint detail sections
294
+ - update API summary tables
295
+ - update screen-to-API mapping
296
+ - append a new row in document history
297
+ - Preserve old history rows; never rewrite historical entries.
298
+
299
+ ### 9B.10 Canonical Response Envelope Rule
300
+
301
+ - Use one canonical response envelope across a bounded module/feature.
302
+ - Keep the envelope shape consistent in YAML examples, flowchart return nodes, and markdown endpoint tables.
303
+ - Recommended normalized envelope keys:
304
+ - `status`
305
+ - `msg`
306
+ - `data`
307
+ - `format_version`
308
+ - If a legacy API has a different wrapper, document it explicitly as an exception.
309
+
310
+ ### 9B.11 Business Status Rule
311
+
312
+ - Business execution result must be represented in response body `status` (not only by HTTP code).
313
+ - Flowchart branches must map to business status outcomes, including validation and duplicate/conflict-like results.
314
+ - Document endpoint-level status code matrix in API docs when branching is non-trivial.
315
+ - HTTP status policy can vary by system profile, but body `status` must remain deterministic.
316
+
317
+ ### 9B.12 Request Body Wrapper Rule
318
+
319
+ - For write/search APIs that use POST payloads, prefer a stable top-level wrapper object:
320
+ - `data: { ... }`
321
+ - Keep filter/search fields under `data` when criteria are complex or nested.
322
+ - If legacy contracts do not use wrapper objects, document exception and compatibility reason.
323
+
324
+ ### 9B.13 Traceability Metadata Rule
325
+
326
+ - YAML should include explicit traceability metadata for each endpoint (for example `x-traceability`).
327
+ - Minimum mapping targets:
328
+ - BR (business rule)
329
+ - UC (use case)
330
+ - AC (acceptance criteria)
331
+ - Flow list and markdown API docs should preserve the same mapping IDs to keep cross-artifact traceability.
332
+
333
+ ### 9B.14 Language and Encoding Governance
334
+
335
+ - EN artifact set must use English narrative consistently.
336
+ - Save generated markdown/YAML as UTF-8 and remove mojibake/corrupted characters before handoff.
337
+ - If source input is VI/JP, keep original text only in dedicated appendix/quotation blocks when needed for traceability.
338
+
339
+ ### 9B.15 Abbreviations and Table Numbering Governance
340
+
341
+ - For generated markdown specs, include an `Abbreviations` section near the top when acronyms are used.
342
+ - Apply `No` column and sequential renumbering policy by following section `9B.8`.
343
+
344
+ ## 9C. Project Profile Overlay Rule (Cross-Project Reuse)
345
+
346
+ - Separate reusable core rules from system-specific constraints.
347
+ - Keep system-specific choices in a project profile layer, for example:
348
+ - fixed HTTP policy patterns
349
+ - datetime timezone/local-naive policy
350
+ - method conventions such as POST-based edit/delete
351
+ - When reusing these rules for a new system, adopt core rules first, then explicitly decide profile overrides.
352
+ - Do not silently promote one system profile as global default for all projects.
353
+
354
+ ## 10. Wording Rules
355
+
356
+ - Use concrete action verbs:
357
+ - `Select ...`
358
+ - `Update ...`
359
+ - `Insert ...`
360
+ - `Create api response;`
361
+ - For existing behavior preservation, use explicit wording:
362
+ - `Keep the current search logic handler: <function>();`
363
+ - Do not add redundant response details if globally standardized.
364
+ - Prefer `:Create api response;` over verbose wrappers.
365
+
366
+ ## 11. Error/Status Rules in Flow Text
367
+
368
+ - Parameter validation error: usually `status = 100` (unless API-specific rule says otherwise).
369
+ - Temporary unknown error code policy may use `status = 900` if already agreed.
370
+ - Keep status usage consistent with confirmed project decisions.
371
+
372
+ ## 12. Common Preview Errors and Fixes
373
+
374
+ - Error: `Cannot find group ... @enduml`
375
+ - Cause: missing `endif` or malformed action statement
376
+ - Fix: close all branches and ensure each action line ends with `;`
377
+
378
+ - Warning: `This syntax is deprecated...`
379
+ - Cause: old color syntax (`#pink:...`, `#lightGreen:...`)
380
+ - Fix: move color marker to end of action:
381
+ - `:...;<<#pink>>`
382
+ - `:...;<<#lightGreen>>`
383
+
384
+ ## 13. Final Checklist Before Handoff
385
+
386
+ - Diagram renders in PlantUML Preview without error.
387
+ - No deprecated color syntax warnings.
388
+ - All `if` blocks have matching `endif`.
389
+ - New logic branch does not remove old logic path unless explicitly requested.
390
+ - SQL condition/order/paging statements match agreed spec.
391
+ - API path and method match the confirmed actual route (use YAML path only when they are identical).
392
+ - Response envelope is consistent with module-level canonical contract.
393
+ - Business `status` mapping is explicit in both YAML and flow branches.
394
+ - POST search/write payload wrapper (`data`) is consistent (or exception documented).
395
+ - Traceability links (BR/UC/AC) are present and consistent across artifacts.
396
+ - EN/UTF-8 quality check passed (no mixed-language drift, no mojibake).
397
+
@@ -0,0 +1,136 @@
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. `Screen flow action` (with PlantUML)
23
+ 4. `Screen layout spec by flow action`
24
+ 5. `System processing flow`
25
+ 6. `Open questions`
26
+ 7. `Screen - API mapping`
27
+ 8. `Document history`
28
+
29
+ If a section is not in scope, keep the section and mark explicitly as `N/A` with reason.
30
+
31
+ ## 3. Table Standards
32
+
33
+ - Every table must include a `No` column (sequential numbering).
34
+ - Use stable headers for action tables:
35
+ - `No | JP Item Name | Item Name | Item Type | Attribute | DB Column | Size | Default Value | Action | Description | Note`
36
+ - Use stable headers for API mapping tables:
37
+ - `No | Trigger/When | UI item (No / JP Item Name) | API to call | Data usage / Notes`
38
+ - Use stable headers for screen mapping:
39
+ - `No | Screen (section) | Screen ID | Read/Search APIs | Write APIs | Notes / Q&A refs`
40
+ - Table rows must keep column count consistent with the header (no broken or merged rows).
41
+ - Avoid single-line merged content that collapses multiple logical items into one table row.
42
+
43
+ ### 3.1 Language and Encoding Standards (EN Artifacts)
44
+
45
+ - For EN artifacts (`docs/en/**` or explicitly requested EN version), narrative text must be English.
46
+ - JP labels can remain only in JP-specific fields/columns (`JP Item Name`, `項目名`, source captions).
47
+ - Do not leave mixed-language fragments in one sentence/cell (for example VI+EN mixed text).
48
+ - If original VI/JP text is required for traceability, keep it in a clearly marked appendix block (`Original Text`), then provide EN translation.
49
+ - Save files as UTF-8 and avoid mojibake/broken glyphs (`�`, `ↁE`, garbled sequences).
50
+ - Keep canonical terminology stable across documents (for example: `bukken`, `sagyo`, `customer employee`).
51
+
52
+ ### 3.2 Markdown Structure Hygiene
53
+
54
+ - Keep each heading on its own line; do not concatenate multiple headings/sections on one line.
55
+ - Keep metadata blocks (`Information`, `Note`, `Behavior notes`) as structured bullet blocks, not single compressed lines.
56
+ - Keep image, table, and separator (`---`) boundaries explicit to preserve parser/render stability.
57
+
58
+ ## 4. Item Numbering and Duplication Rules
59
+
60
+ - Use one numbering mode only: `global across document`.
61
+ - Number values must increase across all action tables in the document.
62
+ - Avoid duplicate item descriptions for the same UI control across screens unless behavior differs.
63
+ - If duplicate number is intentional (rare), annotate reason in `Note`.
64
+
65
+ ## 5. Screen Section Rules
66
+
67
+ For each screen section:
68
+
69
+ - Provide metadata:
70
+ - official screen name
71
+ - Screen ID
72
+ - design source URL (for example Figma)
73
+ - Embed one representative image per screen.
74
+ - Provide one action table.
75
+ - Provide one API mapping table.
76
+ - If a screen has dialogs, create explicit dialog sub-sections with their own tables and API mapping.
77
+
78
+ ## 6. API Traceability Rules
79
+
80
+ - Every actionable UI event that changes state must map to a write API.
81
+ - Every data-loading UI event must map to a read/search API.
82
+ - If one endpoint serves multiple actions (initial load, search, refresh), state this explicitly.
83
+ - If no API is called for an action, state `No API` and explain why.
84
+
85
+ ## 7. PlantUML Rules for Screen Flow
86
+
87
+ - Use valid PlantUML syntax and renderability checks before handoff.
88
+ - Use `\\n` for multi-line labels in nodes.
89
+ - Keep diagram at navigation/action level (not low-level SQL or backend internals).
90
+ - Ensure screen names in PlantUML match section names in layout spec.
91
+
92
+ ## 8. Data Source and Asset Rules
93
+
94
+ - Prioritize source order:
95
+ 1. Confirmed design source (for example Figma)
96
+ 2. Confirmed requirement files (Excel/spec)
97
+ 3. User-provided screenshots
98
+ - Store images in repository-relative paths.
99
+ - Do not keep temporary local absolute paths in markdown.
100
+
101
+ ## 9. Consistency with Other Specs
102
+
103
+ - Align terms with:
104
+ - BA spec glossary
105
+ - API endpoints spec
106
+ - Database spec
107
+ - If terminology differs across docs, raise an open question and add a temporary mapping note.
108
+ - Keep endpoint paths in flow-action spec consistent with API endpoint spec.
109
+
110
+ ## 10. Open Questions and Uncertainty Handling
111
+
112
+ - Capture unresolved items in `Open questions` table.
113
+ - Do not invent UI behavior or API contracts when source is ambiguous.
114
+ - Mark uncertain mappings as `Draft` and include impacted files/sections.
115
+
116
+ ## 11. Change Management
117
+
118
+ - On each update:
119
+ - update impacted screen sections
120
+ - update API mapping tables
121
+ - update screen-to-API mapping summary
122
+ - append one row in document history
123
+ - Never overwrite past history rows.
124
+
125
+ ## 12. Final Checklist Before Handoff
126
+
127
+ - PlantUML renders successfully.
128
+ - All mandatory sections exist.
129
+ - All tables include `No`.
130
+ - Numbering is global across the document (no resets).
131
+ - No broken image links.
132
+ - Screen/API mappings are consistent with `*_ENDPOINTS.md`.
133
+ - Open questions are explicit and traceable.
134
+ - For EN artifact: no leftover VI text outside allowed `Original Text` appendix blocks.
135
+ - No mojibake/encoding corruption markers.
136
+ - Headings/tables are structurally clean (no merged lines that break readability/traceability).
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: sdtk-ba
3
+ description: Business Analyst workflow for SDTK. Use when you need to turn PM initiation into BA_SPEC with glossary, business rules (BR-xx), use cases (UC-xx), acceptance criteria (AC-xx), NFRs, risks, open questions, and a traceability matrix.
4
+ ---
5
+
6
+ # SDTK BA (Business Analysis)
7
+
8
+ ## Output
9
+ - `docs/specs/BA_SPEC_[FEATURE_KEY].md`
10
+
11
+ ## Process
12
+ 1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` (and any source requirements).
13
+ 2. Produce:
14
+ - Glossary
15
+ - BR-xx (numbered)
16
+ - UC-xx (cover 100% REQ-xx)
17
+ - AC-xx (mapped to UC/BR)
18
+ - NFR-xx
19
+ - Risks + Open Questions
20
+ - Traceability summary table (REQ → UC/BR/AC)
21
+ 3. If source requirements are VI/JP: preserve the original text and add a literal EN translation in appendices.
22
+ 4. If anything is unclear: record OQ-xx in BA_SPEC “Open Questions” and escalate to `@pm` for a decision (PM asks the user if still missing info).
23
+ 5. Update `SHARED_PLANNING.md` + `QUALITY_CHECKLIST.md` Phase 2.
24
+ 6. Handoff: `@pm specs ready for PRD`.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: sdtk-design-layout
3
+ description: Generate UI screen layout documentation for a feature, including PlantUML @startsalt wireframes and item tables. Use when a feature includes frontend/admin screens and you need docs/design/* deliverables.
4
+ ---
5
+
6
+ # SDTK Screen Layout Design
7
+
8
+ ## Output
9
+ - `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md`
10
+
11
+ ## Process
12
+ 1. Read BA spec (screens + fields) and API list.
13
+ 2. For each screen, include:
14
+ - PlantUML `@startsalt` wireframe first
15
+ - API list table
16
+ - Item table with numbering that matches the wireframe
17
+ 3. Keep screen IDs consistent (A-*, B-*, C-*).
18
+
19
+ ## Template
20
+ - Use `toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md` as starting structure.
21
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: sdtk-dev
3
+ description: Developer workflow for SDTK. Use when you need to implement a feature from ARCH_DESIGN + BACKLOG: create an implementation plan, write code + tests, complete mandatory code review gate, and prepare a QA handoff.
4
+ ---
5
+
6
+ # SDTK DEV (Implementation + Code Review)
7
+
8
+ ## Outputs
9
+ - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
10
+ - Code + tests (follow repo conventions)
11
+
12
+ ## Process
13
+ 1. Read `ARCH_DESIGN_*` + backlog.
14
+ 2. Read `sdtk.config.json` for project stack + test/lint commands.
15
+ 3. Write `FEATURE_IMPL_PLAN_*` (scope, file list, test plan).
16
+ 4. If anything is unclear: record OQ-xx in FEATURE_IMPL_PLAN “Open Questions” and escalate to `@pm` for a decision (PM asks the user if still missing info).
17
+ 5. Implement incrementally with tests.
18
+ 6. Complete mandatory code review gate (self + peer checklist; AI peer review allowed).
19
+ 7. Update `SHARED_PLANNING.md` + `QUALITY_CHECKLIST.md` Phase 4.
20
+ 8. Handoff: `@qa please test …` (only after code review PASS).
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: sdtk-dev-backend
3
+ description: Generate/modify Python Django REST Framework backend code following the toolkit conventions (models/views/services/serializers/validation/urls/enums). Use when implementing backend features in that project style.
4
+ ---
5
+
6
+ # SDTK Backend (Toolkit conventions)
7
+
8
+ ## Process
9
+ 1. Check whether this repository already has a backend reference module and follow its patterns.
10
+ 2. Follow module structure: `src/backend/<module>/{models,view,service,serializers,validation,enum,urls.py}`.
11
+ 3. Apply conventions:
12
+ - Soft delete via `del_flg`
13
+ - Audit fields (creator/updater/del timestamps)
14
+ - Permission checks before operations
15
+ - `transaction.atomic()` for writes
16
+ - Logging decorator on public endpoints
17
+ 4. Add tests for critical business rules and state transitions.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: sdtk-dev-frontend
3
+ description: Generate/modify React frontend code following the toolkit conventions (list/register/edit/detail pages, components, services, React Query hooks, permission checks). Use when implementing frontend features in that project style.
4
+ ---
5
+
6
+ # SDTK Frontend (Toolkit conventions)
7
+
8
+ ## Process
9
+ 1. Check whether this repository already has a frontend reference module and follow its patterns.
10
+ 2. Follow structure:
11
+ - `src/frontend/features/{feature}/...`
12
+ - `src/frontend/services/{feature}/{feature}Service.js`
13
+ - `src/frontend/services/apiHook/{feature}.js`
14
+ 3. Implement screens based on `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md`.
15
+ 4. Preserve patterns: React Query hooks, loading states, permission checks, consistent labels.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: sdtk-orchestrator
3
+ description: Orchestrate a full 6-phase SDLC multi-agent workflow (PM/BA/ARCH/DEV/QA) using this repo's conventions: SHARED_PLANNING.md + QUALITY_CHECKLIST.md + docs/* artifacts + phase handoffs.
4
+ ---
5
+
6
+ # SDTK Orchestrator (multi-agent workflow)
7
+
8
+ ## Initialize
9
+ - Ensure feature key + feature name exist (ask if missing).
10
+ - Read `sdtk.config.json` (project stack + commands) if present.
11
+ - If `toolkit/scripts/init-feature.ps1` exists: run it to create skeleton artifacts; otherwise create the same files from `toolkit/templates/`.
12
+
13
+ ## Execute pipeline (one phase per turn)
14
+ - Default role: PM (entry point) if user did not specify.
15
+ - Respect role tags: `/pm`, `/ba`, `/arch`, `/dev`, `/qa`.
16
+ - For each phase:
17
+ - Create/update the phase artifact(s) in `docs/`.
18
+ - If phase is ARCH and API contract/flow is in scope, invoke `sdtk-api-doc` to produce/update `docs/api/[FeaturePascal]_API.yaml`, `docs/api/[FEATURE_KEY]_ENDPOINTS.md`, and `docs/api/[feature_snake]_api_flow_list.txt`.
19
+ - If phase is ARCH and API detail spec is in scope, invoke `sdtk-api-design-spec` to produce/update `docs/api/[FEATURE_KEY]_API_DESIGN_DETAIL.md`.
20
+ - If phase is ARCH and UI flow behavior is in scope, invoke `sdtk-screen-design-spec` to produce/update `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md`.
21
+ - If phase is QA and test-case specification is in scope, invoke `sdtk-test-case-spec` to produce/update `docs/qa/[FEATURE_KEY]_TEST_CASE.md`.
22
+ - Update `SHARED_PLANNING.md` (phase row + activity log).
23
+ - Update `QUALITY_CHECKLIST.md` (mark items PASS/Pending).
24
+ - Produce one clear handoff message to the next role.
25
+
26
+ ## API design detail mode (Hybrid)
27
+ - Read `sdtk.config.json` key: `orchestration.apiDesignDetailMode`.
28
+ - Supported values:
29
+ - `auto` (default): run `sdtk-api-design-spec` when ARCH has API scope and YAML + flow list are available.
30
+ - `on`: always run `sdtk-api-design-spec` for API scope (fail fast if required inputs are missing).
31
+ - `off`: skip API design detail generation unless user explicitly requests it.
32
+
33
+ ## Test-case spec mode (Hybrid)
34
+ - Read `sdtk.config.json` key: `orchestration.testCaseSpecMode`.
35
+ - Supported values:
36
+ - `auto` (default): run `sdtk-test-case-spec` when QA phase requires reusable test-case artifact.
37
+ - `on`: always run `sdtk-test-case-spec` for QA phase (fail fast if required inputs are missing).
38
+ - `off`: skip test-case spec generation unless user explicitly requests it.
39
+
40
+ ## Guardrails
41
+ - Do not skip phases; if prerequisites are missing, ask focused questions.
42
+ - Keep traceability: REQ -> BR/UC/AC -> design -> backlog -> code/tests -> QA report.
43
+ - Require code review completion before QA handoff.
44
+ - If input requirements are VI/JP: preserve original text + add EN translation in appendix for traceability (at least in Project Initiation and BA spec).