bmad-module-skill-forge 1.4.1 → 1.5.1

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 (231) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +0 -8
  3. package/docs/_data/pinned.yaml +1 -1
  4. package/docs/_internal/STABILITY.md +1 -1
  5. package/docs/architecture.md +2 -2
  6. package/docs/examples.md +1 -1
  7. package/docs/workflows.md +5 -5
  8. package/package.json +2 -2
  9. package/src/README.md +1 -1
  10. package/src/knowledge/ccc-bridge.md +12 -12
  11. package/src/knowledge/qmd-registry.md +5 -5
  12. package/src/shared/health-check.md +5 -5
  13. package/src/shared/references/description-guard-protocol.md +100 -0
  14. package/src/shared/references/output-contract-schema.md +1 -1
  15. package/src/shared/scripts/schemas/skf-brief-result-envelope.v1.json +6 -6
  16. package/src/shared/scripts/schemas/skf-setup-result-envelope.v1.json +9 -3
  17. package/src/shared/scripts/schemas/skf-update-result-envelope.v1.json +149 -0
  18. package/src/shared/scripts/schemas/skill-brief.v1.json +22 -2
  19. package/src/shared/scripts/skf-build-change-manifest.py +420 -0
  20. package/src/shared/scripts/skf-check-workspace-drift.py +321 -0
  21. package/src/shared/scripts/skf-compare-file-hashes.py +357 -0
  22. package/src/shared/scripts/skf-description-guard.py +359 -0
  23. package/src/shared/scripts/skf-detect-language.py +2 -2
  24. package/src/shared/scripts/skf-detect-scripts-assets.py +613 -0
  25. package/src/shared/scripts/skf-detect-tools.py +147 -16
  26. package/src/shared/scripts/skf-detect-workspaces.py +1 -1
  27. package/src/shared/scripts/skf-disqualify-candidates.py +576 -0
  28. package/src/shared/scripts/skf-emit-brief-result-envelope.py +3 -3
  29. package/src/shared/scripts/skf-emit-result-envelope.py +93 -9
  30. package/src/shared/scripts/skf-enumerate-stack-skills.py +514 -0
  31. package/src/shared/scripts/skf-forge-tier-rw.py +11 -11
  32. package/src/shared/scripts/skf-hash-content.py +284 -0
  33. package/src/shared/scripts/skf-load-provenance.py +295 -0
  34. package/src/shared/scripts/skf-manifest-ops.py +22 -6
  35. package/src/shared/scripts/skf-merge-ccc-exclusions.py +34 -4
  36. package/src/shared/scripts/skf-pair-intersect.py +250 -0
  37. package/src/shared/scripts/skf-provenance-gap-dispatch.py +433 -0
  38. package/src/shared/scripts/skf-qmd-classify-collections.py +42 -8
  39. package/src/shared/scripts/skf-recommend-scope-type.py +2 -2
  40. package/src/shared/scripts/skf-render-quick-metadata.py +2 -2
  41. package/src/shared/scripts/skf-resolve-authoritative-files.py +504 -0
  42. package/src/shared/scripts/skf-scan-manifests.py +738 -0
  43. package/src/shared/scripts/skf-scan-skill-md-structure.py +375 -0
  44. package/src/shared/scripts/skf-update-active-symlink.py +315 -0
  45. package/src/shared/scripts/skf-validate-brief-inputs.py +5 -5
  46. package/src/shared/scripts/skf-validate-brief-schema.py +348 -0
  47. package/src/shared/scripts/skf-write-skill-brief.py +61 -5
  48. package/src/skf-analyze-source/SKILL.md +69 -16
  49. package/src/skf-analyze-source/assets/skill-brief-schema.md +1 -1
  50. package/src/skf-analyze-source/customize.toml +55 -0
  51. package/src/skf-analyze-source/{steps-c/step-01b-continue.md → references/continue.md} +12 -12
  52. package/src/skf-analyze-source/{steps-c/step-06-generate-briefs.md → references/generate-briefs.md} +29 -10
  53. package/src/skf-analyze-source/{steps-c/step-07-health-check.md → references/health-check.md} +5 -3
  54. package/src/skf-analyze-source/{steps-c/step-03-identify-units.md → references/identify-units.md} +48 -14
  55. package/src/skf-analyze-source/{steps-c/step-01-init.md → references/init.md} +32 -9
  56. package/src/skf-analyze-source/{steps-c/step-04-map-and-detect.md → references/map-and-detect.md} +52 -25
  57. package/src/skf-analyze-source/{steps-c/step-05-recommend.md → references/recommend.md} +15 -8
  58. package/src/skf-analyze-source/{steps-c/step-02-scan-project.md → references/scan-project.md} +16 -10
  59. package/src/skf-analyze-source/references/unit-detection-heuristics.md +2 -0
  60. package/src/skf-analyze-source/templates/analysis-report-template.md +6 -6
  61. package/src/skf-audit-skill/SKILL.md +66 -15
  62. package/src/skf-audit-skill/assets/drift-report-template.md +6 -5
  63. package/src/skf-audit-skill/customize.toml +49 -0
  64. package/src/skf-audit-skill/{steps-c/step-07-health-check.md → references/health-check.md} +5 -3
  65. package/src/skf-audit-skill/{steps-c/step-01-init.md → references/init.md} +63 -19
  66. package/src/skf-audit-skill/{steps-c/step-02-re-index.md → references/re-index.md} +11 -11
  67. package/src/skf-audit-skill/{steps-c/step-06-report.md → references/report.md} +25 -7
  68. package/src/skf-audit-skill/{steps-c/step-04-semantic-diff.md → references/semantic-diff.md} +6 -6
  69. package/src/skf-audit-skill/{steps-c/step-05-severity-classify.md → references/severity-classify.md} +5 -5
  70. package/src/skf-audit-skill/references/severity-rules.md +2 -0
  71. package/src/skf-audit-skill/{steps-c/step-03-structural-diff.md → references/structural-diff.md} +35 -17
  72. package/src/skf-brief-skill/SKILL.md +49 -19
  73. package/src/skf-brief-skill/assets/description-voice-examples.md +1 -1
  74. package/src/skf-brief-skill/assets/skill-brief-schema.md +32 -2
  75. package/src/skf-brief-skill/customize.toml +44 -0
  76. package/src/skf-brief-skill/{steps-c/step-02-analyze-target.md → references/analyze-target.md} +27 -15
  77. package/src/skf-brief-skill/{steps-c/step-04-confirm-brief.md → references/confirm-brief.md} +13 -10
  78. package/src/skf-brief-skill/references/draft-checkpoint.md +4 -4
  79. package/src/skf-brief-skill/{steps-c/step-01-gather-intent.md → references/gather-intent.md} +35 -29
  80. package/src/skf-brief-skill/references/headless-args.md +9 -9
  81. package/src/skf-brief-skill/references/headless-source-authority-detection.md +1 -1
  82. package/src/skf-brief-skill/{steps-c/step-06-health-check.md → references/health-check.md} +4 -2
  83. package/src/skf-brief-skill/references/portfolio-similarity-check.md +2 -2
  84. package/src/skf-brief-skill/references/qmd-collection-registration.md +2 -2
  85. package/src/skf-brief-skill/{steps-c/step-03-scope-definition.md → references/scope-definition.md} +27 -20
  86. package/src/skf-brief-skill/references/version-resolution.md +2 -2
  87. package/src/skf-brief-skill/{steps-c/step-05-write-brief.md → references/write-brief.md} +29 -16
  88. package/src/skf-create-skill/SKILL.md +25 -19
  89. package/src/skf-create-skill/assets/compile-assembly-rules.md +3 -3
  90. package/src/skf-create-skill/assets/skill-sections.md +5 -5
  91. package/src/skf-create-skill/assets/tessl-dismissal-rules.md +11 -11
  92. package/src/skf-create-skill/customize.toml +35 -0
  93. package/src/skf-create-skill/references/authoritative-files-protocol.md +142 -0
  94. package/src/skf-create-skill/{steps-c/step-05-compile.md → references/compile.md} +16 -16
  95. package/src/skf-create-skill/{steps-c/step-03d-component-extraction.md → references/component-extraction.md} +16 -16
  96. package/src/skf-create-skill/{steps-c/step-02-ecosystem-check.md → references/ecosystem-check.md} +4 -4
  97. package/src/skf-create-skill/{steps-c/step-04-enrich.md → references/enrich.md} +3 -3
  98. package/src/skf-create-skill/{steps-c/step-03-extract.md → references/extract.md} +52 -120
  99. package/src/skf-create-skill/references/extraction-patterns.md +10 -8
  100. package/src/skf-create-skill/{steps-c/step-07-generate-artifacts.md → references/generate-artifacts.md} +11 -11
  101. package/src/skf-create-skill/{steps-c/step-09-health-check.md → references/health-check.md} +4 -2
  102. package/src/skf-create-skill/{steps-c/step-01-load-brief.md → references/load-brief.md} +40 -32
  103. package/src/skf-create-skill/{steps-c/step-08-report.md → references/report.md} +8 -8
  104. package/src/skf-create-skill/references/source-resolution-protocols.md +6 -6
  105. package/src/skf-create-skill/{steps-c/sub/step-02b-ccc-discover.md → references/sub/ccc-discover.md} +5 -5
  106. package/src/skf-create-skill/{steps-c/sub/step-03c-fetch-docs.md → references/sub/fetch-docs.md} +28 -12
  107. package/src/skf-create-skill/{steps-c/sub/step-03b-fetch-temporal.md → references/sub/fetch-temporal.md} +81 -50
  108. package/src/skf-create-skill/{steps-c/step-06-validate.md → references/validate.md} +48 -28
  109. package/src/skf-create-stack-skill/SKILL.md +76 -17
  110. package/src/skf-create-stack-skill/assets/provenance-map-schema.md +102 -0
  111. package/src/skf-create-stack-skill/assets/stack-skill-template.md +1 -1
  112. package/src/skf-create-stack-skill/customize.toml +46 -0
  113. package/src/skf-create-stack-skill/{steps-c/step-06-compile-stack.md → references/compile-stack.md} +6 -5
  114. package/src/skf-create-stack-skill/references/compose-mode-rules.md +3 -1
  115. package/src/skf-create-stack-skill/{steps-c/step-05-detect-integrations.md → references/detect-integrations.md} +37 -11
  116. package/src/skf-create-stack-skill/{steps-c/step-02-detect-manifests.md → references/detect-manifests.md} +32 -28
  117. package/src/skf-create-stack-skill/{steps-c/step-07-generate-output.md → references/generate-output.md} +11 -85
  118. package/src/skf-create-stack-skill/{steps-c/step-10-health-check.md → references/health-check.md} +4 -2
  119. package/src/skf-create-stack-skill/{steps-c/step-01-init.md → references/init.md} +70 -4
  120. package/src/skf-create-stack-skill/references/integration-patterns.md +2 -0
  121. package/src/skf-create-stack-skill/references/manifest-patterns.md +2 -0
  122. package/src/skf-create-stack-skill/{steps-c/step-04-parallel-extract.md → references/parallel-extract.md} +44 -17
  123. package/src/skf-create-stack-skill/{steps-c/step-03-rank-and-confirm.md → references/rank-and-confirm.md} +5 -4
  124. package/src/skf-create-stack-skill/{steps-c/step-09-report.md → references/report.md} +3 -3
  125. package/src/skf-create-stack-skill/{steps-c/step-08-validate.md → references/validate.md} +6 -6
  126. package/src/skf-drop-skill/SKILL.md +84 -12
  127. package/src/skf-drop-skill/customize.toml +57 -0
  128. package/src/skf-drop-skill/{steps-c/step-02-execute.md → references/execute.md} +49 -34
  129. package/src/skf-drop-skill/{steps-c/step-04-health-check.md → references/health-check.md} +6 -4
  130. package/src/skf-drop-skill/{steps-c/step-03-report.md → references/report.md} +13 -5
  131. package/src/skf-drop-skill/{steps-c/step-01-select.md → references/select.md} +63 -15
  132. package/src/skf-export-skill/SKILL.md +85 -16
  133. package/src/skf-export-skill/assets/managed-section-format.md +3 -3
  134. package/src/skf-export-skill/assets/snippet-format.md +2 -2
  135. package/src/skf-export-skill/customize.toml +49 -0
  136. package/src/skf-export-skill/{steps-c/step-03-generate-snippet.md → references/generate-snippet.md} +11 -11
  137. package/src/skf-export-skill/{steps-c/step-07-health-check.md → references/health-check.md} +6 -4
  138. package/src/skf-export-skill/{steps-c/step-01-load-skill.md → references/load-skill.md} +11 -49
  139. package/src/skf-export-skill/references/manifest-rebuild.md +68 -0
  140. package/src/skf-export-skill/references/multi-skill-mode.md +38 -0
  141. package/src/skf-export-skill/references/orphan-context-detection.md +75 -0
  142. package/src/skf-export-skill/references/orphan-row-detection.md +102 -0
  143. package/src/skf-export-skill/{steps-c/step-02-package.md → references/package.md} +7 -7
  144. package/src/skf-export-skill/references/preflight-snippet-root-probe.md +79 -0
  145. package/src/skf-export-skill/{steps-c/step-06-summary.md → references/summary.md} +23 -11
  146. package/src/skf-export-skill/{steps-c/step-05-token-report.md → references/token-report.md} +5 -5
  147. package/src/skf-export-skill/{steps-c/step-04-update-context.md → references/update-context.md} +109 -113
  148. package/src/skf-quick-skill/SKILL.md +63 -123
  149. package/src/skf-quick-skill/customize.toml +44 -0
  150. package/src/skf-quick-skill/references/batch-mode.md +102 -0
  151. package/src/skf-quick-skill/{steps-c/step-04-compile.md → references/compile.md} +10 -10
  152. package/src/skf-quick-skill/{steps-c/step-02-ecosystem-check.md → references/ecosystem-check.md} +5 -5
  153. package/src/skf-quick-skill/{steps-c/step-06-finalize.md → references/finalize.md} +7 -7
  154. package/src/skf-quick-skill/{steps-c/step-07-health-check.md → references/health-check.md} +3 -3
  155. package/src/skf-quick-skill/{steps-c/step-03-quick-extract.md → references/quick-extract.md} +5 -5
  156. package/src/skf-quick-skill/references/registry-resolution.md +2 -0
  157. package/src/skf-quick-skill/{steps-c/step-01-resolve-target.md → references/resolve-target.md} +14 -10
  158. package/src/skf-quick-skill/{steps-c/step-05-write-and-validate.md → references/write-and-validate.md} +4 -4
  159. package/src/skf-refine-architecture/SKILL.md +86 -16
  160. package/src/skf-refine-architecture/customize.toml +49 -0
  161. package/src/skf-refine-architecture/{steps-c/step-05-compile.md → references/compile.md} +4 -4
  162. package/src/skf-refine-architecture/{steps-c/step-02-gap-analysis.md → references/gap-analysis.md} +5 -5
  163. package/src/skf-refine-architecture/{steps-c/step-07-health-check.md → references/health-check.md} +6 -4
  164. package/src/skf-refine-architecture/{steps-c/step-04-improvements.md → references/improvements.md} +5 -5
  165. package/src/skf-refine-architecture/references/init.md +144 -0
  166. package/src/skf-refine-architecture/{steps-c/step-03-issue-detection.md → references/issue-detection.md} +5 -5
  167. package/src/skf-refine-architecture/references/refinement-rules.md +2 -0
  168. package/src/skf-refine-architecture/{steps-c/step-06-report.md → references/report.md} +14 -5
  169. package/src/skf-rename-skill/SKILL.md +82 -12
  170. package/src/skf-rename-skill/customize.toml +52 -0
  171. package/src/skf-rename-skill/{steps-c/step-02-execute.md → references/execute.md} +94 -99
  172. package/src/skf-rename-skill/references/health-check.md +30 -0
  173. package/src/skf-rename-skill/references/rebuild-context.md +110 -0
  174. package/src/skf-rename-skill/{steps-c/step-03-report.md → references/report.md} +13 -5
  175. package/src/skf-rename-skill/{steps-c/step-01-select.md → references/select.md} +59 -20
  176. package/src/skf-setup/SKILL.md +35 -35
  177. package/src/skf-setup/customize.toml +33 -0
  178. package/src/skf-setup/{steps-c/step-03-auto-index.md → references/auto-index.md} +10 -18
  179. package/src/skf-setup/{steps-c/step-01b-ccc-index.md → references/ccc-index.md} +16 -31
  180. package/src/skf-setup/{steps-c/step-01-detect-and-tier.md → references/detect-and-tier.md} +23 -10
  181. package/src/skf-setup/{steps-c/step-05-health-check.md → references/health-check.md} +1 -1
  182. package/src/skf-setup/{steps-c/step-04-report.md → references/report.md} +21 -19
  183. package/src/skf-setup/references/tier-rules.md +1 -1
  184. package/src/skf-setup/{steps-c/step-02-write-config.md → references/write-config.md} +14 -13
  185. package/src/skf-test-skill/SKILL.md +77 -15
  186. package/src/skf-test-skill/customize.toml +54 -0
  187. package/src/skf-test-skill/{steps-c/step-04-coherence-check.md → references/coherence-check.md} +37 -73
  188. package/src/skf-test-skill/{steps-c/step-03-coverage-check.md → references/coverage-check.md} +16 -39
  189. package/src/skf-test-skill/{steps-c/step-02-detect-mode.md → references/detect-mode.md} +4 -26
  190. package/src/skf-test-skill/{steps-c/step-04b-external-validators.md → references/external-validators.md} +6 -28
  191. package/src/skf-test-skill/references/health-check.md +14 -0
  192. package/src/skf-test-skill/{steps-c/step-01-init.md → references/init.md} +21 -37
  193. package/src/skf-test-skill/references/migration-section-rules.md +4 -2
  194. package/src/skf-test-skill/{steps-c/step-06-report.md → references/report.md} +41 -51
  195. package/src/skf-test-skill/{steps-c/step-05-score.md → references/score.md} +26 -43
  196. package/src/skf-test-skill/references/scoring-rules.md +8 -6
  197. package/src/skf-test-skill/references/source-access-protocol.md +7 -5
  198. package/src/skf-test-skill/scripts/compute-score.py +88 -17
  199. package/src/skf-test-skill/templates/test-report-template.md +13 -13
  200. package/src/skf-update-skill/SKILL.md +23 -14
  201. package/src/skf-update-skill/customize.toml +44 -0
  202. package/src/skf-update-skill/{steps-c/step-02-detect-changes.md → references/detect-changes.md} +176 -68
  203. package/src/skf-update-skill/references/health-check.md +32 -0
  204. package/src/skf-update-skill/{steps-c/step-01-init.md → references/init.md} +56 -8
  205. package/src/skf-update-skill/references/manual-section-rules.md +4 -0
  206. package/src/skf-update-skill/references/merge-conflict-rules.md +4 -0
  207. package/src/skf-update-skill/{steps-c/step-04-merge.md → references/merge.md} +8 -8
  208. package/src/skf-update-skill/{steps-c/step-03-re-extract.md → references/re-extract.md} +53 -44
  209. package/src/skf-update-skill/references/remote-source-resolution.md +5 -1
  210. package/src/skf-update-skill/references/report.md +214 -0
  211. package/src/skf-update-skill/{steps-c/step-05-validate.md → references/validate.md} +5 -5
  212. package/src/skf-update-skill/{steps-c/step-06-write.md → references/write.md} +73 -51
  213. package/src/skf-verify-stack/SKILL.md +89 -17
  214. package/src/skf-verify-stack/assets/feasibility-report-template.md +4 -4
  215. package/src/skf-verify-stack/customize.toml +50 -0
  216. package/src/skf-verify-stack/references/coverage-patterns.md +2 -2
  217. package/src/skf-verify-stack/{steps-c/step-02-coverage.md → references/coverage.md} +13 -9
  218. package/src/skf-verify-stack/{steps-c/step-07-health-check.md → references/health-check.md} +7 -5
  219. package/src/skf-verify-stack/references/init.md +170 -0
  220. package/src/skf-verify-stack/references/integration-verification-rules.md +1 -1
  221. package/src/skf-verify-stack/{steps-c/step-03-integrations.md → references/integrations.md} +18 -14
  222. package/src/skf-verify-stack/{steps-c/step-06-report.md → references/report.md} +27 -42
  223. package/src/skf-verify-stack/{steps-c/step-04-requirements.md → references/requirements.md} +13 -9
  224. package/src/skf-verify-stack/{steps-c/step-05-synthesize.md → references/synthesize.md} +14 -10
  225. package/tools/validate-docs-drift.js +1 -1
  226. package/src/skf-refine-architecture/steps-c/step-01-init.md +0 -136
  227. package/src/skf-rename-skill/steps-c/step-04-health-check.md +0 -22
  228. package/src/skf-test-skill/steps-c/step-07-health-check.md +0 -25
  229. package/src/skf-update-skill/steps-c/step-07-report.md +0 -148
  230. package/src/skf-update-skill/steps-c/step-08-health-check.md +0 -22
  231. package/src/skf-verify-stack/steps-c/step-01-init.md +0 -178
@@ -1,7 +1,9 @@
1
1
  ---
2
- nextStepFile: './step-02-package.md'
2
+ nextStepFile: 'package.md'
3
3
  ---
4
4
 
5
+ <!-- Config: communicate in {communication_language}. -->
6
+
5
7
  # Step 1: Load Skill
6
8
 
7
9
  ## STEP GOAL:
@@ -15,8 +17,6 @@ To load the target skill's artifacts, validate they meet agentskills.io spec com
15
17
 
16
18
  ## MANDATORY SEQUENCE
17
19
 
18
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
19
-
20
20
  ### 1. Parse Export Arguments
21
21
 
22
22
  "**Starting skill export...**"
@@ -25,7 +25,7 @@ Determine the skill(s) to export and any flags:
25
25
 
26
26
  **Skill Path Discovery (version-aware — see `knowledge/version-paths.md`):**
27
27
  - If user provided one or more skill names or paths as arguments, use that list directly
28
- - If `--all` was passed, build the list from every skill in `{skills_output_folder}/.export-manifest.json.exports` whose `active_version` entry is not `status: "deprecated"` (deprecated skills are excluded from all exports — see step-04 §4b)
28
+ - If `--all` was passed, build the list from every skill in `{skills_output_folder}/.export-manifest.json.exports` whose `active_version` entry is not `status: "deprecated"` (deprecated skills are excluded from all exports — see step 4 §4b)
29
29
  - If no explicit skill and no `--all`, discover available skills using the export manifest:
30
30
  1. Read `{skills_output_folder}/.export-manifest.json` — list skill names from `exports`
31
31
  2. For each skill group directory in `{skills_output_folder}/`, check for `{skill_group}/active/{skill-name}/SKILL.md`
@@ -64,54 +64,15 @@ For each IDE in `config.yaml.ides`:
64
64
 
65
65
  ### 1b. Detect Snippet Root Prefix Mismatch
66
66
 
67
- **Skip entirely if `snippet_skill_root_override` is already set in `config.yaml`** — the authoring-repo escape hatch is already configured and any on-disk prefix that matches it is ground truth (see `assets/managed-section-format.md` override rules).
68
-
69
- Otherwise, probe existing snippets to catch the authoring-repo case (skills live under a single shared directory like `skills/` that does not match any per-IDE `skill_root`) before step-04 silently rewrites their root paths:
70
-
71
- 1. Collect candidate snippet paths:
72
- - Read `{skills_output_folder}/.export-manifest.json` if it exists. For each skill in `exports` with a resolvable `active_version`, add `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/context-snippet.md`
73
- - Also include the current skill's snippet if present (resolved via manifest / `active` symlink / flat path per `knowledge/version-paths.md`)
74
- 2. For each snippet that exists on disk, read the first line and parse the `root:` value. Strip the trailing `{skill-name}/` to extract the prefix (e.g. `skills/`, `.claude/skills/`)
75
- 3. Collect unique prefixes into `observed_prefixes`
76
- 4. Compare against `target_context_files[0].skill_root` (the first entry's IDE-mapped skill root — used as reference since step-03 §2.7 picks this same entry for snippet generation when no override is set)
77
-
78
- **If `observed_prefixes` contains any value that does not match the reference `skill_root`:**
79
-
80
- Emit a single warning (once, not per snippet) and present resolution options before proceeding:
67
+ **Skip entirely if `snippet_skill_root_override` is set in `config.yaml`** — the authoring-repo escape hatch is already configured and any on-disk prefix that matches it is ground truth (see `assets/managed-section-format.md` override rules).
81
68
 
82
- "**Snippet root prefix mismatch detected.**
83
- Existing snippets use: `{observed_prefixes}`
84
- IDE-mapped skill_root: `{target_context_files[0].skill_root}`
85
-
86
- This usually means you are in an authoring repo where skills live under a single shared directory. Options:
87
- - **(a) Set override** — add `snippet_skill_root_override: {observed_prefix}` to `config.yaml`. Snippets keep their on-disk prefix; the managed section references the real location.
88
- - **(b) Proceed with IDE mapping** — step-04 will rewrite every snippet's root path to the IDE's skill_root. Use this only if the IDE's skill directory actually contains the skill files.
89
- - **(c) Cancel** — abort export and investigate.
90
-
91
- If multiple distinct prefixes were observed, the snippets disagree with each other — investigate before choosing (a)."
92
-
93
- In `{headless_mode}`, default to (b) and log the observed prefix(es) so the mismatch is visible in run logs. In interactive mode, wait for user choice before continuing to section 2.
94
-
95
- **If all observed prefixes match the reference `skill_root` (or no existing snippets were found):** Proceed silently.
69
+ **Otherwise:** load `references/preflight-snippet-root-probe.md` and follow its probe + (a) Set override / (b) Proceed with IDE mapping / (c) Cancel gate protocol. The reference handles candidate snippet collection (manifest-driven), prefix observation, the mismatch warning, and headless default ((b) Proceed). Returns control to §1c on no-mismatch fast path or after a (b) choice.
96
70
 
97
71
  ### 1c. Multi-skill Mode (when `len(skill_batch) > 1`)
98
72
 
99
- When multiple skills are being exported in a single run (via `--all`, multi-selection at the discovery menu, or an explicit multi-argument invocation), the workflow does NOT loop the full step-01→step-07 sequence once per skill. Instead, it partitions work across steps to avoid repeated gates and redundant batch work:
100
-
101
- | Step | Behavior in multi-skill mode |
102
- |------|------------------------------|
103
- | step-01 §2–5 | **Iterate per skill** — load, validate, read metadata, and check the test report for every skill in `skill_batch`. Collect per-skill results. |
104
- | step-01 §6 | **Single gate** — present one consolidated summary table (one row per skill) and a single [C] gate for the whole batch. |
105
- | step-02 | **Iterate per skill** — validate each skill's package structure and collect per-skill readiness. |
106
- | step-03 | **Iterate per skill** — regenerate each skill's `context-snippet.md` independently (each skill has its own prior-gotchas carry-forward state). |
107
- | step-04 | **Batch once** — §3b orphan detection, §4 skill-index rebuild, §5 managed-section assembly, and §6–9 diff + write all execute once for the entire batch. The exported skill set in §4b already enumerates every skill in the manifest — it does not need per-skill iteration. §9b adds/updates a manifest entry per skill in `skill_batch` (not just the last one), then writes the manifest once. |
108
- | step-05 | **Iterate per skill** — compute token counts per skill, then present one aggregate report. |
109
- | step-06 | **One batch summary + one result contract** — the files-written table lists every skill; the result contract JSON covers the whole run, and `outputs` enumerates every context-snippet + target context file touched. |
110
- | step-07 | **Runs once** — health check is per-workflow-run, not per-skill. |
111
-
112
- **Halt semantics in batch mode:** if any single skill fails validation in §2 (required-file or metadata-field failure), halt the entire batch before §5 — do not partially export. Report which skill failed and why.
73
+ **If `len(skill_batch) == 1`:** single-skill mode (legacy behavior) every section below operates on the one skill without iteration. Skip this subsection.
113
74
 
114
- **Single-skill mode (`len(skill_batch) == 1`)** preserves the legacy behavior: every section below operates on the one skill without iteration.
75
+ **If `len(skill_batch) > 1`:** load `references/multi-skill-mode.md` and apply its per-step behavior matrix. The reference partitions work so that step 1 §2–5 iterates per skill, step 1 §6 presents a single consolidated [C] gate, step 4 batches once across the whole run, and step 7 health check runs once. It also defines the all-or-nothing halt semantics if any single skill fails §2 validation.
115
76
 
116
77
  ### 2. Load and Validate Skill Artifacts
117
78
 
@@ -169,7 +130,7 @@ Load `{sidecar_path}/preferences.yaml` (if exists):
169
130
 
170
131
  1. Glob `{forge_data_folder}/{skill_name}/{active_version}/test-report-{skill_name}-*.md` (i.e. `{forge_version}/test-report-{skill_name}-*.md`). Sort matches descending by the parsed ISO-timestamp segment in the filename (`YYYYMMDDTHHMMSSZ` between the skill name and the hash — `sort -r` on the filename works because the timestamp is the first variable component). Take the first match.
171
132
  2. If the versioned glob returns nothing, fall back to the same glob at the flat path `{forge_data_folder}/{skill_name}/test-report-{skill_name}-*.md`. Pick the newest by parsed timestamp.
172
- 3. If neither glob returns anything, look for the stable companion `skf-test-skill-result-latest.json` in the same two directories (versioned first, then flat). Read the report path from `outputs[]` per the canonical contract documented at `shared/references/output-contract-schema.md` (resolved by skf-test-skill step-06 §4c) and load that file.
133
+ 3. If neither glob returns anything, look for the stable companion `skf-test-skill-result-latest.json` in the same two directories (versioned first, then flat). Read the report path from `outputs[]` per the canonical contract documented at `shared/references/output-contract-schema.md` (resolved by skf-test-skill step 6 §4c) and load that file.
173
134
  4. If all three lookups fail, the skill has no test report.
174
135
 
175
136
  **If a test report is found:**
@@ -236,11 +197,12 @@ Continue to step 5 regardless — this is advisory, not blocking.
236
197
 
237
198
  ### 6. Present MENU OPTIONS
238
199
 
239
- Display: "**Select:** [C] Continue to packaging" (multi-skill mode: the single [C] gate covers the whole batch)
200
+ Display: "**Select:** [C] Continue to packaging | [X] Cancel and exit (or type `cancel` / `exit` / `:q`)" (multi-skill mode: the single [C] gate covers the whole batch)
240
201
 
241
202
  #### Menu Handling Logic:
242
203
 
243
204
  - IF C: Proceed with loaded skill data, then load, read entire file, then execute {nextStepFile}
205
+ - IF X (or `cancel` / `exit` / `:q`): Display "Cancelled — no packaging or context file writes were performed." and HALT (exit code 6, `halt_reason: "user-cancelled"`). In headless, emit the error envelope per SKILL.md "Result Contract (Headless)" with the resolved `skills`, `context_files_updated: []`, and `manifest_path: null`.
244
206
  - IF Any other: help user respond, then [Redisplay Menu Options](#6-present-menu-options)
245
207
 
246
208
  #### EXECUTION RULES:
@@ -0,0 +1,68 @@
1
+ ---
2
+ # Static reference loaded by update-context.md §4a only when manifest
3
+ # schema documentation is needed (the in-prompt schema is otherwise
4
+ # delegated to skf-manifest-ops.py which handles v2 enforcement and
5
+ # v1→v2 migration internally).
6
+ ---
7
+
8
+ <!-- Config: communicate in {communication_language}. -->
9
+
10
+ # Export Manifest v2 — Schema Reference
11
+
12
+ ## Purpose
13
+
14
+ Reference for the v2 export manifest schema enforced by `skf-manifest-ops.py` and consumed by every workflow that touches `{skills_output_folder}/.export-manifest.json`. This file is the source of truth for the v2 shape; the helper script implements it; downstream skills (drop-skill, rename-skill, update-skill) read this same file to stay aligned.
15
+
16
+ ## v2 Schema
17
+
18
+ ```json
19
+ {
20
+ "schema_version": "2",
21
+ "exports": {
22
+ "skill-name": {
23
+ "active_version": "0.6.0",
24
+ "versions": {
25
+ "0.1.0": {
26
+ "ides": ["claude-code"],
27
+ "last_exported": "2026-01-15",
28
+ "status": "deprecated"
29
+ },
30
+ "0.5.0": {
31
+ "ides": ["claude-code"],
32
+ "last_exported": "2026-03-15",
33
+ "status": "archived"
34
+ },
35
+ "0.6.0": {
36
+ "ides": ["claude-code", "github-copilot"],
37
+ "last_exported": "2026-04-04",
38
+ "status": "active"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## Status enum
47
+
48
+ - `"active"` — currently exported; snippet appears in managed sections
49
+ - `"archived"` — previously exported, not active; files retained for rollback
50
+ - `"deprecated"` — dropped via drop-skill workflow; excluded from all exports (files may or may not exist on disk)
51
+ - `"draft"` — created but never exported
52
+
53
+ ## v1 → v2 migration (handled by `skf-manifest-ops.py`)
54
+
55
+ Pre-rename v2 manifests used a `platforms` array at the version level. If a version entry contains `platforms` instead of (or in addition to) `ides`, the helper treats `platforms` as `ides` and rewrites it on the next manifest write — silent in-place upgrade, no user prompt.
56
+
57
+ For v1 manifests (no `schema_version` field), the helper migrates in-place on the first read:
58
+
59
+ 1. For each entry in `exports`, read its `last_exported`
60
+ 2. Resolve the skill's current version from `{resolved_skill_package}/metadata.json`
61
+ 3. Wrap in v2 structure: `active_version` ← resolved version, single entry in `versions` with `status: "active"`, `ides: []` (unknown — fills on next successful export), and `last_exported`
62
+ 4. Set `schema_version: "2"` at root
63
+
64
+ Workflows that load the manifest via `skf-manifest-ops.py read` always receive the v2 shape regardless of on-disk state.
65
+
66
+ ## Integrity invariant
67
+
68
+ `active_version` must resolve to a `versions` entry. If `active_version` is set but there is no matching key under `versions`, the manifest is inconsistent (possible corruption or a botched v1→v2 migration). Workflows must skip the affected skill and surface a loud warning rather than fall through to a degraded state. The recommended recovery is to re-run `[EX] Export Skill` on the affected skill — the export pass rebuilds the version entry from `metadata.json` ground truth.
@@ -0,0 +1,38 @@
1
+ ---
2
+ # Static reference loaded by load-skill.md §1c only when
3
+ # `len(skill_batch) > 1` (multi-skill mode activated via `--all`,
4
+ # multi-selection at the discovery menu, or explicit multi-argument
5
+ # invocation). In single-skill mode the per-step matrix below does
6
+ # not apply and this file is never loaded. Loaded once per export run.
7
+ ---
8
+
9
+ <!-- Config: communicate in {communication_language}. -->
10
+
11
+ # Multi-skill Mode — Per-step Behavior Matrix
12
+
13
+ ## Purpose
14
+
15
+ When multiple skills are exported in a single run, the workflow does NOT loop the full step 1 → step 7 sequence once per skill. Instead, it partitions work across steps to avoid repeated gates and redundant batch work (one §3b orphan-detection pass, one §4 skill-index rebuild, one §6 user gate, one health check, etc.).
16
+
17
+ Loaded by `load-skill.md` §1c when `len(skill_batch) > 1`.
18
+
19
+ ## Per-step matrix
20
+
21
+ | Step | Behavior in multi-skill mode |
22
+ |------|------------------------------|
23
+ | step 1 §2–5 | **Iterate per skill** — load, validate, read metadata, and check the test report for every skill in `skill_batch`. Collect per-skill results. |
24
+ | step 1 §6 | **Single gate** — present one consolidated summary table (one row per skill) and a single [C] gate for the whole batch. |
25
+ | step 2 | **Iterate per skill** — validate each skill's package structure and collect per-skill readiness. |
26
+ | step 3 | **Iterate per skill** — regenerate each skill's `context-snippet.md` independently (each skill has its own prior-gotchas carry-forward state). |
27
+ | step 4 | **Batch once** — §3b orphan detection, §4 skill-index rebuild, §5 managed-section assembly, and §6–9 diff + write all execute once for the entire batch. The exported skill set in §4b already enumerates every skill in the manifest — it does not need per-skill iteration. §9b adds/updates a manifest entry per skill in `skill_batch` (not just the last one), then writes the manifest once. |
28
+ | step 5 | **Iterate per skill** — compute token counts per skill, then present one aggregate report. |
29
+ | step 6 | **One batch summary + one result contract** — the files-written table lists every skill; the result contract JSON covers the whole run, and `outputs` enumerates every context-snippet + target context file touched. |
30
+ | step 7 | **Runs once** — health check is per-workflow-run, not per-skill. |
31
+
32
+ ## Halt semantics
33
+
34
+ If any single skill fails validation in step 1 §2 (required-file or metadata-field failure), halt the entire batch before step 4 §5 — do not partially export. Report which skill failed and why. The principle: a multi-skill run is a unit of work, not a per-skill best-effort sweep — partial exports leave the manifest and managed sections in an ambiguous state that's expensive for the operator to reconcile.
35
+
36
+ ## Single-skill mode (reference)
37
+
38
+ `len(skill_batch) == 1` preserves the legacy behavior: every section operates on the one skill without iteration, no gate consolidation, no per-step table consultation. This file does not need to be loaded.
@@ -0,0 +1,75 @@
1
+ ---
2
+ # Static reference loaded by update-context.md §3b only when
3
+ # `orphaned_context_files` is non-empty (i.e. the cheap pre-check in
4
+ # §3b found a context file on disk with an SKF managed section that
5
+ # is no longer in the current `target_context_files`). The reference
6
+ # carries the (a)/(b)/(c) gate protocol, headless default, and
7
+ # downstream-state contract; the trigger detection itself stays
8
+ # inline in §3b so the LLM knows when to invoke this protocol.
9
+ ---
10
+
11
+ <!-- Config: communicate in {communication_language}. Render the orphan list and gate prompt in {document_output_language}. -->
12
+
13
+ # Orphan Context-File Detection — Gate Protocol
14
+
15
+ ## Purpose
16
+
17
+ Handle the (a) clear / (b) keep / (c) rewrite gate when one or more known context files (`CLAUDE.md`, `.cursorrules`, `AGENTS.md`) on disk contain an SKF managed section but their owning IDE is no longer listed in `config.yaml.ides`. Loaded by `update-context.md` §3b after the cheap pre-check populates `orphaned_context_files`.
18
+
19
+ ## Inputs
20
+
21
+ - `orphaned_context_files` — list of `{context_file, file_path}` entries built by §3b's pre-check
22
+ - `target_context_files` — current export's IDE → context-file map (from step 1)
23
+ - `{headless_mode}` — boolean flag from workflow context
24
+
25
+ ## Gate Protocol
26
+
27
+ Emit the warning and gate:
28
+
29
+ > **Orphaned context files detected.** The following files contain SKF managed sections but no configured IDEs target them:
30
+ > {list: context file → file path}
31
+ >
32
+ > The managed sections in these files are stale. Options:
33
+ >
34
+ > - **(a) clear** — remove the SKF managed section from each orphaned file (surgical marker replacement, leaves user content intact)
35
+ > - **(b) keep** — leave them untouched (they will remain stale until you re-add an IDE that targets this file or delete the file)
36
+ > - **(c) rewrite** — also rewrite the orphaned files with the current skill index (use this if the IDE was removed by mistake)
37
+
38
+ Wait for user choice.
39
+
40
+ **Headless / non-interactive default:** when `{headless_mode}` (or dry-run, or unattended), default to **(b) keep** and print the warning only — no destructive action without explicit consent.
41
+
42
+ ## Choice handling
43
+
44
+ ### (a) clear
45
+
46
+ For each file in `orphaned_context_files`:
47
+
48
+ 1. Replace everything between `<!-- SKF:BEGIN` and `<!-- SKF:END -->` (inclusive) with an empty string, preserving surrounding content byte-exactly.
49
+ 2. Append the file path to `orphans_cleared` (workflow-context list, surfaced in the §6 result contract).
50
+
51
+ ### (b) keep
52
+
53
+ Record nothing. The orphaned files remain on disk, untouched. Proceed.
54
+
55
+ ### (c) rewrite
56
+
57
+ Add each entry in `orphaned_context_files` to a separate `rewrite_context_files` list. This list is kept distinct from `target_context_files` so the user's intent to only export to configured IDEs is preserved in the manifest update at §9b — `rewrite_context_files` participates in the §4–§9a write loop for this run only and is not promoted into the manifest's `ides` arrays.
58
+
59
+ Use `.agents/skills/` as the default skill root for rewritten orphans (the IDE-neutral path used when the original IDE mapping is no longer available).
60
+
61
+ Record each rewritten file in `orphans_rewritten` (workflow-context list, surfaced in the §6 result contract).
62
+
63
+ ## Downstream contract
64
+
65
+ After this protocol completes, §3b returns control to §4 with these workflow-context variables populated:
66
+
67
+ - `orphans_cleared: []` — set when the user chose (a) or stayed empty otherwise
68
+ - `orphans_rewritten: []` — set when the user chose (c) or stayed empty otherwise
69
+ - `rewrite_context_files: []` — extends the per-context-file iteration in §4–§9a when the user chose (c)
70
+
71
+ The §4–§9a loop iterates over `target_context_files + rewrite_context_files`. The §9b manifest update reads only `target_context_files` (rewritten orphans are not promoted into the manifest).
72
+
73
+ ## Scope note
74
+
75
+ This cleanup only runs during interactive export (and the headless default explicitly does nothing destructive). Drop-skill and rename-skill operate on the manifest's declared context files and are not responsible for orphan detection — their scope is the active manifest, not arbitrary on-disk markers.
@@ -0,0 +1,102 @@
1
+ ---
2
+ # Static reference loaded by update-context.md §4c.1 only when
3
+ # `orphan_managed_rows` is non-empty (i.e. the cheap pre-check in
4
+ # §4c.1 found `[skill-name v...]` entries in the prior managed
5
+ # section that are absent from the manifest-driven exported skill
6
+ # set built in §4b). The reference carries the (a)/(b)/(c) gate
7
+ # protocol, headless default, deviations[] contract, and §6
8
+ # result-contract integration; the trigger detection itself stays
9
+ # inline in §4c.1 so the LLM knows when to invoke this protocol.
10
+ ---
11
+
12
+ <!-- Config: communicate in {communication_language}. Render the orphan list and gate prompt in {document_output_language}. -->
13
+
14
+ # Orphan Managed-Section Rows — Gate Protocol
15
+
16
+ ## Purpose
17
+
18
+ Handle the (a) Drop / (b) Preserve verbatim / (c) Cancel gate when the prior managed section in the first target context file contains `[skill-name v...]` rows for skills that are not in the manifest-driven exported skill set — typically externally-installed skills authored in a different repo and dropped into `{skills_output_folder}` without going through export-skill.
19
+
20
+ Strict ADR-K would silently drop such rows, but the user's managed section is load-bearing — silent removal of an installed skill is a regression. The convention captured in `skills/export-skill-result-latest.json` deviations is to make this an explicit operator (or `{headless_mode}`) choice.
21
+
22
+ ## Inputs
23
+
24
+ - `orphan_managed_rows` — list of `{skill_name, version, snippet_text, source_files: []}` entries built by §4c.1's pre-check across **every** target context file, deduplicated by `(skill_name, version)`. `source_files` carries the file paths the orphan appeared in (one entry per file in which the row was found). `snippet_text` is the original snippet line(s) captured verbatim from the first encountered occurrence, used for re-emission if (b) is chosen.
25
+ - `target_context_files` — the full IDE → context-file list (referenced in the gate's framing copy so the user understands the consolidation scope)
26
+ - `{headless_mode}` — boolean flag from workflow context
27
+
28
+ ## Gate Protocol
29
+
30
+ Emit the gate:
31
+
32
+ > **Managed-section rows present but absent from manifest** (consolidated across {len(target_context_files)} target context file(s)):
33
+ >
34
+ > {list each as `- {skill_name} v{version} (in: {comma-separated source_files})`}
35
+ >
36
+ > These skills appear in one or more existing managed sections but no entry exists in `.export-manifest.json` and no source draft exists under `{skills_output_folder}/{skill_name}/`. They were likely installed from a different repo and never run through export-skill in this project. Options:
37
+ >
38
+ > - **(a) Drop** — remove these rows from the rebuilt managed section across **all** target context files (strict ADR-K behavior). The skills' on-disk files are not touched, but they will no longer appear in any context file's managed index.
39
+ > - **(b) Preserve verbatim** — copy each orphan's existing snippet line(s) into the rebuilt managed section across **all** target context files unchanged (one canonical row per `(skill, version)` written everywhere — orphans become symmetric across IDEs as a side effect, which is the correct outcome since the user's intent is "these external skills should appear in my managed index"). Records `deviations[].kind = "preserve_external_skills"` with the affected skill names, versions, and `source_files` in the result contract for audit.
40
+ > - **(c) Cancel** — abort export. Run export-skill against each external skill (or remove the orphan rows from the context files manually) before re-running.
41
+
42
+ Wait for user choice.
43
+
44
+ **Headless default** (when `{headless_mode}`): auto-select **(b) Preserve verbatim**, with the same `deviations[]` entry. Emit a loud log line:
45
+
46
+ > `headless: {N} managed-section rows had no manifest entry; preserving verbatim with deviations[].kind = preserve_external_skills. Run export-skill against each to migrate them into the manifest.`
47
+
48
+ Silent drop under automation would regress the user's managed section without consent; cancel under automation would block the whole export over an externally-installed skill the user did not author. Preservation matches the prior-attentive-operator convention.
49
+
50
+ ## Choice handling
51
+
52
+ ### (a) Drop
53
+
54
+ Do not include any orphan rows in the rebuilt section. Record:
55
+
56
+ ```
57
+ orphans_dropped = [{skill_name, version}, …]
58
+ ```
59
+
60
+ in workflow context for the §6 result contract.
61
+
62
+ ### (b) Preserve verbatim
63
+
64
+ Append each captured `snippet_text` to the assembled section after the manifest-driven entries, preserving alphabetical order in the merged list (sort the combined set of `manifest-driven` + `orphan` snippets by `skill_name`). Each `(skill, version)` is written **once** per rebuilt managed section — the deduplication done by §4c.1 means there is no per-file divergence to reconcile here.
65
+
66
+ Append the following entry to the `deviations[]` array in the §6 result contract:
67
+
68
+ ```json
69
+ {
70
+ "kind": "preserve_external_skills",
71
+ "skills": [
72
+ {"name": "...", "version": "...", "source_files": ["..."]}
73
+ ],
74
+ "rationale": "managed-section row exists but no manifest entry / no source draft"
75
+ }
76
+ ```
77
+
78
+ `source_files` per skill records the prior context files the orphan was found in (asymmetric provenance preserved for audit) — useful when an operator later debugs which IDE's managed section originally carried the row.
79
+
80
+ The same orphans are written to **every** target context file in the §4–§9a loop, so all configured IDEs end up with consistent managed sections (asymmetric prior orphans become symmetric — the correct outcome for the "preserve external skills" intent).
81
+
82
+ ### (c) Cancel
83
+
84
+ HALT the workflow:
85
+
86
+ - Do not rewrite any context file.
87
+ - Do not update the manifest.
88
+ - Do not produce a result contract.
89
+ - Exit code 6, `halt_reason: "user-cancelled"` (matches the §8 Menu cancel semantics).
90
+ - In headless mode this branch is never taken (headless default is (b)), so this exit path is interactive-only.
91
+
92
+ ## Downstream contract
93
+
94
+ After this protocol completes, §4c.1 returns control to §4d with these workflow-context variables populated:
95
+
96
+ - `orphans_dropped: []` — set when the user chose (a) or stayed empty otherwise
97
+ - `deviations[]` — extended with the `preserve_external_skills` entry when the user chose (b)
98
+ - The assembled managed section contains the orphan rows verbatim when (b) was chosen, and excludes them when (a) was chosen
99
+
100
+ ## Scope note
101
+
102
+ This detection runs once per export run (not per target context file) — the §4c.1 pre-check iterates **every** entry in `target_context_files` and deduplicates by `(skill_name, version)` before invoking this protocol, so the gate's choice applies globally and asymmetric orphans (a row present in `.cursorrules` but not in `CLAUDE.md`, or vice versa) are detected and surfaced with `source_files` provenance.
@@ -1,7 +1,9 @@
1
1
  ---
2
- nextStepFile: './step-03-generate-snippet.md'
2
+ nextStepFile: 'generate-snippet.md'
3
3
  ---
4
4
 
5
+ <!-- Config: communicate in {communication_language}. Validate package contents in {document_output_language}. -->
6
+
5
7
  # Step 2: Package
6
8
 
7
9
  ## STEP GOAL:
@@ -12,21 +14,19 @@ To assemble and validate an agentskills.io-compliant package structure from the
12
14
 
13
15
  - Focus only on package structure assembly and validation — do not modify SKILL.md content
14
16
  - Auto-proceed when complete
15
- - **Multi-skill mode:** when step-01 loaded more than one skill (`len(skill_batch) > 1`), iterate sections 1–4 below per skill using each skill's `{resolved_skill_package}`. Collect per-skill status; report the aggregate in §4 as one row per skill. Halt the batch if any skill is NOT READY. See step-01 §1c.
17
+ - **Multi-skill mode:** when step 1 loaded more than one skill (`len(skill_batch) > 1`), iterate sections 1–4 below per skill using each skill's `{resolved_skill_package}`. Collect per-skill status; report the aggregate in §4 as one row per skill. Halt the batch if any skill is NOT READY. See step 1 §1c.
16
18
 
17
19
  ## MANDATORY SEQUENCE
18
20
 
19
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
20
-
21
21
  ### 1. Validate Package Structure
22
22
 
23
- Verify the skill package at `{resolved_skill_package}` (resolved in step-01 via manifest or `active` symlink — see `knowledge/version-paths.md`) contains the expected agentskills.io package layout:
23
+ Verify the skill package at `{resolved_skill_package}` (resolved in step 1 via manifest or `active` symlink — see `knowledge/version-paths.md`) contains the expected agentskills.io package layout:
24
24
 
25
25
  ```
26
26
  {skill_package} = {skills_output_folder}/{skill-name}/{version}/{skill-name}/
27
27
  ├── SKILL.md ← Required: Active skill document
28
28
  ├── metadata.json ← Required: Machine-readable metadata
29
- ├── context-snippet.md ← Will be generated/updated in step-03
29
+ ├── context-snippet.md ← Will be generated/updated in step 3
30
30
  ├── references/ ← Optional: Progressive disclosure
31
31
  │ ├── {function-a}.md
32
32
  │ └── {function-b}.md
@@ -66,7 +66,7 @@ Determine package status:
66
66
 
67
67
  **READY:** All required files present, all required metadata fields valid
68
68
  **WARNINGS:** Ready but with missing recommended fields or empty references/
69
- **NOT READY:** Missing required files or required metadata fields (should not reach here — step-01 would have halted)
69
+ **NOT READY:** Missing required files or required metadata fields (should not reach here — step 1 would have halted)
70
70
 
71
71
  ### 4. Report Package Status
72
72
 
@@ -0,0 +1,79 @@
1
+ ---
2
+ # Static reference loaded by load-skill.md §1b only when
3
+ # `snippet_skill_root_override` is UNSET in config.yaml. When the
4
+ # override is set, every existing snippet's on-disk prefix is ground
5
+ # truth by contract — no probe needed and the entire authoring-repo
6
+ # escape hatch is already configured. Loaded once per export run, not
7
+ # per skill.
8
+ ---
9
+
10
+ <!-- Config: communicate in {communication_language}. Render the warning and gate prompt in {document_output_language}. -->
11
+
12
+ # Snippet Root Prefix Mismatch — Pre-flight Probe
13
+
14
+ ## Purpose
15
+
16
+ Catch the authoring-repo case before step 4 silently rewrites root paths. In an authoring repo, skills typically live under a single shared directory (`skills/`) that does not match any per-IDE `skill_root` (`.claude/skills/`, `.cursor/skills/`, etc.). Without this probe, step 4's root-rewrite algorithm would replace the on-disk prefix with an IDE-mapped one that the snippet files do not actually reside under.
17
+
18
+ Loaded by `load-skill.md` §1b after `target_context_files` is resolved and `snippet_skill_root_override` is confirmed unset.
19
+
20
+ ## Inputs
21
+
22
+ - `target_context_files[0].skill_root` — the reference IDE-mapped skill root (used because step 3 §2.7 picks this same entry for snippet generation when no override is set)
23
+ - `{skills_output_folder}` — for manifest-driven candidate enumeration
24
+ - Current skill's snippet path (resolved via manifest / `active` symlink / flat path per `knowledge/version-paths.md`)
25
+ - `{headless_mode}` — boolean flag from workflow context
26
+
27
+ ## Probe Algorithm
28
+
29
+ 1. Collect candidate snippet paths:
30
+ - Read `{skills_output_folder}/.export-manifest.json` if it exists. For each skill in `exports` with a resolvable `active_version`, add `{skills_output_folder}/{skill-name}/{active_version}/{skill-name}/context-snippet.md`.
31
+ - Also include the current skill's snippet if present.
32
+ 2. For each snippet that exists on disk, read the first line and parse the `root:` value. Strip the trailing `{skill-name}/` to extract the prefix (e.g. `skills/`, `.claude/skills/`).
33
+ 3. Collect unique prefixes into `observed_prefixes`.
34
+ 4. Compare against `target_context_files[0].skill_root` (the reference).
35
+
36
+ ## Mismatch Gate
37
+
38
+ **If `observed_prefixes` contains any value that does not match the reference `skill_root`:**
39
+
40
+ Emit a single warning (once, not per snippet) and present resolution options before continuing to §2:
41
+
42
+ > **Snippet root prefix mismatch detected.**
43
+ > Existing snippets use: `{observed_prefixes}`
44
+ > IDE-mapped skill_root: `{target_context_files[0].skill_root}`
45
+ >
46
+ > This usually means you are in an authoring repo where skills live under a single shared directory. Options:
47
+ >
48
+ > - **(a) Set override** — add `snippet_skill_root_override: {observed_prefix}` to `config.yaml`. Snippets keep their on-disk prefix; the managed section references the real location.
49
+ > - **(b) Proceed with IDE mapping** — step 4 will rewrite every snippet's root path to the IDE's skill_root. Use this only if the IDE's skill directory actually contains the skill files.
50
+ > - **(c) Cancel** — abort export and investigate.
51
+ > - **(d) Use observed prefix for this run only** — set the effective snippet root to the single observed on-disk prefix for this export run, without writing to `config.yaml`. The managed section references the real on-disk location. (Only offered when exactly one prefix was observed.)
52
+ >
53
+ > If multiple distinct prefixes were observed, the snippets disagree with each other — investigate before choosing (a) or (d).
54
+
55
+ Wait for user choice.
56
+
57
+ **Headless default:** when `{headless_mode}`, default to **(b) Proceed with IDE mapping** and log the observed prefix(es) so the mismatch is visible in run logs (not silent).
58
+
59
+ ## Choice handling
60
+
61
+ ### (a) Set override
62
+
63
+ Halt and instruct the user to update `config.yaml` with `snippet_skill_root_override: {observed_prefix}`, then re-run export. Exit code 6, `halt_reason: "user-cancelled"` (configuration change is out-of-band — workflow does not edit config.yaml on the user's behalf).
64
+
65
+ ### (b) Proceed with IDE mapping
66
+
67
+ Continue to §2. Step 4's root-rewrite algorithm will rewrite every snippet's prefix to the reference `skill_root`. The user is accepting that the IDE's skill directory contains the actual files; if it does not, the resulting managed section will reference paths that don't resolve.
68
+
69
+ ### (c) Cancel
70
+
71
+ HALT. Exit code 6, `halt_reason: "user-cancelled"`. No files written.
72
+
73
+ ### (d) Use observed prefix for this run only
74
+
75
+ **Only available when `observed_prefixes` contains exactly one value.** Set the effective snippet root for this run to that single observed prefix — do NOT mutate `config.yaml`. Step 4's root-rewrite algorithm uses this value as the reference instead of `target_context_files[0].skill_root`, so snippets keep their on-disk prefix and the managed section resolves to the real location. Print a one-line hint: "Persist `snippet_skill_root_override: {observed_prefix}` in config.yaml to skip this prompt on future exports." Continue to §2.
76
+
77
+ ## No-mismatch fast path
78
+
79
+ **If all observed prefixes match the reference `skill_root` (or no existing snippets were found):** no warning, no gate. Return control to §1b and proceed silently to §2.
@@ -1,7 +1,9 @@
1
1
  ---
2
- nextStepFile: './step-07-health-check.md'
2
+ nextStepFile: 'health-check.md'
3
3
  ---
4
4
 
5
+ <!-- Config: communicate in {communication_language}. Render the user-facing summary in {document_output_language}. -->
6
+
5
7
  # Step 6: Summary
6
8
 
7
9
  ## STEP GOAL:
@@ -12,12 +14,10 @@ To present a complete export summary showing all files written, token counts, an
12
14
 
13
15
  - Focus only on summarizing what was done and providing next steps — no additional file writes
14
16
  - Chains to the local health-check step via `{nextStepFile}` after completion — the user-facing summary is NOT the terminal step
15
- - **Multi-skill mode:** emit ONE consolidated summary and ONE result contract for the whole batch. The files-written table lists every skill in `skill_batch` (one row per skill's `context-snippet.md` + one row per target managed-section file, shared across the batch). The result contract's `outputs` enumerates every context-snippet file plus every target context file. Distribution instructions (§2) key off `source_authority` per skill — present one block per distinct authority value observed in the batch, listing the skills it applies to. See step-01 §1c.
17
+ - **Multi-skill mode:** emit ONE consolidated summary and ONE result contract for the whole batch. The files-written table lists every skill in `skill_batch` (one row per skill's `context-snippet.md` + one row per target managed-section file, shared across the batch). The result contract's `outputs` enumerates every context-snippet file plus every target context file. Distribution instructions (§2) key off `source_authority` per skill — present one block per distinct authority value observed in the batch, listing the skills it applies to. See step 1 §1c.
16
18
 
17
19
  ## MANDATORY SEQUENCE
18
20
 
19
- **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
20
-
21
21
  ### 1. Compile Export Summary
22
22
 
23
23
  "**Export Complete{if dry-run: ' (Dry Run)'}**
@@ -89,18 +89,18 @@ Your skill is generated from an external dependency for local use.
89
89
 
90
90
  ### 3. Use It In This Project
91
91
 
92
- Always show this section (regardless of `source_authority`) so the author can install the skill they just forged into the current project and try it immediately:
92
+ Always show this section (regardless of `source_authority`) so the author can install the skill they just forged into the current project and try it immediately.
93
+
94
+ **Rendering rule for the command below — must be obeyed:** substitute `{resolved_skill_package}` with the actual resolved path before printing (do not leave the placeholder for the user to replace). The substituted path must be either absolute (starts with `/`) or `./`-prefixed. A bare relative path like `skills/foo/1.0.0/foo` is parsed by the `skills` CLI as `https://github.com/skills/foo.git` (org/repo GitHub lookup) and will fail with an authentication error. If `{resolved_skill_package}` resolves to a relative path, prefix it with `./` before emitting.
93
95
 
94
96
  "### Use It In This Project
95
97
 
96
- To install this skill into the current project right now:
98
+ To install this skill into the current project right now, run:
97
99
 
98
100
  ```
99
101
  npx skills add {resolved_skill_package}
100
102
  ```
101
103
 
102
- Replace `{resolved_skill_package}` with the absolute path to the package folder shown above (from step-02), e.g. `{skills_output_folder}/{skill-name}/{version}/{skill-name}/`.
103
-
104
104
  For other source formats (registry name, git URL, tarball, etc.), see the **Installation → Source Formats** section at <https://www.npmjs.com/package/skills>.
105
105
 
106
106
  If the installed skill's commands are not available in the same IDE session, reload plugins (e.g. for Claude Code users, run `/reload-plugins`) or restart your AI editor. Next time you will see the command `/{skill-name}` (e.g. `/{skill-name}`)."
@@ -130,18 +130,30 @@ No files were written. To run the export for real:
130
130
 
131
131
  ### 6. Result Contract
132
132
 
133
- Write the result contract per `shared/references/output-contract-schema.md`: the per-run record at `{skills_output_folder}/export-skill-result-{YYYYMMDD-HHmmss}.json` (UTC timestamp, resolution to seconds) and a copy at `{skills_output_folder}/export-skill-result-latest.json` (stable path for pipeline consumers — copy, not symlink). Include all context files and target managed-section files in `outputs`; include total always-on and on-trigger token counts in `summary`.
133
+ Write the result contract per `shared/references/output-contract-schema.md`: the per-run record at `{skills_output_folder}/export-skill-result-{timestamp}.json` (reuse the activation-stored `{timestamp}`, resolution to seconds) and a copy at `{skills_output_folder}/export-skill-result-latest.json` (stable path for pipeline consumers — copy, not symlink). Include all context files and target managed-section files in `outputs`; include total always-on and on-trigger token counts in `summary`.
134
+
135
+ When `{headless_mode}` is true, also emit the single-line envelope on **stdout** before chaining to step 7 (matches the SKILL.md "Result Contract (Headless)" shape):
134
136
 
135
- **`deviations[]` field (export-skill-specific extension):** when step-04 §4c.1 detected manifest-orphan managed rows and the operator (or `{headless_mode}`) chose **(b) Preserve verbatim**, also include a `deviations[]` array in the contract. Each entry has the shape:
137
+ ```
138
+ SKF_EXPORT_RESULT_JSON: {"status":"success","skills":{skill_batch_names},"context_files_updated":{context_files_updated},"manifest_path":"{skills_output_folder}/.export-manifest.json","headless_decisions":{headless_decisions},"exit_code":0,"halt_reason":null}
139
+ ```
140
+
141
+ Substitute `{skill_batch_names}`, `{context_files_updated}`, and `{headless_decisions}` as JSON arrays. When `--dry-run` was set, emit `"status":"dry-run"` instead and report what *would* have been written without performing the writes.
142
+
143
+ **`deviations[]` field (export-skill-specific extension):** when step 4 §4c.1 detected manifest-orphan managed rows and the operator (or `{headless_mode}`) chose **(b) Preserve verbatim**, also include a `deviations[]` array in the contract. Each entry has the shape:
136
144
 
137
145
  ```json
138
146
  {
139
147
  "kind": "preserve_external_skills",
140
- "skills": [{"name": "skill-name", "version": "1.0.0"}, …],
148
+ "skills": [
149
+ {"name": "skill-name", "version": "1.0.0", "source_files": ["CLAUDE.md", ".cursorrules"]}
150
+ ],
141
151
  "rationale": "managed-section row exists but no manifest entry / no source draft"
142
152
  }
143
153
  ```
144
154
 
155
+ `source_files` per skill records the prior context files the orphan was found in (the §4c.1 multi-file scan deduplicates by `(skill, version)` and tracks which target context files originally carried the row — useful when an operator later debugs which IDE's managed section first introduced the external skill).
156
+
145
157
  Other workflow choices that diverge from the strict spec path may add their own entries with a distinct `kind` value — auditors then have one place to look for "what did this run choose to do differently from the canonical flow." Omit the field when there are no deviations rather than writing an empty array, so the absence is readable as "ran the canonical path."
146
158
 
147
159
  ### 7. Chain to Health Check