bmad-module-skill-forge 0.8.3 → 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 (75) hide show
  1. package/README.md +9 -4
  2. package/docs/bmad-synergy.md +183 -0
  3. package/docs/concepts.md +60 -2
  4. package/docs/examples.md +70 -17
  5. package/docs/getting-started.md +23 -1
  6. package/docs/how-it-works.md +143 -29
  7. package/docs/index.md +1 -1
  8. package/docs/workflows.md +45 -5
  9. package/package.json +1 -1
  10. package/src/README.md +47 -0
  11. package/src/agents/forger.agent.yaml +9 -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 +28 -4
  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 +17 -11
  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/installer.js +1 -0
  75. package/tools/cli/lib/ui.js +24 -2
@@ -0,0 +1,391 @@
1
+ ---
2
+ name: 'step-02-execute'
3
+ description: 'Execute the rename transactionally — copy, verify, then delete old'
4
+ nextStepFile: './step-03-report.md'
5
+ versionPathsKnowledge: '../../../knowledge/version-paths.md'
6
+ managedSectionLogic: '../../export-skill/data/managed-section-format.md'
7
+ ---
8
+
9
+ # Step 2: Execute Rename (Transactional)
10
+
11
+ ## STEP GOAL:
12
+
13
+ Execute the rename decisions recorded in step-01 as a transaction. Copy the old `{skill_group}` and `{forge_group}` to the new name, rename inner directories, rewrite every in-file reference, verify no trace of the old name remains inside the new location, update the export manifest, rebuild platform context files, and only then delete the old directories. Any failure before the final delete rolls back by removing the new directories — the old skill remains intact.
14
+
15
+ ## MANDATORY EXECUTION RULES (READ FIRST):
16
+
17
+ ### Universal Rules:
18
+
19
+ - 🛑 **NEVER** delete `{old_skill_group}` or `{old_forge_group}` until sections 1-7 have all succeeded
20
+ - 🛑 **NEVER** modify content outside `<!-- SKF:BEGIN/END -->` markers in platform context files
21
+ - 🛑 **NEVER** skip verification — the rename is not committed until section 5 passes
22
+ - 📖 CRITICAL: Read the complete step file before taking any action
23
+ - 🔄 CRITICAL: When loading next step, ensure entire file is read
24
+ - ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
25
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
26
+
27
+ ### Role Reinforcement:
28
+
29
+ - ✅ You are Ferris in Management mode — a transactional rename surgeon
30
+ - ✅ Copy-before-delete: the new name is fully materialized and verified before the old name is touched
31
+ - ✅ Every step before section 8 is reversible — on any failure, delete `{new_skill_group}` and `{new_forge_group}` and halt
32
+ - ✅ Surgical precision on platform context files: preserve all content outside `<!-- SKF:BEGIN/END -->` markers
33
+
34
+ ### Step-Specific Rules:
35
+
36
+ - 🎯 Execute sections strictly in order — each section depends on the previous one
37
+ - 🚫 FORBIDDEN to re-prompt the user — decisions were made in step-01
38
+ - 🚫 FORBIDDEN to delete anything from `{old_skill_group}` or `{old_forge_group}` before section 8
39
+ - 🚫 FORBIDDEN to proceed past a verification failure in section 5
40
+ - 💬 Report each section's outcome as it completes so the user sees progress
41
+
42
+ ## EXECUTION PROTOCOLS:
43
+
44
+ - 🎯 Re-read version-paths knowledge at the start to avoid drift between step files
45
+ - 💾 Hold a copy of the manifest in memory before modifying it so section 6 can roll back on failure
46
+ - 📖 Rebuild managed sections from the **updated** manifest (after section 6), not from memory
47
+ - 🚫 If any section before section 8 fails, execute the rollback procedure defined for that section and halt
48
+
49
+ ## CONTEXT BOUNDARIES:
50
+
51
+ - Available: Decisions from step-01 (`old_name`, `new_name`, `affected_versions`, `old_skill_group`, `new_skill_group`, `old_forge_group`, `new_forge_group`), SKF module config, version-paths knowledge, managed-section format
52
+ - Focus: Copy → rename inner dirs → rewrite files → verify → update manifest → rebuild context → delete old
53
+ - Limits: Only touch paths inside `{skills_output_folder}` and `{forge_data_folder}`; only modify content between `<!-- SKF:BEGIN/END -->` markers in platform context files
54
+ - Dependencies: Step-01 must have completed and stored all decisions in context
55
+
56
+ ## MANDATORY SEQUENCE
57
+
58
+ **CRITICAL:** This is transactional. After section 1 (copy), the old skill is untouched. If any section between 2 and 7 fails, delete `{new_skill_group}` and `{new_forge_group}`, report the failure, and halt — the old skill remains intact. Only section 8 (delete old) makes the operation irreversible. Do not skip, reorder, or improvise.
59
+
60
+ ### 0. Re-read Version-Paths Knowledge
61
+
62
+ Read `{versionPathsKnowledge}` again and confirm the templates (`{skill_package}`, `{skill_group}`, `{forge_version}`, `{forge_group}`) and the Rename section. Also read `{managedSectionLogic}` for the managed-section format template and the skill index rebuild rules that will be reused in section 7.
63
+
64
+ ### 1. Copy skill_group and forge_group
65
+
66
+ **Precondition:** Both `{new_skill_group}` and `{new_forge_group}` must NOT exist (step-01 validated this in the collision check, but verify again before copying).
67
+
68
+ 1. If `{new_skill_group}` or `{new_forge_group}` exists on disk, halt with: "**Collision detected at execution time.** `{new_skill_group}` or `{new_forge_group}` now exists on disk — it did not exist during step-01 selection. Aborting before any files are touched."
69
+
70
+ 2. Copy `{old_skill_group}` to `{new_skill_group}` recursively:
71
+ - Preserve file permissions, timestamps, and symlinks
72
+ - Equivalent to `cp -a {old_skill_group} {new_skill_group}` (preserves symlinks) or `cp -r` followed by explicit symlink re-creation in section 4
73
+ - If the copy fails: halt with "**Copy failed:** `{old_skill_group}` → `{new_skill_group}`: {error}. No files were modified. Old skill is intact."
74
+
75
+ 3. Copy `{old_forge_group}` to `{new_forge_group}` the same way:
76
+ - If the copy fails: **rollback** by deleting `{new_skill_group}` (just created in step 2), then halt with "**Copy failed:** `{old_forge_group}` → `{new_forge_group}`: {error}. Rolled back new skill_group. Old skill is intact."
77
+
78
+ **Rollback procedure for this section:** `rm -rf {new_skill_group}` and `rm -rf {new_forge_group}` (whichever exist). Old skill is untouched.
79
+
80
+ Report: "**Copied** `{old_skill_group}` → `{new_skill_group}` and `{old_forge_group}` → `{new_forge_group}`."
81
+
82
+ ### 2. Rename Inner Version Directories
83
+
84
+ For each version `v` in `affected_versions`:
85
+
86
+ 1. Resolve the old inner directory: `{new_skill_group}/{v}/{old_name}/`
87
+ 2. Resolve the new inner directory: `{new_skill_group}/{v}/{new_name}/`
88
+ 3. Rename the directory (move within the same parent): `mv {new_skill_group}/{v}/{old_name} {new_skill_group}/{v}/{new_name}`
89
+ 4. If the old inner directory does not exist (orphaned version with no skill package), skip with a warning recorded in `section2_warnings`
90
+
91
+ **Rollback on any rename failure:**
92
+
93
+ - `rm -rf {new_skill_group}` and `rm -rf {new_forge_group}`
94
+ - Halt with: "**Inner directory rename failed** at `{v}/{old_name}`: {error}. Rolled back both new directories. Old skill is intact."
95
+
96
+ Report: "**Renamed {count} inner directories** to `{new_name}/`."
97
+
98
+ ### 3. Update File Contents Inside the New Location
99
+
100
+ For each version `v` in `affected_versions`, operate on the files inside `{new_skill_group}/{v}/{new_name}/` (the freshly renamed inner directory) and `{new_forge_group}/{v}/`:
101
+
102
+ **3a. SKILL.md frontmatter:**
103
+
104
+ - Path: `{new_skill_group}/{v}/{new_name}/SKILL.md`
105
+ - In the YAML frontmatter (between the leading `---` markers), replace the `name:` field value from `{old_name}` to `{new_name}`
106
+ - Only replace within the frontmatter block — do not substitute matches inside the body text
107
+ - If the file is missing, record it in `section3_warnings` and continue
108
+
109
+ **3b. metadata.json:**
110
+
111
+ - Path: `{new_skill_group}/{v}/{new_name}/metadata.json`
112
+ - Parse the JSON, set `name` = `{new_name}`, write back preserving formatting
113
+ - If the file is missing, record it in `section3_warnings` and continue
114
+
115
+ **3c. context-snippet.md:**
116
+
117
+ - Path: `{new_skill_group}/{v}/{new_name}/context-snippet.md`
118
+ - Replace the display name header `[{old_name} v...]` → `[{new_name} v...]` (preserving the version suffix)
119
+ - Rewrite every `root:` path that references the old name to use the new name. This must handle both platform paths and draft paths:
120
+ - `root: .claude/skills/{old_name}/` → `root: .claude/skills/{new_name}/`
121
+ - `root: .cursor/skills/{old_name}/` → `root: .cursor/skills/{new_name}/`
122
+ - `root: .agents/skills/{old_name}/` → `root: .agents/skills/{new_name}/`
123
+ - `root: skills/{old_name}/` → `root: skills/{new_name}/` (draft form written by create-skill/quick-skill/create-stack-skill before first export)
124
+ - Legacy pre-fix form `root: skills/{old_name}/active/{old_name}/` (from older skills created before the create-skill template was corrected) → `root: skills/{new_name}/` (also normalize to flat form during rename)
125
+ - Any other `root:` prefix ending in `{old_name}/` → replace the `{old_name}/` segment with `{new_name}/`
126
+ - If the file is missing, record it in `section3_warnings` and continue
127
+
128
+ **3d. provenance-map.json:**
129
+
130
+ - Path: `{new_forge_group}/{v}/provenance-map.json`
131
+ - Parse JSON, set `skill_name` = `{new_name}`, write back preserving formatting
132
+ - If the file is missing (some versions may not have a provenance map), record it in `section3_warnings` and continue
133
+
134
+ **Rollback on any update failure (not just a missing file):**
135
+
136
+ - `rm -rf {new_skill_group}` and `rm -rf {new_forge_group}`
137
+ - Halt with: "**File update failed** at `{path}`: {error}. Rolled back both new directories. Old skill is intact."
138
+
139
+ Report: "**Updated file contents** across {affected_versions_count} version(s): SKILL.md, metadata.json, context-snippet.md, provenance-map.json."
140
+
141
+ ### 4. Fix the `active` Symlink in the New Location
142
+
143
+ Recreate or repair the `active` symlink in `{new_skill_group}`:
144
+
145
+ 1. Inspect `{old_skill_group}/active` to determine the target version (the value the symlink points to — typically just the version string, not an absolute path)
146
+ 2. Check `{new_skill_group}/active`:
147
+ - If the copy in section 1 preserved it correctly and it points to the same version string → leave it as-is
148
+ - If it exists but points somewhere invalid (e.g., an absolute path back into the old location) → remove and recreate it
149
+ - If it is missing (some copy tools do not preserve symlinks) → create it
150
+ 3. The symlink target should be a relative path: the version string alone (e.g., `0.6.0`), so that `{new_skill_group}/active/{new_name}/` resolves correctly
151
+
152
+ **Rollback on failure:**
153
+
154
+ - `rm -rf {new_skill_group}` and `rm -rf {new_forge_group}`
155
+ - Halt with: "**Failed to repair `active` symlink** in `{new_skill_group}`: {error}. Rolled back both new directories. Old skill is intact."
156
+
157
+ ### 5. Verify — No Trace of `{old_name}` Inside the New Location
158
+
159
+ This is the commit-point check. If any match is found, the rename is not safe to commit.
160
+
161
+ For every version `v` in `affected_versions`, grep (literal substring, case-sensitive) for `{old_name}` in:
162
+
163
+ - `{new_skill_group}/{v}/{new_name}/SKILL.md`
164
+ - `{new_skill_group}/{v}/{new_name}/metadata.json`
165
+ - `{new_skill_group}/{v}/{new_name}/context-snippet.md`
166
+ - `{new_forge_group}/{v}/provenance-map.json`
167
+
168
+ Also check the directory listing itself:
169
+
170
+ - `{new_skill_group}/{v}/` should contain `{new_name}/` and MUST NOT contain `{old_name}/`
171
+
172
+ **Important nuance:** body text of SKILL.md may legitimately mention the old name (e.g., historical notes, changelog, cross-references). The grep is allowed to match within SKILL.md body text ONLY if the match is clearly informational (surrounding prose, not a structural reference). For the purposes of this step, treat any match in `metadata.json`, `context-snippet.md`, `provenance-map.json`, or the SKILL.md frontmatter block as a hard failure. Matches inside the SKILL.md body below the closing `---` are recorded as `verification_warnings` but do not block the rename.
173
+
174
+ **On hard failure (any structural reference to `{old_name}` remains):**
175
+
176
+ - `rm -rf {new_skill_group}` and `rm -rf {new_forge_group}`
177
+ - Halt with: "**Verification failed.** `{old_name}` still appears in: {list of paths}. Rolled back both new directories. Old skill is intact."
178
+
179
+ Report: "**Verified** — no structural references to `{old_name}` remain inside the new location across {affected_versions_count} version(s). {if verification_warnings is non-empty: 'Informational body-text mentions retained in SKILL.md: {list}.'}"
180
+
181
+ ### 6. Update Export Manifest
182
+
183
+ **If `manifest_exists = false` (step-01 recorded no manifest on disk):**
184
+
185
+ Skip this section entirely. Set `manifest_updated = false` and `manifest_backup = null`. There is no manifest to re-key — the skill was never exported. Section 7 will find no platform context files to rebuild either (no manifest means no prior export, so no `<!-- SKF:BEGIN -->` markers exist), and any platform file that happens to be present will be left alone by the section 2 marker check.
186
+
187
+ Report: "**Manifest update skipped** — no `.export-manifest.json` on disk. The rename is a pure on-disk operation."
188
+
189
+ **If `manifest_exists = true`:**
190
+
191
+ 1. Load `{skills_output_folder}/.export-manifest.json`
192
+ 2. **Hold a deep copy in memory** as `manifest_backup` — required for rollback in this section and section 7 on failure
193
+ 3. If the manifest contains `exports.{old_name}`:
194
+ - Set `exports.{new_name}` = deep copy of `exports.{old_name}` (preserving `active_version`, `versions` map, and all fields)
195
+ - Delete `exports.{old_name}`
196
+ 4. If the manifest does NOT contain `exports.{old_name}` (the skill was on disk but never exported), skip the re-key — the manifest has nothing to change for this skill
197
+ 5. Write the updated manifest back to `{skills_output_folder}/.export-manifest.json`
198
+
199
+ **Rollback on write failure:**
200
+
201
+ - Restore the manifest from `manifest_backup` (write it back to disk)
202
+ - `rm -rf {new_skill_group}` and `rm -rf {new_forge_group}`
203
+ - Halt with: "**Manifest update failed:** {error}. Restored manifest from backup and rolled back new directories. Old skill is intact."
204
+
205
+ Set context flag `manifest_updated = true`.
206
+
207
+ Report: "**Manifest updated** — re-keyed `exports.{old_name}` → `exports.{new_name}`."
208
+
209
+ ### 7. Rebuild Platform Context Files
210
+
211
+ Load the `ides` list from `config.yaml`. The installer writes installer-specific IDE identifiers (e.g. `claude-code`, `github-copilot`, `codex`, `cline`, `roo`, `windsurf`, `cursor`, `other`), NOT platform values — these must be mapped to platforms before any target-file lookup.
212
+
213
+ **Resolve `target_platforms`** using the "IDE → Platform Mapping" table in `{managedSectionLogic}`:
214
+
215
+ 1. For each entry in `config.yaml.ides`, look up its platform value (`claude-code` → `claude`, `github-copilot` → `copilot`, `codex`/`cline`/`roo`/`windsurf`/`other` → `copilot`, `cursor` → `cursor`)
216
+ 2. For any entry not found in the table, default to `copilot` and emit a warning: "Unknown IDE '{value}' in config.yaml — defaulting to copilot"
217
+ 3. Deduplicate the resulting platform list (e.g. both `codex` and `cline` collapse to a single `copilot` entry)
218
+ 4. If `config.yaml.ides` is absent or the mapping yields an empty list, fall back to `["copilot"]` and emit a note: "No IDEs configured in config.yaml — defaulting to copilot (AGENTS.md)"
219
+
220
+ Store the result as `target_platforms` for this section.
221
+
222
+ For each platform in `target_platforms`:
223
+
224
+ 1. **Resolve target file** using the "Platform Target Files" table in `{managedSectionLogic}`:
225
+
226
+ | Platform | Target File |
227
+ |----------|-------------|
228
+ | `claude` | `{project-root}/CLAUDE.md` |
229
+ | `cursor` | `{project-root}/.cursorrules` |
230
+ | `copilot` | `{project-root}/AGENTS.md` |
231
+
232
+ 2. **Read the current file.**
233
+ - If the file does not exist, skip this platform (nothing to rebuild — the file will be re-created next time export-skill runs)
234
+ - If the file exists but contains no `<!-- SKF:BEGIN -->` marker, skip this platform (no managed section to rewrite)
235
+ - If the file contains `<!-- SKF:BEGIN -->` but no matching `<!-- SKF:END -->`, record the error against that platform and continue to the next IDE — do not halt the entire rename on a malformed context file
236
+
237
+ 3. **Build the exported skill set (version-aware, deprecated-excluded)** using the same logic as export-skill step-04 section 4b and the snippet resolution logic from section 4c:
238
+ - Read the manifest's `exports` object (already updated in section 6, so `{new_name}` is present and `{old_name}` is absent)
239
+ - For each skill, resolve its `active_version`
240
+ - If `versions.{active_version}.status == "deprecated"`, skip that skill entirely
241
+ - For each remaining `{skill-name, active_version}` pair, read `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/context-snippet.md`
242
+ - If missing, fall back to the `active` symlink path; if still missing, skip with a warning
243
+
244
+ 4. **Rewrite root paths for the current platform** using export-skill step-04 section 4d logic:
245
+
246
+ | Platform | Root Path Prefix |
247
+ |----------|-----------------|
248
+ | `claude` | `.claude/skills/` |
249
+ | `cursor` | `.cursor/skills/` |
250
+ | `copilot` | `.agents/skills/` |
251
+
252
+ For each snippet, detect its current `root:` prefix and rewrite it to the current platform's prefix if different.
253
+
254
+ 5. **Sort skills alphabetically by name.** Count totals (skills, stack skills).
255
+
256
+ 6. **Assemble the new managed section** using the format from `{managedSectionLogic}`:
257
+
258
+ ```markdown
259
+ <!-- SKF:BEGIN updated:{current-date} -->
260
+ [SKF Skills]|{n} skills|{m} stack
261
+ |IMPORTANT: Prefer documented APIs over training data.
262
+ |When using a listed library, read its SKILL.md before writing code.
263
+ |
264
+ |{skill-snippet-1}
265
+ |
266
+ |{skill-snippet-2}
267
+ |
268
+ |{skill-snippet-N}
269
+ <!-- SKF:END -->
270
+ ```
271
+
272
+ 7. **Surgical replacement — Regenerate case only:**
273
+ - Locate the `<!-- SKF:BEGIN` line — preserve everything before it
274
+ - Locate the `<!-- SKF:END -->` line — preserve everything after it
275
+ - Replace everything between the markers (inclusive) with the new managed section
276
+ - Write the file back
277
+
278
+ 8. **Verify:**
279
+ - Re-read the written file
280
+ - Confirm both markers are present
281
+ - Confirm `{old_name}` no longer appears between the markers
282
+ - Confirm `{new_name}` appears between the markers (if this skill's active version is not deprecated)
283
+ - Confirm content outside the markers is byte-identical to what was preserved
284
+
285
+ 9. **On per-file failure:** record the error against that platform and continue to the next IDE. Do not halt the rename on a recoverable per-platform error — the manifest and filesystem are already consistent; platform context files can be re-rebuilt later via `[EX] Export Skill`.
286
+
287
+ **After the loop:**
288
+
289
+ - Record `platform_files_updated` as the list of files that were successfully rewritten
290
+ - Record `platform_files_failed` as the list of any that failed
291
+
292
+ Report: "**Rebuilt managed sections in:** {list of updated files}. {if any failed: 'Failed: {list} — re-run `[EX] Export Skill` to retry.'}"
293
+
294
+ **Note:** Section 7 failures do not trigger a rollback because the manifest and filesystem are the canonical state. Platform context files are derived artifacts that can be regenerated at any time.
295
+
296
+ ### 8. Delete Old Directories (Point of No Return)
297
+
298
+ This is the only section after which rollback is impossible. By this point:
299
+
300
+ - `{new_skill_group}` is fully materialized with all inner directories renamed and files updated
301
+ - `{new_forge_group}` is fully materialized with `skill_name` updated in every provenance map
302
+ - No structural references to `{old_name}` remain inside either new directory (verified in section 5)
303
+ - The manifest has been re-keyed (section 6)
304
+ - Platform context files reference `{new_name}` (section 7, best-effort)
305
+
306
+ Execute the deletes:
307
+
308
+ 1. Verify `{old_skill_group}` is inside `{skills_output_folder}` (defense in depth)
309
+ 2. `rm -rf {old_skill_group}` — delete the old skill_group recursively
310
+ 3. Verify deletion succeeded (the path no longer exists)
311
+ 4. Verify `{old_forge_group}` is inside `{forge_data_folder}` (defense in depth)
312
+ 5. `rm -rf {old_forge_group}` — delete the old forge_group recursively
313
+ 6. Verify deletion succeeded
314
+
315
+ **On deletion error:**
316
+
317
+ - Record the error in `deletion_errors` against the specific path
318
+ - Continue attempting the other path — partial cleanup is still better than none
319
+ - Do NOT attempt any rollback — the new name is already committed and the old name's remnants can be removed manually
320
+
321
+ Report: "**Deleted old directories:** `{old_skill_group}` and `{old_forge_group}`. {if deletion_errors is non-empty: 'Errors: {list} — remove manually with `rm -rf {path}`.'}"
322
+
323
+ ### 9. Store Results in Context
324
+
325
+ Store the following for step-03:
326
+
327
+ - `old_name` — the previous skill name
328
+ - `new_name` — the new skill name
329
+ - `affected_versions` — list of versions that were renamed
330
+ - `affected_versions_count` — integer count
331
+ - `files_updated_per_version` — structured summary (SKILL.md, metadata.json, context-snippet.md, provenance-map.json — each with ×count)
332
+ - `manifest_rekeyed` — boolean (true if section 6 succeeded)
333
+ - `platform_files_updated` — list of successfully rebuilt files
334
+ - `platform_files_failed` — list of files that failed to rebuild (empty if none)
335
+ - `section2_warnings` — list of orphaned version warnings (empty if none)
336
+ - `section3_warnings` — list of missing file warnings (empty if none)
337
+ - `verification_warnings` — list of informational SKILL.md body mentions of `{old_name}` retained (empty if none)
338
+ - `deletion_errors` — list of post-commit deletion errors (empty if none)
339
+
340
+ ### 10. Load Next Step
341
+
342
+ Load, read the full file, and then execute `{nextStepFile}`.
343
+
344
+ ## Error Handling Summary
345
+
346
+ | Section | Failure Mode | Reversible? | Recovery Action |
347
+ |---------|--------------|-------------|-----------------|
348
+ | 1 | Copy failure | Yes | Delete whichever new directory exists; old skill intact |
349
+ | 2 | Inner rename failure | Yes | `rm -rf` both new directories; old skill intact |
350
+ | 3 | File update failure | Yes | `rm -rf` both new directories; old skill intact |
351
+ | 4 | `active` symlink repair failure | Yes | `rm -rf` both new directories; old skill intact |
352
+ | 5 | Verification failure | Yes | `rm -rf` both new directories; old skill intact |
353
+ | 6 | Manifest write failure | Yes | Restore manifest from backup; `rm -rf` both new directories; old skill intact |
354
+ | 7 | Platform context rebuild failure | Per-file | Record errors, continue other platforms; do NOT rollback — manifest and disk are canonical |
355
+ | 8 | Delete failure | **No** | Record deletion errors; new name is already committed; user removes remnants manually |
356
+
357
+ ## CRITICAL STEP COMPLETION NOTE
358
+
359
+ ONLY WHEN all execution sections have been attempted (copy, inner rename, file updates, symlink fix, verification, manifest re-key, context rebuild, old delete) and results have been stored in context, will you then load and read fully `{nextStepFile}` to generate the final report.
360
+
361
+ ---
362
+
363
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
364
+
365
+ ### ✅ SUCCESS:
366
+
367
+ - Version-paths knowledge and managed-section format re-read at the start of the step
368
+ - `{new_skill_group}` and `{new_forge_group}` copied from the old paths with symlinks preserved
369
+ - Inner version directories renamed from `{old_name}/` to `{new_name}/` across every affected version
370
+ - SKILL.md frontmatter, metadata.json, context-snippet.md (display name + root paths), and provenance-map.json updated across every version
371
+ - `active` symlink in the new location points to the correct version
372
+ - Verification grep confirms no structural references to `{old_name}` remain inside the new directories
373
+ - Export manifest re-keyed from `exports.{old_name}` to `exports.{new_name}` preserving `active_version` and `versions` map
374
+ - Platform context files rebuilt from the updated manifest using export-skill step-04 logic with surgical marker replacement
375
+ - Old `{skill_group}` and `{forge_group}` deleted only after all previous sections succeeded
376
+ - All failures before section 8 trigger a full rollback; failures in section 8 are recorded for manual cleanup
377
+ - All results stored in context for step-03
378
+
379
+ ### ❌ SYSTEM FAILURE:
380
+
381
+ - Deleting any part of `{old_skill_group}` or `{old_forge_group}` before section 8
382
+ - Proceeding past a verification failure in section 5 instead of rolling back
383
+ - Failing to restore the manifest from backup after a write failure in section 6
384
+ - Rewriting content outside `<!-- SKF:BEGIN/END -->` markers in platform context files
385
+ - Rebuilding managed sections from the pre-update manifest instead of the re-keyed one
386
+ - Leaving structural references to `{old_name}` inside `{new_skill_group}` or `{new_forge_group}`
387
+ - Hardcoding paths instead of using `{skill_package}`, `{skill_group}`, `{forge_version}`, `{forge_group}` templates
388
+ - Halting the entire workflow on a recoverable per-platform error in section 7
389
+ - Not storing results in context for step-03
390
+
391
+ **Master Rule:** The rename is transactional. Copy-before-delete is inviolable. Every section before section 8 must have a concrete rollback procedure, and rollback must be executed on failure without exception. The old skill is canonical until the new name is fully verified.
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: 'step-03-report'
3
+ description: 'Report rename operation results'
4
+ ---
5
+
6
+ # Step 3: Report Rename Results
7
+
8
+ ## STEP GOAL:
9
+
10
+ Present a clear, final summary of what the rename workflow changed — old and new names, versions renamed, file-level update counts, manifest re-key, platform context rebuild, and any residual warnings or deletion errors — so the user can verify the outcome and know whether any manual follow-up is required.
11
+
12
+ ## MANDATORY EXECUTION RULES (READ FIRST):
13
+
14
+ ### Universal Rules:
15
+
16
+ - 🛑 NEVER modify any files in this step — report only
17
+ - 📖 CRITICAL: Read the complete step file before taking any action
18
+ - 📋 YOU ARE A FACILITATOR, summarizing what step-02 already executed
19
+ - ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
20
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
21
+
22
+ ### Role Reinforcement:
23
+
24
+ - ✅ You are Ferris in Management mode — summarizing a transactional rename with precision
25
+ - ✅ Be explicit about what changed and what did not — no glossing over partial failures
26
+ - ✅ Surface every warning and deletion error so the user knows exactly where manual cleanup is required
27
+
28
+ ### Step-Specific Rules:
29
+
30
+ - 🎯 Focus only on reporting the results stored in context by step-02
31
+ - 🚫 FORBIDDEN to re-execute any part of the rename
32
+ - 🚫 FORBIDDEN to hide verification warnings, platform rebuild failures, or deletion errors
33
+ - 💬 Present the "next steps" guidance so the user knows which downstream workflows to run
34
+
35
+ ## EXECUTION PROTOCOLS:
36
+
37
+ - 🎯 Render the report using the context values set in step-02 (`old_name`, `new_name`, `affected_versions`, `affected_versions_count`, `files_updated_per_version`, `manifest_rekeyed`, `platform_files_updated`, `platform_files_failed`, `section2_warnings`, `section3_warnings`, `verification_warnings`, `deletion_errors`)
38
+ - 💬 Include the "next steps" block unconditionally — it captures the common follow-ups for any rename
39
+
40
+ ## CONTEXT BOUNDARIES:
41
+
42
+ - Available: All decision and result values stored in context by step-01 and step-02
43
+ - Focus: Rendering the final report
44
+ - Limits: No file writes, no deletions, no further execution
45
+ - Dependencies: Step-02 must have completed (or attempted all sections through section 8) and stored its results
46
+
47
+ ## MANDATORY SEQUENCE
48
+
49
+ **CRITICAL:** Follow this sequence exactly.
50
+
51
+ ### 1. Render the Report
52
+
53
+ Display the following block, filling in values from context:
54
+
55
+ ```
56
+ **Rename complete.**
57
+
58
+ From: {old_name}
59
+ To: {new_name}
60
+
61
+ Versions renamed: {affected_versions_count} ({comma-separated affected_versions})
62
+
63
+ References updated:
64
+ - SKILL.md frontmatter (×{affected_versions_count})
65
+ - metadata.json (×{affected_versions_count})
66
+ - context-snippet.md (×{affected_versions_count})
67
+ - provenance-map.json (×{affected_versions_count})
68
+
69
+ Manifest updated: {if manifest_rekeyed: "exports.{new_name} (re-keyed from exports.{old_name})" else: "(no manifest entry existed for {old_name})"}
70
+ Platform files rebuilt: {list from platform_files_updated, or "(none)"}
71
+ {if platform_files_failed is non-empty:}
72
+ Platform files FAILED: {list from platform_files_failed}
73
+ → Re-run `[EX] Export Skill` to retry the managed section rebuild for these files.
74
+
75
+ {if section2_warnings is non-empty:}
76
+ Warnings (inner directory rename):
77
+ {list each warning from section2_warnings}
78
+
79
+ {if section3_warnings is non-empty:}
80
+ Warnings (missing files during content update):
81
+ {list each warning from section3_warnings}
82
+
83
+ {if verification_warnings is non-empty:}
84
+ Informational: the old name still appears in SKILL.md body text (prose only, non-structural) in:
85
+ {list each path from verification_warnings}
86
+ → These are typically historical notes or changelog entries. Review and edit manually if you want them updated.
87
+
88
+ {if deletion_errors is non-empty:}
89
+ **Post-commit deletion errors:**
90
+ {list each error}
91
+ → The new name is fully committed. Remove the remnants manually with `rm -rf {path}`.
92
+
93
+ ---
94
+
95
+ **Next steps:**
96
+ - Run `@Ferris EX` if you want to re-verify the managed sections in platform context files
97
+ - If you had QMD collections or external tooling registered under `{old_name}`, re-run `@Ferris SF` (or your registration command) to re-index under `{new_name}`
98
+ - If this skill was published to agentskills.io under `{old_name}`, the registry version is unchanged — this rename is a LOCAL operation only
99
+ ```
100
+
101
+ ### 2. Close the Workflow
102
+
103
+ After rendering the report, the workflow is complete. Do not load any further step file — there is no `nextStepFile`.
104
+
105
+ ## CRITICAL STEP COMPLETION NOTE
106
+
107
+ This is the final step. Once the report has been rendered, the rename-skill workflow is finished. Do not re-run any earlier step automatically — if the user wants another rename, they should re-invoke the workflow from the top.
108
+
109
+ ---
110
+
111
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
112
+
113
+ ### ✅ SUCCESS:
114
+
115
+ - Report rendered with old name, new name, and affected version list
116
+ - Per-file update counts stated explicitly (SKILL.md, metadata.json, context-snippet.md, provenance-map.json)
117
+ - Manifest re-key outcome clearly stated
118
+ - Platform files rebuilt listed (and failures surfaced when present)
119
+ - All warning categories surfaced (inner rename, missing files, informational body-text mentions)
120
+ - Post-commit deletion errors surfaced with manual cleanup guidance
121
+ - Next-steps block included unconditionally
122
+ - No further file writes or executions performed
123
+
124
+ ### ❌ SYSTEM FAILURE:
125
+
126
+ - Hiding failed platform rebuilds, verification warnings, or deletion errors
127
+ - Reporting "complete" when step-02 partially failed without flagging it
128
+ - Re-executing any part of the rename workflow
129
+ - Omitting the next-steps guidance
130
+ - Reading stale context values instead of the post-rename state stored by step-02
131
+
132
+ **Master Rule:** The report must be an honest, complete summary of what step-02 actually did. Every partial failure must be visible so the user knows exactly what manual follow-up, if any, is required.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: rename-skill
3
+ description: "Rename a skill and all its versions. Transactional — copy, verify, then delete the old name. Rebuilds platform context files."
4
+ web_bundle: true
5
+ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/rename-skill'
6
+ ---
7
+
8
+ # Rename Skill
9
+
10
+ **Goal:** Rename a skill across all its versions with transactional safety — copy to the new name, verify all references updated, delete the old name only after verification succeeds. Rebuilds platform context files to reference the new name.
11
+
12
+ **Your Role:** In addition to your name, communication_style, and persona, you are also Ferris in Management mode — a precision surgeon who operates on the entire skill group atomically. The agentskills.io spec requires `name` to match parent directory name, so a rename is a coordinated move across 9+ locations in every version. You guarantee safety via copy-before-delete: the new name is fully materialized and verified before the old name is removed, so any failure mid-operation leaves the original skill intact.
13
+
14
+ ---
15
+
16
+ ## WORKFLOW ARCHITECTURE
17
+
18
+ This uses **step-file architecture** for disciplined execution:
19
+
20
+ ### Core Principles
21
+
22
+ - **Micro-file Design**: Each step is a self-contained instruction file that is a part of an overall workflow that must be followed exactly
23
+ - **Just-In-Time Loading**: Only the current step file is in memory — never load future step files until told to do so
24
+ - **Sequential Enforcement**: Sequence within the step files must be completed in order, no skipping or optimization allowed
25
+ - **Transactional Safety**: Copy-verify-delete pattern — the new name is fully materialized and verified before the old name is removed. Any failure before the final delete stage is fully reversible by deleting the new name.
26
+ - **Manifest-Driven Truth**: The export manifest is the source of truth for what exists and what is active; the filesystem and the manifest are updated together and must end in a consistent state
27
+
28
+ ### Step Processing Rules
29
+
30
+ 1. **READ COMPLETELY**: Always read the entire step file before taking any action
31
+ 2. **FOLLOW SEQUENCE**: Execute all numbered sections in order, never deviate
32
+ 3. **WAIT FOR INPUT**: If a menu is presented, halt and wait for user selection
33
+ 4. **CHECK CONTINUATION**: If the step has a menu with Continue as an option, only proceed to next step when user selects 'C' (Continue)
34
+ 5. **LOAD NEXT**: When directed, load, read entire file, then execute the next step file
35
+
36
+ ### Critical Rules (NO EXCEPTIONS)
37
+
38
+ - 🛑 **NEVER** load multiple step files simultaneously
39
+ - 📖 **ALWAYS** read entire step file before execution
40
+ - 🚫 **NEVER** skip steps or optimize the sequence
41
+ - 🎯 **ALWAYS** follow the exact instructions in the step file
42
+ - ⏸️ **ALWAYS** halt at menus and wait for user input
43
+ - 📋 **NEVER** create mental todo lists from future steps
44
+ - ⚙️ **TOOL/SUBPROCESS FALLBACK**: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
45
+ - 🛡️ **NEVER** delete the old skill directories until the new name has been fully materialized and verified
46
+ - 🛡️ **NEVER** proceed past a verification failure — roll back (delete the new directories) and halt
47
+ - 🛡️ **NEVER** allow a rename to collide with an existing skill name
48
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
49
+
50
+ ---
51
+
52
+ ## INITIALIZATION SEQUENCE
53
+
54
+ ### 1. Module Configuration Loading
55
+
56
+ Load and read full config from {project-root}/_bmad/skf/config.yaml and resolve:
57
+
58
+ - `project_name`, `output_folder`, `user_name`, `communication_language`, `document_output_language`
59
+ - `skills_output_folder`, `forge_data_folder`, `sidecar_path`
60
+ - Generate and store `timestamp` as the current date-time in `YYYYMMDD-HHmmss` format. This value is fixed for the entire workflow run and must not be regenerated in subsequent steps.
61
+
62
+ ### 2. First Step Execution
63
+
64
+ Load, read the full file and then execute `./steps-c/step-01-select.md` to begin the workflow.
@@ -3,7 +3,7 @@ name: 'step-01-init'
3
3
  description: 'Discover skill, load forge tier state, validate inputs, create test report'
4
4
 
5
5
  nextStepFile: './step-02-detect-mode.md'
6
- outputFile: '{forge_data_folder}/{skill_name}/test-report-{skill_name}.md'
6
+ outputFile: '{forge_version}/test-report-{skill_name}.md'
7
7
  templateFile: '../templates/test-report-template.md'
8
8
  sidecarFile: '{sidecar_path}/forge-tier.yaml'
9
9
  skillsOutputFolder: '{skills_output_folder}'
@@ -69,16 +69,24 @@ Provide the skill path or name. I'll search in `{skillsOutputFolder}`.
69
69
 
70
70
  **Path or name:**"
71
71
 
72
- ### 2. Validate Skill Exists
72
+ ### 2. Validate Skill Exists (version-aware)
73
73
 
74
- Check that the skill directory contains required files:
74
+ Resolve the skill path using version-aware resolution (see [knowledge/version-paths.md](../../../knowledge/version-paths.md)):
75
+
76
+ 1. Read `{skillsOutputFolder}/.export-manifest.json` and look up the skill name in `exports` to get `active_version`
77
+ 2. If found: resolve to `{skill_package}` = `{skillsOutputFolder}/{skill_name}/{active_version}/{skill_name}/`
78
+ 3. If not in manifest: check for `active` symlink at `{skillsOutputFolder}/{skill_name}/active` — resolve to `{skill_group}/active/{skill_name}/`
79
+ 4. If neither: fall back to flat path `{skillsOutputFolder}/{skill_name}/`. If SKILL.md exists at the flat path, auto-migrate per `knowledge/version-paths.md` migration rules
80
+ 5. Store the resolved path as `{resolved_skill_package}`
81
+
82
+ Check that the skill package contains required files:
75
83
 
76
84
  **Required files:**
77
- - `{skillsOutputFolder}/{skill_name}/SKILL.md` — the skill documentation
78
- - `{skillsOutputFolder}/{skill_name}/metadata.json` — skill metadata
85
+ - `{resolved_skill_package}/SKILL.md` — the skill documentation
86
+ - `{resolved_skill_package}/metadata.json` — skill metadata
79
87
 
80
88
  **If SKILL.md missing:**
81
- "**Error: SKILL.md not found at `{skillsOutputFolder}/{skill_name}/SKILL.md`**
89
+ "**Error: SKILL.md not found at `{resolved_skill_package}/SKILL.md`**
82
90
 
83
91
  This skill has not been created yet. Run the **create-skill** workflow first."
84
92
 
@@ -116,11 +124,9 @@ Read `{sidecarFile}` to determine available analysis depth.
116
124
  - Read tool availability flags (ast_grep, gh_cli, qmd)
117
125
 
118
126
  **If forge-tier.yaml missing:**
119
- "**Warning:** Forge tier not detected. Defaulting to **Quick** tier (structural checks only).
127
+ "**Cannot proceed.** forge-tier.yaml not found at `{sidecarFile}`. Please run the **setup-forge** workflow first to configure your forge tier (Quick/Forge/Forge+/Deep)."
120
128
 
121
- Run **setup-forge** to enable deeper analysis with AST-backed verification."
122
-
123
- Default to Quick tier and continue.
129
+ HALT do not proceed.
124
130
 
125
131
  ### 4b. Apply Tier Override (if set)
126
132
 
@@ -194,7 +200,7 @@ ONLY WHEN all required files are validated, forge tier is loaded, output documen
194
200
  ### ✅ SUCCESS:
195
201
 
196
202
  - Skill path validated (SKILL.md exists)
197
- - Forge tier state loaded (or gracefully defaulted to Quick), override applied if set in preferences.yaml
203
+ - Forge tier state loaded (HALT if missing), override applied if set in preferences.yaml
198
204
  - Skill metadata extracted
199
205
  - Output document created from template with initial frontmatter
200
206
  - Initialization status reported clearly
@@ -3,7 +3,7 @@ name: 'step-02-detect-mode'
3
3
  description: 'Determine naive (individual) vs contextual (stack) testing mode'
4
4
 
5
5
  nextStepFile: './step-03-coverage-check.md'
6
- outputFile: '{forge_data_folder}/{skill_name}/test-report-{skill_name}.md'
6
+ outputFile: '{forge_version}/test-report-{skill_name}.md'
7
7
  ---
8
8
 
9
9
  # Step 2: Detect Mode