sdtk-kit 0.3.0 → 0.3.2
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/assets/manifest/toolkit-bundle.manifest.json +72 -37
- package/assets/manifest/toolkit-bundle.sha256.txt +24 -17
- package/assets/toolkit/toolkit/AGENTS.md +5 -3
- package/assets/toolkit/toolkit/scripts/init-feature.ps1 +9 -1
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +6 -4
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +12 -208
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +95 -4
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +4 -2
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +128 -0
- package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +3 -2
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +12 -208
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +128 -0
- package/assets/toolkit/toolkit/templates/README.md +9 -2
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +12 -208
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +1 -2
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/templates/docs/api/API_ENDPOINTS_TEMPLATE.md +1 -1
- package/assets/toolkit/toolkit/templates/docs/api/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +128 -0
- package/assets/toolkit/toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md +1 -1
- package/package.json +44 -45
- package/src/commands/help.js +7 -1
|
@@ -1,397 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# FLOWCHART CREATION RULES (Compatibility Note)
|
|
2
2
|
|
|
3
|
-
This
|
|
4
|
-
Target files are usually API flow list documents (for example `*_api.txt`) and API YAML files (for example `docs/api/*.yaml`).
|
|
3
|
+
This file is kept only for backward compatibility.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Do not use this file as the primary source of truth anymore.
|
|
6
|
+
The rule set has been split into two files:
|
|
7
|
+
- `YAML_CREATION_RULES_FINAL.md` (root) / `templates/docs/api/YAML_CREATION_RULES.md` (toolkit)
|
|
8
|
+
- `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` (root) / `templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` (toolkit)
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
10
|
+
Use the YAML rules file for:
|
|
11
|
+
- endpoint path/method conventions
|
|
12
|
+
- request/response schema design
|
|
13
|
+
- contract-level API rules
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
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).
|
|
15
|
+
Use the API design + flowchart rules file for:
|
|
16
|
+
- flow list writing
|
|
17
|
+
- PlantUML flow depth and wording
|
|
18
|
+
- API design detail markdown rules
|
|
397
19
|
|
|
20
|
+
This compatibility note should remain only until all references are migrated.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# YAML CREATION RULES FINAL
|
|
2
|
+
|
|
3
|
+
This file is the canonical rule set for designing and maintaining feature-level OpenAPI YAML.
|
|
4
|
+
|
|
5
|
+
Use this file for:
|
|
6
|
+
- OpenAPI YAML contract design
|
|
7
|
+
- endpoint path/method decisions
|
|
8
|
+
- request/response schema design
|
|
9
|
+
- endpoint summary and contract consistency checks
|
|
10
|
+
|
|
11
|
+
Do not use this file as the primary rule source for:
|
|
12
|
+
- flowchart writing details
|
|
13
|
+
- API design detail markdown layout
|
|
14
|
+
|
|
15
|
+
Use `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` for those.
|
|
16
|
+
|
|
17
|
+
## 1. Rule Precedence
|
|
18
|
+
- Priority 1: follow the existing system's real route, method, payload, and response conventions.
|
|
19
|
+
- Priority 2: match the current source code and runtime behavior.
|
|
20
|
+
- Priority 3: apply the reusable standards in this document.
|
|
21
|
+
- If a reusable rule conflicts with the target system, keep the system rule and document the exception explicitly.
|
|
22
|
+
|
|
23
|
+
## 2. API Scope Classification
|
|
24
|
+
- Every endpoint must be classified as one of:
|
|
25
|
+
- `New`
|
|
26
|
+
- `Deferred`
|
|
27
|
+
- `Existing (reuse)`
|
|
28
|
+
- Do not silently create a new feature-local API if an existing system API already provides the same behavior with a compatible contract.
|
|
29
|
+
- If the existing API is close in purpose but payload or response is incompatible with the feature need, create a bounded new API.
|
|
30
|
+
|
|
31
|
+
## 3. Endpoint Path Design
|
|
32
|
+
- Use singular resource names in endpoint paths.
|
|
33
|
+
- Use explicit action segments only when needed by system convention:
|
|
34
|
+
- `list`
|
|
35
|
+
- `search`
|
|
36
|
+
- `edit`
|
|
37
|
+
- `delete`
|
|
38
|
+
- `multi-create`
|
|
39
|
+
- Prefer stable system-style patterns such as:
|
|
40
|
+
- list: `GET /{resource}/list/{company_uuid}/{parent_uuid}`
|
|
41
|
+
- search: `POST /{resource}/search/{company_uuid}`
|
|
42
|
+
- view-specific search: `POST /{resource}/bukken-view/search/{company_uuid}`
|
|
43
|
+
- create: `POST /{resource}/{company_uuid}`
|
|
44
|
+
- detail: `GET /{resource}/{company_uuid}/{resource_uuid}`
|
|
45
|
+
- edit: `POST /{resource}/edit/{company_uuid}/{resource_uuid}`
|
|
46
|
+
- delete: `POST /{resource}/delete/{company_uuid}/{resource_uuid}`
|
|
47
|
+
- Separate namespaces by bounded context.
|
|
48
|
+
- Do not repeat namespace meaning in child path segments.
|
|
49
|
+
|
|
50
|
+
## 4. Request Contract Rules
|
|
51
|
+
- For feature-owned POST search and write APIs, prefer a stable wrapper:
|
|
52
|
+
- `data: { ... }`
|
|
53
|
+
- For complex filters, place fields under:
|
|
54
|
+
- `data.info`
|
|
55
|
+
- If reusing an existing system API, keep the owning module's contract shape exactly as-is.
|
|
56
|
+
- Do not force reused APIs into the feature wrapper pattern.
|
|
57
|
+
- If a payload field changes behavior, the field must be explicit in the schema and must not remain only in examples.
|
|
58
|
+
|
|
59
|
+
## 5. Response Contract Rules
|
|
60
|
+
- Success responses must include `status` at minimum.
|
|
61
|
+
- Create APIs should return the minimum new identifier required by the caller.
|
|
62
|
+
- Example: `status + sagyo_assign_uuid`
|
|
63
|
+
- Edit and delete APIs should return status-only unless the target system has a stronger standard.
|
|
64
|
+
- Pre-check or validation helper APIs should return only the minimum boolean or status needed by the UI.
|
|
65
|
+
- Do not return detail payloads the UI does not consume.
|
|
66
|
+
- Do not add FE-only visual helper payloads when the client can derive them safely.
|
|
67
|
+
- Example: remove `timeline_backgrounds` if the frontend renders timeline lines from existing data.
|
|
68
|
+
|
|
69
|
+
## 6. Naming and Field Mapping Rules
|
|
70
|
+
- Use canonical business-domain terminology from the system glossary and database.
|
|
71
|
+
- Prefer actual system terms such as:
|
|
72
|
+
- `bukken`
|
|
73
|
+
- `sagyo`
|
|
74
|
+
- `sagyoin`
|
|
75
|
+
- `certification`
|
|
76
|
+
- Avoid legacy aliases when an official term already exists.
|
|
77
|
+
- Field names should align with database semantics when they represent the same concept.
|
|
78
|
+
- If the DB uses a string state code, the API field must not be modeled as an integer.
|
|
79
|
+
- If a field is date-only (`format: date`), include the display format in the description.
|
|
80
|
+
- Example: `Start date (YYYYMMDD)`
|
|
81
|
+
|
|
82
|
+
## 7. Search and List API Rules
|
|
83
|
+
- One search API may serve multiple UI actions when the logic is the same:
|
|
84
|
+
- initial load
|
|
85
|
+
- search button
|
|
86
|
+
- refresh after mode/date change
|
|
87
|
+
- If one endpoint serves multiple UI actions, document that explicitly in YAML description and endpoint docs.
|
|
88
|
+
- Search APIs must define filter combination semantics clearly:
|
|
89
|
+
- AND across different fields
|
|
90
|
+
- OR within each `*_uuids` array
|
|
91
|
+
- If UI rendering depends on stable order, the YAML description must state the confirmed ORDER BY logic.
|
|
92
|
+
|
|
93
|
+
## 8. Split vs Reuse Rules
|
|
94
|
+
- Split read/search endpoints when the FE needs materially different grouped or view-shaped datasets.
|
|
95
|
+
- Merge or remove helper payloads when they add maintenance cost without business value.
|
|
96
|
+
- Reuse existing platform APIs when behavior already exists and only a feature-level mapping layer is needed.
|
|
97
|
+
- Example: reuse shared environment setting APIs instead of creating feature-local setting APIs.
|
|
98
|
+
|
|
99
|
+
## 9. Sample Data Rules
|
|
100
|
+
- For fields declared as `format: uuid`, use canonical UUID samples.
|
|
101
|
+
- Example: `123e4567-e89b-12d3-a456-426614174000`
|
|
102
|
+
- Do not use placeholder UUID-like labels such as:
|
|
103
|
+
- `customer-uuid-001`
|
|
104
|
+
- `assign-uuid-001`
|
|
105
|
+
- Keep sample data deterministic and internally consistent across request and response examples.
|
|
106
|
+
|
|
107
|
+
## 10. Cross-Artifact Consistency Rules
|
|
108
|
+
- The YAML contract is the source of truth for:
|
|
109
|
+
- endpoint path
|
|
110
|
+
- method
|
|
111
|
+
- request wrapper
|
|
112
|
+
- response shape
|
|
113
|
+
- After any YAML contract change, sync these artifacts:
|
|
114
|
+
- endpoint markdown
|
|
115
|
+
- flow list
|
|
116
|
+
- PlantUML flow assets
|
|
117
|
+
- API design detail markdown
|
|
118
|
+
- If any artifact cannot yet be synced, note the mismatch explicitly rather than leaving stale content.
|
|
119
|
+
|
|
120
|
+
## 11. Minimum YAML Quality Gate
|
|
121
|
+
- Path/method follow the target system convention.
|
|
122
|
+
- API type is classified (`New`, `Deferred`, `Existing (reuse)`).
|
|
123
|
+
- Request/response wrappers are stable and explicit.
|
|
124
|
+
- FE-only helper payloads are removed.
|
|
125
|
+
- Field names and types match DB semantics.
|
|
126
|
+
- UUID examples are valid UUIDs.
|
|
127
|
+
- Date descriptions include display format where needed.
|
|
128
|
+
- Search/list APIs document filter semantics and ordering when relevant.
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Files in `toolkit/templates/` are skeleton artifacts used by `init-feature.ps1`
|
|
4
4
|
to bootstrap a new feature across the SDLC phases.
|
|
5
5
|
|
|
6
|
+
**Note:** These templates produce *scaffold* files with TBD placeholders.
|
|
7
|
+
The scaffolds define the document structure for each SDLC phase. Content is
|
|
8
|
+
expected to be filled in by human authors or AI agents working through the
|
|
9
|
+
6-phase pipeline (PM Init -> BA -> PM Planning -> ARCH -> DEV -> QA).
|
|
10
|
+
See `SHARED_PLANNING.md` (generated) for the phase pipeline tracker.
|
|
11
|
+
|
|
6
12
|
## Tokens
|
|
7
13
|
- `{{FEATURE_KEY}}` (UPPER_SNAKE_CASE), example: `WORKFLOW_ENGINE`
|
|
8
14
|
- `{{FEATURE_NAME}}`, example: `Workflow Engine`
|
|
@@ -45,6 +51,9 @@ The script renders templates into `docs/**` and updates:
|
|
|
45
51
|
|
|
46
52
|
## Rules Used by Toolkit
|
|
47
53
|
- API design/flowchart rules:
|
|
54
|
+
- `templates/docs/api/YAML_CREATION_RULES.md`
|
|
55
|
+
- `templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md`
|
|
56
|
+
- Compatibility notes kept for legacy references:
|
|
48
57
|
- `templates/docs/api/FLOWCHART_CREATION_RULES.md`
|
|
49
58
|
- `templates/docs/api/API_DESIGN_CREATION_RULES.md`
|
|
50
59
|
- Screen flow-action spec rules:
|
|
@@ -52,5 +61,3 @@ The script renders templates into `docs/**` and updates:
|
|
|
52
61
|
- Numbering mode is fixed: global numbering across full document (no screen-level reset).
|
|
53
62
|
- QA test-case spec rules:
|
|
54
63
|
- `templates/docs/qa/TEST_CASE_CREATION_RULES.md`
|
|
55
|
-
|
|
56
|
-
|