bmad-module-skill-forge 0.8.4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +5 -3
  2. package/docs/bmad-synergy.md +183 -0
  3. package/docs/concepts.md +30 -2
  4. package/docs/examples.md +57 -17
  5. package/docs/getting-started.md +17 -0
  6. package/docs/how-it-works.md +143 -29
  7. package/docs/index.md +1 -1
  8. package/docs/workflows.md +43 -5
  9. package/package.json +1 -1
  10. package/src/README.md +47 -0
  11. package/src/agents/forger.agent.yaml +8 -0
  12. package/src/knowledge/agentskills-spec.md +3 -0
  13. package/src/knowledge/overview.md +1 -0
  14. package/src/knowledge/provenance-tracking.md +3 -0
  15. package/src/knowledge/skf-knowledge-index.csv +1 -0
  16. package/src/knowledge/skill-lifecycle.md +19 -7
  17. package/src/knowledge/version-paths.md +243 -0
  18. package/src/module-help.csv +2 -0
  19. package/src/workflows/README.md +9 -1
  20. package/src/workflows/analyze-source/data/skill-brief-schema.md +4 -0
  21. package/src/workflows/audit-skill/steps-c/step-01-init.md +10 -6
  22. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +1 -1
  23. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +1 -1
  24. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +1 -1
  25. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +1 -1
  26. package/src/workflows/audit-skill/steps-c/step-06-report.md +1 -1
  27. package/src/workflows/brief-skill/data/skill-brief-schema.md +11 -0
  28. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +24 -1
  29. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +10 -0
  30. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +9 -0
  31. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +14 -1
  32. package/src/workflows/create-skill/data/skill-sections.md +2 -0
  33. package/src/workflows/create-skill/data/source-resolution-protocols.md +40 -4
  34. package/src/workflows/create-skill/steps-c/step-03-extract.md +1 -1
  35. package/src/workflows/create-skill/steps-c/step-05-compile.md +1 -0
  36. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +48 -32
  37. package/src/workflows/create-skill/steps-c/step-08-report.md +8 -7
  38. package/src/workflows/create-stack-skill/data/compose-mode-rules.md +12 -6
  39. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +4 -1
  40. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +11 -5
  41. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +1 -1
  42. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +1 -1
  43. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +40 -23
  44. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +6 -3
  45. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +5 -3
  46. package/src/workflows/drop-skill/steps-c/step-01-select.md +298 -0
  47. package/src/workflows/drop-skill/steps-c/step-02-execute.md +290 -0
  48. package/src/workflows/drop-skill/steps-c/step-03-report.md +135 -0
  49. package/src/workflows/drop-skill/workflow.md +63 -0
  50. package/src/workflows/export-skill/data/managed-section-format.md +33 -8
  51. package/src/workflows/export-skill/data/snippet-format.md +16 -4
  52. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +46 -7
  53. package/src/workflows/export-skill/steps-c/step-02-package.md +2 -2
  54. package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +39 -7
  55. package/src/workflows/export-skill/steps-c/step-04-update-context.md +185 -13
  56. package/src/workflows/export-skill/steps-c/step-05-token-report.md +2 -2
  57. package/src/workflows/export-skill/steps-c/step-06-summary.md +26 -7
  58. package/src/workflows/quick-skill/steps-c/step-01-resolve-target.md +10 -0
  59. package/src/workflows/quick-skill/steps-c/step-03-quick-extract.md +2 -0
  60. package/src/workflows/quick-skill/steps-c/step-05-validate.md +1 -1
  61. package/src/workflows/quick-skill/steps-c/step-06-write.md +30 -14
  62. package/src/workflows/refine-architecture/steps-c/step-01-init.md +8 -3
  63. package/src/workflows/rename-skill/steps-c/step-01-select.md +281 -0
  64. package/src/workflows/rename-skill/steps-c/step-02-execute.md +391 -0
  65. package/src/workflows/rename-skill/steps-c/step-03-report.md +132 -0
  66. package/src/workflows/rename-skill/workflow.md +64 -0
  67. package/src/workflows/test-skill/steps-c/step-01-init.md +14 -6
  68. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +1 -1
  69. package/src/workflows/update-skill/data/remote-source-resolution.md +18 -4
  70. package/src/workflows/update-skill/steps-c/step-01-init.md +15 -8
  71. package/src/workflows/update-skill/steps-c/step-06-write.md +43 -13
  72. package/src/workflows/update-skill/steps-c/step-07-report.md +7 -5
  73. package/src/workflows/verify-stack/steps-c/step-01-init.md +8 -3
  74. package/tools/cli/lib/ui.js +24 -2
@@ -1,5 +1,37 @@
1
1
  # Source Resolution Protocols
2
2
 
3
+ ## Tag Resolution (when target_version is set)
4
+
5
+ When `brief.target_version` is present AND `source_repo` is a remote URL, resolve the target version to a git tag before cloning:
6
+
7
+ 1. **List available tags:**
8
+ - `gh api repos/{owner}/{repo}/tags --paginate --jq '.[].name'`
9
+ - Fallback: `git ls-remote --tags {source_repo} | sed 's|.*refs/tags/||'`
10
+
11
+ 2. **Match `target_version` against tags** in priority order:
12
+ - **Exact match:** `{target_version}` (e.g., `0.5.0`)
13
+ - **With `v` prefix:** `v{target_version}` (e.g., `v0.5.0`)
14
+ - **With package scope (monorepos):** `{brief.name}@{target_version}` or `@{scope}/{brief.name}@{target_version}`
15
+
16
+ 3. **Resolution outcomes:**
17
+ - **Single match:** Store the matched tag as `source_ref`. Use it as `{branch}` in all subsequent clone/API commands.
18
+ - **Multiple matches:** Present the matching tags to the user — "Multiple tags match version {target_version}: {list}. Which one should I use?" Wait for selection.
19
+ - **Zero matches:** ⚠️ Warn: "No git tag found matching version {target_version}. Closest available tags: {list 5 nearest by semver sort}. Falling back to default branch — **extracted code may not match target version.**" Set `source_ref` to `HEAD` and proceed with default branch.
20
+
21
+ 4. **Store `source_ref`** in context. This value is written to metadata.json and provenance-map.json for downstream workflows (update-skill, audit-skill) to re-clone from the same ref.
22
+
23
+ When `brief.target_version` is NOT set: skip tag resolution. Set `source_ref` to `HEAD` (default branch behavior, unchanged from before).
24
+
25
+ ### Local Source Warning
26
+
27
+ When `brief.target_version` is set AND `source_repo` is a local path:
28
+
29
+ ⚠️ "**Local source may not match target version {target_version}.** Ensure you've checked out the correct version locally, or use a remote GitHub URL so SKF can clone from the git tag automatically."
30
+
31
+ Proceed with local files as-is. Set `source_ref` to `"local"`.
32
+
33
+ ---
34
+
3
35
  ## Remote Source Resolution (Forge/Deep only)
4
36
 
5
37
  If `source_repo` is a local path: proceed with the tier-appropriate strategy as normal.
@@ -8,17 +40,17 @@ If `source_repo` is a remote URL (GitHub URL or owner/repo format) AND tier is F
8
40
 
9
41
  1. **Check `git` availability:** Verify `git` is functional (`git --version`). If `git` is not available, skip to the fallback warning below.
10
42
 
11
- 2. **Ephemeral shallow clone:** Clone the repository to a system temp path for AST access:
43
+ 2. **Ephemeral shallow clone:** Clone the repository to a system temp path for AST access. Use `source_ref` from tag resolution (or `{branch}` for the default branch if no tag was resolved):
12
44
 
13
45
  ```
14
46
  temp_path = {system_temp}/skf-ephemeral-{skill-name}-{timestamp}/
15
- git clone --depth 1 --branch {branch} --single-branch --filter=blob:none {source_repo} {temp_path}
47
+ git clone --depth 1 --branch {source_ref} --single-branch --filter=blob:none {source_repo} {temp_path}
16
48
  ```
17
49
 
18
50
  **If `include_patterns` are NOT specified:**
19
51
 
20
52
  ```
21
- git clone --depth 1 --branch {branch} --single-branch --filter=blob:none {source_repo} {temp_path}
53
+ git clone --depth 1 --branch {source_ref} --single-branch --filter=blob:none {source_repo} {temp_path}
22
54
  ```
23
55
 
24
56
  **If `include_patterns` ARE specified**, use sparse-checkout to limit the clone scope:
@@ -132,14 +164,18 @@ After the source path is accessible, capture the current commit hash for provena
132
164
 
133
165
  - **Local path:** `git -C {source_root} rev-parse HEAD` — if the path is a git repo
134
166
  - **Ephemeral clone (Forge/Deep):** already captured during clone (step 3 above)
135
- - **Quick tier (remote, no clone):** `gh api repos/{owner}/{repo}/commits/{branch} --jq '.sha'`
167
+ - **Quick tier (remote, no clone):** `gh api repos/{owner}/{repo}/commits/{source_ref} --jq '.sha'`
136
168
 
137
169
  Store the result as `source_commit` in context. If capture fails (not a git repo, API unavailable), set `source_commit: null` — this is not an error.
138
170
 
171
+ Also store `source_ref` in context (from tag resolution above, or `HEAD` if no tag was resolved, or `"local"` for local sources). This value is persisted to metadata.json and provenance-map.json so downstream workflows (update-skill, audit-skill) can re-access the same source ref.
172
+
139
173
  ---
140
174
 
141
175
  ## Version Reconciliation (all tiers, source mode only)
142
176
 
177
+ **Target version override:** If `brief.target_version` is present, use it as the authoritative version for the skill. Do NOT warn about a brief-vs-source version mismatch — the user intentionally specified this version. Set the working version to `brief.target_version` and skip the rest of this reconciliation section. The `target_version` field indicates deliberate user intent (e.g., targeting an older version, or providing the version for a docs-only skill).
178
+
143
179
  **If `source_type: "docs-only"`:** skip this section — no source files exist to reconcile.
144
180
 
145
181
  After the source path is accessible (local path from step-01, or ephemeral clone from above), check whether the source contains a version identifier and reconcile it with `brief.version`. Look for the first matching version file in the resolved source path:
@@ -47,7 +47,7 @@ To extract all public exports, function signatures, type definitions, and co-imp
47
47
 
48
48
  ## CONTEXT BOUNDARIES:
49
49
 
50
- - Available: brief_data, tier, source_root, file_tree from step-01; ecosystem check outcome from step-02 (proceed/halt decision no named variable stored)
50
+ - Available: brief_data, tier, source_root, file_tree from step-01; ecosystem check outcome from step-02; source_ref and source_commit from source resolution (see source-resolution-protocols.md)
51
51
  - Focus: Source code extraction and inventory building
52
52
  - Limits: Do NOT compile, assemble, or write any output
53
53
  - Dependencies: Source code must be accessible (local repos resolved in step-01; remote repos cloned in section 2a)
@@ -101,6 +101,7 @@ Following the structure from the skill-sections data file:
101
101
  - Populate all fields from brief_data, extraction inventory, and tier
102
102
  - Set `generation_date` to current ISO-8601 timestamp
103
103
  - Set `source_commit` from resolved source (if available)
104
+ - Set `source_ref` from resolved source ref (tag name, branch, or `HEAD`; null if unavailable)
104
105
  - Set `stats` from extraction aggregate counts:
105
106
  - `exports_documented`: count of exports with documentation in the assembled SKILL.md
106
107
  - `exports_public_api`: count of exports from public entry points (`__init__.py`, `index.ts`, `lib.rs`, or equivalent) — derive this from step-03's entry-point validation (section 4b), NOT from the provenance-map entry count (which may be incomplete if extraction patterns missed some export types)
@@ -9,7 +9,7 @@ forgeTierConfig: '{sidecar_path}/forge-tier.yaml'
9
9
 
10
10
  ## STEP GOAL:
11
11
 
12
- To write all compiled content to disk — 4 deliverable files to `{skills_output_folder}/{name}/` and 3 workspace artifacts to `{forge_data_folder}/{name}/`, creating directories as needed.
12
+ To write all compiled content to disk — 4 deliverable files to `{skill_package}` and 3 workspace artifacts to `{forge_version}`, creating directories as needed. Then create or update the `active` symlink.
13
13
 
14
14
  ## MANDATORY EXECUTION RULES (READ FIRST):
15
15
 
@@ -47,6 +47,7 @@ To write all compiled content to disk — 4 deliverable files to `{skills_output
47
47
  - Focus: File system operations — create directories, write files
48
48
  - Limits: Do NOT modify content during writing
49
49
  - Dependencies: All content must be compiled and validated in context
50
+ - Path resolution: See `knowledge/version-paths.md` for canonical path templates (`{skill_package}`, `{skill_group}`, `{forge_version}`, `{forge_group}`)
50
51
 
51
52
  ## MANDATORY SEQUENCE
52
53
 
@@ -54,65 +55,77 @@ To write all compiled content to disk — 4 deliverable files to `{skills_output
54
55
 
55
56
  ### 1. Create Directory Structure
56
57
 
57
- Create the following directories:
58
+ Resolve `{version}` from the skill brief's `version` field. Create the following directories:
58
59
 
59
60
  ```
60
- {skills_output_folder}/{name}/
61
- {skills_output_folder}/{name}/references/
62
- {forge_data_folder}/{name}/
61
+ {skill_group} # {skills_output_folder}/{name}/
62
+ {skill_package} # {skills_output_folder}/{name}/{version}/{name}/
63
+ {skill_package}/references/
64
+ {forge_version} # {forge_data_folder}/{name}/{version}/
63
65
  ```
64
66
 
65
- If `scripts_inventory` is non-empty, also create: `{skills_output_folder}/{name}/scripts/`
66
- If `assets_inventory` is non-empty, also create: `{skills_output_folder}/{name}/assets/`
67
+ If `scripts_inventory` is non-empty, also create: `{skill_package}/scripts/`
68
+ If `assets_inventory` is non-empty, also create: `{skill_package}/assets/`
67
69
 
68
- Where `{name}` is the skill name from the brief (kebab-case).
70
+ Where `{name}` is the skill name from the brief (kebab-case) and `{version}` is the semver version from the brief (with build metadata stripped per `knowledge/version-paths.md`).
69
71
 
70
72
  If directories already exist, do not error — proceed with file writing (overwrites existing files).
71
73
 
72
- ### 2. Write Deliverables to {skills_output_folder}/{name}/
74
+ ### 2. Write Deliverables to {skill_package}
73
75
 
74
76
  Write these 4 files from the compiled content:
75
77
 
76
- **File 1:** `{skills_output_folder}/{name}/SKILL.md`
78
+ **File 1:** `{skill_package}/SKILL.md`
77
79
  - The complete compiled skill document
78
80
  - agentskills.io-compliant format with all sections
79
81
  - [MANUAL] markers seeded
80
82
 
81
- **File 2:** `{skills_output_folder}/{name}/context-snippet.md`
83
+ **File 2:** `{skill_package}/context-snippet.md`
82
84
  - Compressed 2-line format for CLAUDE.md integration
83
85
 
84
- **File 3:** `{skills_output_folder}/{name}/metadata.json`
86
+ **File 3:** `{skill_package}/metadata.json`
85
87
  - Machine-readable birth certificate with stats and provenance
86
88
 
87
- **File 4:** `{skills_output_folder}/{name}/references/*.md`
89
+ **File 4:** `{skill_package}/references/*.md`
88
90
  - One file per function group or type
89
91
  - Progressive disclosure detail files
90
92
 
91
- **Files 4b (conditional):** `{skills_output_folder}/{name}/scripts/*`
93
+ **Files 4b (conditional):** `{skill_package}/scripts/*`
92
94
  - One file per detected script, copied from source with content preserved
93
95
  - Only created when `scripts_inventory` is non-empty
94
96
 
95
- **Files 4c (conditional):** `{skills_output_folder}/{name}/assets/*`
97
+ **Files 4c (conditional):** `{skill_package}/assets/*`
96
98
  - One file per detected asset, copied from source with content preserved
97
99
  - Only created when `assets_inventory` is non-empty
98
100
 
99
- ### 3. Write Workspace Artifacts to {forge_data_folder}/{name}/
101
+ ### 3. Write Workspace Artifacts to {forge_version}
100
102
 
101
103
  Write these 3 files from the compiled content:
102
104
 
103
- **File 5:** `{forge_data_folder}/{name}/provenance-map.json`
105
+ **File 5:** `{forge_version}/provenance-map.json`
104
106
  - Per-claim source map with AST bindings and confidence tiers
105
107
 
106
- **File 6:** `{forge_data_folder}/{name}/evidence-report.md`
108
+ **File 6:** `{forge_version}/evidence-report.md`
107
109
  - Build artifact with extraction summary, validation results, warnings
108
110
 
109
- **File 7:** `{forge_data_folder}/{name}/extraction-rules.yaml`
111
+ **File 7:** `{forge_version}/extraction-rules.yaml`
110
112
  - Language and ast-grep schema used for this extraction (for reproducibility)
111
113
 
112
- ### 4. Verify Write Completion
114
+ ### 4. Create Active Symlink
115
+
116
+ Create or update the `active` symlink at `{skill_group}/active` pointing to `{version}`:
117
+
118
+ ```
119
+ {skill_group}/active -> {version}
120
+ ```
121
+
122
+ If the symlink already exists, remove it first and recreate. This ensures `{skill_group}/active/{name}/` resolves to the just-written skill package.
123
+
124
+ ### 5. Verify Write Completion
113
125
 
114
126
  After all files are written, verify:
115
127
  - All 4 deliverable artifact types exist (SKILL.md, context-snippet.md, metadata.json, at least one file in references/), all 3 workspace artifacts exist (provenance-map.json, evidence-report.md, extraction-rules.yaml), plus scripts/ and assets/ files when inventories are non-empty
128
+ - The `active` symlink at `{skill_group}/active` resolves to `{version}`
116
129
  - Store `ref_count` = count of files written to `references/` for use in step-08 report
117
130
  - List each file with its path and size
118
131
 
@@ -124,7 +137,7 @@ Display brief confirmation:
124
137
 
125
138
  "**Artifacts generated.**
126
139
 
127
- **Deliverables ({skills_output_folder}/{name}/):**
140
+ **Deliverables ({skill_package}):**
128
141
  - SKILL.md
129
142
  - context-snippet.md
130
143
  - metadata.json
@@ -132,14 +145,16 @@ Display brief confirmation:
132
145
  {if assets: - assets/ ({assets_count} files)}
133
146
  - references/ ({reference_count} files)
134
147
 
135
- **Workspace ({forge_data_folder}/{name}/):**
148
+ **Workspace ({forge_version}):**
136
149
  - provenance-map.json
137
150
  - evidence-report.md
138
151
  - extraction-rules.yaml
139
152
 
153
+ **Symlink:** {skill_group}/active -> {version}
154
+
140
155
  Proceeding to compilation report..."
141
156
 
142
- ### 5. QMD Collection Registration (Deep Tier Only)
157
+ ### 6. QMD Collection Registration (Deep Tier Only)
143
158
 
144
159
  **IF forge tier is Deep AND QMD tool is available:**
145
160
 
@@ -148,7 +163,7 @@ Index the generated skill artifacts into a QMD collection so that audit-skill an
148
163
  **Collection creation:** Create (or replace) a QMD collection from the skill artifacts:
149
164
  ```bash
150
165
  qmd collection remove {name}-extraction 2>/dev/null # no-op if new
151
- qmd collection add {skills_output_folder}/{name} --name {name}-extraction --mask "**/*"
166
+ qmd collection add {skill_package} --name {name}-extraction --mask "**/*"
152
167
  qmd embed # generates vector embeddings for vector_search/deep_search
153
168
  ```
154
169
 
@@ -174,7 +189,7 @@ Write the updated forge-tier.yaml.
174
189
 
175
190
  **IF forge tier is NOT Deep:** Skip this section silently. No messaging.
176
191
 
177
- ### 5b. CCC Index Registry Registration (Forge+ and Deep with ccc)
192
+ ### 6b. CCC Index Registry Registration (Forge+ and Deep with ccc)
178
193
 
179
194
  **IF `tools.ccc` is true in forge-tier.yaml (Forge+ or Deep with ccc available):**
180
195
 
@@ -204,7 +219,7 @@ Write the updated forge-tier.yaml.
204
219
 
205
220
  **IF `tools.ccc` is false:** Skip this section silently.
206
221
 
207
- ### 6. Menu Handling Logic
222
+ ### 7. Menu Handling Logic
208
223
 
209
224
  **Auto-proceed step — no user interaction.**
210
225
 
@@ -220,7 +235,7 @@ After all artifacts are written, verified, and optionally indexed into QMD, imme
220
235
 
221
236
  ## CRITICAL STEP COMPLETION NOTE
222
237
 
223
- ONLY WHEN all 7 artifact files are written and verified will you proceed to load `{nextStepFile}` for the compilation report.
238
+ ONLY WHEN all 7 artifact files are written, the active symlink is created, and verification is complete will you proceed to load `{nextStepFile}` for the compilation report.
224
239
 
225
240
  ---
226
241
 
@@ -228,10 +243,11 @@ ONLY WHEN all 7 artifact files are written and verified will you proceed to load
228
243
 
229
244
  ### ✅ SUCCESS:
230
245
 
231
- - Directory structure created ({skills_output_folder}/{name}/, {forge_data_folder}/{name}/)
232
- - All 4 deliverable files written to {skills_output_folder}/{name}/
233
- - All 3 workspace artifact files written to {forge_data_folder}/{name}/
234
- - Write completion verified all 7 files exist
246
+ - Directory structure created ({skill_group}, {skill_package}, {forge_version})
247
+ - All 4 deliverable files written to {skill_package}
248
+ - All 3 workspace artifact files written to {forge_version}
249
+ - Active symlink created at {skill_group}/active -> {version}
250
+ - Write completion verified — all 7 files exist and symlink resolves
235
251
  - Deep tier: QMD collection `{name}-extraction` created/updated and registered in forge-tier.yaml
236
252
  - Non-Deep tier: QMD indexing skipped silently
237
253
  - Brief confirmation displayed with file list
@@ -246,4 +262,4 @@ ONLY WHEN all 7 artifact files are written and verified will you proceed to load
246
262
  - Not verifying all files were written
247
263
  - Failing the workflow due to QMD indexing errors (should degrade gracefully)
248
264
 
249
- **Master Rule:** This step writes artifacts and registers QMD collections. All content was compiled and validated in previous steps. Write faithfully, verify completely. QMD indexing failures never block the workflow.
265
+ **Master Rule:** This step writes artifacts, creates the active symlink, and registers QMD collections. All content was compiled and validated in previous steps. Write faithfully, verify completely. QMD indexing failures never block the workflow.
@@ -77,13 +77,14 @@ Where `{primary_confidence}` is the predominant confidence tier (T1 if Forge/Dee
77
77
  | T3 (External) | {t3_count} | Sourced from external documentation URLs |
78
78
 
79
79
  **Output Files:**
80
- - `{skills_output_folder}/{name}/SKILL.md` — Active skill with trigger-based usage
81
- - `{skills_output_folder}/{name}/context-snippet.md` — Passive context for CLAUDE.md
82
- - `{skills_output_folder}/{name}/metadata.json` — Machine-readable birth certificate
83
- - `{skills_output_folder}/{name}/references/` — Progressive disclosure ({ref_count} files)
84
- - `{forge_data_folder}/{name}/provenance-map.json` — Source map with AST bindings
85
- - `{forge_data_folder}/{name}/evidence-report.md` — Build audit trail
86
- - `{forge_data_folder}/{name}/extraction-rules.yaml` — Reproducible extraction schema"
80
+ - `{skill_package}/SKILL.md` — Active skill with trigger-based usage
81
+ - `{skill_package}/context-snippet.md` — Passive context snippet (used by export-skill)
82
+ - `{skill_package}/metadata.json` — Machine-readable birth certificate
83
+ - `{skill_package}/references/` — Progressive disclosure ({ref_count} files)
84
+ - `{forge_version}/provenance-map.json` — Source map with AST bindings
85
+ - `{forge_version}/evidence-report.md` — Build audit trail
86
+ - `{forge_version}/extraction-rules.yaml` — Reproducible extraction schema
87
+ - `{skill_group}/active` -> `{version}` — Symlink to current version"
87
88
 
88
89
  ### 3. Display Warnings (If Any)
89
90
 
@@ -4,12 +4,18 @@ Rules for synthesizing a stack skill from pre-generated individual skills and an
4
4
 
5
5
  ## Skill Loading
6
6
 
7
- 1. Scan `{skills_output_folder}` for subdirectories containing both `SKILL.md` and `metadata.json`
8
- 2. **Filter:** Skip any subdirectory named `{project_name}-stack` or any skill where `metadata.json` has `"skill_type": "stack"` — stack skills must not be loaded as source dependencies to avoid self-referencing loops
9
- 3. Skip any subdirectory missing either `SKILL.md` or `metadata.json` — log a warning and skip
10
- 4. Load each `metadata.json` and extract: `name`, `language`, `confidence_tier`, `source_repo`, `exports` (count), `version`
11
- 5. Store the subdirectory name as `skill_dir` (distinct from `name`the directory may differ from the metadata name)
12
- 6. Store loaded skills as `raw_dependencies` with `source: "existing_skill"`
7
+ Skills use version-nested directories see [knowledge/version-paths.md](../../../knowledge/version-paths.md) for the full path templates and resolution rules.
8
+
9
+ **Version-aware skill enumeration:**
10
+
11
+ 1. **Primary: Export manifest** Read `{skills_output_folder}/.export-manifest.json`. For each entry in `exports`, resolve the active version path: `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/`this directory must contain both `SKILL.md` and `metadata.json`.
12
+ 2. **Fallback: `active` symlinks** If the manifest does not exist, is empty, or a manifest entry lacks an `active_version`, scan for `{skills_output_folder}/*/active/*/SKILL.md`. Each match resolves to a skill package at `{skills_output_folder}/{skill-name}/active/{skill-name}/` (the `{active_skill}` template).
13
+ 3. **Filter:** Skip any skill named `{project_name}-stack` or any skill where `metadata.json` has `"skill_type": "stack"` — stack skills must not be loaded as source dependencies to avoid self-referencing loops
14
+ 4. Skip any resolved skill package missing either `SKILL.md` or `metadata.json` — log a warning and skip
15
+ 5. Load each `metadata.json` from the resolved version-aware path and extract: `name`, `language`, `confidence_tier`, `source_repo`, `exports` (count), `version`
16
+ 6. Store the skill group directory name as `skill_dir` (the top-level name under `{skills_output_folder}`, distinct from `name` — the directory may differ from the metadata name)
17
+ 7. Store the resolved package path as `skill_package_path` for use in later steps (extraction, integration detection)
18
+ 8. Store loaded skills as `raw_dependencies` with `source: "existing_skill"`
13
19
 
14
20
  ## Architecture Integration Mapping
15
21
 
@@ -106,8 +106,11 @@ Check if the user provided:
106
106
 
107
107
  Set `compose_mode: false` as the default.
108
108
 
109
+ Skills use version-nested directories — see [knowledge/version-paths.md](../../../knowledge/version-paths.md) for the full path templates and resolution rules.
110
+
109
111
  - If user provides an architecture document path for composition or explicitly requests compose mode → set `compose_mode: true` and store `architecture_doc_path`
110
- - If no manifest files exist in project root AND at least one subdirectory in `{skills_output_folder}` contains both `SKILL.md` and `metadata.json` → suggest compose mode to the user and ask for optional architecture document path
112
+ - If no manifest files exist in project root AND at least one skill is discoverable in `{skills_output_folder}` → suggest compose mode to the user and ask for optional architecture document path
113
+ - **Skill discovery (version-aware):** First, read `{skills_output_folder}/.export-manifest.json` — each entry in `exports` names a skill with an `active_version`, which resolves to `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/` containing `SKILL.md` and `metadata.json`. If the export manifest does not exist or is empty, fall back to scanning for `active` symlinks: check `{skills_output_folder}/*/active/*/SKILL.md` — each match indicates a skill whose package lives at `{skills_output_folder}/{skill-name}/active/{skill-name}/` (the `{active_skill}` template).
111
114
  - If user accepts → set `compose_mode: true` and store `architecture_doc_path` (may be `null` if user chose not to provide one)
112
115
  - If user declines → `compose_mode` remains `false`, continue with code-mode
113
116
 
@@ -58,17 +58,23 @@ Use the explicit dependency list directly. Store the explicit list as `raw_depen
58
58
 
59
59
  **If `compose_mode` is true AND `explicit_deps` was NOT provided:**
60
60
 
61
- Scan `{skills_output_folder}` for subdirectories containing SKILL.md and metadata.json.
61
+ Discover skills in `{skills_output_folder}` using version-aware resolution — see [knowledge/version-paths.md](../../../knowledge/version-paths.md) for path templates.
62
62
 
63
- **Filter:** Skip any subdirectory named `{project_name}-stack` or any skill where `metadata.json` has `"skill_type": "stack"` — stack skills must not be loaded as source dependencies to avoid self-referencing loops.
63
+ **Version-aware skill enumeration:**
64
+
65
+ 1. **Primary: Export manifest** — Read `{skills_output_folder}/.export-manifest.json`. For each entry in `exports`, resolve the active version path: `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/` — this directory must contain both `SKILL.md` and `metadata.json`.
66
+ 2. **Fallback: `active` symlinks** — If the manifest does not exist, is empty, or a manifest entry lacks an `active_version`, scan for `{skills_output_folder}/*/active/*/SKILL.md`. Each match resolves to a skill package at `{skills_output_folder}/{skill-name}/active/{skill-name}/` (the `{active_skill}` template).
67
+
68
+ **Filter:** Skip any skill named `{project_name}-stack` or any skill where `metadata.json` has `"skill_type": "stack"` — stack skills must not be loaded as source dependencies to avoid self-referencing loops.
64
69
 
65
70
  **If zero skills remain after filtering:** HALT with: "**Cannot proceed in compose-mode.** No individual skills found in `{skills_output_folder}` (after filtering stack skills). Run [CS] Create Skill or [QS] Quick Skill to generate individual skills first, then re-run [SS]."
66
71
 
67
72
  For each skill found:
68
- 1. Read metadata.json
73
+ 1. Read `metadata.json` from the resolved version-aware path (`{skill_package}` or `{active_skill}`)
69
74
  2. Extract: name, language, confidence_tier, source_repo, exports count, version
70
- 3. Store the subdirectory name as `skill_dir` (distinct from `name` — the directory may differ from the metadata name)
71
- 4. Store as `raw_dependencies` with source: "existing_skill"
75
+ 3. Store the skill group directory name as `skill_dir` (the top-level name under `{skills_output_folder}`, distinct from `name` — the directory may differ from the metadata name)
76
+ 4. Store the resolved package path as `skill_package_path` for use in later steps
77
+ 5. Store as `raw_dependencies` with source: "existing_skill"
72
78
 
73
79
  Display:
74
80
  "**Loaded {N} existing skills as dependencies.**
@@ -56,7 +56,7 @@ For each confirmed dependency, extract key exports, usage patterns, and API surf
56
56
 
57
57
  "**Extraction data already available from individual skills. Skipping extraction phase.**"
58
58
 
59
- For each confirmed skill, load `{skills_output_folder}/{skill_dir}/SKILL.md` (where `skill_dir` is the subdirectory name stored in step-02, which may differ from the `name` field in metadata.json) into context. Build a `per_library_extractions[]` entry for each skill with the following fields:
59
+ For each confirmed skill, load SKILL.md from the version-aware path resolved in step-02. Use `skill_package_path` (stored in step-02) directly this already points to the resolved `{skill_package}` or `{active_skill}` directory containing the skill's artifacts. If `skill_package_path` is not available, resolve via the `{active_skill}` template: `{skills_output_folder}/{skill_dir}/active/{skill_dir}/SKILL.md` (see [knowledge/version-paths.md](../../../knowledge/version-paths.md)). Build a `per_library_extractions[]` entry for each skill with the following fields:
60
60
  - `library`: skill name from metadata.json
61
61
  - `exports`: exports list extracted from the SKILL.md exports section
62
62
  - `usage_patterns`: usage patterns from the SKILL.md usage section
@@ -81,7 +81,7 @@ All integration evidence inherits confidence tiers from the source skills. Load
81
81
  **VS verdict parsing (if feasibility report exists):** Read the `overall_verdict` from the report's YAML frontmatter. Parse the `## Integration Verdicts` markdown table for per-pair verdicts. For each architecture-detected pair, include `VS overall: {verdict}` and `VS pair: {verdict}` in the integration evidence per the format in `{composeModeRules}`. VS verdicts do not apply to inferred integrations since the VS report operates on architecture-described interactions only. Additionally, flag any pairs where VS reported `Risky` or `Blocked` by appending a `[VS: Risky]` or `[VS: Blocked]` warning annotation to the integration entry.
82
82
 
83
83
  If no architecture document available:
84
- - Infer potential integrations from skills sharing the same `language` field or sharing domain keywords in their SKILL.md descriptions (use the `usage_patterns` and `exports` fields from `per_library_extractions[]` built in step-04, or reload `{skills_output_folder}/{skill_dir}/SKILL.md` if full prose text is needed for keyword extraction)
84
+ - Infer potential integrations from skills sharing the same `language` field or sharing domain keywords in their SKILL.md descriptions (use the `usage_patterns` and `exports` fields from `per_library_extractions[]` built in step-04, or reload SKILL.md from the version-aware path: use `skill_package_path` from step-02, or resolve via `{skills_output_folder}/{skill_dir}/active/{skill_dir}/SKILL.md` see [knowledge/version-paths.md](../../../knowledge/version-paths.md))
85
85
  - Mark inferred integrations: `[inferred from shared domain]` — use this suffix instead of `[composed]` for inferred integrations
86
86
  - Inferred integrations qualify automatically — no file-count threshold applies
87
87
 
@@ -47,6 +47,7 @@ Write all deliverable and workspace artifact files to their target directories.
47
47
  - From step 05: integration_graph for integration pair references
48
48
  - From step 01: forge_tier, project info for metadata
49
49
  - This step produces: written_files[] (all output artifacts)
50
+ - Path resolution: See `knowledge/version-paths.md` for canonical path templates. Stack skills use `{project_name}-stack` as the skill name
50
51
 
51
52
  ## MANDATORY SEQUENCE
52
53
 
@@ -54,27 +55,30 @@ Write all deliverable and workspace artifact files to their target directories.
54
55
 
55
56
  ### 1. Create Output Directories
56
57
 
57
- Create the directory structure:
58
+ Resolve `{version}` from the primary library version or default to `1.0.0`. Create the directory structure:
58
59
 
59
60
  ```
60
- {skills_output_folder}/{project_name}-stack/
61
+ {skill_group} # {skills_output_folder}/{project_name}-stack/
62
+ {skill_package} # {skills_output_folder}/{project_name}-stack/{version}/{project_name}-stack/
61
63
  ├── references/
62
64
  │ └── integrations/
63
65
  ```
64
66
 
65
67
  ```
66
- {forge_data_folder}/{project_name}-stack/
68
+ {forge_version} # {forge_data_folder}/{project_name}-stack/{version}/
67
69
  ```
68
70
 
71
+ Where the skill name is `{project_name}-stack` and `{version}` is the semver version (with build metadata stripped per `knowledge/version-paths.md`).
72
+
69
73
  If directories already exist, proceed (overwrite previous output).
70
74
 
71
75
  ### 2. Write SKILL.md
72
76
 
73
- Write `{skills_output_folder}/{project_name}-stack/SKILL.md` with the approved skill_content from step 06.
77
+ Write `{skill_package}/SKILL.md` with the approved skill_content from step 06.
74
78
 
75
79
  ### 3. Write Per-Library Reference Files
76
80
 
77
- For each confirmed library, write `{skills_output_folder}/{project_name}-stack/references/{library_name}.md`:
81
+ For each confirmed library, write `{skill_package}/references/{library_name}.md`:
78
82
 
79
83
  Load structure from `{stackSkillTemplate}` references section:
80
84
  - Library name, version from manifest (**in compose-mode**: version from source skill `metadata.json`)
@@ -85,7 +89,7 @@ Load structure from `{stackSkillTemplate}` references section:
85
89
 
86
90
  ### 4. Write Integration Pair Reference Files
87
91
 
88
- For each detected integration pair, write `{skills_output_folder}/{project_name}-stack/references/integrations/{libraryA}-{libraryB}.md`:
92
+ For each detected integration pair, write `{skill_package}/references/integrations/{libraryA}-{libraryB}.md`:
89
93
 
90
94
  Load structure from `{stackSkillTemplate}` integrations section:
91
95
  - Library pair and integration type
@@ -98,7 +102,7 @@ Load structure from `{stackSkillTemplate}` integrations section:
98
102
 
99
103
  ### 5. Write context-snippet.md
100
104
 
101
- Write `{skills_output_folder}/{project_name}-stack/context-snippet.md`:
105
+ Write `{skill_package}/context-snippet.md`:
102
106
 
103
107
  Use the Vercel-aligned indexed format targeting ~80-120 tokens:
104
108
  ```
@@ -111,7 +115,7 @@ Use the Vercel-aligned indexed format targeting ~80-120 tokens:
111
115
 
112
116
  ### 6. Write metadata.json
113
117
 
114
- Write `{skills_output_folder}/{project_name}-stack/metadata.json`:
118
+ Write `{skill_package}/metadata.json`:
115
119
 
116
120
  Populate all fields from the metadata.json schema defined in `{stackSkillTemplate}`:
117
121
 
@@ -155,7 +159,7 @@ Populate all fields from the metadata.json schema defined in `{stackSkillTemplat
155
159
 
156
160
  ### 7. Write Forge Data Artifacts
157
161
 
158
- Write workspace artifacts to `{forge_data_folder}/{project_name}-stack/`:
162
+ Write workspace artifacts to `{forge_version}`:
159
163
 
160
164
  **provenance-map.json:**
161
165
 
@@ -208,26 +212,38 @@ Write workspace artifacts to `{forge_data_folder}/{project_name}-stack/`:
208
212
  - Warnings and failures encountered
209
213
  - Confidence tier distribution
210
214
 
211
- ### 8. Display Write Summary
215
+ ### 8. Create Active Symlink
216
+
217
+ Create or update the `active` symlink at `{skill_group}/active` pointing to `{version}`:
218
+
219
+ ```
220
+ {skill_group}/active -> {version}
221
+ ```
222
+
223
+ If the symlink already exists, remove it first and recreate. This ensures `{skill_group}/active/{project_name}-stack/` resolves to the just-written skill package.
224
+
225
+ ### 9. Display Write Summary
212
226
 
213
227
  "**Output files written.**
214
228
 
215
- **Deliverables** ({skills_output_folder}/{project_name}-stack/):
216
- - SKILL.md ({line_count} lines)
217
- - context-snippet.md ({token_estimate} tokens)
218
- - metadata.json
219
- - references/ {lib_count} library files
220
- - references/integrations/ {pair_count} integration files
229
+ **Deliverables** ({skill_package}):
230
+ - SKILL.md ({line_count} lines)
231
+ - context-snippet.md ({token_estimate} tokens)
232
+ - metadata.json
233
+ - references/ -- {lib_count} library files
234
+ - references/integrations/ -- {pair_count} integration files
235
+
236
+ **Workspace** ({forge_version}):
237
+ - provenance-map.json
238
+ - evidence-report.md
221
239
 
222
- **Workspace** ({forge_data_folder}/{project_name}-stack/):
223
- - ✓ provenance-map.json
224
- - ✓ evidence-report.md
240
+ **Symlink:** {skill_group}/active -> {version}
225
241
 
226
242
  **Total files written:** {total_count}
227
243
 
228
244
  **Proceeding to validation...**"
229
245
 
230
- ### 9. Auto-Proceed to Next Step
246
+ ### 10. Auto-Proceed to Next Step
231
247
 
232
248
  Load, read the full file and then execute `{nextStepFile}`.
233
249
 
@@ -237,9 +253,10 @@ Load, read the full file and then execute `{nextStepFile}`.
237
253
 
238
254
  ### ✅ SUCCESS:
239
255
 
240
- - All deliverable files written to skills_output_folder
241
- - All workspace artifacts written to forge_data_folder
242
- - Directory structure created correctly
256
+ - All deliverable files written to {skill_package}
257
+ - All workspace artifacts written to {forge_version}
258
+ - Directory structure created correctly with version nesting
259
+ - Active symlink created at {skill_group}/active -> {version}
243
260
  - Each file matches its template structure
244
261
  - Write summary displayed with accurate counts
245
262
 
@@ -55,17 +55,20 @@ Validate all written output files against their expected structure and verify co
55
55
 
56
56
  Check that all expected files exist from written_files[]:
57
57
 
58
- **Deliverables** (`{skills_output_folder}/{project_name}-stack/`):
58
+ **Deliverables** (`{skill_package}`):
59
59
  - [ ] SKILL.md
60
60
  - [ ] context-snippet.md
61
61
  - [ ] metadata.json
62
62
  - [ ] references/ directory with per-library files
63
63
  - [ ] references/integrations/ directory with pair files (if integrations detected)
64
64
 
65
- **Workspace** (`{forge_data_folder}/{project_name}-stack/`):
65
+ **Workspace** (`{forge_version}`):
66
66
  - [ ] provenance-map.json
67
67
  - [ ] evidence-report.md
68
68
 
69
+ **Symlink:**
70
+ - [ ] `{skill_group}/active` exists and resolves to `{version}`
71
+
69
72
  Record any missing files as **ERROR** findings.
70
73
 
71
74
  ### 2. Check Tool Availability
@@ -140,7 +143,7 @@ Record missing tier labels as **WARNING** findings.
140
143
  ### 8. Validate context-snippet.md
141
144
 
142
145
  Verify context-snippet.md follows Vercel-aligned indexed format:
143
- - [ ] First line matches: `[{project}-stack v{version}]|root: skills/{project}-stack/`
146
+ - [ ] First line matches: `[{project}-stack v{version}]|root: {prefix}{project}-stack/` where prefix is `skills/` or a platform root (`.claude/skills/`, `.cursor/skills/`, `.agents/skills/`)
144
147
  - [ ] Second line starts with `|IMPORTANT:`
145
148
  - [ ] Stack and integrations lines present
146
149
  - [ ] Approximate token count is ~80-120 tokens
@@ -74,16 +74,18 @@ Forge tier: **{tier}**"
74
74
 
75
75
  "**Output files:**
76
76
 
77
- **Deliverables** (`{skills_output_folder}/{project_name}-stack/`):
77
+ **Deliverables** (`{skill_package}`):
78
78
  - SKILL.md — Integration patterns, library summaries, conventions
79
79
  - context-snippet.md — Compressed stack index ({token_estimate} tokens)
80
80
  - metadata.json — Skill metadata and library registry
81
81
  - references/ — {lib_count} per-library reference files
82
82
  {If integrations:} - references/integrations/ — {pair_count} integration pair files
83
83
 
84
- **Workspace** (`{forge_data_folder}/{project_name}-stack/`):
84
+ **Workspace** (`{forge_version}`):
85
85
  - provenance-map.json — Extraction source tracking
86
- - evidence-report.md — Evidence and confidence breakdown"
86
+ - evidence-report.md — Evidence and confidence breakdown
87
+
88
+ **Symlink:** `{skill_group}/active` -> `{version}`"
87
89
 
88
90
  ### 4. Display Validation Summary
89
91