sdtk-spec-kit 0.3.14 → 0.3.15

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 (45) hide show
  1. package/assets/manifest/toolkit-bundle.manifest.json +61 -126
  2. package/assets/manifest/toolkit-bundle.sha256.txt +29 -42
  3. package/assets/toolkit/toolkit/AGENTS.md +17 -15
  4. package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +10 -6
  5. package/assets/toolkit/toolkit/install.ps1 +60 -50
  6. package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +2 -2
  7. package/assets/toolkit/toolkit/scripts/agents/run-codex-task.ps1 +117 -103
  8. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +179 -169
  9. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +111 -84
  10. package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +46 -10
  11. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +85 -85
  12. package/assets/toolkit/toolkit/skills/sdtk-design-layout/SKILL.md +42 -3
  13. package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +61 -5
  14. package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +63 -5
  15. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/SKILL.md +53 -33
  16. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/SKILL.md +60 -24
  17. package/assets/toolkit/toolkit/skills/skills.catalog.yaml +9 -9
  18. package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +116 -90
  19. package/assets/toolkit/toolkit/skills-claude/api-doc/SKILL.md +49 -9
  20. package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +3 -3
  21. package/assets/toolkit/toolkit/skills-claude/design-layout/SKILL.md +36 -2
  22. package/assets/toolkit/toolkit/skills-claude/dev-backend/SKILL.md +58 -5
  23. package/assets/toolkit/toolkit/skills-claude/dev-frontend/SKILL.md +60 -5
  24. package/assets/toolkit/toolkit/skills-claude/screen-design-spec/SKILL.md +49 -27
  25. package/assets/toolkit/toolkit/skills-claude/test-case-spec/SKILL.md +74 -20
  26. package/assets/toolkit/toolkit/templates/README.md +5 -1
  27. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +1 -2
  28. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  29. package/assets/toolkit/toolkit/templates/docs/api/FLOWCHART_CREATION_RULES.md +3 -3
  30. package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +128 -128
  31. package/assets/toolkit/toolkit/templates/mailbox/AGENT_TASK_TEMPLATE.md +3 -1
  32. package/package.json +46 -46
  33. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +0 -22
  34. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
  35. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/FLOWCHART_CREATION_RULES.md +0 -20
  36. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
  37. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/FLOWCHART_CREATION_RULES.md +0 -20
  38. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +0 -128
  39. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +0 -22
  40. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
  41. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOWCHART_CREATION_RULES.md +0 -20
  42. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -220
  43. package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +0 -128
  44. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -220
  45. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/references/TEST_CASE_CREATION_RULES.md +0 -129
@@ -1,169 +1,179 @@
1
- param(
2
- [string]$ProjectPath,
3
- [ValidateSet('project', 'user')]
4
- [string]$Scope = 'project',
5
- [switch]$Force
6
- )
7
-
8
- $ErrorActionPreference = 'Stop'
9
- Set-StrictMode -Version Latest
10
-
11
- function Copy-File {
12
- param(
13
- [Parameter(Mandatory = $true)][string]$SourcePath,
14
- [Parameter(Mandatory = $true)][string]$DestinationPath,
15
- [Parameter(Mandatory = $true)][bool]$Overwrite
16
- )
17
-
18
- if (-not (Test-Path -LiteralPath $SourcePath)) {
19
- throw "Missing source: $SourcePath"
20
- }
21
-
22
- if (Test-Path -LiteralPath $DestinationPath) {
23
- if (-not $Overwrite) {
24
- Write-Warning "Already exists (skipping). Use -Force to overwrite: $DestinationPath"
25
- return
26
- }
27
- }
28
-
29
- $parent = Split-Path -Parent $DestinationPath
30
- if ($parent -and -not (Test-Path -LiteralPath $parent)) {
31
- New-Item -ItemType Directory -Force -Path $parent | Out-Null
32
- }
33
-
34
- Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
35
- }
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
-
77
- $toolkitRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
78
-
79
- # Resolve destination based on scope
80
- if ($Scope -eq 'user') {
81
- $skillsDest = Join-Path $HOME '.claude/skills'
82
- Write-Host "Scope: user (installing to $skillsDest)"
83
- } else {
84
- if (-not $ProjectPath) {
85
- $ProjectPath = (Resolve-Path (Join-Path $toolkitRoot '..')).Path
86
- }
87
- $projectRoot = Resolve-Path -LiteralPath $ProjectPath
88
- $skillsDest = Join-Path $projectRoot '.claude/skills'
89
- Write-Host "Scope: project (installing to $skillsDest)"
90
- }
91
-
92
- $skillsSource = Join-Path $toolkitRoot 'skills-claude'
93
- if (-not (Test-Path -LiteralPath $skillsSource)) {
94
- throw "Claude skills source not found: $skillsSource"
95
- }
96
-
97
- $skillCount = 0
98
- foreach ($skillDir in (Get-ChildItem -Path $skillsSource -Directory)) {
99
- $srcFile = Join-Path $skillDir.FullName 'SKILL.md'
100
- if (-not (Test-Path -LiteralPath $srcFile)) { continue }
101
-
102
- if (Install-ClaudeSkillDirectory -SkillDir $skillDir -SkillsDest $skillsDest -ToolkitRoot $toolkitRoot -Overwrite ([bool]$Force)) {
103
- $skillCount++
104
- }
105
- }
106
-
107
- # Install reference files
108
- $refDest = Join-Path $skillsDest 'references'
109
- if (-not (Test-Path -LiteralPath $refDest)) {
110
- New-Item -ItemType Directory -Force -Path $refDest | Out-Null
111
- }
112
-
113
- $refCount = 0
114
- $missingRefs = @()
115
-
116
- # 6 files from toolkit/templates/docs/
117
- $templateRefs = @(
118
- @{ Src = 'templates/docs/api/YAML_CREATION_RULES.md' },
119
- @{ Src = 'templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md' },
120
- @{ Src = 'templates/docs/api/FLOWCHART_CREATION_RULES.md' },
121
- @{ Src = 'templates/docs/api/API_DESIGN_CREATION_RULES.md' },
122
- @{ Src = 'templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md' },
123
- @{ Src = 'templates/docs/qa/TEST_CASE_CREATION_RULES.md' }
124
- )
125
-
126
- foreach ($ref in $templateRefs) {
127
- $srcPath = Join-Path $toolkitRoot $ref.Src
128
- $fileName = Split-Path -Leaf $srcPath
129
- $destPath = Join-Path $refDest $fileName
130
- if (Test-Path -LiteralPath $srcPath) {
131
- Copy-File -SourcePath $srcPath -DestinationPath $destPath -Overwrite ([bool]$Force)
132
- $refCount++
133
- } else {
134
- $missingRefs += $srcPath
135
- }
136
- }
137
-
138
- # 3 files from toolkit/skills/sdtk-screen-design-spec/references/
139
- $screenRefs = @('numbering-rules.md', 'figma-mcp.md', 'excel-image-export.md')
140
- foreach ($fileName in $screenRefs) {
141
- $srcPath = Join-Path $toolkitRoot "skills/sdtk-screen-design-spec/references/$fileName"
142
- $destPath = Join-Path $refDest $fileName
143
- if (Test-Path -LiteralPath $srcPath) {
144
- Copy-File -SourcePath $srcPath -DestinationPath $destPath -Overwrite ([bool]$Force)
145
- $refCount++
146
- } else {
147
- $missingRefs += $srcPath
148
- }
149
- }
150
-
151
- # Fail-fast: abort if any reference files are missing
152
- if ($missingRefs.Count -gt 0) {
153
- $list = ($missingRefs | ForEach-Object { " - $_" }) -join "`n"
154
- throw "Claude install failed. Missing reference files:`n$list"
155
- }
156
-
157
- # Strict count assertions
158
- $expectedSkills = 14
159
- $expectedRefs = 9
160
- if ($skillCount -ne $expectedSkills) {
161
- throw "Claude install failed. Expected $expectedSkills skills but installed $skillCount."
162
- }
163
- if ($refCount -ne $expectedRefs) {
164
- throw "Claude install failed. Expected $expectedRefs reference files but installed $refCount."
165
- }
166
-
167
- Write-Host " Skills installed: $skillCount"
168
- Write-Host " Reference files : $refCount"
169
- Write-Host " Destination : $skillsDest"
1
+ param(
2
+ [string]$ProjectPath,
3
+ [ValidateSet('project', 'user')]
4
+ [string]$Scope = 'project',
5
+ [switch]$Force
6
+ )
7
+
8
+ $ErrorActionPreference = 'Stop'
9
+ Set-StrictMode -Version Latest
10
+
11
+ function Copy-File {
12
+ param(
13
+ [Parameter(Mandatory = $true)][string]$SourcePath,
14
+ [Parameter(Mandatory = $true)][string]$DestinationPath,
15
+ [Parameter(Mandatory = $true)][bool]$Overwrite
16
+ )
17
+
18
+ if (-not (Test-Path -LiteralPath $SourcePath)) {
19
+ throw "Missing source: $SourcePath"
20
+ }
21
+
22
+ if (Test-Path -LiteralPath $DestinationPath) {
23
+ if (-not $Overwrite) {
24
+ Write-Warning "Already exists (skipping). Use -Force to overwrite: $DestinationPath"
25
+ return
26
+ }
27
+ }
28
+
29
+ $parent = Split-Path -Parent $DestinationPath
30
+ if ($parent -and -not (Test-Path -LiteralPath $parent)) {
31
+ New-Item -ItemType Directory -Force -Path $parent | Out-Null
32
+ }
33
+
34
+ Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
35
+ }
36
+
37
+ function Get-ClaudeManagedReferenceSources {
38
+ param(
39
+ [Parameter(Mandatory = $true)][string]$SkillName
40
+ )
41
+
42
+ switch ($SkillName) {
43
+ 'api-doc' { return @(
44
+ 'templates/docs/api/YAML_CREATION_RULES.md',
45
+ 'templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md'
46
+ ) }
47
+ 'api-design-spec' { return @(
48
+ 'templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md'
49
+ ) }
50
+ 'arch' { return @(
51
+ 'templates/docs/api/YAML_CREATION_RULES.md',
52
+ 'templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md',
53
+ 'templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md'
54
+ ) }
55
+ 'screen-design-spec' { return @(
56
+ 'templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md',
57
+ 'skills/sdtk-screen-design-spec/references/numbering-rules.md',
58
+ 'skills/sdtk-screen-design-spec/references/figma-mcp.md',
59
+ 'skills/sdtk-screen-design-spec/references/excel-image-export.md'
60
+ ) }
61
+ 'test-case-spec' { return @(
62
+ 'templates/docs/qa/TEST_CASE_CREATION_RULES.md'
63
+ ) }
64
+ default { return @() }
65
+ }
66
+ }
67
+
68
+ function Install-ClaudeSkillDirectory {
69
+ param(
70
+ [Parameter(Mandatory = $true)][System.IO.DirectoryInfo]$SkillDir,
71
+ [Parameter(Mandatory = $true)][string]$SkillsDest,
72
+ [Parameter(Mandatory = $true)][string]$ToolkitRoot,
73
+ [Parameter(Mandatory = $true)][bool]$Overwrite
74
+ )
75
+
76
+ $destDir = Join-Path $SkillsDest $SkillDir.Name
77
+ if (Test-Path -LiteralPath $destDir) {
78
+ if (-not $Overwrite) {
79
+ Write-Warning "Already exists (skipping). Use -Force to overwrite: $destDir"
80
+ return $true
81
+ }
82
+ Remove-Item -LiteralPath $destDir -Recurse -Force
83
+ }
84
+
85
+ $parent = Split-Path -Parent $destDir
86
+ if ($parent -and -not (Test-Path -LiteralPath $parent)) {
87
+ New-Item -ItemType Directory -Force -Path $parent | Out-Null
88
+ }
89
+ Copy-Item -LiteralPath $SkillDir.FullName -Destination $destDir -Recurse -Force
90
+
91
+ $canonicalSkillDir = Join-Path $ToolkitRoot "skills/sdtk-$($SkillDir.Name)"
92
+ foreach ($subDirName in @('scripts', 'prompts')) {
93
+ $srcSubDir = Join-Path $canonicalSkillDir $subDirName
94
+ $destSubDir = Join-Path $destDir $subDirName
95
+ if (-not (Test-Path -LiteralPath $srcSubDir)) {
96
+ continue
97
+ }
98
+
99
+ if (Test-Path -LiteralPath $destSubDir) {
100
+ Remove-Item -LiteralPath $destSubDir -Recurse -Force
101
+ }
102
+ Copy-Item -LiteralPath $srcSubDir -Destination $destSubDir -Recurse -Force
103
+ }
104
+
105
+ $referenceSources = @(Get-ClaudeManagedReferenceSources -SkillName $SkillDir.Name)
106
+ if ($referenceSources.Count -gt 0) {
107
+ $destRefDir = Join-Path $destDir 'references'
108
+ if (Test-Path -LiteralPath $destRefDir) {
109
+ Remove-Item -LiteralPath $destRefDir -Recurse -Force
110
+ }
111
+ New-Item -ItemType Directory -Force -Path $destRefDir | Out-Null
112
+
113
+ foreach ($relativeSource in $referenceSources) {
114
+ $srcRefPath = Join-Path $ToolkitRoot $relativeSource
115
+ $destRefPath = Join-Path $destRefDir ([System.IO.Path]::GetFileName($relativeSource))
116
+ Copy-File -SourcePath $srcRefPath -DestinationPath $destRefPath -Overwrite $true
117
+ }
118
+ }
119
+
120
+ return $true
121
+ }
122
+
123
+ $toolkitRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
124
+
125
+ # Resolve destination based on scope
126
+ if ($Scope -eq 'user') {
127
+ $skillsDest = Join-Path $HOME '.claude/skills'
128
+ Write-Host "Scope: user (installing to $skillsDest)"
129
+ } else {
130
+ if (-not $ProjectPath) {
131
+ $ProjectPath = (Resolve-Path (Join-Path $toolkitRoot '..')).Path
132
+ }
133
+ $projectRoot = Resolve-Path -LiteralPath $ProjectPath
134
+ $skillsDest = Join-Path $projectRoot '.claude/skills'
135
+ Write-Host "Scope: project (installing to $skillsDest)"
136
+ }
137
+
138
+ $skillsSource = Join-Path $toolkitRoot 'skills-claude'
139
+ if (-not (Test-Path -LiteralPath $skillsSource)) {
140
+ throw "Claude skills source not found: $skillsSource"
141
+ }
142
+
143
+ $skillCount = 0
144
+ foreach ($skillDir in (Get-ChildItem -Path $skillsSource -Directory)) {
145
+ $srcFile = Join-Path $skillDir.FullName 'SKILL.md'
146
+ if (-not (Test-Path -LiteralPath $srcFile)) { continue }
147
+
148
+ if (Install-ClaudeSkillDirectory -SkillDir $skillDir -SkillsDest $skillsDest -ToolkitRoot $toolkitRoot -Overwrite ([bool]$Force)) {
149
+ $skillCount++
150
+ }
151
+ }
152
+
153
+ # Remove obsolete shared Claude specialist reference catch-all if it exists
154
+ $legacyRefDest = Join-Path $skillsDest 'references'
155
+ if (Test-Path -LiteralPath $legacyRefDest) {
156
+ Remove-Item -LiteralPath $legacyRefDest -Recurse -Force
157
+ }
158
+
159
+ $managedRefCount = 0
160
+ foreach ($skillName in @('arch', 'api-doc', 'api-design-spec', 'screen-design-spec', 'test-case-spec')) {
161
+ $refDir = Join-Path $skillsDest "$skillName/references"
162
+ if (Test-Path -LiteralPath $refDir) {
163
+ $managedRefCount += @(Get-ChildItem -LiteralPath $refDir -File).Count
164
+ }
165
+ }
166
+
167
+ # Strict count assertions
168
+ $expectedSkills = 14
169
+ $expectedManagedRefs = 11
170
+ if ($skillCount -ne $expectedSkills) {
171
+ throw "Claude install failed. Expected $expectedSkills skills but installed $skillCount."
172
+ }
173
+ if ($managedRefCount -ne $expectedManagedRefs) {
174
+ throw "Claude install failed. Expected $expectedManagedRefs specialist reference files but installed $managedRefCount."
175
+ }
176
+
177
+ Write-Host " Skills installed: $skillCount"
178
+ Write-Host " Specialist refs : $managedRefCount"
179
+ Write-Host " Destination : $skillsDest"
@@ -1,84 +1,111 @@
1
- ---
2
- name: sdtk-api-design-spec
3
- description: Generate detailed API design markdown (`[FEATURE_KEY]_API_DESIGN_DETAIL.md`) from OpenAPI YAML and API flow list using Excel-style structure rules. Use when you need field-level request/response tables + per-endpoint process flow images for implementation/review handoff.
4
- ---
5
-
6
- # SDTK-SPEC API Design Detail Spec
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
-
12
- ## Outputs
13
- - `docs/api/[FEATURE_KEY]_API_DESIGN_DETAIL.md`
14
- - Supporting generated assets:
15
- - `docs/api/flows/*.puml`
16
- - `docs/api/images/*.svg`
17
-
18
- ## Required Inputs
19
- - Feature key (`FEATURE_KEY`)
20
- - API contract YAML:
21
- - Preferred: `docs/api/[FeaturePascal]_API.yaml`
22
- - Fallback: a specified YAML file path
23
- - API flow list:
24
- - Preferred: `docs/api/[feature_snake]_api_flow_list.txt`
25
- - Fallback: a specified flow list path
26
-
27
- ## Core Rules
28
- - Apply `./references/API_DESIGN_FLOWCHART_CREATION_RULES.md` first.
29
- - Keep endpoint contracts consistent with source YAML.
30
- - Keep process flow source synchronized with flow list (`*_api_flow_list.txt`).
31
- - Keep one visible flowchart per API section (embed image), avoid duplicate preview rendering.
32
- - Keep `Process Flow` sections implementation-readable:
33
- - include YAML-derived flow summary / notes / login bullets
34
- - keep error sections aligned with actual flow exits, not `None`
35
-
36
- ## Generation Procedure
37
- 1. Resolve input files (`yaml`, `flow_list`, `output`).
38
- 2. Parse YAML endpoints (method, path, request schema, success/error schema).
39
- 3. Parse flow blocks from flow list (`@startuml ... @enduml`) and map by normalized `METHOD + path`.
40
- 4. Generate detailed markdown sections per API:
41
- - Flow summary / notes / login bullets from YAML `description`
42
- - Process flow source block (`text` fenced block)
43
- - Embedded flowchart image
44
- - Path parameter table
45
- - Request table (hierarchy levels + type + format + required)
46
- - Success response table
47
- - Error response table (explicit schema if defined, otherwise shared envelope + inferred business statuses from flow)
48
- 5. Generate/update `.puml` per API under `docs/api/flows`.
49
- 6. Render `.svg` images under `docs/api/images`.
50
- 7. Validate:
51
- - every API section has one embedded image
52
- - every embed path exists
53
- - no render error image output
54
- - markdown tables keep `No` sequential numbering
55
-
56
- ## Script
57
- - `scripts/generate_api_design_detail.py`
58
-
59
- ### Typical command
60
- ```powershell
61
- python "toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py" `
62
- --feature-key WORK_PLANNING_BOARD `
63
- --yaml "docs/api/WorkPlanningBoard_API.yaml" `
64
- --flow-list "docs/api/work_planning_board_api_flow_list.txt" `
65
- --output "docs/api/WORK_PLANNING_BOARD_API_DESIGN_DETAIL.md"
66
- ```
67
-
68
- ### Optional subset generation
69
- ```powershell
70
- python "toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py" `
71
- --feature-key WORK_PLANNING_BOARD `
72
- --yaml "docs/api/WorkPlanningBoard_API.yaml" `
73
- --flow-list "docs/api/work_planning_board_api_flow_list.txt" `
74
- --output "docs/api/WORK_PLANNING_BOARD_API_DESIGN_DETAIL.md" `
75
- --include "POST /api/work-assignment/{organization_uuid}" `
76
- --include "POST /api/work-assignment/edit/{organization_uuid}/{task_assignment_uuid}" `
77
- --include "POST /api/work-assignment/delete/{organization_uuid}/{task_assignment_uuid}"
78
- ```
79
-
80
- ## Orchestrator Integration (Hybrid)
81
- - `apiDesignDetailMode` in `sdtk-spec.config.json` controls orchestration behavior:
82
- - `auto` (default): generate API design detail when ARCH has API scope and YAML/flow sources are available.
83
- - `on`: always generate API design detail for API scope (fail if required sources are missing).
84
- - `off`: skip unless user explicitly requests.
1
+ ---
2
+ name: sdtk-api-design-spec
3
+ description: Generate detailed API design markdown (`[FEATURE_KEY]_API_DESIGN_DETAIL.md`) from OpenAPI YAML and API flow list using Excel-style structure rules. Use when you need field-level request/response tables + per-endpoint process flow images for implementation/review handoff.
4
+ ---
5
+
6
+ # SDTK-SPEC API Design Detail Spec
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
+ - I do not generate API design detail without a valid YAML source and matching flow list.
12
+ - I do not skip the flowchart creation rules; freehand flow sections that bypass `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` are non-conformant.
13
+
14
+ ## Outputs
15
+ - `docs/api/[FEATURE_KEY]_API_DESIGN_DETAIL.md`
16
+ - Supporting generated assets:
17
+ - `docs/api/flows/*.puml`
18
+ - `docs/api/images/*.svg`
19
+
20
+ ## Required Inputs
21
+ - Feature key (`FEATURE_KEY`)
22
+ - API contract YAML:
23
+ - Preferred: `docs/api/[FeaturePascal]_API.yaml`
24
+ - Fallback: a specified YAML file path
25
+ - API flow list:
26
+ - Preferred: `docs/api/[feature_snake]_api_flow_list.txt`
27
+ - Fallback: a specified flow list path
28
+
29
+ ## When To Stop Or Escalate
30
+ - Stop if the required YAML file does not exist or cannot be resolved; do not fabricate an endpoint table.
31
+ - Stop if the flow list is missing or contains no parseable `@startuml ... @enduml` blocks; record the gap and escalate to `sdtk-api-doc` for regeneration.
32
+ - Stop if YAML and flow list describe fundamentally different endpoint sets; surface the discrepancy as a blocker before generating any section.
33
+ - Escalate to `@arch` if a flow block is ambiguous about business logic that would change how a table row is authored.
34
+
35
+ ## Core Process
36
+ 1. Resolve input files (`yaml`, `flow_list`, `output`).
37
+ 2. Load and apply `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` before generating any section.
38
+ 3. Parse YAML endpoints (method, path, request schema, success/error schema).
39
+ 4. Parse flow blocks from flow list (`@startuml ... @enduml`) and map by normalized `METHOD + path`.
40
+ 5. Generate detailed markdown sections per API:
41
+ - Flow summary / notes / login bullets from YAML `description`
42
+ - Process flow source block (`text` fenced block)
43
+ - Embedded flowchart image
44
+ - Path parameter table
45
+ - Request table (hierarchy levels + type + format + required)
46
+ - Success response table
47
+ - Error response table (explicit schema if defined, otherwise shared envelope + inferred business statuses from flow)
48
+ 6. Generate/update `.puml` per API under `docs/api/flows`.
49
+ 7. Render `.svg` images under `docs/api/images`.
50
+
51
+ ## Validation / Quality Gates
52
+ - Every API section has exactly one embedded image; no section is left without a flow visual.
53
+ - Every embed path exists on disk; broken image links are a hard failure.
54
+ - No render error image output is accepted.
55
+ - Markdown tables keep `No` sequential numbering.
56
+ - YAML-derived field tables match the YAML source exactly; no invented fields.
57
+ - Error response table aligns with actual flow exits, not placeholder `None` values.
58
+ - No mixed-language content in narrative text.
59
+
60
+ ## Order-Critical Hard Gate
61
+ Do not generate any API section before reading and applying `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md`. Sections generated without that reference produce structurally incorrect output that will fail implementation review.
62
+
63
+ Do not emit `API_DESIGN_DETAIL.md` if the input YAML and flow list describe incompatible endpoint sets. Fix the upstream sources before proceeding.
64
+
65
+ ## Common Mistakes
66
+
67
+ | Mistake | Why it is wrong | Do instead |
68
+ |---|---|---|
69
+ | Generate sections without reading flowchart rules | Produces non-conformant flow blocks | Always read `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` first |
70
+ | Leave error table as `None` or empty | Hides actual error paths from implementers | Derive error rows from the flow list and YAML error schemas |
71
+ | Embed image paths that do not exist on disk | Breaks document rendering for reviewers | Verify `.svg` exists before embedding; fail loudly if missing |
72
+ | Invent request fields not present in YAML | Introduces contract drift | Only table fields that exist in the parsed YAML schema |
73
+ | Run on an outdated YAML source | Generates stale API design detail | Always confirm the YAML was produced from the current BA/ARCH pass |
74
+
75
+ ## Script
76
+ - `scripts/generate_api_design_detail.py`
77
+
78
+ ### Typical command
79
+ ```powershell
80
+ python "toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py" `
81
+ --feature-key WORK_PLANNING_BOARD `
82
+ --yaml "docs/api/WorkPlanningBoard_API.yaml" `
83
+ --flow-list "docs/api/work_planning_board_api_flow_list.txt" `
84
+ --output "docs/api/WORK_PLANNING_BOARD_API_DESIGN_DETAIL.md"
85
+ ```
86
+
87
+ ### Optional subset generation
88
+ ```powershell
89
+ python "toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py" `
90
+ --feature-key WORK_PLANNING_BOARD `
91
+ --yaml "docs/api/WorkPlanningBoard_API.yaml" `
92
+ --flow-list "docs/api/work_planning_board_api_flow_list.txt" `
93
+ --output "docs/api/WORK_PLANNING_BOARD_API_DESIGN_DETAIL.md" `
94
+ --include "POST /api/work-assignment/{organization_uuid}" `
95
+ --include "POST /api/work-assignment/edit/{organization_uuid}/{task_assignment_uuid}" `
96
+ --include "POST /api/work-assignment/delete/{organization_uuid}/{task_assignment_uuid}"
97
+ ```
98
+
99
+ ## Orchestrator Integration (Hybrid)
100
+ - `apiDesignDetailMode` in `sdtk-spec.config.json` controls orchestration behavior:
101
+ - `auto` (default): generate API design detail when ARCH has API scope and YAML/flow sources are available.
102
+ - `on`: always generate API design detail for API scope (fail if required sources are missing).
103
+ - `off`: skip unless user explicitly requests.
104
+
105
+ ## Reference Loading Guidance
106
+ Read at skill start:
107
+ - `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` (required before any section generation)
108
+
109
+ Read on demand:
110
+ - `docs/api/[FeaturePascal]_API.yaml` (required input)
111
+ - `docs/api/[feature_snake]_api_flow_list.txt` (required input)
@@ -8,6 +8,8 @@ description: Generate OpenAPI 3.x YAML and PlantUML flow diagrams for a feature
8
8
  ## Critical Constraints
9
9
  - I do not invent API paths or payload contracts that contradict BA or ARCH artifacts.
10
10
  - I do not leave YAML, endpoint markdown, and flow-list outputs out of sync.
11
+ - I do not emit a final API doc without applying canonical YAML and flowchart rules.
12
+ - I do not proceed if BA_SPEC or ARCH_DESIGN is absent or clearly incomplete for the current feature scope.
11
13
 
12
14
  ## Outputs
13
15
  - `docs/api/[FeaturePascal]_API.yaml`
@@ -16,17 +18,24 @@ description: Generate OpenAPI 3.x YAML and PlantUML flow diagrams for a feature
16
18
  - Optional downstream (via `sdtk-api-design-spec`):
17
19
  - `docs/api/[FEATURE_KEY]_API_DESIGN_DETAIL.md`
18
20
 
19
- ## Inputs (minimum)
20
- - Feature name/key
21
- - Entities + key fields
22
- - Use cases (UC-xx) + business rules (BR-xx)
21
+ ## Required Inputs
22
+ - Feature name and key
23
+ - Entities and key fields
24
+ - Use cases (UC-xx) and business rules (BR-xx)
23
25
  - Auth/permission model
26
+ - `docs/specs/BA_SPEC_[FEATURE_KEY].md` or `docs/architecture/ARCH_DESIGN_[FEATURE_KEY].md`
24
27
 
25
- ## Process
28
+ ## When To Stop Or Escalate
29
+ - Stop if no BA_SPEC or ARCH_DESIGN exists for the current feature; surface as a blocker before generating any artifact.
30
+ - Stop if path naming policy from `governance/ai/core/SDTK_API_PATH_STYLE_POLICY.md` cannot be resolved without a product decision; record as OQ-xx and escalate to `@pm`.
31
+ - Stop if required UC/BR coverage cannot be confirmed from available sources; do not invent coverage.
32
+ - Escalate to `@arch` if the data model or endpoint scope is structurally ambiguous.
33
+
34
+ ## Core Process
26
35
  1. Read `docs/specs/BA_SPEC_[FEATURE_KEY].md` and/or `docs/architecture/ARCH_DESIGN_[FEATURE_KEY].md`.
27
- 2. Read and apply split API rule sources:
28
- - `./references/YAML_CREATION_RULES.md` for YAML contract rules
29
- - `./references/API_DESIGN_FLOWCHART_CREATION_RULES.md` for flow list / flowchart rules
36
+ 2. Load reference rules:
37
+ - `toolkit/templates/docs/api/YAML_CREATION_RULES.md` for YAML contract rules
38
+ - `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` for flow list / flowchart rules
30
39
  3. Define endpoints mapped to UC-xx; keep path naming consistent across CRUD/search/list/mst patterns and apply `governance/ai/core/SDTK_API_PATH_STYLE_POLICY.md` for canonical resource naming.
31
40
  4. For each endpoint, document request/response schema and error cases.
32
41
  5. Generate/update endpoint markdown (`[FEATURE_KEY]_ENDPOINTS.md`) with summary tables, API type grouping, and screen-logic mapping.
@@ -39,5 +48,32 @@ description: Generate OpenAPI 3.x YAML and PlantUML flow diagrams for a feature
39
48
  - terminology consistency across endpoint detail, summary tables, and flow labels
40
49
  10. If orchestrator mode requires API design detail generation (`apiDesignDetailMode=auto/on`), handoff to `sdtk-api-design-spec` after YAML + flow list are updated.
41
50
 
42
- ## Reference
43
- - Deeper analysis: `docs/specs/API_DOC_SKILL_ANALYSIS.md` (if present).
51
+ ## Validation / Quality Gates
52
+ - YAML, ENDPOINTS.md, and flow list are consistent: the same resource uses the same path segment across all three.
53
+ - Every UC-xx in scope has at least one endpoint mapped.
54
+ - Every endpoint has a defined success response and at least one error case.
55
+ - All path segments match the canonical naming policy in `governance/ai/core/SDTK_API_PATH_STYLE_POLICY.md`.
56
+ - No OQ-xx is silently collapsed; unresolved items remain explicit.
57
+ - English artifact hygiene passes (no language leftovers, no mojibake).
58
+
59
+ ## Order-Critical Hard Gate
60
+ Do not finalize YAML or ENDPOINTS.md before reading and applying both reference rule files. Generating endpoints without `toolkit/templates/docs/api/YAML_CREATION_RULES.md` and `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` produces non-conformant output that will fail downstream review.
61
+
62
+ ## Common Mistakes
63
+
64
+ | Mistake | Why it is wrong | Do instead |
65
+ |---|---|---|
66
+ | Invent endpoint paths not in BA/ARCH | Creates untracked contract drift | Map every endpoint to an explicit UC-xx or BR-xx |
67
+ | Apply path naming from memory without reading policy | Policy details evolve; memory is stale | Always read `SDTK_API_PATH_STYLE_POLICY.md` first |
68
+ | Leave YAML and ENDPOINTS.md out of sync | Downstream tools depend on consistency | Cross-check path/method/schema for each endpoint across all three outputs |
69
+ | Silently collapse an OQ-xx marked as OPEN | Hides unresolved decisions | Keep OQ-xx explicit; escalate to `@pm` if resolution is needed |
70
+ | Skip flowchart rules and free-style PlantUML | Produces flows that deviate from SDTK conventions | Apply `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` before generating any flow |
71
+
72
+ ## Reference Loading Guidance
73
+ Read these files at skill start, not on demand:
74
+ - `toolkit/templates/docs/api/YAML_CREATION_RULES.md`
75
+ - `toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md`
76
+
77
+ Read on demand when needed:
78
+ - `governance/ai/core/SDTK_API_PATH_STYLE_POLICY.md` (always required for path naming)
79
+ - `docs/specs/API_DOC_SKILL_ANALYSIS.md` (if present; deeper domain analysis only)