sdtk-kit 0.3.7 → 0.3.9

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 (49) hide show
  1. package/README.md +4 -2
  2. package/assets/manifest/toolkit-bundle.manifest.json +118 -78
  3. package/assets/manifest/toolkit-bundle.sha256.txt +45 -37
  4. package/assets/toolkit/toolkit/AGENTS.md +10 -2
  5. package/assets/toolkit/toolkit/install.ps1 +44 -4
  6. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +43 -3
  7. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +5 -1
  8. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +7 -1
  9. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
  10. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +87 -11
  11. package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +4 -0
  12. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
  13. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +4 -0
  14. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +7 -1
  15. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
  16. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +69 -13
  17. package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +4 -0
  18. package/assets/toolkit/toolkit/skills/sdtk-design-layout/SKILL.md +20 -5
  19. package/assets/toolkit/toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py +34 -1
  20. package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +4 -0
  21. package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +4 -0
  22. package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +4 -0
  23. package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +4 -0
  24. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +4 -0
  25. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +17 -4
  26. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/SKILL.md +21 -4
  27. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +69 -13
  28. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/numbering-rules.md +20 -68
  29. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/validate_flow_action_spec_numbering.py +168 -3
  30. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/SKILL.md +11 -0
  31. package/assets/toolkit/toolkit/skills/skills.catalog.yaml +302 -0
  32. package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +22 -8
  33. package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +26 -39
  34. package/assets/toolkit/toolkit/skills-claude/design-layout/SKILL.md +38 -6
  35. package/assets/toolkit/toolkit/skills-claude/screen-design-spec/SKILL.md +47 -25
  36. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +7 -1
  37. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +6 -0
  38. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
  39. package/assets/toolkit/toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md +12 -1
  40. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +69 -13
  41. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_TEMPLATE.md +40 -9
  42. package/assets/toolkit/toolkit/templates/handoffs/ARCH_TO_DEV.md +31 -0
  43. package/assets/toolkit/toolkit/templates/handoffs/BA_TO_ARCH.md +28 -0
  44. package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE1_SPEC_REVIEW.md +26 -0
  45. package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE2_CODE_QUALITY_REVIEW.md +20 -0
  46. package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_QA.md +23 -0
  47. package/assets/toolkit/toolkit/templates/handoffs/PM_TO_BA.md +26 -0
  48. package/assets/toolkit/toolkit/templates/handoffs/QA_RELEASE_DECISION.md +21 -0
  49. package/package.json +1 -1
@@ -58,6 +58,46 @@ function Copy-File {
58
58
  Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
59
59
  }
60
60
 
61
+ function Install-ClaudeSkillDirectory {
62
+ param(
63
+ [Parameter(Mandatory = $true)][System.IO.DirectoryInfo]$SkillDir,
64
+ [Parameter(Mandatory = $true)][string]$SkillsDest,
65
+ [Parameter(Mandatory = $true)][string]$ToolkitRoot,
66
+ [Parameter(Mandatory = $true)][bool]$Overwrite
67
+ )
68
+
69
+ $destDir = Join-Path $SkillsDest $SkillDir.Name
70
+ if (Test-Path -LiteralPath $destDir) {
71
+ if (-not $Overwrite) {
72
+ Write-Warning "Already exists (skipping). Use -Force to overwrite: $destDir"
73
+ return $true
74
+ }
75
+ Remove-Item -LiteralPath $destDir -Recurse -Force
76
+ }
77
+
78
+ $parent = Split-Path -Parent $destDir
79
+ if ($parent -and -not (Test-Path -LiteralPath $parent)) {
80
+ New-Item -ItemType Directory -Force -Path $parent | Out-Null
81
+ }
82
+ Copy-Item -LiteralPath $SkillDir.FullName -Destination $destDir -Recurse -Force
83
+
84
+ $canonicalSkillDir = Join-Path $ToolkitRoot "skills/sdtk-$($SkillDir.Name)"
85
+ foreach ($subDirName in @('scripts', 'prompts')) {
86
+ $srcSubDir = Join-Path $canonicalSkillDir $subDirName
87
+ $destSubDir = Join-Path $destDir $subDirName
88
+ if (-not (Test-Path -LiteralPath $srcSubDir)) {
89
+ continue
90
+ }
91
+
92
+ if (Test-Path -LiteralPath $destSubDir) {
93
+ Remove-Item -LiteralPath $destSubDir -Recurse -Force
94
+ }
95
+ Copy-Item -LiteralPath $srcSubDir -Destination $destSubDir -Recurse -Force
96
+ }
97
+
98
+ return $true
99
+ }
100
+
61
101
  function Install-RuntimeAdapter {
62
102
  param(
63
103
  [Parameter(Mandatory = $true)][string]$ToolkitRoot,
@@ -102,9 +142,9 @@ function Install-ClaudeSkills {
102
142
  $srcFile = Join-Path $skillDir.FullName 'SKILL.md'
103
143
  if (-not (Test-Path -LiteralPath $srcFile)) { continue }
104
144
 
105
- $destFile = Join-Path $skillsDest "$($skillDir.Name)/SKILL.md"
106
- Copy-File -SourcePath $srcFile -DestinationPath $destFile -Overwrite $Overwrite
107
- $skillCount++
145
+ if (Install-ClaudeSkillDirectory -SkillDir $skillDir -SkillsDest $skillsDest -ToolkitRoot $ToolkitRoot -Overwrite $Overwrite) {
146
+ $skillCount++
147
+ }
108
148
  }
109
149
 
110
150
  # Install reference files
@@ -267,4 +307,4 @@ if (-not $Quiet) {
267
307
  }
268
308
  Write-Host '3) Generate feature docs:'
269
309
  Write-Host ' sdtk generate --feature-key YOUR_FEATURE --feature-name "Your Feature"'
270
- }
310
+ }
@@ -34,6 +34,46 @@ function Copy-File {
34
34
  Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
35
35
  }
36
36
 
37
+ function Install-ClaudeSkillDirectory {
38
+ param(
39
+ [Parameter(Mandatory = $true)][System.IO.DirectoryInfo]$SkillDir,
40
+ [Parameter(Mandatory = $true)][string]$SkillsDest,
41
+ [Parameter(Mandatory = $true)][string]$ToolkitRoot,
42
+ [Parameter(Mandatory = $true)][bool]$Overwrite
43
+ )
44
+
45
+ $destDir = Join-Path $SkillsDest $SkillDir.Name
46
+ if (Test-Path -LiteralPath $destDir) {
47
+ if (-not $Overwrite) {
48
+ Write-Warning "Already exists (skipping). Use -Force to overwrite: $destDir"
49
+ return $true
50
+ }
51
+ Remove-Item -LiteralPath $destDir -Recurse -Force
52
+ }
53
+
54
+ $parent = Split-Path -Parent $destDir
55
+ if ($parent -and -not (Test-Path -LiteralPath $parent)) {
56
+ New-Item -ItemType Directory -Force -Path $parent | Out-Null
57
+ }
58
+ Copy-Item -LiteralPath $SkillDir.FullName -Destination $destDir -Recurse -Force
59
+
60
+ $canonicalSkillDir = Join-Path $ToolkitRoot "skills/sdtk-$($SkillDir.Name)"
61
+ foreach ($subDirName in @('scripts', 'prompts')) {
62
+ $srcSubDir = Join-Path $canonicalSkillDir $subDirName
63
+ $destSubDir = Join-Path $destDir $subDirName
64
+ if (-not (Test-Path -LiteralPath $srcSubDir)) {
65
+ continue
66
+ }
67
+
68
+ if (Test-Path -LiteralPath $destSubDir) {
69
+ Remove-Item -LiteralPath $destSubDir -Recurse -Force
70
+ }
71
+ Copy-Item -LiteralPath $srcSubDir -Destination $destSubDir -Recurse -Force
72
+ }
73
+
74
+ return $true
75
+ }
76
+
37
77
  $toolkitRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
38
78
 
39
79
  # Resolve destination based on scope
@@ -59,9 +99,9 @@ foreach ($skillDir in (Get-ChildItem -Path $skillsSource -Directory)) {
59
99
  $srcFile = Join-Path $skillDir.FullName 'SKILL.md'
60
100
  if (-not (Test-Path -LiteralPath $srcFile)) { continue }
61
101
 
62
- $destFile = Join-Path $skillsDest "$($skillDir.Name)/SKILL.md"
63
- Copy-File -SourcePath $srcFile -DestinationPath $destFile -Overwrite ([bool]$Force)
64
- $skillCount++
102
+ if (Install-ClaudeSkillDirectory -SkillDir $skillDir -SkillsDest $skillsDest -ToolkitRoot $toolkitRoot -Overwrite ([bool]$Force)) {
103
+ $skillCount++
104
+ }
65
105
  }
66
106
 
67
107
  # Install reference files
@@ -5,6 +5,10 @@ description: Generate detailed API design markdown (`[FEATURE_KEY]_API_DESIGN_DE
5
5
 
6
6
  # SDTK API Design Detail Spec
7
7
 
8
+ ## Critical Constraints
9
+ - I do not drift from the source YAML or flow list.
10
+ - I do not leave broken flow image embeds or missing assumptions in the API design detail.
11
+
8
12
  ## Outputs
9
13
  - `docs/api/[FEATURE_KEY]_API_DESIGN_DETAIL.md`
10
14
  - Supporting generated assets:
@@ -32,7 +36,7 @@ description: Generate detailed API design markdown (`[FEATURE_KEY]_API_DESIGN_DE
32
36
  ## Generation Procedure
33
37
  1. Resolve input files (`yaml`, `flow_list`, `output`).
34
38
  2. Parse YAML endpoints (method, path, request schema, success/error schema).
35
- 3. Parse flow blocks from flow list (`@startuml ... @enduml`) and map by `METHOD + path`.
39
+ 3. Parse flow blocks from flow list (`@startuml ... @enduml`) and map by normalized `METHOD + path`.
36
40
  4. Generate detailed markdown sections per API:
37
41
  - Flow summary / notes / login bullets from YAML `description`
38
42
  - Process flow source block (`text` fenced block)
@@ -7,10 +7,16 @@ The active rule source for API design detail and API flowchart behavior is now:
7
7
  - `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` (root)
8
8
  - `templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` (toolkit)
9
9
 
10
- Use that file for:
10
+ Even in compatibility mode, generated API design detail docs must still include:
11
+ - a top-level `## Assumptions` section
12
+ - this table format: `| # | Assumption | Verified | Risk if wrong |`
13
+ - explicit unresolved assumptions when downstream review depends on them
14
+
15
+ Use the active rule file for:
11
16
  - API design detail markdown structure
12
17
  - flowchart integration and synchronization rules
13
18
  - error section rules
14
19
  - flow summary / notes / login rules
20
+ - assumptions-section requirements
15
21
 
16
22
  This compatibility note should remain only until all references are migrated.
@@ -38,6 +38,23 @@ Primary sample references:
38
38
  - `GET /bukken/info/{company_uuid}/{bukken_uuid}` style
39
39
  - search API query-builder style shown in the Bukken sample helper flow
40
40
 
41
+ ## 2.1 API Design Detail Markdown Requirements
42
+
43
+ Generated `*_API_DESIGN_DETAIL.md` files must keep this minimum structure:
44
+ - `## 0. Abbreviations`
45
+ - `## 1. Document Scope`
46
+ - `## Assumptions`
47
+ - per-endpoint `## <n>. API Detail ...` sections
48
+ - `## 3. Generation Notes` or the current equivalent final notes section
49
+
50
+ `## Assumptions` must use this table shape:
51
+
52
+ ```text
53
+ | # | Assumption | Verified | Risk if wrong |
54
+ ```
55
+
56
+ If an assumption is not verified yet, keep it explicit and treat it as a downstream review risk instead of silently collapsing it into a fact.
57
+
41
58
  ## 3. Core Flowchart Writing Rules
42
59
 
43
60
  ### Rule A. Add a visible API header for every block
@@ -53,6 +53,49 @@ def normalize_feature_snake(feature_key: str) -> str:
53
53
  return re.sub(r"[^a-z0-9]+", "_", feature_key.lower()).strip("_")
54
54
 
55
55
 
56
+ def collect_server_prefixes(spec: dict) -> List[str]:
57
+ prefixes: List[str] = []
58
+ for server in spec.get("servers", []) or []:
59
+ url = str((server or {}).get("url", "")).strip()
60
+ if not url:
61
+ continue
62
+ if "://" in url:
63
+ match = re.match(r"https?://[^/]+(?P<path>/.*)?", url)
64
+ url = match.group("path") if match and match.group("path") else "/"
65
+ if not url.startswith("/"):
66
+ continue
67
+ normalized = re.sub(r"/{2,}", "/", url).rstrip("/")
68
+ if normalized:
69
+ prefixes.append(normalized)
70
+ return sorted(set(prefixes), key=len, reverse=True)
71
+
72
+
73
+ def normalize_match_path(path: str, server_prefixes: List[str]) -> str:
74
+ normalized = path.strip()
75
+ if "://" in normalized:
76
+ match = re.match(r"https?://[^/]+(?P<path>/.*)?", normalized)
77
+ normalized = match.group("path") if match and match.group("path") else "/"
78
+ normalized = normalized.split("?", maxsplit=1)[0].strip()
79
+ if not normalized.startswith("/"):
80
+ normalized = "/" + normalized
81
+ normalized = re.sub(r"/{2,}", "/", normalized)
82
+
83
+ for prefix in server_prefixes:
84
+ if normalized == prefix:
85
+ normalized = "/"
86
+ break
87
+ if normalized.startswith(prefix + "/"):
88
+ normalized = normalized[len(prefix) :]
89
+ break
90
+
91
+ if not normalized.startswith("/"):
92
+ normalized = "/" + normalized
93
+ if len(normalized) > 1:
94
+ normalized = normalized.rstrip("/")
95
+ normalized = re.sub(r"\{[^/]+\}", "{}", normalized)
96
+ return normalized
97
+
98
+
56
99
  def parse_include_filters(raw_filters: List[str]) -> List[Tuple[Optional[str], str]]:
57
100
  parsed: List[Tuple[Optional[str], str]] = []
58
101
  for raw in raw_filters:
@@ -99,18 +142,30 @@ def collect_operations(spec: dict, include_filters: List[Tuple[Optional[str], st
99
142
  return operations
100
143
 
101
144
 
102
- def collect_flow_map(flow_text: str) -> Dict[Tuple[str, str], str]:
103
- flow_map: Dict[Tuple[str, str], str] = {}
145
+ def extract_flow_signature(block: str, server_prefixes: List[str]) -> Tuple[Optional[str], Optional[str]]:
146
+ patterns = [
147
+ r'partition\s+"API:\s*([A-Z]+)\s+(\S+)(?:\s{2,}.*?)?"\s*\{',
148
+ r'partition\s+"([A-Z]+)\s+\*\*(.*?)\*\*',
149
+ r'partition\s+"API:\s*([A-Z]+)\s+\*\*(.*?)\*\*',
150
+ ]
151
+ for pattern in patterns:
152
+ match = re.search(pattern, block)
153
+ if not match:
154
+ continue
155
+ method = match.group(1).lower().strip()
156
+ path = normalize_match_path(match.group(2), server_prefixes)
157
+ return method, path
158
+ return None, None
159
+
160
+
161
+ def collect_flow_blocks(flow_text: str, server_prefixes: List[str]) -> List[Tuple[Optional[str], Optional[str], str]]:
162
+ blocks_with_meta: List[Tuple[Optional[str], Optional[str], str]] = []
104
163
  blocks = re.findall(r"@startuml[\s\S]*?@enduml", flow_text)
105
164
  for block in blocks:
106
- m = re.search(r'partition\s+"([A-Z]+)\s+\*\*(.*?)\*\*', block)
107
- if not m:
108
- continue
109
- method = m.group(1).lower().strip()
110
- path = m.group(2).strip()
111
165
  sanitized = re.sub(r";<<#[^>]+>>", ";", block.strip())
112
- flow_map[(method, path)] = sanitized + "\n"
113
- return flow_map
166
+ method, path = extract_flow_signature(sanitized, server_prefixes)
167
+ blocks_with_meta.append((method, path, sanitized + "\n"))
168
+ return blocks_with_meta
114
169
 
115
170
 
116
171
  def slugify(text: str) -> str:
@@ -435,13 +490,19 @@ def main() -> int:
435
490
  images_dir = Path(args.images_dir)
436
491
 
437
492
  spec = load_yaml(yaml_path)
493
+ server_prefixes = collect_server_prefixes(spec)
438
494
  include_filters = parse_include_filters(args.include)
439
495
  operations = collect_operations(spec, include_filters)
440
496
  if not operations:
441
497
  raise RuntimeError("No API operations selected from YAML")
442
498
 
443
- flow_map = collect_flow_map(flow_path.read_text(encoding="utf-8"))
499
+ flow_blocks = collect_flow_blocks(flow_path.read_text(encoding="utf-8"), server_prefixes)
500
+ flow_map: Dict[Tuple[str, str], str] = {}
501
+ for block_method, block_path, block_text in flow_blocks:
502
+ if block_method and block_path and (block_method, block_path) not in flow_map:
503
+ flow_map[(block_method, block_path)] = block_text
444
504
  missing_flows: List[str] = []
505
+ order_fallbacks: List[str] = []
445
506
 
446
507
  flows_dir.mkdir(parents=True, exist_ok=True)
447
508
  images_dir.mkdir(parents=True, exist_ok=True)
@@ -481,7 +542,18 @@ def main() -> int:
481
542
  svg_rel = Path(os.path.relpath(svg_path, output_path.parent))
482
543
  desc_sections = parse_description_sections(str(op.get("description", "")))
483
544
 
484
- flow = flow_map.get((method, path))
545
+ normalized_path = normalize_match_path(path, server_prefixes)
546
+ flow = flow_map.get((method, normalized_path))
547
+ if not flow and len(flow_blocks) == len(operations):
548
+ candidate_method, candidate_path, candidate_flow = flow_blocks[i - 1]
549
+ flow = candidate_flow
550
+ if candidate_method and candidate_path and (candidate_method != method or candidate_path != normalized_path):
551
+ order_fallbacks.append(
552
+ f"{method.upper()} {path} -> used block {i} by order fallback despite signature mismatch "
553
+ f"({candidate_method.upper()} {candidate_path})"
554
+ )
555
+ else:
556
+ order_fallbacks.append(f"{method.upper()} {path} -> used block {i} by order fallback")
485
557
  if not flow:
486
558
  missing_flows.append(f"{method.upper()} {path}")
487
559
  flow = (
@@ -638,6 +710,10 @@ def main() -> int:
638
710
  print("[WARN] Missing flow blocks:")
639
711
  for item in missing_flows:
640
712
  print(f" - {item}")
713
+ if order_fallbacks:
714
+ print("[WARN] Flow block order fallback used:")
715
+ for item in order_fallbacks:
716
+ print(f" - {item}")
641
717
  if render_errors:
642
718
  print("[WARN] Render issues:")
643
719
  for item in render_errors:
@@ -5,6 +5,10 @@ description: Generate OpenAPI 3.x YAML and PlantUML flow diagrams for a feature
5
5
 
6
6
  # SDTK API Documentation
7
7
 
8
+ ## Critical Constraints
9
+ - I do not invent API paths or payload contracts that contradict BA or ARCH artifacts.
10
+ - I do not leave YAML, endpoint markdown, and flow-list outputs out of sync.
11
+
8
12
  ## Outputs
9
13
  - `docs/api/[FeaturePascal]_API.yaml`
10
14
  - `docs/api/[FEATURE_KEY]_ENDPOINTS.md`
@@ -38,6 +38,23 @@ Primary sample references:
38
38
  - `GET /bukken/info/{company_uuid}/{bukken_uuid}` style
39
39
  - search API query-builder style shown in the Bukken sample helper flow
40
40
 
41
+ ## 2.1 API Design Detail Markdown Requirements
42
+
43
+ Generated `*_API_DESIGN_DETAIL.md` files must keep this minimum structure:
44
+ - `## 0. Abbreviations`
45
+ - `## 1. Document Scope`
46
+ - `## Assumptions`
47
+ - per-endpoint `## <n>. API Detail ...` sections
48
+ - `## 3. Generation Notes` or the current equivalent final notes section
49
+
50
+ `## Assumptions` must use this table shape:
51
+
52
+ ```text
53
+ | # | Assumption | Verified | Risk if wrong |
54
+ ```
55
+
56
+ If an assumption is not verified yet, keep it explicit and treat it as a downstream review risk instead of silently collapsing it into a fact.
57
+
41
58
  ## 3. Core Flowchart Writing Rules
42
59
 
43
60
  ### Rule A. Add a visible API header for every block
@@ -5,6 +5,10 @@ description: Solution Architect workflow for SDTK. Use when you need to convert
5
5
 
6
6
  # SDTK ARCH (Solution Architecture)
7
7
 
8
+ ## Critical Constraints
9
+ - I do not generate `FLOW_ACTION_SPEC` before `DESIGN_LAYOUT` for UI-scope features.
10
+ - I do not let API, DB, and UI artifacts drift from the same BA and PM source of truth.
11
+
8
12
  ## Outputs
9
13
  - `docs/architecture/ARCH_DESIGN_[FEATURE_KEY].md`
10
14
  - If applicable:
@@ -7,10 +7,16 @@ The active rule source for API design detail and API flowchart behavior is now:
7
7
  - `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` (root)
8
8
  - `templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` (toolkit)
9
9
 
10
- Use that file for:
10
+ Even in compatibility mode, generated API design detail docs must still include:
11
+ - a top-level `## Assumptions` section
12
+ - this table format: `| # | Assumption | Verified | Risk if wrong |`
13
+ - explicit unresolved assumptions when downstream review depends on them
14
+
15
+ Use the active rule file for:
11
16
  - API design detail markdown structure
12
17
  - flowchart integration and synchronization rules
13
18
  - error section rules
14
19
  - flow summary / notes / login rules
20
+ - assumptions-section requirements
15
21
 
16
22
  This compatibility note should remain only until all references are migrated.
@@ -38,6 +38,23 @@ Primary sample references:
38
38
  - `GET /bukken/info/{company_uuid}/{bukken_uuid}` style
39
39
  - search API query-builder style shown in the Bukken sample helper flow
40
40
 
41
+ ## 2.1 API Design Detail Markdown Requirements
42
+
43
+ Generated `*_API_DESIGN_DETAIL.md` files must keep this minimum structure:
44
+ - `## 0. Abbreviations`
45
+ - `## 1. Document Scope`
46
+ - `## Assumptions`
47
+ - per-endpoint `## <n>. API Detail ...` sections
48
+ - `## 3. Generation Notes` or the current equivalent final notes section
49
+
50
+ `## Assumptions` must use this table shape:
51
+
52
+ ```text
53
+ | # | Assumption | Verified | Risk if wrong |
54
+ ```
55
+
56
+ If an assumption is not verified yet, keep it explicit and treat it as a downstream review risk instead of silently collapsing it into a fact.
57
+
41
58
  ## 3. Core Flowchart Writing Rules
42
59
 
43
60
  ### Rule A. Add a visible API header for every block
@@ -19,12 +19,13 @@ A flow-action spec should include, at minimum:
19
19
 
20
20
  1. `Abbreviations`
21
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`
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`
28
29
 
29
30
  If a section is not in scope, keep the section and mark explicitly as `N/A` with reason.
30
31
 
@@ -40,7 +41,34 @@ If a section is not in scope, keep the section and mark explicitly as `N/A` with
40
41
  - Table rows must keep column count consistent with the header (no broken or merged rows).
41
42
  - Avoid single-line merged content that collapses multiple logical items into one table row.
42
43
 
43
- ### 3.1 Language and Encoding Standards (EN Artifacts)
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)
44
72
 
45
73
  - For EN artifacts (`docs/en/**` or explicitly requested EN version), narrative text must be English.
46
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.
@@ -49,16 +77,24 @@ If a section is not in scope, keep the section and mark explicitly as `N/A` with
49
77
  - Save files as UTF-8 and avoid mojibake/broken glyphs (`�`, `ↁE`, garbled sequences).
50
78
  - Keep canonical terminology stable across documents (for example: `bukken`, `sagyo`, `customer employee`).
51
79
 
52
- ### 3.2 Markdown Structure Hygiene
80
+ ### 3.3 Markdown Structure Hygiene
53
81
 
54
82
  - Keep each heading on its own line; do not concatenate multiple headings/sections on one line.
55
83
  - Keep metadata blocks (`Information`, `Note`, `Behavior notes`) as structured bullet blocks, not single compressed lines.
56
84
  - Keep image, table, and separator (`---`) boundaries explicit to preserve parser/render stability.
57
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
+
58
93
  ## 4. Item Numbering and Duplication Rules
59
94
 
60
95
  - Use one numbering mode only: `global across document`.
61
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`.
62
98
  - Avoid duplicate item descriptions for the same UI control across screens unless behavior differs.
63
99
  - If duplicate number is intentional (rare), annotate reason in `Note`.
64
100
 
@@ -92,6 +128,19 @@ Rules:
92
128
  - The flow-action spec and the design-layout doc must remain separate documents.
93
129
  - When Figma becomes available later, update the source mode from `generated-draft` to `source-backed`.
94
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
+
95
144
  ## 6. API Traceability Rules
96
145
 
97
146
  - Every actionable UI event that changes state must map to a write API.
@@ -101,8 +150,11 @@ Rules:
101
150
 
102
151
  ## 7. PlantUML Rules for Screen Flow
103
152
 
104
- - Use valid PlantUML syntax and renderability checks before handoff.
105
- - Use `\\n` for multi-line labels in nodes.
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.
106
158
  - Keep diagram at navigation/action level (not low-level SQL or backend internals).
107
159
  - Ensure screen names in PlantUML match section names in layout spec.
108
160
 
@@ -112,7 +164,8 @@ Rules:
112
164
  1. Confirmed design source (for example Figma)
113
165
  2. Confirmed requirement files (Excel/spec)
114
166
  3. User-provided screenshots
115
- - Store images in repository-relative paths.
167
+ - Store images in repository-relative filesystem paths.
168
+ - Reference images in markdown using file-relative paths from the spec file's directory.
116
169
  - Do not keep temporary local absolute paths in markdown.
117
170
 
118
171
  ### 8.1 Rendered Screen Images for Generated-Draft Screens
@@ -120,8 +173,10 @@ Rules:
120
173
  When `Design Source Type` is `generated-draft`:
121
174
  - Screen preview images may be rendered from `DESIGN_LAYOUT_[FEATURE_KEY].md` PlantUML SALT wireframes.
122
175
  - Renderer: `toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py`
123
- - Expected output path: `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
124
- - If the rendered `.svg` file exists, use it as the `Screen image:` reference.
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.
125
180
  - If rendering is unavailable or the `.svg` does not exist, replace the image line with:
126
181
  `> Screen image not rendered in this environment. See Design Source Reference for layout.`
127
182
  - Do not leave a broken image reference pointing to a non-existent file.
@@ -158,6 +213,7 @@ When `Design Source Type` is `generated-draft`:
158
213
  - Numbering is global across the document (no resets).
159
214
  - No broken image links (for `generated-draft` screens: `.svg` exists or render-skipped note is present).
160
215
  - Screen/API mappings are consistent with `*_ENDPOINTS.md`.
216
+ - Assumptions section exists and unresolved assumptions are traceable.
161
217
  - Open questions are explicit and traceable.
162
218
  - For EN artifact: no leftover VI text outside allowed `Original Text` appendix blocks.
163
219
  - No mojibake/encoding corruption markers.
@@ -5,6 +5,10 @@ description: Business Analyst workflow for SDTK. Use when you need to turn PM in
5
5
 
6
6
  # SDTK BA (Business Analysis)
7
7
 
8
+ ## Critical Constraints
9
+ - I do not mark BA analysis complete until `REQ`, `UC`, `BR`, and `AC` traceability is explicit.
10
+ - I do not silently resolve business ambiguities that belong to PM or the user.
11
+
8
12
  ## Output
9
13
  - `docs/specs/BA_SPEC_[FEATURE_KEY].md`
10
14
 
@@ -5,19 +5,35 @@ description: Generate UI screen layout documentation for a feature, including Pl
5
5
 
6
6
  # SDTK Screen Layout Design
7
7
 
8
+ ## Critical Constraints
9
+ - I do not skip screen IDs or item numbering alignment with the wireframe.
10
+ - I do not hide render limitations; I record when screen preview rendering is unavailable.
11
+ - I do not leave rendered wireframes without visible local item markers that map back to the `Items` table.
12
+ - I do not pretend wireframe markers are the same thing as `FLOW_ACTION_SPEC` global action-table numbers.
13
+
8
14
  ## Output
9
15
  - `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md`
10
16
 
11
17
  ## Process
12
18
  1. Read BA spec (screens + fields) and API list.
13
19
  2. For each screen, include:
14
- - PlantUML `@startsalt` wireframe first
20
+ - PlantUML `@startsalt` wireframe first, with visible screen-local markers embedded directly in the SALT labels
15
21
  - API list table
16
- - Item table with numbering that matches the wireframe
17
- 3. Keep screen IDs consistent (A-*, B-*, C-*).
18
- 4. After writing `DESIGN_LAYOUT`, attempt to render screen preview images by default:
22
+ - Item table whose `No` values exactly match the local marker sequence used in the wireframe for that screen
23
+ 3. Use this wireframe-marker convention so the rendered SVG can be cross-referenced visually:
24
+ - markers are screen-local visual references and reset per screen
25
+ - prefer Unicode circled-number markers in generated docs; avoid parenthetical `(N)` markers because they blend into UI text and can conflict with SALT parsing
26
+ - text label or input prompt: prefix the visible label with the local marker
27
+ - button: place the local marker inside the visible button label
28
+ - table header: prefix the header text with the local marker
29
+ - standalone control, pagination, toggle, or status chip: prefix the visible label with the local marker
30
+ - do not rely on prose, comments, or a separate legend; the marker must be visible inside the rendered wireframe itself
31
+ - the local marker does not need to equal the `FLOW_ACTION_SPEC` global `No`; `screen-design-spec` publishes the mapping table
32
+ 4. Keep screen IDs consistent (A-*, B-*, C-*).
33
+ 5. After writing `DESIGN_LAYOUT`, attempt to render screen preview images by default:
19
34
  - Run `render_design_layout_images.py` to extract `@startsalt` blocks and render `.svg` files.
20
35
  - Output path: `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
36
+ - The renderer warns if a screen wireframe has no visible local markers or still uses legacy `(N)` markers.
21
37
  - If PlantUML is unavailable, rendering is skipped with a warning and the render-skipped note is used in `FLOW_ACTION_SPEC`. The layout doc remains valid.
22
38
 
23
39
  ## Screen Image Renderer
@@ -34,4 +50,3 @@ description: Generate UI screen layout documentation for a feature, including Pl
34
50
 
35
51
  ## Template
36
52
  - Use `toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md` as starting structure.
37
-