bmad-module-skill-forge 0.2.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 (154) hide show
  1. package/.nvmrc +1 -0
  2. package/LICENSE +26 -0
  3. package/README.md +213 -0
  4. package/docs/404.md +20 -0
  5. package/docs/agents.md +73 -0
  6. package/docs/architecture.md +301 -0
  7. package/docs/examples.md +144 -0
  8. package/docs/getting-started.md +198 -0
  9. package/docs/index.md +75 -0
  10. package/docs/workflows.md +190 -0
  11. package/package.json +109 -0
  12. package/src/agents/forger.agent.yaml +93 -0
  13. package/src/forger/README.md +17 -0
  14. package/src/forger/forge-tier.yaml +13 -0
  15. package/src/forger/preferences.yaml +10 -0
  16. package/src/knowledge/agentskills-spec.md +158 -0
  17. package/src/knowledge/confidence-tiers.md +153 -0
  18. package/src/knowledge/manual-section-integrity.md +156 -0
  19. package/src/knowledge/overview.md +56 -0
  20. package/src/knowledge/progressive-capability.md +120 -0
  21. package/src/knowledge/provenance-tracking.md +163 -0
  22. package/src/knowledge/skf-knowledge-index.csv +9 -0
  23. package/src/knowledge/skill-lifecycle.md +150 -0
  24. package/src/knowledge/zero-hallucination.md +101 -0
  25. package/src/module-help.csv +12 -0
  26. package/src/module.yaml +22 -0
  27. package/src/workflows/README.md +148 -0
  28. package/src/workflows/analyze-source/data/skill-brief-schema.md +75 -0
  29. package/src/workflows/analyze-source/data/unit-detection-heuristics.md +88 -0
  30. package/src/workflows/analyze-source/steps-c/step-01-init.md +191 -0
  31. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +144 -0
  32. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +208 -0
  33. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +199 -0
  34. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +222 -0
  35. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +236 -0
  36. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +239 -0
  37. package/src/workflows/analyze-source/templates/analysis-report-template.md +41 -0
  38. package/src/workflows/analyze-source/validation-report.md +657 -0
  39. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +385 -0
  40. package/src/workflows/analyze-source/workflow.md +61 -0
  41. package/src/workflows/audit-skill/data/drift-report-template.md +62 -0
  42. package/src/workflows/audit-skill/data/severity-rules.md +52 -0
  43. package/src/workflows/audit-skill/steps-c/step-01-init.md +195 -0
  44. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +191 -0
  45. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +194 -0
  46. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +199 -0
  47. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +210 -0
  48. package/src/workflows/audit-skill/steps-c/step-06-report.md +217 -0
  49. package/src/workflows/audit-skill/validation-report.md +545 -0
  50. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +318 -0
  51. package/src/workflows/audit-skill/workflow.md +63 -0
  52. package/src/workflows/brief-skill/data/skill-brief-schema.md +82 -0
  53. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +184 -0
  54. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +203 -0
  55. package/src/workflows/brief-skill/steps-c/step-03-scope-definition.md +225 -0
  56. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +185 -0
  57. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +156 -0
  58. package/src/workflows/brief-skill/validation-report.md +630 -0
  59. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +360 -0
  60. package/src/workflows/brief-skill/workflow.md +57 -0
  61. package/src/workflows/create-skill/data/extraction-patterns.md +63 -0
  62. package/src/workflows/create-skill/data/skill-sections.md +166 -0
  63. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +176 -0
  64. package/src/workflows/create-skill/steps-c/step-02-ecosystem-check.md +143 -0
  65. package/src/workflows/create-skill/steps-c/step-03-extract.md +184 -0
  66. package/src/workflows/create-skill/steps-c/step-04-enrich.md +152 -0
  67. package/src/workflows/create-skill/steps-c/step-05-compile.md +198 -0
  68. package/src/workflows/create-skill/steps-c/step-06-validate.md +162 -0
  69. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +165 -0
  70. package/src/workflows/create-skill/steps-c/step-08-report.md +160 -0
  71. package/src/workflows/create-skill/validation-report.md +189 -0
  72. package/src/workflows/create-skill/workflow-plan-create-skill.md +491 -0
  73. package/src/workflows/create-skill/workflow.md +52 -0
  74. package/src/workflows/create-stack-skill/data/integration-patterns.md +61 -0
  75. package/src/workflows/create-stack-skill/data/manifest-patterns.md +35 -0
  76. package/src/workflows/create-stack-skill/data/stack-skill-template.md +110 -0
  77. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +142 -0
  78. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +145 -0
  79. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +161 -0
  80. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +155 -0
  81. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +154 -0
  82. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +160 -0
  83. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +202 -0
  84. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +193 -0
  85. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +137 -0
  86. package/src/workflows/create-stack-skill/validation-report.md +401 -0
  87. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +481 -0
  88. package/src/workflows/create-stack-skill/workflow.md +59 -0
  89. package/src/workflows/export-skill/data/managed-section-format.md +70 -0
  90. package/src/workflows/export-skill/data/snippet-format.md +32 -0
  91. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +184 -0
  92. package/src/workflows/export-skill/steps-c/step-02-package.md +153 -0
  93. package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +166 -0
  94. package/src/workflows/export-skill/steps-c/step-04-update-context.md +222 -0
  95. package/src/workflows/export-skill/steps-c/step-05-token-report.md +126 -0
  96. package/src/workflows/export-skill/steps-c/step-06-summary.md +167 -0
  97. package/src/workflows/export-skill/validation-report.md +263 -0
  98. package/src/workflows/export-skill/workflow-plan-export-skill.md +369 -0
  99. package/src/workflows/export-skill/workflow.md +56 -0
  100. package/src/workflows/quick-skill/data/registry-resolution.md +91 -0
  101. package/src/workflows/quick-skill/data/skill-template.md +66 -0
  102. package/src/workflows/quick-skill/steps-c/step-01-resolve-target.md +165 -0
  103. package/src/workflows/quick-skill/steps-c/step-02-ecosystem-check.md +143 -0
  104. package/src/workflows/quick-skill/steps-c/step-03-quick-extract.md +177 -0
  105. package/src/workflows/quick-skill/steps-c/step-04-compile.md +180 -0
  106. package/src/workflows/quick-skill/steps-c/step-05-validate.md +150 -0
  107. package/src/workflows/quick-skill/steps-c/step-06-write.md +160 -0
  108. package/src/workflows/quick-skill/validation-report.md +543 -0
  109. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +405 -0
  110. package/src/workflows/quick-skill/workflow.md +56 -0
  111. package/src/workflows/setup-forge/data/tier-rules.md +50 -0
  112. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +140 -0
  113. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +141 -0
  114. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +116 -0
  115. package/src/workflows/setup-forge/steps-c/step-04-report.md +131 -0
  116. package/src/workflows/setup-forge/validation-report.md +504 -0
  117. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +428 -0
  118. package/src/workflows/setup-forge/workflow.md +49 -0
  119. package/src/workflows/test-skill/data/output-section-formats.md +96 -0
  120. package/src/workflows/test-skill/data/scoring-rules.md +74 -0
  121. package/src/workflows/test-skill/steps-c/step-01-init.md +185 -0
  122. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +162 -0
  123. package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +222 -0
  124. package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +249 -0
  125. package/src/workflows/test-skill/steps-c/step-05-score.md +222 -0
  126. package/src/workflows/test-skill/steps-c/step-06-report.md +175 -0
  127. package/src/workflows/test-skill/templates/test-report-template.md +24 -0
  128. package/src/workflows/test-skill/validation-report.md +390 -0
  129. package/src/workflows/test-skill/workflow-plan-test-skill.md +288 -0
  130. package/src/workflows/test-skill/workflow.md +57 -0
  131. package/src/workflows/update-skill/data/manual-section-rules.md +44 -0
  132. package/src/workflows/update-skill/data/merge-conflict-rules.md +62 -0
  133. package/src/workflows/update-skill/steps-c/step-01-init.md +208 -0
  134. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +184 -0
  135. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +187 -0
  136. package/src/workflows/update-skill/steps-c/step-04-merge.md +230 -0
  137. package/src/workflows/update-skill/steps-c/step-05-validate.md +187 -0
  138. package/src/workflows/update-skill/steps-c/step-06-write.md +204 -0
  139. package/src/workflows/update-skill/steps-c/step-07-report.md +201 -0
  140. package/src/workflows/update-skill/validation-report.md +559 -0
  141. package/src/workflows/update-skill/workflow-plan-update-skill.md +441 -0
  142. package/src/workflows/update-skill/workflow.md +56 -0
  143. package/tools/cli/commands/install.js +33 -0
  144. package/tools/cli/commands/status.js +195 -0
  145. package/tools/cli/commands/uninstall.js +226 -0
  146. package/tools/cli/commands/update.js +63 -0
  147. package/tools/cli/lib/compiler.js +306 -0
  148. package/tools/cli/lib/ide-commands.js +244 -0
  149. package/tools/cli/lib/installer.js +307 -0
  150. package/tools/cli/lib/manifest.js +109 -0
  151. package/tools/cli/lib/ui.js +277 -0
  152. package/tools/cli/lib/version-check.js +86 -0
  153. package/tools/cli/skf-cli.js +45 -0
  154. package/tools/skf-npx-wrapper.js +36 -0
@@ -0,0 +1,441 @@
1
+ ---
2
+ conversionFrom: 'src/workflows/update-skill/update-skill.spec.md'
3
+ originalFormat: 'BMAD Workflow Specification (Placeholder)'
4
+ stepsCompleted: ['step-00-conversion', 'step-02-classification', 'step-03-requirements', 'step-04-tools', 'step-05-plan-review', 'step-06-design', 'step-07-foundation', 'step-08-build-step-01', 'step-09-build-remaining', 'validation']
5
+ created: 2026-02-27
6
+ status: VALIDATED
7
+ validationDate: 2026-02-27
8
+ validationReport: './validation-report.md'
9
+ approvedDate: 2026-02-27
10
+ ---
11
+
12
+ # Workflow Creation Plan
13
+
14
+ ## Conversion Source
15
+
16
+ **Original Path:** src/workflows/update-skill/update-skill.spec.md
17
+ **Original Format:** BMAD Workflow Specification (Placeholder)
18
+ **Detected Structure:** Single spec file defining a 7-step create-only workflow for smart skill regeneration with [MANUAL] section preservation. No step files, templates, or data files exist yet — this is a design-phase placeholder.
19
+
20
+ ---
21
+
22
+ ## Original Workflow Analysis
23
+
24
+ ### Goal (from source)
25
+
26
+ Smart regeneration preserving [MANUAL] sections. Detects changes in source code since last generation, re-extracts affected exports, diffs against existing provenance map, and regenerates SKILL.md while preserving any [MANUAL] sections the developer has added. Handles both individual and stack skills internally.
27
+
28
+ ### Original Steps (Complete List)
29
+
30
+ **Step 1:** load-existing - Load existing skill and provenance map
31
+ **Step 2:** detect-changes - Diff source against provenance map
32
+ **Step 3:** re-extract - AST extraction on changed files only
33
+ **Step 4:** merge - Merge new extractions, preserve [MANUAL] sections
34
+ **Step 5:** validate - Validate updated skill against spec
35
+ **Step 6:** write - Write updated SKILL.md and provenance map
36
+ **Step 7:** report - Display change summary
37
+
38
+ ### Output / Deliverable
39
+
40
+ Document-producing workflow that outputs:
41
+ - Updated `{skills_output_folder}/{name}/SKILL.md`
42
+ - Updated `{forge_data_folder}/{name}/provenance-map.json`
43
+ - Updated `{forge_data_folder}/{name}/evidence-report.md`
44
+
45
+ ### Input Requirements
46
+
47
+ **Required:**
48
+ - Existing skill path (`{skills_output_folder}/{name}/`)
49
+ - Updated source code
50
+
51
+ **Optional:**
52
+ - None
53
+
54
+ ### Key Instructions to LLM
55
+
56
+ - Primary agent: Ferris (Surgeon mode) — precision-focused, surgical changes only
57
+ - Workflow type: Core (part of the SKF module's essential functionality)
58
+ - Create-only mode (steps-c/ only, no tri-modal)
59
+ - Must handle both individual and stack skills internally (no separate workflows)
60
+ - Must preserve [MANUAL] sections — developer-authored content must survive regeneration
61
+ - Uses provenance map for change detection (diff-based, not full re-extraction)
62
+ - Build priority: Phase 2 (Lifecycle)
63
+
64
+ ---
65
+
66
+ ## Conversion Notes
67
+
68
+ **What works well in original:**
69
+ - Clear 7-step pipeline with well-defined responsibilities per step
70
+ - Provenance-map-driven change detection (efficient, targeted)
71
+ - Explicit [MANUAL] section preservation requirement
72
+ - Unified handling of individual and stack skills
73
+ - Well-defined input/output contract
74
+
75
+ **What needs improvement:**
76
+ - Spec is a placeholder — no implementation details exist for any step
77
+ - No data files, templates, or step files have been created
78
+ - No description of how [MANUAL] sections are identified or preserved
79
+ - No detail on AST extraction approach for re-extraction
80
+ - No error handling or edge case coverage (e.g., deleted exports, renamed files)
81
+
82
+ **Compliance gaps identified:**
83
+ - No step files exist (need full step-file architecture)
84
+ - No frontmatter standards applied yet
85
+ - No menu/continuation patterns defined
86
+ - No state tracking or stepsCompleted patterns
87
+ - No data files or templates referenced
88
+ - Installed path uses `{project-root}/_bmad/skf/workflows/update-skill` but needs proper BMAD structure
89
+
90
+ ---
91
+
92
+ ## Memory-Informed Conversion Notes
93
+
94
+ ### Patterns from Prior Workflow Builds
95
+
96
+ **Tier-awareness (from create-skill, audit-skill, create-stack-skill):**
97
+ - Quick tier: text pattern matching, T1-low confidence
98
+ - Forge tier: AST structural extraction, T1 confidence
99
+ - Deep tier: AST + QMD semantic enrichment, T2 confidence
100
+ - Update-skill must implement tier-aware re-extraction matching these patterns
101
+
102
+ **Workflow chaining (from audit-skill #334):**
103
+ - Requires: setup-forge output (forge-tier.yaml), create-skill output (provenance-map.json + SKILL.md)
104
+ - Triggered by: audit-skill when CRITICAL/HIGH drift detected
105
+ - Produces: updated provenance-map.json feeding back into audit-skill cycle
106
+
107
+ **Ferris Surgeon mode (from agent plan #37):**
108
+ - Defined as "precise edits that preserve manual changes" — exact match for update-skill's purpose
109
+ - Zero-hallucination principle: every regenerated instruction must trace to code with AST file:line citations
110
+ - Confidence tier labeling (T1/T1-low/T2) required on all re-extracted content
111
+
112
+ **Subprocess patterns (from audit-skill #321):**
113
+ - Pattern 2: per-file AST extraction (for re-extract step)
114
+ - Pattern 4: parallel comparison (for detect-changes step)
115
+ - Pattern 3: QMD/rules operations (for Deep tier enrichment)
116
+
117
+ **Stack skill support (from create-stack-skill #297):**
118
+ - Must handle multi-file outputs: SKILL.md, references/*.md, integrations/*.md
119
+ - Stack skills use integration-first architecture with cross-cutting patterns
120
+ - Update must preserve [MANUAL] sections across ALL output files, not just SKILL.md
121
+
122
+ **Batch mode (from create-skill #89):**
123
+ - --batch flag for updating multiple skills
124
+ - --continue flag for checkpoint resume from sidecar
125
+
126
+ ### Missing Features to Add During Conversion
127
+
128
+ 1. Tier-aware re-extraction (Quick/Forge/Deep graceful degradation)
129
+ 2. Degraded mode for missing provenance map (fallback to full re-extraction)
130
+ 3. Stack skill multi-file update support
131
+ 4. Batch mode with checkpoint resume
132
+ 5. Change summary with before/after diff visualization
133
+ 6. Edge case handling: deleted exports, renamed files, moved functions
134
+ 7. [MANUAL] section conflict resolution when regenerated content overlaps
135
+
136
+ ---
137
+
138
+ ## Classification Decisions
139
+
140
+ **Workflow Name:** update-skill
141
+ **Target Path:** {project-root}/_bmad/skf/workflows/update-skill/
142
+
143
+ **4 Key Decisions:**
144
+ 1. **Document Output:** false (modifies existing files, does not produce new documents)
145
+ 2. **Module Affiliation:** SKF (Phase 2 Lifecycle workflow, Ferris agent menu [US] Update Skill)
146
+ 3. **Session Type:** single-session (targeted re-extraction on changed files only, efficient provenance-driven diffing)
147
+ 4. **Lifecycle Support:** create-only (steps-c/ only — update-skill IS the edit operation for skill artifacts)
148
+
149
+ **Structure Implications:**
150
+ - Needs steps-c/ folder only (no steps-e/ or steps-v/)
151
+ - Standard step-01-init.md without continuation logic
152
+ - No stepsCompleted tracking in output (non-document)
153
+ - SKF module variables available: skills_output_folder, forge_data_folder, forge_tier, etc.
154
+ - Stored in SKF module's workflows directory alongside create-skill, audit-skill, etc.
155
+
156
+ ---
157
+
158
+ ## Requirements
159
+
160
+ **Flow Structure:**
161
+ - Pattern: linear
162
+ - Phases: load → diff → extract → merge → validate → write → report
163
+ - Estimated steps: 7 (matching spec pipeline)
164
+
165
+ **User Interaction:**
166
+ - Style: mostly autonomous with strategic gates
167
+ - Decision points: Gate 1 after load (confirm change scope), Gate 2 after merge (approve [MANUAL] conflict resolution if any)
168
+ - Checkpoint frequency: 2 gates — steps 02-03 and 05-07 auto-proceed
169
+
170
+ **Inputs Required:**
171
+ - Required: existing skill path ({skills_output_folder}/{name}/), sidecar/forge-tier.yaml (tier detection), {forge_data_folder}/{name}/provenance-map.json (export mappings + timestamps), existing SKILL.md + metadata.json
172
+ - Optional: --batch flag for multi-skill update, --continue flag for checkpoint resume, specific file list to restrict re-extraction scope
173
+ - Prerequisites: setup-forge completed (forge-tier.yaml), create-skill completed (provenance-map.json + SKILL.md exist)
174
+
175
+ **Output Specifications:**
176
+ - Type: action (modifies existing files in-place)
177
+ - Format: N/A (non-document)
178
+ - Actions: surgically updates SKILL.md, provenance-map.json, evidence-report.md; for stack skills also updates references/*.md and references/integrations/*.md
179
+ - Frequency: single skill per run (batch mode wraps multiple runs)
180
+
181
+ **Success Criteria:**
182
+ - All changed exports re-extracted with correct confidence tiers (T1/T1-low/T2)
183
+ - All [MANUAL] sections preserved intact with zero content loss
184
+ - Provenance map updated with new timestamps and file mappings
185
+ - No hallucinated content — every instruction traces to AST file:line citation
186
+ - Stack skills: all affected reference files updated consistently
187
+ - Evidence report reflects update operation with before/after provenance
188
+
189
+ **Instruction Style:**
190
+ - Overall: prescriptive
191
+ - Notes: matches established SKF pattern (setup-forge, create-skill, audit-skill all use prescriptive). Zero-hallucination principle requires exact AST citations. No room for creative interpretation when modifying existing skill artifacts.
192
+
193
+ ---
194
+
195
+ ## Tools Configuration
196
+
197
+ **Core BMAD Tools:**
198
+ - **Party Mode:** excluded — deterministic surgical operation, no creative brainstorming applicable
199
+ - **Advanced Elicitation:** excluded — prescriptive workflow with no ambiguity points
200
+ - **Brainstorming:** excluded — not applicable to code-driven extraction pipeline
201
+
202
+ **LLM Features:**
203
+ - **Web-Browsing:** excluded — all data is local (source code + skill artifacts)
204
+ - **File I/O:** included — core requirement. Reads skill artifacts, provenance maps, source code. Writes updated SKILL.md, provenance-map.json, evidence-report.md, and stack reference files
205
+ - **Sub-Agents:** excluded — single-agent workflow (Ferris Surgeon mode)
206
+ - **Sub-Processes:** included — Pattern 2 (per-file AST extraction in Step 03), Pattern 4 (parallel diff comparison in Step 02)
207
+
208
+ **Memory:**
209
+ - Type: single-session (no continuation logic)
210
+ - Sidecar: reads forge-tier.yaml (pre-existing from setup-forge), reads/writes provenance-map.json
211
+
212
+ **External Integrations:**
213
+ - **ast_bridge:** required for Forge/Deep tier AST extraction (pre-detected by setup-forge)
214
+ - **gh_bridge:** required for all tiers to read source files
215
+ - **qmd_bridge:** required for Deep tier semantic enrichment only
216
+ - **skills_ref:** required for validation against agentskills.io spec (Step 05)
217
+
218
+ **Installation Requirements:**
219
+ - None — all tools pre-detected by setup-forge workflow
220
+ - User preference: N/A (no additional installs needed)
221
+
222
+ ---
223
+
224
+ ## Workflow Design
225
+
226
+ ### Step Sequence
227
+
228
+ | Step | Name | Type | Goal | Menu | Size Est |
229
+ |------|------|------|------|------|----------|
230
+ | 01 | init | Init (Input Discovery) | Load existing skill, provenance map, forge tier; detect skill type; present baseline + change scope | [C] Continue | ~200 |
231
+ | 02 | detect-changes | Middle (Simple) | Diff source timestamps/hashes against provenance map; classify changes | Auto-proceed | ~180 |
232
+ | 03 | re-extract | Middle (Simple) | Tier-aware AST extraction on changed files only | Auto-proceed | ~200 |
233
+ | 04 | merge | Middle (Conditional) | Merge new extractions into existing skill; preserve [MANUAL] sections; conflict resolution | Conditional: [C] if conflicts, auto-proceed if clean | ~250 |
234
+ | 05 | validate | Validation Sequence | Validate updated skill against spec; verify [MANUAL] integrity; check confidence tiers | Auto-proceed | ~180 |
235
+ | 06 | write | Middle (Simple) | Write updated SKILL.md, provenance-map.json, evidence-report.md, stack reference files | Auto-proceed | ~180 |
236
+ | 07 | report | Final Step | Display change summary with diff, [MANUAL] preservation count, chaining recommendations | No next step | ~150 |
237
+
238
+ ### Interaction Patterns
239
+
240
+ - **Step 01:** Menu Pattern 2 (C only) — user confirms scope after baseline summary
241
+ - **Steps 02-03:** Menu Pattern 3 (Auto-proceed) — deterministic operations
242
+ - **Step 04:** Conditional — [C] if [MANUAL] conflicts, auto-proceed if clean merge
243
+ - **Steps 05-06:** Menu Pattern 3 (Auto-proceed) — validation and write
244
+ - **Step 07:** Final Step — no menu, display summary and chaining recommendations
245
+ - **No A/P anywhere** — prescriptive surgical workflow
246
+
247
+ ### Data Flow
248
+
249
+ ```
250
+ Step 01 (init)
251
+ IN: skill path (user), forge-tier.yaml (sidecar), SKILL.md, metadata.json, provenance-map.json
252
+ OUT: loaded baseline state → Step 02
253
+
254
+ Step 02 (detect-changes)
255
+ IN: provenance-map.json entries, source file timestamps/hashes
256
+ OUT: change manifest (changed/added/deleted/moved files + export-level changes)
257
+
258
+ Step 03 (re-extract)
259
+ IN: change manifest, source files (changed only)
260
+ OUT: fresh extractions with confidence tiers (T1/T1-low/T2)
261
+
262
+ Step 04 (merge)
263
+ IN: fresh extractions, existing SKILL.md content, [MANUAL] section markers
264
+ OUT: merged SKILL.md content with [MANUAL] sections preserved
265
+
266
+ Step 05 (validate)
267
+ IN: merged content, agentskills.io spec (via skills_ref)
268
+ OUT: validation results (pass/fail with details)
269
+
270
+ Step 06 (write)
271
+ IN: validated merged content, updated provenance data
272
+ OUT: written files (SKILL.md, provenance-map.json, evidence-report.md, stack refs)
273
+
274
+ Step 07 (report)
275
+ IN: change manifest, merge results, validation results
276
+ OUT: change summary displayed to user + chaining recommendation
277
+ ```
278
+
279
+ ### File Structure
280
+
281
+ ```
282
+ update-skill/
283
+ ├── workflow.md
284
+ ├── data/
285
+ │ ├── manual-section-rules.md
286
+ │ └── merge-conflict-rules.md
287
+ └── steps-c/
288
+ ├── step-01-init.md
289
+ ├── step-02-detect-changes.md
290
+ ├── step-03-re-extract.md
291
+ ├── step-04-merge.md
292
+ ├── step-05-validate.md
293
+ ├── step-06-write.md
294
+ └── step-07-report.md
295
+ ```
296
+
297
+ ### Role and Persona
298
+
299
+ - **Role:** Ferris in Surgeon mode — precision-focused, surgical changes only
300
+ - **Communication:** Terse, technical, confidence-labeled. Every statement backed by AST citations
301
+ - **Tone:** Clinical precision
302
+ - **Style:** Prescriptive throughout — zero ambiguity, zero hallucination
303
+
304
+ ### Error Handling
305
+
306
+ - Missing SKILL.md → abort: "Run create-skill first"
307
+ - Missing provenance-map.json → offer degraded mode (full re-extraction, T1-low confidence)
308
+ - Missing forge-tier.yaml → abort: "Run setup-forge first"
309
+ - No changes detected → skip to Step 07: "No drift detected. Skill is current."
310
+ - [MANUAL] conflict → halt, present conflict details, require user resolution
311
+ - Deleted exports with [MANUAL] annotations → flag WARNING, require user decision
312
+ - Validation failure → present issues, recommend fixes, allow proceed or abort
313
+
314
+ ### Subprocess Optimization
315
+
316
+ | Step | Pattern | What | Returns |
317
+ |------|---------|------|---------|
318
+ | 02 | Pattern 4 (Parallel) | Parallel timestamp/hash comparison across file categories | Change manifest per category |
319
+ | 03 | Pattern 2 (Per-file) | Per-file AST extraction on each changed file | Structured extraction findings per file |
320
+ | 03 (Deep) | Pattern 3 (Data Ops) | QMD query for semantic enrichment on changed exports | T2 evidence per export |
321
+ | 05 | Pattern 4 (Parallel) | Parallel validation checks (spec, [MANUAL] integrity, confidence tiers) | Structured validation results |
322
+
323
+ Fallback: All operations executable in main thread if subprocesses unavailable.
324
+
325
+ ### Workflow Chaining
326
+
327
+ **Input Contract (Required):**
328
+ - setup-forge → sidecar/forge-tier.yaml
329
+ - create-skill or create-stack-skill → {skills_output_folder}/{name}/SKILL.md + {forge_data_folder}/{name}/provenance-map.json
330
+
331
+ **Input Contract (Optional):**
332
+ - audit-skill → drift report (when triggered by CRITICAL/HIGH drift)
333
+
334
+ **Output Contract:**
335
+ - Updated provenance-map.json → feeds back into audit-skill cycle
336
+ - Updated SKILL.md → consumed by export-skill, test-skill
337
+
338
+ **Step 07 Recommendation:**
339
+ - Validation passed: "Skill updated. Run audit-skill to verify, or export-skill to package."
340
+ - Issues remain: "Partial update. Run audit-skill to identify remaining drift."
341
+
342
+ ---
343
+
344
+ ## Foundation Build Complete
345
+
346
+ **Created:**
347
+ - Folder structure at: _bmad-output/bmb-creations/workflows/update-skill/
348
+ - workflow.md (entry point with SKF module config loading)
349
+ - data/manual-section-rules.md ([MANUAL] section detection, preservation, conflict types)
350
+ - data/merge-conflict-rules.md (5 change categories, merge priority order, stack skill rules)
351
+
352
+ **Configuration:**
353
+ - Workflow name: update-skill
354
+ - Continuable: no (single-session)
355
+ - Document output: no (action-based, modifies existing files)
356
+ - Mode: create-only (steps-c/)
357
+ - No output template needed (non-document workflow)
358
+
359
+ **Next Steps:**
360
+ - Step 8: Build step-01-init.md
361
+ - Step 9: Build remaining steps 02-07 (repeatable)
362
+
363
+ ---
364
+
365
+ ## Step 01 Build Complete
366
+
367
+ **Created:**
368
+ - steps-c/step-01-init.md (~150 lines)
369
+
370
+ **Step Configuration:**
371
+ - Type: non-continuable (no step-01b needed)
372
+ - Input Discovery: yes (discovers skill path, provenance map, forge-tier.yaml, [MANUAL] sections)
373
+ - Menu: Pattern 2 (C only) — user confirms baseline scope
374
+ - Next Step: step-02-detect-changes
375
+
376
+ **Supporting Files:**
377
+ - data/manual-section-rules.md (referenced from step-01 for [MANUAL] inventory)
378
+ - data/merge-conflict-rules.md (pre-created, used in step-04)
379
+
380
+ **Key Features:**
381
+ - Validates all required artifacts before proceeding (SKILL.md, metadata.json, forge-tier.yaml)
382
+ - Degraded mode option when provenance map missing
383
+ - Detects individual vs stack skill type from metadata.json
384
+ - Inventories all [MANUAL] sections across all output files (including stack references)
385
+ - Presents baseline summary table with forge tier, provenance age, export count, [MANUAL] count
386
+
387
+ ---
388
+
389
+ ## Steps 02-07 Build Complete
390
+
391
+ ### Step 02: detect-changes (~180 lines)
392
+ - Type: Middle (Simple), Auto-proceed
393
+ - Pattern 4 parallel subprocess for timestamp/hash comparison
394
+ - 3-category scan: file-level changes, export-level changes, rename detection
395
+ - Change manifest output with per-file classification (MODIFIED/ADDED/DELETED/MOVED/RENAMED)
396
+ - No-change shortcut: skips directly to step-07-report if source matches provenance
397
+ - Next: step-03-re-extract
398
+
399
+ ### Step 03: re-extract (~190 lines)
400
+ - Type: Middle (Simple), Auto-proceed
401
+ - Pattern 2 per-file subprocess for AST extraction on changed files only
402
+ - Tier-aware: Quick (regex, T1-low), Forge (AST, T1), Deep (AST+QMD, T1+T2)
403
+ - "DO NOT BE LAZY" directive ensures per-file subprocess extraction
404
+ - Conditional QMD enrichment (Pattern 3) for Deep tier only
405
+ - Next: step-04-merge
406
+
407
+ ### Step 04: merge (~230 lines)
408
+ - Type: Middle (Conditional), [C] if conflicts / auto-proceed if clean
409
+ - Loads manual-section-rules.md and merge-conflict-rules.md
410
+ - 5-priority merge order: delete → move → rename → modify → add
411
+ - [MANUAL] block extraction, mapping, and preservation algorithm
412
+ - Conflict resolution UI: [K]eep / [R]emove / [E]dit per conflict
413
+ - Stack skill conditional merge across reference files
414
+ - Next: step-05-validate
415
+
416
+ ### Step 05: validate (~190 lines)
417
+ - Type: Validation Sequence, Auto-proceed (advisory, non-blocking)
418
+ - Pattern 4 parallel validation across 4 checks:
419
+ - Check A: Spec compliance (agentskills.io via skills_ref)
420
+ - Check B: [MANUAL] section integrity (byte-level comparison)
421
+ - Check C: Confidence tier consistency (tier vs forge capabilities)
422
+ - Check D: Provenance completeness (export-to-source mapping)
423
+ - Stack skill reference file validation conditional
424
+ - Next: step-06-write
425
+
426
+ ### Step 06: write (~200 lines)
427
+ - Type: Middle (Simple), Auto-proceed
428
+ - Atomic file writes: SKILL.md, metadata.json (version increment), provenance-map.json (updated mappings), evidence-report.md (appended operation record)
429
+ - Stack skill reference file writes conditional
430
+ - Read-back verification for all written files
431
+ - Write verification table displayed before proceeding
432
+ - Next: step-07-report
433
+
434
+ ### Step 07: report (~200 lines)
435
+ - Type: Final Step, no next step
436
+ - Handles no-change shortcut from step 02
437
+ - Comprehensive summary: operation metrics, change categories, export changes, confidence tier breakdown, [MANUAL] preservation status
438
+ - Validation findings presented if any
439
+ - Files written listed with paths
440
+ - Workflow chaining recommendations based on validation results
441
+ - Workflow ends here
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: update-skill
3
+ description: Smart regeneration preserving [MANUAL] sections. Detects individual vs stack internally.
4
+ web_bundle: true
5
+ installed_path: '{project-root}/_bmad/skf/workflows/update-skill'
6
+ ---
7
+
8
+ # Update Skill
9
+
10
+ **Goal:** Surgically update existing skills when source code changes, preserving all [MANUAL] developer content while re-extracting only affected exports with full provenance tracking.
11
+
12
+ **Your Role:** In addition to your name, communication_style, and persona, you are also a precision code analyst operating in Surgeon mode. This is a surgical operation, not an exploratory session. You bring AST-backed structural analysis and provenance-driven change detection expertise, while the source code provides the ground truth. Every regenerated instruction must trace to code with file:line citations.
13
+
14
+ ## WORKFLOW ARCHITECTURE
15
+
16
+ ### Core Principles
17
+
18
+ - **Micro-file Design**: Each step is a self-contained instruction file that must be followed exactly
19
+ - **Just-In-Time Loading**: Only the current step file is in memory — never load future step files until told to do so
20
+ - **Sequential Enforcement**: Sequence within the step files must be completed in order, no skipping or optimization allowed
21
+ - **Surgical Precision**: Only changed exports are re-extracted — unchanged content is never touched
22
+ - **[MANUAL] Preservation**: Developer-authored [MANUAL] sections survive regeneration with zero content loss
23
+ - **Zero Hallucination**: Every instruction must trace to actual code with AST file:line citations and confidence tier labels
24
+
25
+ ### Step Processing Rules
26
+
27
+ 1. **READ COMPLETELY**: Always read the entire step file before taking any action
28
+ 2. **FOLLOW SEQUENCE**: Execute all numbered sections in order, never deviate
29
+ 3. **WAIT FOR INPUT**: If a menu is presented, halt and wait for user selection
30
+ 4. **CHECK CONTINUATION**: If the step has a menu with Continue as an option, only proceed to next step when user selects 'C' (Continue)
31
+ 5. **LOAD NEXT**: When directed, load, read entire file, then execute the next step file
32
+
33
+ ### Critical Rules (NO EXCEPTIONS)
34
+
35
+ - 🛑 **NEVER** load multiple step files simultaneously
36
+ - 📖 **ALWAYS** read entire step file before execution
37
+ - 🚫 **NEVER** skip steps or optimize the sequence
38
+ - 🎯 **ALWAYS** follow the exact instructions in the step file
39
+ - ⏸️ **ALWAYS** halt at menus and wait for user input
40
+ - 📋 **NEVER** create mental todo lists from future steps
41
+ - 🔬 **NEVER** hallucinate — every statement must have AST provenance
42
+
43
+ ---
44
+
45
+ ## INITIALIZATION SEQUENCE
46
+
47
+ ### 1. Module Configuration Loading
48
+
49
+ Load and read full config from {project-root}/_bmad/skf/config.yaml and resolve:
50
+
51
+ - `project_name`, `output_folder`, `user_name`, `communication_language`, `document_output_language`
52
+ - `skills_output_folder`, `forge_data_folder`
53
+
54
+ ### 2. First Step Execution
55
+
56
+ Load, read the full file and then execute ./steps-c/step-01-init.md to begin the workflow.
@@ -0,0 +1,33 @@
1
+ const chalk = require('chalk');
2
+ const { Installer } = require('../lib/installer');
3
+ const { UI } = require('../lib/ui');
4
+
5
+ module.exports = {
6
+ command: 'install',
7
+ description: 'Install SKF agents and workflows into your project',
8
+ options: [],
9
+ action: async () => {
10
+ try {
11
+ const ui = new UI();
12
+ const config = await ui.promptInstall();
13
+
14
+ if (config.cancelled) {
15
+ console.log(chalk.yellow('\nInstallation cancelled.'));
16
+ process.exit(0);
17
+ return;
18
+ }
19
+
20
+ const installer = new Installer();
21
+ const result = await installer.install(config);
22
+
23
+ if (result && result.success) {
24
+ ui.displaySuccess(config.skfFolder, config.ides, config._action);
25
+ process.exit(0);
26
+ }
27
+ } catch (error) {
28
+ console.error(chalk.red('\nInstallation failed:'), error.message);
29
+ console.error(chalk.dim(error.stack));
30
+ process.exit(1);
31
+ }
32
+ },
33
+ };