bmad-module-skill-forge 0.8.4 → 0.10.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 (82) 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/module.yaml +4 -0
  20. package/src/workflows/README.md +9 -1
  21. package/src/workflows/analyze-source/data/skill-brief-schema.md +4 -0
  22. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +5 -0
  23. package/src/workflows/audit-skill/steps-c/step-01-init.md +10 -6
  24. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +1 -1
  25. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +1 -1
  26. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +1 -1
  27. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +1 -1
  28. package/src/workflows/audit-skill/steps-c/step-06-report.md +7 -2
  29. package/src/workflows/brief-skill/data/skill-brief-schema.md +11 -0
  30. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +24 -1
  31. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +10 -0
  32. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +9 -0
  33. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +18 -4
  34. package/src/workflows/create-skill/data/skill-sections.md +2 -0
  35. package/src/workflows/create-skill/data/source-resolution-protocols.md +40 -4
  36. package/src/workflows/create-skill/steps-c/step-03-extract.md +1 -1
  37. package/src/workflows/create-skill/steps-c/step-05-compile.md +1 -0
  38. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +48 -32
  39. package/src/workflows/create-skill/steps-c/step-08-report.md +16 -12
  40. package/src/workflows/create-stack-skill/data/compose-mode-rules.md +12 -6
  41. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +4 -1
  42. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +11 -5
  43. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +1 -1
  44. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +1 -1
  45. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +40 -23
  46. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +6 -3
  47. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +11 -4
  48. package/src/workflows/drop-skill/steps-c/step-01-select.md +298 -0
  49. package/src/workflows/drop-skill/steps-c/step-02-execute.md +290 -0
  50. package/src/workflows/drop-skill/steps-c/step-03-report.md +136 -0
  51. package/src/workflows/drop-skill/workflow.md +63 -0
  52. package/src/workflows/export-skill/data/managed-section-format.md +33 -8
  53. package/src/workflows/export-skill/data/snippet-format.md +16 -4
  54. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +46 -7
  55. package/src/workflows/export-skill/steps-c/step-02-package.md +2 -2
  56. package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +39 -7
  57. package/src/workflows/export-skill/steps-c/step-04-update-context.md +185 -13
  58. package/src/workflows/export-skill/steps-c/step-05-token-report.md +2 -2
  59. package/src/workflows/export-skill/steps-c/step-06-summary.md +35 -8
  60. package/src/workflows/quick-skill/steps-c/step-01-resolve-target.md +10 -0
  61. package/src/workflows/quick-skill/steps-c/step-03-quick-extract.md +2 -0
  62. package/src/workflows/quick-skill/steps-c/step-05-validate.md +1 -1
  63. package/src/workflows/quick-skill/steps-c/step-06-write.md +36 -21
  64. package/src/workflows/refine-architecture/steps-c/step-01-init.md +8 -3
  65. package/src/workflows/refine-architecture/steps-c/step-06-report.md +7 -4
  66. package/src/workflows/rename-skill/steps-c/step-01-select.md +281 -0
  67. package/src/workflows/rename-skill/steps-c/step-02-execute.md +391 -0
  68. package/src/workflows/rename-skill/steps-c/step-03-report.md +133 -0
  69. package/src/workflows/rename-skill/workflow.md +64 -0
  70. package/src/workflows/setup-forge/steps-c/step-04-report.md +8 -5
  71. package/src/workflows/shared/health-check.md +231 -0
  72. package/src/workflows/test-skill/steps-c/step-01-init.md +14 -6
  73. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +1 -1
  74. package/src/workflows/test-skill/steps-c/step-06-report.md +4 -3
  75. package/src/workflows/update-skill/data/remote-source-resolution.md +18 -4
  76. package/src/workflows/update-skill/steps-c/step-01-init.md +15 -8
  77. package/src/workflows/update-skill/steps-c/step-06-write.md +43 -13
  78. package/src/workflows/update-skill/steps-c/step-07-report.md +13 -8
  79. package/src/workflows/verify-stack/steps-c/step-01-init.md +8 -3
  80. package/src/workflows/verify-stack/steps-c/step-06-report.md +6 -3
  81. package/tools/cli/lib/compiler.js +1 -1
  82. package/tools/cli/lib/ui.js +24 -2
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: 'step-06-write'
3
3
  description: 'Write output files to skills folder and display completion summary'
4
+ nextStepFile: '../../shared/health-check.md'
4
5
  ---
5
6
 
6
7
  # Step 6: Write Output
@@ -35,16 +36,17 @@ To write the compiled SKILL.md, context-snippet.md, and metadata.json to the ski
35
36
  ## EXECUTION PROTOCOLS:
36
37
 
37
38
  - 🎯 Follow the MANDATORY SEQUENCE exactly
38
- - 💾 Write three files to {skills_output_folder}/{repo_name}/
39
+ - 💾 Write three files to `{skill_package}` and create the `active` symlink
39
40
  - 📖 File I/O required for directory creation and file writing
40
- - 🚫 This is the final step — no next step to load
41
+ - 🚫 After writing files, chains to shared health check — no further steps after that
41
42
 
42
43
  ## CONTEXT BOUNDARIES:
43
44
 
44
45
  - Previous steps provided: skill_content, context_snippet, metadata_json, validation_result
45
46
  - Also available: resolved_url, repo_name, language, skills_output_folder
46
47
  - Focus: file writing and completion only
47
- - This is the FINAL stepworkflow ends here
48
+ - Chains to shared health check after completion no further steps after that
49
+ - Path resolution: See `knowledge/version-paths.md` for canonical path templates. Quick-skill uses `{repo_name}` as the skill name and defaults `{version}` to `1.0.0` if not detected from the extraction inventory
48
50
 
49
51
  ## MANDATORY SEQUENCE
50
52
 
@@ -52,15 +54,16 @@ To write the compiled SKILL.md, context-snippet.md, and metadata.json to the ski
52
54
 
53
55
  ### 1. Create Output Directory
54
56
 
55
- Create the skill output directory:
57
+ Resolve `{version}` from the extraction inventory's detected version, defaulting to `1.0.0` if not detected. Create the skill output directories:
56
58
 
57
59
  ```
58
- {skills_output_folder}/{repo_name}/
60
+ {skill_group} # {skills_output_folder}/{repo_name}/
61
+ {skill_package} # {skills_output_folder}/{repo_name}/{version}/{repo_name}/
59
62
  ```
60
63
 
61
- If directory already exists, confirm with user before overwriting:
64
+ If `{skill_package}` already exists, confirm with user before overwriting:
62
65
 
63
- "**Directory `{skills_output_folder}/{repo_name}/` already exists.** Overwrite existing files? [Y/N]"
66
+ "**Directory `{skill_package}` already exists.** Overwrite existing files? [Y/N]"
64
67
 
65
68
  - **If user selects Y:** Proceed to section 2.
66
69
  - **If user selects N:** Halt with: "Overwrite cancelled. Existing skill preserved. Run [QS] with a different skill name or remove the existing directory manually."
@@ -70,7 +73,7 @@ If directory already exists, confirm with user before overwriting:
70
73
  Write the compiled SKILL.md content to:
71
74
 
72
75
  ```
73
- {skills_output_folder}/{repo_name}/SKILL.md
76
+ {skill_package}/SKILL.md
74
77
  ```
75
78
 
76
79
  Confirm: "Written: SKILL.md"
@@ -80,7 +83,7 @@ Confirm: "Written: SKILL.md"
80
83
  Write the context snippet to:
81
84
 
82
85
  ```
83
- {skills_output_folder}/{repo_name}/context-snippet.md
86
+ {skill_package}/context-snippet.md
84
87
  ```
85
88
 
86
89
  Confirm: "Written: context-snippet.md"
@@ -90,11 +93,23 @@ Confirm: "Written: context-snippet.md"
90
93
  Write the metadata JSON to:
91
94
 
92
95
  ```
93
- {skills_output_folder}/{repo_name}/metadata.json
96
+ {skill_package}/metadata.json
94
97
  ```
95
98
 
96
99
  Confirm: "Written: metadata.json"
97
100
 
101
+ ### 4b. Create Active Symlink
102
+
103
+ Create or update the `active` symlink at `{skill_group}/active` pointing to `{version}`:
104
+
105
+ ```
106
+ {skill_group}/active -> {version}
107
+ ```
108
+
109
+ If the symlink already exists, remove it first and recreate.
110
+
111
+ Confirm: "Symlink: {skill_group}/active -> {version}"
112
+
98
113
  ### 5. Handle Write Failures
99
114
 
100
115
  **If any file write fails — HARD HALT:**
@@ -112,16 +127,17 @@ Please check:
112
127
 
113
128
  "**Quick Skill complete.**
114
129
 
115
- **Skill:** {repo_name}
130
+ **Skill:** {repo_name} v{version}
116
131
  **Language:** {language}
117
132
  **Source:** {resolved_url}
118
133
  **Authority:** community
119
134
  **Confidence:** {extraction confidence}
120
135
 
121
136
  **Files written:**
122
- - `{skills_output_folder}/{repo_name}/SKILL.md`
123
- - `{skills_output_folder}/{repo_name}/context-snippet.md`
124
- - `{skills_output_folder}/{repo_name}/metadata.json`
137
+ - `{skill_package}/SKILL.md`
138
+ - `{skill_package}/context-snippet.md`
139
+ - `{skill_package}/metadata.json`
140
+ - `{skill_group}/active` -> `{version}`
125
141
 
126
142
  **Exports documented:** {count}
127
143
  **Validation:** {pass / N issues (advisory)}
@@ -135,11 +151,9 @@ Please check:
135
151
 
136
152
  **Note:** This is a best-effort community skill. For deeper analysis with AST-verified exports and provenance tracking, use the full **create-skill** workflow with a skill brief."
137
153
 
138
- ### 7. End Workflow
139
-
140
- This is the final step. The workflow is complete.
154
+ ### 7. Workflow Health Check
141
155
 
142
- No next step to load. Session ends here.
156
+ Load and execute `{nextStepFile}` for workflow self-improvement check.
143
157
 
144
158
  ---
145
159
 
@@ -147,8 +161,9 @@ No next step to load. Session ends here.
147
161
 
148
162
  ### ✅ SUCCESS:
149
163
 
150
- - Output directory created (or overwrite confirmed)
151
- - All three files written successfully
164
+ - Output directory created (or overwrite confirmed) with version-nested structure
165
+ - All three files written successfully to {skill_package}
166
+ - Active symlink created at {skill_group}/active -> {version}
152
167
  - Completion summary displayed with file paths
153
168
  - Next step recommendations provided
154
169
  - Workflow ends cleanly
@@ -158,6 +173,6 @@ No next step to load. Session ends here.
158
173
  - Modifying content during write (write exactly what was compiled)
159
174
  - Not handling write failures with hard halt
160
175
  - Not displaying completion summary
161
- - Attempting to load a next step (this is final)
176
+ - Attempting to load steps beyond the shared health check
162
177
 
163
178
  **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -74,9 +74,14 @@ Wait for user input. Store the validated architecture document path as `architec
74
74
 
75
75
  ### 2. Scan Skills Folder
76
76
 
77
- Read the `{skills_output_folder}` directory.
77
+ Read the `{skills_output_folder}` directory. Skills use a version-nested directory structure (see [knowledge/version-paths.md](../../../knowledge/version-paths.md)).
78
78
 
79
- For each subdirectory, check for the presence of `SKILL.md` and `metadata.json`.
79
+ **Version-aware skill discovery:**
80
+ 1. Read `{skills_output_folder}/.export-manifest.json` if it exists. For each skill in `exports`, use `active_version` to resolve `{skill_package}` = `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/`
81
+ 2. For any subdirectory not covered by the manifest, check for an `active` symlink at `{skills_output_folder}/{dir_name}/active` — resolve to `{skill_group}/active/{dir_name}/`
82
+ 3. Fall back to flat path `{skills_output_folder}/{dir_name}/` for unmigrated skills
83
+
84
+ For each resolved skill package, check for the presence of `SKILL.md` and `metadata.json`.
80
85
 
81
86
  **For each valid skill directory, extract from metadata.json:**
82
87
  - `name` — skill name
@@ -87,7 +92,7 @@ For each subdirectory, check for the presence of `SKILL.md` and `metadata.json`.
87
92
 
88
93
  **Build a skill inventory** as an internal list of all loaded skills with the fields above.
89
94
 
90
- **If a subdirectory lacks SKILL.md or metadata.json:**
95
+ **If a resolved skill package lacks SKILL.md or metadata.json:**
91
96
  - Log: "Skipping `{dir_name}` — missing SKILL.md or metadata.json"
92
97
  - Do not include in inventory
93
98
 
@@ -3,13 +3,14 @@ name: 'step-06-report'
3
3
  description: 'Present refinement summary to user with counts, next steps, and review options'
4
4
 
5
5
  outputFile: '{output_folder}/refined-architecture-{project_name}.md'
6
+ nextStepFile: '../../shared/health-check.md'
6
7
  ---
7
8
 
8
9
  # Step 6: Present Report
9
10
 
10
11
  ## STEP GOAL:
11
12
 
12
- Present the complete refinement summary to the user. Display counts of gaps filled, issues flagged, and improvements suggested. Provide the output file path and recommend next steps. Offer the user options to review changes in detail or exit. This is the FINAL step no nextStepFile.
13
+ Present the complete refinement summary to the user. Display counts of gaps filled, issues flagged, and improvements suggested. Provide the output file path and recommend next steps. Offer the user options to review changes in detail or exit. Chains to the shared health check on exit.
13
14
 
14
15
  ## MANDATORY EXECUTION RULES (READ FIRST):
15
16
 
@@ -30,7 +31,7 @@ Present the complete refinement summary to the user. Display counts of gaps fill
30
31
  - 🎯 Focus ONLY on presenting the completed refinement — no new analysis
31
32
  - 🚫 FORBIDDEN to discover new gaps, issues, or improvements
32
33
  - 🚫 FORBIDDEN to modify the refined document — only read and present
33
- - 📋 This is the FINAL step — no nextStepFile
34
+ - 📋 Chains to shared health check via `{nextStepFile}` — no further steps after that
34
35
 
35
36
  ## EXECUTION PROTOCOLS:
36
37
 
@@ -110,15 +111,17 @@ Re-run **[RA] Refine Architecture** anytime after updating your skills or archit
110
111
 
111
112
  **Architecture refinement complete.**"
112
113
 
114
+ Then load and execute `{nextStepFile}` for workflow self-improvement check.
115
+
113
116
  #### EXECUTION RULES:
114
117
 
115
118
  - ALWAYS halt and wait for user input after presenting the menu
116
119
  - R may be selected multiple times — always walk through all refinements
117
- - X ends the workflow
120
+ - X triggers the health check, which is the true workflow exit
118
121
 
119
122
  ## CRITICAL STEP COMPLETION NOTE
120
123
 
121
- This is the final step of the refine-architecture workflow. When the user selects X, the workflow is complete. The refined architecture at `{outputFile}` contains the full original content plus all gap-fills, issue annotations, and improvement suggestions backed by skill API evidence.
124
+ When the user selects X, this step chains to the shared health check. After the health check completes, the refine-architecture workflow is fully done. The refined architecture at `{outputFile}` contains the full original content plus all gap-fills, issue annotations, and improvement suggestions backed by skill API evidence.
122
125
 
123
126
  ---
124
127
 
@@ -0,0 +1,281 @@
1
+ ---
2
+ name: 'step-01-select'
3
+ description: 'Select skill to rename and validate the new name'
4
+ nextStepFile: './step-02-execute.md'
5
+ versionPathsKnowledge: '../../../knowledge/version-paths.md'
6
+ ---
7
+
8
+ # Step 1: Select Rename Target
9
+
10
+ ## STEP GOAL:
11
+
12
+ Identify the skill the user wants to rename, validate the new name against the agentskills.io spec (kebab-case, length, uniqueness), warn about source authority implications, enumerate every version that will be touched, and obtain explicit user confirmation before any filesystem operation is scheduled. Every selection decision is stored in context so step-02 can execute the rename transactionally.
13
+
14
+ ## MANDATORY EXECUTION RULES (READ FIRST):
15
+
16
+ ### Universal Rules:
17
+
18
+ - 🛑 NEVER schedule a rename without explicit user confirmation
19
+ - 🛑 NEVER accept a new name that collides with an existing skill
20
+ - 📖 CRITICAL: Read the complete step file before taking any action
21
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
22
+ - 📋 YOU ARE A FACILITATOR, not a content generator
23
+ - ⚙️ 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
24
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
25
+
26
+ ### Role Reinforcement:
27
+
28
+ - ✅ You are Ferris in Management mode — a precision surgeon for transactional renames
29
+ - ✅ You validate the new name against agentskills.io spec constraints before anything moves
30
+ - ✅ You enumerate the full blast radius (every affected version and directory) before asking for confirmation
31
+ - ✅ Safety via copy-before-delete — the old skill is untouched until step-02 finishes verification
32
+
33
+ ### Step-Specific Rules:
34
+
35
+ - 🎯 Focus only on selection, validation, and confirmation
36
+ - 🚫 FORBIDDEN to proceed without explicit user confirmation at the final gate
37
+ - 🚫 FORBIDDEN to modify the manifest, copy, or delete any files in this step — execution happens in step-02
38
+ - 🚫 FORBIDDEN to accept a new name that fails validation (kebab-case, length, uniqueness)
39
+ - 💬 Present the list of affected versions clearly so the user understands the scope before committing
40
+
41
+ ## EXECUTION PROTOCOLS:
42
+
43
+ - 🎯 Load version-paths knowledge and the export manifest (if present) alongside an on-disk skill scan
44
+ - 💾 Gather all selection decisions into context for step-02
45
+ - 📖 Show the full list of affected versions and the resolved paths clearly
46
+ - 🚫 Halt only if neither the manifest nor an on-disk scan yields any skill — rename must still work for draft skills that were never exported, so a missing or empty manifest is not fatal
47
+
48
+ ## CONTEXT BOUNDARIES:
49
+
50
+ - Available: Export manifest v2, SKF module config variables, on-disk skill directory listing, version-paths knowledge (Rename section)
51
+ - Focus: Selection, validation, and user confirmation
52
+ - Limits: Do not write to the manifest, do not copy or delete any files — execution is deferred to step-02
53
+ - Dependencies: At least one skill must exist in the export manifest (or on disk); otherwise the workflow halts
54
+
55
+ ## MANDATORY SEQUENCE
56
+
57
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
58
+
59
+ ### 1. Load Knowledge
60
+
61
+ Read `{versionPathsKnowledge}` completely and extract:
62
+
63
+ - Path templates: `{skill_package}`, `{skill_group}`, `{forge_version}`, `{forge_group}`
64
+ - Export manifest v2 schema (`schema_version`, `exports`, `active_version`, `versions` map, `status` field values)
65
+ - The Rename section under "Skill Management Operations" — the complete list of 9 locations that must be updated coherently
66
+
67
+ You will use these templates and rules to build directory paths, enumerate affected versions, and plan the transactional rename in step-02.
68
+
69
+ ### 2. Read Export Manifest
70
+
71
+ Load `{skills_output_folder}/.export-manifest.json` if it exists.
72
+
73
+ **If the file is missing or empty:** Treat as an empty manifest — proceed to section 3 and rely entirely on the on-disk directory scan. Drafted or never-exported skills can still be renamed. Store `manifest_exists = false` for later use in step-02 (section 6 will not attempt to update a manifest that does not exist).
74
+
75
+ **If the file exists but contains no `exports` entries:** Same handling — proceed to section 3 with the directory scan. Store `manifest_exists = true` so step-02 still touches the (empty) manifest on write.
76
+
77
+ **If the file exists with entries:** Parse JSON and verify `schema_version` is `"2"`. If the manifest is v1 (no `schema_version` field), note this but continue — treat every entry as having a single active version derived from its current state. Store `manifest_exists = true`.
78
+
79
+ **Hard halt condition:** If the file exists but is malformed (not valid JSON), halt with: "**Export manifest is corrupt** at `{skills_output_folder}/.export-manifest.json` — fix or remove the file before renaming."
80
+
81
+ ### 3. List Available Skills
82
+
83
+ Build and display a summary of every skill available for rename. Start with the manifest (if any), then augment with on-disk scan.
84
+
85
+ For each skill in the manifest's `exports` (if `manifest_exists` and entries exist):
86
+
87
+ 1. Read `active_version` from the manifest entry
88
+ 2. Count the number of versions in the skill's `versions` map
89
+ 3. Display `{skill-name} ({n} versions, active: {active_version})`
90
+
91
+ Also scan `{skills_output_folder}/` for any top-level directories that are NOT present in the manifest's `exports` object. Record these as "(not in manifest)" — they represent draft or orphaned skills that the rename workflow can also handle. When the manifest is missing or empty, every on-disk skill appears in this category.
92
+
93
+ **If the combined list is empty** (no manifest entries AND no on-disk skill directories): halt with "**Rename Skill — nothing to rename.** No skills found in `{skills_output_folder}/`. Run `[CS] Create Skill` first."
94
+
95
+ Display the combined list:
96
+
97
+ ```
98
+ **Rename Skill — select target**
99
+
100
+ Available skills:
101
+ 1. cognee (3 versions, active: 0.6.0)
102
+ 2. express (1 version, active: 4.18.0)
103
+ 3. legacy-helper (not in manifest)
104
+ ```
105
+
106
+ ### 4. Ask Which Skill
107
+
108
+ "**Which skill would you like to rename?**
109
+ Enter the skill name or its number from the list above."
110
+
111
+ Wait for user input. Accept either the numeric index or the skill name (exact match).
112
+
113
+ **If the user's input does not match any listed skill:** Re-display the list and ask again.
114
+
115
+ Store the selection as `old_name`.
116
+
117
+ ### 5. Ask for New Name
118
+
119
+ "**What is the new name for this skill?**
120
+ The new name must be kebab-case: lowercase alphanumeric with hyphens, 1-64 characters, matching the regex `^[a-z][a-z0-9-]*[a-z0-9]$` (single-character names may be a single lowercase letter or digit)."
121
+
122
+ Wait for user input. Trim whitespace. Apply the following validations in order:
123
+
124
+ 1. **Kebab-case format:** Must match `^[a-z][a-z0-9-]*[a-z0-9]$` (or `^[a-z0-9]$` for the single-character case). If it fails:
125
+ "**Invalid name format.** The new name must be lowercase alphanumeric with hyphens, starting with a letter and ending with a letter or digit. Try again."
126
+ Re-ask.
127
+
128
+ 2. **Length:** Must be 1-64 characters per the agentskills.io spec. If it fails:
129
+ "**Invalid name length.** The new name must be 1-64 characters. Try again."
130
+ Re-ask.
131
+
132
+ 3. **Same as old name:** If the new name equals `old_name`:
133
+ "**The new name is identical to the current name.** Nothing to rename. Try again or abort the workflow."
134
+ Re-ask.
135
+
136
+ 4. **Collision check:** The new name MUST NOT collide with any existing skill:
137
+ - It must not appear as a key in `exports` in the manifest
138
+ - It must not exist as a top-level directory in `{skills_output_folder}/`
139
+ - It must not exist as a top-level directory in `{forge_data_folder}/`
140
+
141
+ If any collision is detected:
142
+ "**Name collision.** `{new-name}` already exists at: {list the colliding locations}. Pick a different name."
143
+ Re-ask.
144
+
145
+ Only after all four validations pass, store the input as `new_name`.
146
+
147
+ ### 6. Source Authority Check
148
+
149
+ Resolve `{skill_package}` for the active version using the manifest:
150
+ `{skills_output_folder}/{old_name}/{active_version}/{old_name}/metadata.json`
151
+
152
+ Read the `source_authority` field (if present).
153
+
154
+ **If `source_authority == "official"`:**
155
+
156
+ Display the warning:
157
+
158
+ ```
159
+ ⚠️ **source_authority: "official"**
160
+ This skill has `source_authority: "official"`. Renaming locally will diverge from any
161
+ published skill at agentskills.io under this name. Consumers fetching from the
162
+ registry will still get the original name. Rename is a LOCAL operation only — it
163
+ does not rename anything at the registry.
164
+ ```
165
+
166
+ Ask: "**Continue anyway?** [Y/N]"
167
+
168
+ Wait for response.
169
+ - **If `N`** or anything other than `Y` → "**Cancelled.** No changes were made." HALT the workflow.
170
+ - **If `Y`** → proceed.
171
+
172
+ **If `source_authority` is absent, or any value other than `"official"`:** skip the warning and proceed.
173
+
174
+ ### 7. Enumerate Affected Versions
175
+
176
+ List all versions for `old_name`:
177
+
178
+ 1. Read every key under `exports.{old_name}.versions` in the manifest
179
+ 2. Also list every directory under `{skills_output_folder}/{old_name}/` that looks like a version (any entry that is not `active`)
180
+ 3. Union the two sets — this handles both manifest-tracked and orphaned on-disk versions
181
+ 4. Sort descending where possible (newest first)
182
+
183
+ Store the sorted list as `affected_versions` and count it as `affected_versions_count`.
184
+
185
+ Also resolve the four outer paths using the templates from `{versionPathsKnowledge}`:
186
+
187
+ - `old_skill_group` = `{skills_output_folder}/{old_name}/`
188
+ - `new_skill_group` = `{skills_output_folder}/{new_name}/`
189
+ - `old_forge_group` = `{forge_data_folder}/{old_name}/`
190
+ - `new_forge_group` = `{forge_data_folder}/{new_name}/`
191
+
192
+ ### 8. Confirmation Gate
193
+
194
+ Display the full operation summary:
195
+
196
+ ```
197
+ **About to rename:**
198
+
199
+ From: {old_name}
200
+ To: {new_name}
201
+ Versions affected: {affected_versions_count} ({comma-separated affected_versions})
202
+
203
+ Directories that will be copied then removed:
204
+ {old_skill_group} → {new_skill_group}
205
+ {old_forge_group} → {new_forge_group}
206
+
207
+ Inside each version, the inner `{old_name}/` directory will be renamed to `{new_name}/`,
208
+ and the following files will be updated:
209
+ - SKILL.md (frontmatter `name` field)
210
+ - metadata.json (`name` field)
211
+ - context-snippet.md (display name and root paths)
212
+ - provenance-map.json (`skill_name` field, under {old_forge_group})
213
+
214
+ Manifest `exports.{old_name}` will be re-keyed to `exports.{new_name}`.
215
+ Platform context files (CLAUDE.md, .cursorrules, AGENTS.md) will be rebuilt so
216
+ the managed section references `{new_name}` instead of `{old_name}`.
217
+
218
+ Operation is **transactional** — the new name will be fully materialized and verified
219
+ before the old name is removed. If any step fails before the final delete, the new
220
+ directories are removed and the old skill remains intact.
221
+
222
+ Proceed? [Y/N]
223
+ ```
224
+
225
+ Wait for explicit user response.
226
+
227
+ - **If `Y`** → proceed to section 9
228
+ - **If `N`** → "**Cancelled.** No changes were made." HALT the workflow
229
+ - **Any other input** → re-display the confirmation and ask again
230
+
231
+ ### 9. Store Decisions in Context
232
+
233
+ Store the following decisions in workflow context for step-02:
234
+
235
+ - `old_name` — the current skill name
236
+ - `new_name` — the validated new name
237
+ - `affected_versions` — list of version strings for every version that must be updated
238
+ - `affected_versions_count` — integer count of the above
239
+ - `old_skill_group` — absolute path `{skills_output_folder}/{old_name}/`
240
+ - `new_skill_group` — absolute path `{skills_output_folder}/{new_name}/`
241
+ - `old_forge_group` — absolute path `{forge_data_folder}/{old_name}/`
242
+ - `new_forge_group` — absolute path `{forge_data_folder}/{new_name}/`
243
+ - `source_authority_override` — boolean (true if the user acknowledged the `"official"` warning, false/absent otherwise)
244
+
245
+ ### 10. Load Next Step
246
+
247
+ Load, read the full file, and then execute `{nextStepFile}`.
248
+
249
+ ## CRITICAL STEP COMPLETION NOTE
250
+
251
+ ONLY WHEN the user has confirmed with `Y` at the confirmation gate AND all selection decisions have been stored in context, will you then load and read fully `{nextStepFile}` to execute the rename.
252
+
253
+ ---
254
+
255
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
256
+
257
+ ### ✅ SUCCESS:
258
+
259
+ - Version-paths knowledge loaded and the Rename section internalized before any decision
260
+ - Export manifest read and validated (halt if empty/missing)
261
+ - Complete skill list displayed with version counts and active version
262
+ - Old name selected by explicit user input
263
+ - New name validated against kebab-case regex, length, identity, and collision checks
264
+ - `source_authority: "official"` warning shown and acknowledged when applicable
265
+ - `affected_versions` enumerated from both the manifest and the on-disk directory listing
266
+ - All four outer paths resolved from templates (no hardcoding)
267
+ - Explicit user confirmation (`Y`) received at the confirmation gate
268
+ - All selection decisions stored in context for step-02
269
+
270
+ ### ❌ SYSTEM FAILURE:
271
+
272
+ - Proceeding without reading version-paths knowledge
273
+ - Halting when the manifest is missing but on-disk skills exist — the fallback on-disk scan MUST be attempted before any "nothing to rename" halt
274
+ - Accepting a new name that fails any of the four validation checks
275
+ - Missing the source_authority warning when `"official"` is present
276
+ - Hardcoding directory paths instead of using `{skill_package}`, `{skill_group}`, `{forge_version}`, `{forge_group}` templates
277
+ - Modifying the manifest, copying, or deleting files in this step (execution belongs to step-02)
278
+ - Skipping the confirmation gate or proceeding on any response other than `Y`
279
+ - Not storing decisions in context for step-02
280
+
281
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE. No filesystem operation proceeds without explicit user confirmation, and no invalid new name is ever accepted.