bmad-module-skill-forge 0.6.0 → 0.7.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 (144) hide show
  1. package/README.md +2 -2
  2. package/docs/agents.md +9 -5
  3. package/docs/concepts.md +17 -13
  4. package/docs/examples.md +19 -4
  5. package/docs/getting-started.md +34 -19
  6. package/docs/how-it-works.md +87 -84
  7. package/docs/index.md +1 -1
  8. package/docs/workflows.md +88 -40
  9. package/package.json +1 -1
  10. package/src/agents/forger.agent.yaml +17 -5
  11. package/src/forger/README.md +1 -1
  12. package/src/forger/forge-tier.yaml +2 -1
  13. package/src/forger/preferences.yaml +5 -7
  14. package/src/knowledge/agentskills-spec.md +1 -1
  15. package/src/knowledge/architecture-verification.md +102 -0
  16. package/src/knowledge/ccc-bridge.md +3 -2
  17. package/src/knowledge/confidence-tiers.md +12 -1
  18. package/src/knowledge/doc-fetcher.md +1 -1
  19. package/src/knowledge/manual-section-integrity.md +2 -2
  20. package/src/knowledge/overview.md +11 -7
  21. package/src/knowledge/progressive-capability.md +5 -2
  22. package/src/knowledge/qmd-registry.md +5 -2
  23. package/src/knowledge/skf-knowledge-index.csv +2 -0
  24. package/src/knowledge/skill-lifecycle.md +26 -2
  25. package/src/knowledge/split-body-strategy.md +16 -2
  26. package/src/knowledge/tool-resolution.md +55 -0
  27. package/src/knowledge/zero-hallucination.md +11 -8
  28. package/src/module-help.csv +9 -6
  29. package/src/module.yaml +3 -0
  30. package/src/workflows/README.md +35 -17
  31. package/src/workflows/analyze-source/data/skill-brief-schema.md +18 -5
  32. package/src/workflows/analyze-source/steps-c/step-01-init.md +2 -2
  33. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +1 -1
  34. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +1 -1
  35. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +1 -1
  36. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +3 -3
  37. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +1 -1
  38. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +2 -2
  39. package/src/workflows/analyze-source/workflow.md +2 -2
  40. package/src/workflows/audit-skill/data/severity-rules.md +1 -1
  41. package/src/workflows/audit-skill/steps-c/step-01-init.md +2 -1
  42. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +8 -1
  43. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +2 -2
  44. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +2 -2
  45. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +1 -1
  46. package/src/workflows/audit-skill/workflow.md +2 -1
  47. package/src/workflows/brief-skill/data/scope-templates.md +10 -0
  48. package/src/workflows/brief-skill/data/skill-brief-schema.md +25 -23
  49. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +1 -1
  50. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +1 -1
  51. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +3 -0
  52. package/src/workflows/create-skill/data/extraction-patterns.md +7 -1
  53. package/src/workflows/create-skill/data/skill-sections.md +12 -11
  54. package/src/workflows/create-skill/data/source-resolution-protocols.md +2 -2
  55. package/src/workflows/create-skill/data/tier-degradation-rules.md +1 -1
  56. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +14 -10
  57. package/src/workflows/create-skill/steps-c/step-02b-ccc-discover.md +4 -0
  58. package/src/workflows/create-skill/steps-c/step-03-extract.md +19 -19
  59. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +3 -3
  60. package/src/workflows/create-skill/steps-c/step-03c-fetch-docs.md +3 -1
  61. package/src/workflows/create-skill/steps-c/step-04-enrich.md +3 -1
  62. package/src/workflows/create-skill/steps-c/step-05-compile.md +4 -3
  63. package/src/workflows/create-skill/steps-c/step-06-validate.md +2 -2
  64. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +33 -44
  65. package/src/workflows/create-skill/steps-c/step-08-report.md +25 -11
  66. package/src/workflows/create-skill/workflow.md +2 -2
  67. package/src/workflows/create-stack-skill/data/compose-mode-rules.md +65 -0
  68. package/src/workflows/create-stack-skill/data/manifest-patterns.md +23 -1
  69. package/src/workflows/create-stack-skill/data/stack-skill-template.md +28 -6
  70. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +25 -7
  71. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +37 -3
  72. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +29 -3
  73. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +50 -7
  74. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +35 -3
  75. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +5 -1
  76. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +53 -5
  77. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +3 -3
  78. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +8 -2
  79. package/src/workflows/create-stack-skill/workflow.md +2 -2
  80. package/src/workflows/export-skill/data/managed-section-format.md +8 -1
  81. package/src/workflows/export-skill/data/snippet-format.md +1 -1
  82. package/src/workflows/export-skill/steps-c/step-04-update-context.md +7 -2
  83. package/src/workflows/export-skill/steps-c/step-05-token-report.md +1 -1
  84. package/src/workflows/export-skill/workflow.md +3 -1
  85. package/src/workflows/quick-skill/data/skill-template.md +18 -6
  86. package/src/workflows/quick-skill/steps-c/step-04-compile.md +26 -6
  87. package/src/workflows/quick-skill/steps-c/step-05-validate.md +1 -1
  88. package/src/workflows/quick-skill/steps-c/step-06-write.md +3 -0
  89. package/src/workflows/quick-skill/workflow.md +1 -1
  90. package/src/workflows/refine-architecture/data/refinement-rules.md +102 -0
  91. package/src/workflows/refine-architecture/steps-c/step-01-init.md +188 -0
  92. package/src/workflows/refine-architecture/steps-c/step-02-gap-analysis.md +179 -0
  93. package/src/workflows/refine-architecture/steps-c/step-03-issue-detection.md +182 -0
  94. package/src/workflows/refine-architecture/steps-c/step-04-improvements.md +169 -0
  95. package/src/workflows/refine-architecture/steps-c/step-05-compile.md +200 -0
  96. package/src/workflows/refine-architecture/steps-c/step-06-report.md +147 -0
  97. package/src/workflows/refine-architecture/workflow.md +61 -0
  98. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +2 -1
  99. package/src/workflows/setup-forge/steps-c/step-01b-ccc-index.md +5 -3
  100. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +15 -16
  101. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +1 -1
  102. package/src/workflows/setup-forge/steps-c/step-04-report.md +2 -2
  103. package/src/workflows/setup-forge/workflow.md +3 -2
  104. package/src/workflows/test-skill/data/scoring-rules.md +3 -0
  105. package/src/workflows/test-skill/data/source-access-protocol.md +1 -1
  106. package/src/workflows/test-skill/steps-c/step-01-init.md +1 -0
  107. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +2 -0
  108. package/src/workflows/test-skill/workflow.md +2 -2
  109. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +3 -3
  110. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +8 -3
  111. package/src/workflows/update-skill/steps-c/step-05-validate.md +8 -12
  112. package/src/workflows/update-skill/steps-c/step-06-write.md +5 -2
  113. package/src/workflows/update-skill/workflow.md +1 -1
  114. package/src/workflows/verify-stack/data/coverage-patterns.md +45 -0
  115. package/src/workflows/verify-stack/data/feasibility-report-template.md +63 -0
  116. package/src/workflows/verify-stack/data/integration-verification-rules.md +73 -0
  117. package/src/workflows/verify-stack/steps-c/step-01-init.md +174 -0
  118. package/src/workflows/verify-stack/steps-c/step-02-coverage.md +181 -0
  119. package/src/workflows/verify-stack/steps-c/step-03-integrations.md +195 -0
  120. package/src/workflows/verify-stack/steps-c/step-04-requirements.md +168 -0
  121. package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +191 -0
  122. package/src/workflows/verify-stack/steps-c/step-06-report.md +197 -0
  123. package/src/workflows/verify-stack/workflow.md +61 -0
  124. package/src/workflows/analyze-source/validation-report.md +0 -657
  125. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +0 -385
  126. package/src/workflows/audit-skill/validation-report.md +0 -545
  127. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +0 -318
  128. package/src/workflows/brief-skill/validation-report.md +0 -630
  129. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +0 -360
  130. package/src/workflows/create-skill/validation-report.md +0 -189
  131. package/src/workflows/create-skill/workflow-plan-create-skill.md +0 -525
  132. package/src/workflows/create-stack-skill/validation-report.md +0 -401
  133. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +0 -481
  134. package/src/workflows/export-skill/validation-report.md +0 -263
  135. package/src/workflows/export-skill/workflow-plan-export-skill.md +0 -369
  136. package/src/workflows/quick-skill/validation-report.md +0 -543
  137. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +0 -405
  138. package/src/workflows/setup-forge/validation-report.md +0 -504
  139. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +0 -430
  140. package/src/workflows/test-skill/validation-report.md +0 -390
  141. package/src/workflows/test-skill/workflow-plan-test-skill.md +0 -292
  142. package/src/workflows/update-skill/data/tier-degradation-rules.md +0 -46
  143. package/src/workflows/update-skill/validation-report.md +0 -559
  144. package/src/workflows/update-skill/workflow-plan-update-skill.md +0 -441
@@ -27,7 +27,7 @@ For each confirmed dependency, extract key exports, usage patterns, and API surf
27
27
 
28
28
  ### Step-Specific Rules:
29
29
 
30
- - 🎯 Extract per-library using Pattern 4 (parallel subprocess) when available
30
+ - 🎯 Extract per-library using Pattern 4 (parallel): In Claude Code, use multiple parallel Agent tool calls or `run_in_background: true`. In Cursor, use parallel requests (IDE-dependent). In CLI, use `xargs -P` or background processes. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
31
31
  - 💬 Each subprocess returns structured extraction, not raw file contents
32
32
  - 🚫 FORBIDDEN to analyze cross-library integrations — that is step 05
33
33
  - ⚙️ If parallel subprocess unavailable, extract libraries sequentially in main thread
@@ -50,6 +50,30 @@ For each confirmed dependency, extract key exports, usage patterns, and API surf
50
50
 
51
51
  **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
52
52
 
53
+ ### 0. Check Compose Mode
54
+
55
+ **If `compose_mode` is true:**
56
+
57
+ "**Extraction data already available from individual skills. Skipping extraction phase.**"
58
+
59
+ For each confirmed skill, load `{skills_output_folder}/{skill_dir}/SKILL.md` (where `skill_dir` is the subdirectory name stored in step-02, which may differ from the `name` field in metadata.json) into context. Build a `per_library_extractions[]` entry for each skill with the following fields:
60
+ - `library`: skill name from metadata.json
61
+ - `exports`: exports list extracted from the SKILL.md exports section
62
+ - `usage_patterns`: usage patterns from the SKILL.md usage section
63
+ - `confidence`: the skill's existing confidence tier (T1, T1-low, T2) — inherited directly
64
+
65
+ Display an extraction summary:
66
+
67
+ "**Loaded {N} skill extractions from existing skills.**
68
+
69
+ | Skill | Exports | Confidence | Status |
70
+ |-------|---------|------------|--------|
71
+ | {name} | {count} | {tier} | Loaded |"
72
+
73
+ Auto-proceed to next step.
74
+
75
+ **If not compose_mode:** Continue with section 1 (existing flow).
76
+
53
77
  ### 1. Prepare Extraction Plan
54
78
 
55
79
  **AST Tool Availability Check (Forge/Deep only):**
@@ -81,14 +105,25 @@ For each library in `confirmed_dependencies`, determine extraction strategy base
81
105
  - Confidence: T1 (AST-verified structural extraction)
82
106
 
83
107
  **Deep Tier (adds to Forge):**
84
- - Use qmd_bridge for temporal usage evolution
85
- - Identify deprecated patterns and migration paths
86
- - Track API changes across project history
87
- - Confidence: T2 (QMD-enriched temporal context)
108
+ - Perform all Forge tier extractions (T1)
109
+ - Additionally: query existing QMD temporal collections for each library
110
+ - Read the `qmd_collections` registry from `{sidecar_path}/forge-tier.yaml`
111
+ - For each library in `confirmed_dependencies`, search for a registry entry where `skill_name` matches the library name AND `type` is `"temporal"`
112
+ - **If a matching temporal collection exists:**
113
+ - Query `qmd_bridge.search("{library_name} deprecated OR removed OR breaking change")` for deprecation context
114
+ - Query `qmd_bridge.search("{library_name} migration OR upgrade")` for migration patterns
115
+ - Query `qmd_bridge.search("{library_name} version issue OR bug OR workaround")` for version-specific warnings
116
+ - **Tool resolution for qmd_bridge:** Use QMD MCP tools — `mcp__plugin_qmd-plugin_qmd__search` (Claude Code), qmd MCP server (Cursor), `qmd search "{query}"` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
117
+ - Classify each result as T2-past (historical) or T2-future (planned changes) per confidence-tiers.md
118
+ - Append temporal findings to the library's extraction as T2 annotations with `[QMD:{collection}:{doc}]` citations
119
+ - **If no matching temporal collection found:**
120
+ - Log: "No temporal collection for {library_name}. T2 enrichment skipped."
121
+ - Continue with T1/T1-low extraction only
122
+ - Confidence: T1 for structural (AST), T2 for temporal annotations (QMD-enriched)
88
123
 
89
124
  ### 2. Launch Parallel Extraction
90
125
 
91
- **Launch subprocesses in parallel** (max_parallel_generation) — one per confirmed library:
126
+ **Launch subprocesses in parallel** (max_parallel_generation: 3–5 concurrent Agent tool calls in Claude Code, IDE-dependent in Cursor, CPU core count in CLI) — one per confirmed library:
92
127
 
93
128
  Each subprocess:
94
129
  1. Reads all files importing the library (from step 03 file lists)
@@ -105,7 +140,13 @@ Each subprocess:
105
140
  usage_patterns: ["pattern description with file:line"],
106
141
  confidence: "T1|T1-low|T2",
107
142
  files_analyzed: count,
108
- warnings: []
143
+ warnings: [],
144
+ temporal: {
145
+ deprecated_exports: ["export_name — reason [QMD:collection:doc]"],
146
+ migration_notes: ["note [QMD:collection:doc]"],
147
+ version_warnings: ["warning [QMD:collection:doc]"],
148
+ t2_annotation_count: count
149
+ }
109
150
  }
110
151
  ```
111
152
 
@@ -137,6 +178,8 @@ For each library extraction:
137
178
 
138
179
  **Results:** {success_count}/{total_count} libraries extracted
139
180
  **Confidence distribution:** T1: {count}, T1-low: {count}, T2: {count}
181
+ {If Deep tier:} **T2 enrichment:** {enriched_count}/{total_count} libraries had temporal collections available
182
+ {If libraries without temporal > 0:} **Tip:** Run [CS] Create Skill at Deep tier for individual libraries to generate temporal collections, then re-run [SS] for full T2 enrichment.
140
183
  {If warnings:} **Warnings:** {warning_count} issues noted
141
184
 
142
185
  **Proceeding to integration detection...**"
@@ -4,6 +4,7 @@ description: 'Detect co-import patterns and integration points between confirmed
4
4
 
5
5
  nextStepFile: './step-06-compile-stack.md'
6
6
  integrationPatterns: '../data/integration-patterns.md'
7
+ composeModeRules: '../data/compose-mode-rules.md'
7
8
  ---
8
9
 
9
10
  # Step 5: Detect Integrations
@@ -28,7 +29,7 @@ Analyze co-import patterns between confirmed libraries to identify integration p
28
29
 
29
30
  ### Step-Specific Rules:
30
31
 
31
- - 🎯 Focus on detecting cross-library patterns using Pattern 1 (grep) subprocess
32
+ - 🎯 Focus on detecting cross-library patterns using Pattern 1 (grep/search): In Claude Code, use the Grep tool or Bash with `rg`. In Cursor, use built-in search. In CLI, use `grep`/`rg` directly. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
32
33
  - 🚫 FORBIDDEN to compile SKILL.md — that is step 06
33
34
  - 💬 Integration detection is the core differentiator of stack skills vs individual skills
34
35
  - ⚙️ If subprocess unavailable, perform grep operations in main thread
@@ -42,7 +43,7 @@ Analyze co-import patterns between confirmed libraries to identify integration p
42
43
 
43
44
  ## CONTEXT BOUNDARIES:
44
45
 
45
- - From step 03: confirmed_dependencies[] with file lists per library
46
+ - From step 03: confirmed_dependencies[] in code-mode, includes file lists per library; in compose-mode, file lists are not present (use per_library_extractions[] from step 04 for skill content)
46
47
  - From step 04: per_library_extractions[] with exports and patterns
47
48
  - This step produces: integration_graph {pairs[], types[], files[]}
48
49
  - This is the VALUE-ADD step — what makes stack skills different from individual skills
@@ -61,10 +62,39 @@ Report: "**Analyzing {pair_count} library pairs for integration patterns...**"
61
62
 
62
63
  ### 2. Detect Co-Import Files
63
64
 
65
+ **If `compose_mode` is true:**
66
+
67
+ Instead of co-import grep, detect integrations from architecture document:
68
+
69
+ 1. Load `{composeModeRules}` for integration evidence format rules
70
+ 2. **If `{architecture_doc_path}` is null or not available:** Skip directly to the "If no architecture document available" fallback below
71
+ 3. Load the architecture document from `{architecture_doc_path}`
72
+ 4. Use prose-based co-mention analysis: find paragraphs mentioning 2+ confirmed skill names
73
+ 5. For each detected integration pair:
74
+ - Load both skills' export lists and API signatures
75
+ - Compose an integration section following the format from `{composeModeRules}`
76
+ - Include VS feasibility verdict if a feasibility report (`feasibility-report-{project_name}.md`) exists in `{forge_data_folder}/`
77
+ - Cite evidence from both skills: `[from skill: {skill_name}]`
78
+
79
+ All integration evidence inherits confidence tiers from the source skills. Load and apply the full **Confidence Tier Inheritance** matrix from `{composeModeRules}` to compute the correct tier for each pair (covers T1+T1, T1+T1-low, T1-low+T1-low, T1+T2, T1-low+T2, T2+T2 cases). Apply the `[composed]` suffix to all confidence labels — e.g., `T1 [composed]`, `T1-low [composed, +T2 annotations]`.
80
+
81
+ **VS verdict parsing (if feasibility report exists):** Read the `overall_verdict` from the report's YAML frontmatter. Parse the `## Integration Verdicts` markdown table for per-pair verdicts. For each architecture-detected pair, include `VS overall: {verdict}` and `VS pair: {verdict}` in the integration evidence per the format in `{composeModeRules}`. VS verdicts do not apply to inferred integrations since the VS report operates on architecture-described interactions only. Additionally, flag any pairs where VS reported `Risky` or `Blocked` by appending a `[VS: Risky]` or `[VS: Blocked]` warning annotation to the integration entry.
82
+
83
+ If no architecture document available:
84
+ - Infer potential integrations from skills sharing the same `language` field or sharing domain keywords in their SKILL.md descriptions (use the `usage_patterns` and `exports` fields from `per_library_extractions[]` built in step-04, or reload `{skills_output_folder}/{skill_dir}/SKILL.md` if full prose text is needed for keyword extraction)
85
+ - Mark inferred integrations: `[inferred from shared domain]` — use this suffix instead of `[composed]` for inferred integrations
86
+ - Inferred integrations qualify automatically — no file-count threshold applies
87
+
88
+ Skip to section 3 (Classify Integration Types) with the compose-mode pairs.
89
+
90
+ **If not compose_mode:**
91
+
64
92
  For each library pair (A, B):
65
93
 
66
94
  **Launch a subprocess** that greps across all source files to find files importing BOTH library A and library B. Return only file paths and import line numbers.
67
95
 
96
+ **Subprocess resolution:** Use the Grep tool (Claude Code), built-in search (Cursor), or `grep`/`rg` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
97
+
68
98
  **Subprocess returns:** `{pair: [A, B], co_import_files: [{path, line_A, line_B}], count: N}`
69
99
 
70
100
  **If subprocess unavailable:** Intersect the file lists from step 03 import counts for each pair.
@@ -77,6 +107,8 @@ If `tools.ccc` is true AND `ccc_index.status` is `"fresh"` or `"stale"` in forge
77
107
 
78
108
  For each library pair that has exactly 1 co-import file (below the 2-file threshold), run `ccc_bridge.search("{libA} {libB}", source_root, top_k=10)` to find files where the two libraries interact semantically — even without explicit import co-location. If CCC returns additional files where both libraries appear, add them to the pair's co-import candidate list and re-evaluate against the 2-file threshold.
79
109
 
110
+ **Tool resolution for ccc_bridge.search:** Use `/ccc` skill search (Claude Code), ccc MCP server (Cursor), or `ccc search "{libA} {libB}" --path {source_root} --top 10` (CLI). See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
111
+
80
112
  For pairs that already qualify (2+ files), CCC is not needed for detection — but the CCC results may surface additional integration files for richer classification in section 3.
81
113
 
82
114
  CCC failures: skip augmentation silently, proceed with grep-only results.
@@ -85,7 +117,7 @@ CCC failures: skip augmentation silently, proceed with grep-only results.
85
117
 
86
118
  Load `{integrationPatterns}` for classification rules.
87
119
 
88
- For each qualifying pair (2+ co-import files), analyze the co-import files to classify the integration type:
120
+ For each qualifying pair, analyze to classify the integration type (**in compose-mode**: all architecture-document-detected pairs qualify automatically — the 2+ co-import file threshold applies only in code-mode; **in code-mode**: pair must have 2+ co-import files):
89
121
 
90
122
  - **Type 1: Middleware Chain** — Sequential function calls piping output between libraries
91
123
  - **Type 2: Shared Types** — Type definitions exchanged between libraries
@@ -80,6 +80,8 @@ description: >
80
80
 
81
81
  **This is the core value of the stack skill.** Compile in order:
82
82
 
83
+ **Zero-integration guard:** If the integration graph from step 05 has zero edges (no detected integration pairs), skip the integration layer compilation and note: "No integration patterns detected — stack skill will contain library summaries without an integration layer." Proceed directly to section 4 (Per-Library Sections).
84
+
83
85
  **Cross-cutting patterns** (if any):
84
86
  - Patterns spanning 3+ libraries
85
87
  - Middleware chains, shared configuration, common architectural patterns
@@ -98,7 +100,7 @@ description: >
98
100
 
99
101
  ### 4. Compile Per-Library Sections
100
102
 
101
- For each confirmed library (ordered by integration connectivity, then import count):
103
+ For each confirmed library (ordered by integration connectivity, then import count — **in compose-mode**, order by integration connectivity, then skill confidence tier since import counts are not available):
102
104
 
103
105
  - Role in stack (one-line description)
104
106
  - Key exports used in this project
@@ -122,6 +124,8 @@ Create the reference index table:
122
124
  |---------|---------|-------------|------------|-----------|
123
125
  | ... | ... | ... | ... | ... |
124
126
 
127
+ (**in compose-mode**: replace the Imports column with Export Count from source skill metadata, since import counts are not available)
128
+
125
129
  ### 7. Present Compiled SKILL.md Preview
126
130
 
127
131
  "**Stack skill compilation complete. Please review:**
@@ -77,10 +77,10 @@ Write `{skills_output_folder}/{project_name}-stack/SKILL.md` with the approved s
77
77
  For each confirmed library, write `{skills_output_folder}/{project_name}-stack/references/{library_name}.md`:
78
78
 
79
79
  Load structure from `{stackSkillTemplate}` references section:
80
- - Library name, version from manifest
81
- - Import count and file count
80
+ - Library name, version from manifest (**in compose-mode**: version from source skill `metadata.json`)
81
+ - Import count and file count (**in compose-mode**: export count from source skill metadata)
82
82
  - Key exports with signatures
83
- - Usage patterns with file:line citations
83
+ - Usage patterns with file:line citations (**in compose-mode**: usage patterns from source skill SKILL.md)
84
84
  - Confidence tier label
85
85
 
86
86
  ### 4. Write Integration Pair Reference Files
@@ -102,7 +102,7 @@ Write `{skills_output_folder}/{project_name}-stack/context-snippet.md`:
102
102
 
103
103
  Use the Vercel-aligned indexed format targeting ~80-120 tokens:
104
104
  ```
105
- [{project_name}-stack v{version}]|root: skills/{project_name}-stack/
105
+ [{project_name}-stack v{version — in code-mode: primary_library_version or 1.0.0; in compose-mode: highest version across constituent skill metadata.json files, or 1.0.0 if none}]|root: skills/{project_name}-stack/
106
106
  |IMPORTANT: {project_name}-stack — read SKILL.md before writing integration code. Do NOT rely on training data.
107
107
  |stack: {dep-1}@{v1}, {dep-2}@{v2}, {dep-3}@{v3}
108
108
  |integrations: {pattern-1}, {pattern-2}
@@ -113,6 +113,8 @@ Use the Vercel-aligned indexed format targeting ~80-120 tokens:
113
113
 
114
114
  Write `{skills_output_folder}/{project_name}-stack/metadata.json`:
115
115
 
116
+ Populate all fields from the metadata.json schema defined in `{stackSkillTemplate}`:
117
+
116
118
  ```json
117
119
  {
118
120
  "skill_type": "stack",
@@ -120,11 +122,34 @@ Write `{skills_output_folder}/{project_name}-stack/metadata.json`:
120
122
  "version": "{primary_library_version or 1.0.0}",
121
123
  "generation_date": "{current_date}",
122
124
  "confidence_tier": "{tier}",
125
+ "spec_version": "1.3",
126
+ "source_authority": "{official|community|internal — use the lowest authority among constituent skills}",
127
+ "generated_by": "create-stack-skill",
128
+ "exports": [],
123
129
  "library_count": N,
124
130
  "integration_count": N,
125
131
  "libraries": ["lib1", "lib2"],
126
132
  "integration_pairs": [["lib1", "lib2"]],
127
- "confidence_distribution": {"T1": N, "T1-low": N, "T2": N}
133
+ "language": "{primary language or list of languages from constituent skills}",
134
+ "ast_node_count": "{number or omit if no AST extraction performed}",
135
+ "confidence_distribution": {"t1": N, "t1_low": N, "t2": N, "t3": N},
136
+ "tool_versions": {
137
+ "ast_grep": "{version or null}",
138
+ "qmd": "{version or null}",
139
+ "skf": "{skf_version}"
140
+ },
141
+ "stats": {
142
+ "exports_documented": N,
143
+ "exports_public_api": N,
144
+ "exports_internal": N,
145
+ "exports_total": N,
146
+ "public_api_coverage": 0.0,
147
+ "total_coverage": 0.0,
148
+ "scripts_count": N,
149
+ "assets_count": N
150
+ },
151
+ "dependencies": [],
152
+ "compatibility": "{semver-range}"
128
153
  }
129
154
  ```
130
155
 
@@ -133,6 +158,8 @@ Write `{skills_output_folder}/{project_name}-stack/metadata.json`:
133
158
  Write workspace artifacts to `{forge_data_folder}/{project_name}-stack/`:
134
159
 
135
160
  **provenance-map.json:**
161
+
162
+ **In code-mode:**
136
163
  ```json
137
164
  {
138
165
  "libraries": {
@@ -154,6 +181,27 @@ Write workspace artifacts to `{forge_data_folder}/{project_name}-stack/`:
154
181
  }
155
182
  ```
156
183
 
184
+ **In compose-mode:**
185
+ ```json
186
+ {
187
+ "libraries": {
188
+ "lib_name": {
189
+ "source_skill_path": "skills/{skill_dir}/",
190
+ "compose_source": "architecture_co_mention|inferred_from_shared_domain",
191
+ "confidence": "T1|T1-low|T2",
192
+ "source_skill_tier": "{original skill confidence tier}",
193
+ "exports_found": N
194
+ }
195
+ },
196
+ "integrations": {
197
+ "libA+libB": {
198
+ "detection_method": "architecture_co_mention|inferred_from_shared_domain",
199
+ "type": "pattern_type"
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
157
205
  **evidence-report.md:**
158
206
  - Extraction summary per library
159
207
  - Integration detection results per pair
@@ -112,16 +112,16 @@ Parse metadata.json and verify required fields:
112
112
  - [ ] `skill_type` equals "stack"
113
113
  - [ ] `name` matches `{project_name}-stack`
114
114
  - [ ] `version` and `generation_date` present
115
- - [ ] `confidence_tier` matches tier from step 01
115
+ - [ ] `confidence_tier` matches forge tier from step 01 (Quick/Forge/Forge+/Deep) — in both code-mode and compose-mode, this is the forge tier; per-library inherited confidence is tracked separately in `confidence_distribution`
116
116
  - [ ] `library_count` matches actual reference files; `integration_count` matches pair files
117
117
  - [ ] `libraries` array present and non-empty
118
- - [ ] `confidence_distribution` object present with T1/T1-low/T2 keys
118
+ - [ ] `confidence_distribution` object present with `t1`, `t1_low`, `t2`, `t3` keys (lowercase, matching template definition)
119
119
 
120
120
  Record mismatches as **WARNING** findings.
121
121
 
122
122
  ### 6. Validate Reference File Completeness
123
123
 
124
- For each confirmed library, verify `references/{library}.md` contains: library name header, version from manifest, Key Exports section, Usage Patterns section.
124
+ For each confirmed library, verify `references/{library}.md` contains: library name header, version from manifest (**in compose-mode**: version from source skill metadata), Key Exports section, Usage Patterns section.
125
125
 
126
126
  For each integration pair, verify `references/integrations/{libraryA}-{libraryB}.md` contains: integration pair header, type classification, Integration Pattern section, Key Files section.
127
127
 
@@ -64,7 +64,11 @@ Forge tier: **{tier}**"
64
64
  |------|-------|-------------|
65
65
  | T1 | {count} | AST-verified structural extraction |
66
66
  | T1-low | {count} | Source reading inference |
67
- | T2 | {count} | QMD-enriched temporal context |"
67
+ | T2 | {count} | QMD-enriched temporal context |
68
+
69
+ {IF compose_mode:}
70
+ *Note: Confidence tiers above are inherited from source skills — they reflect the extraction method used when those skills were originally generated, not the current compose run.*
71
+ {END IF}"
68
72
 
69
73
  ### 3. Display Output File Summary
70
74
 
@@ -107,7 +111,9 @@ Forge tier: **{tier}**"
107
111
 
108
112
  "**Next steps:**
109
113
  - **[TS] test-skill** — Validate the stack skill against its own assertions
110
- - **[ES] export-skill** — Package for distribution or agent loading
114
+ - **[EX] export-skill** — Package for distribution or agent loading
115
+
116
+ - **[VS] verify-stack** — Validate the stack's integration feasibility against your architecture document{IF compose_mode:} (re-run to confirm feasibility after any architecture changes from **[RA] refine-architecture**){END IF}
111
117
 
112
118
  **Workflow complete.**"
113
119
 
@@ -7,7 +7,7 @@ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/create-stack-skil
7
7
 
8
8
  # Create Stack Skill
9
9
 
10
- **Goal:** Analyze a project's dependency manifests, detect significant libraries, discover co-import integration points, and produce a consolidated stack skill documenting how libraries connect in THIS specific codebase.
10
+ **Goal:** Produce a consolidated stack skill documenting how libraries connect. **Code-mode:** analyzes dependency manifests and co-import patterns from actual source code. **Compose-mode:** synthesizes from pre-generated individual skills and architecture documents when no codebase exists yet.
11
11
 
12
12
  **Your Role:** In addition to your name, communication_style, and persona, you are also a dependency analyst and integration architect operating in Ferris Architect mode. You bring expertise in dependency analysis, cross-library integration patterns, and compositional architecture, while the user brings their project knowledge and scope preferences. Execute with prescriptive precision — every finding must trace to actual code with file:line citations.
13
13
 
@@ -23,7 +23,7 @@ This uses **step-file architecture** for disciplined execution:
23
23
  - **Just-In-Time Loading**: Only the current step file is in memory — never load future step files until told to do so
24
24
  - **Sequential Enforcement**: Sequence within the step files must be completed in order, no skipping or optimization allowed
25
25
  - **Append-Only Building**: Build outputs by accumulating state across steps
26
- - **Zero Hallucination**: All extracted content must trace to actual source code — no inferred or assumed patterns
26
+ - **Zero Hallucination**: All extracted content must trace to actual source code — no inferred or assumed patterns. In compose-mode, inferred integrations are permitted but must be labeled `[inferred from shared domain]` per compose-mode-rules.md
27
27
 
28
28
  ### Step Processing Rules
29
29
 
@@ -22,7 +22,7 @@
22
22
  | Cursor | `cursor` | .cursorrules |
23
23
  | Copilot | `copilot` | AGENTS.md |
24
24
 
25
- ## Three-Case Logic
25
+ ## Four-Case Logic
26
26
 
27
27
  ### Case 1: Create (No File Exists)
28
28
 
@@ -53,6 +53,13 @@ Target file contains `<!-- SKF:BEGIN` and `<!-- SKF:END -->` markers. Replace co
53
53
  4. Replace everything between markers (inclusive) with new managed section
54
54
  5. Write file
55
55
 
56
+ ### Case 4: Malformed Markers (Halt)
57
+
58
+ Target file contains `<!-- SKF:BEGIN` but no matching `<!-- SKF:END -->` marker. This indicates a corrupted managed section.
59
+
60
+ 1. Halt workflow with error: "Malformed managed section — `<!-- SKF:BEGIN` found but no `<!-- SKF:END -->`. Fix the markers manually before re-running export."
61
+ 2. Do not modify the file
62
+
56
63
  ## Regeneration: Full Index Rebuild
57
64
 
58
65
  When regenerating (Case 3), rebuild the COMPLETE skill index:
@@ -40,7 +40,7 @@
40
40
 
41
41
  ## Rules
42
42
 
43
- - **api line**: Top exports from metadata.json `exports` array. Append `()` to function names. Comma-separated.
43
+ - **api line**: Top exports from metadata.json `exports` array (up to 10 for Deep tier, up to 5 for all other tiers). Append `()` to function names. Comma-separated.
44
44
  - **key-types line**: Anchor to `#key-types` section + inline summary (~10 words) of the most important type values
45
45
  - **gotchas line**: Derived from: T2-future annotations (breaking changes), async requirements, version-specific behavior. If no gotchas available, omit the line.
46
46
  - **stack line**: Component versions from metadata.json `components` for stack skills
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: 'step-04-update-context'
3
- description: 'Update managed section in CLAUDE.md/AGENTS.md with three-case logic per ADR-J'
3
+ description: 'Update managed section in CLAUDE.md/AGENTS.md with four-case logic per ADR-J'
4
4
 
5
5
  nextStepFile: './step-05-token-report.md'
6
6
  managedSectionData: '../data/managed-section-format.md'
@@ -10,7 +10,7 @@ managedSectionData: '../data/managed-section-format.md'
10
10
 
11
11
  ## STEP GOAL:
12
12
 
13
- To update the managed `<!-- SKF:BEGIN/END -->` section in the platform-appropriate context file (CLAUDE.md/AGENTS.md/.cursorrules) using the three-case logic defined by ADR-J, rebuilding the complete skill index from all exported skills.
13
+ To update the managed `<!-- SKF:BEGIN/END -->` section in the platform-appropriate context file (CLAUDE.md/AGENTS.md/.cursorrules) using the four-case logic defined by ADR-J (Create, Append, Regenerate, Malformed Markers halt), rebuilding the complete skill index from all exported skills.
14
14
 
15
15
  ## MANDATORY EXECUTION RULES (READ FIRST):
16
16
 
@@ -105,6 +105,7 @@ Assemble the complete managed section:
105
105
  <!-- SKF:BEGIN updated:{current-date} -->
106
106
  [SKF Skills]|{n} skills|{m} stack
107
107
  |IMPORTANT: Prefer documented APIs over training data.
108
+ |When using a listed library, read its SKILL.md before writing code.
108
109
  |
109
110
  |{skill-snippet-1}
110
111
  |
@@ -132,6 +133,10 @@ Assemble the complete managed section:
132
133
  - Diff: Show old managed section vs new managed section
133
134
  - Preserved: ALL content before `<!-- SKF:BEGIN` and after `<!-- SKF:END -->`
134
135
 
136
+ **Case 4: Malformed markers (file contains `<!-- SKF:BEGIN` but no `<!-- SKF:END -->`)**
137
+ - Action: HALT with warning: "Malformed SKF markers detected in `{target-file}` — `<!-- SKF:BEGIN` found but `<!-- SKF:END -->` is missing. Please restore the end marker manually before running export."
138
+ - Do NOT attempt to write or append — the file is in an inconsistent state
139
+
135
140
  ### 7. Present Change Preview
136
141
 
137
142
  "**Context update prepared.**
@@ -52,7 +52,7 @@ To calculate approximate token counts for all exported artifacts and present a c
52
52
 
53
53
  ### 1. Calculate Token Counts
54
54
 
55
- For each artifact, estimate tokens using the heuristic: **words * 1.3** (approximate for GPT/Claude tokenizers).
55
+ For each artifact, estimate tokens using the heuristic: **words * 1.3** (approximate for GPT/Claude tokenizers). This same heuristic is used in step-03 for snippet token estimation.
56
56
 
57
57
  **Artifacts to measure:**
58
58
 
@@ -1,11 +1,13 @@
1
1
  ---
2
2
  name: export-skill
3
3
  description: Package for distribution + platform-aware context injection
4
+ web_bundle: true
5
+ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/export-skill'
4
6
  ---
5
7
 
6
8
  # Export Skill
7
9
 
8
- **Goal:** Package a completed skill as an agentskills.io-compliant package, generate context snippets, and update the managed section in CLAUDE.md/AGENTS.md for platform-aware context injection.
10
+ **Goal:** Package a completed skill as an agentskills.io-compliant package, generate context snippets, and update the managed section in CLAUDE.md/.cursorrules/AGENTS.md for platform-aware context injection.
9
11
 
10
12
  **Your Role:** In addition to your name, communication_style, and persona, you are also a delivery and packaging specialist collaborating with a skill developer. This is a partnership, not a client-vendor relationship. You bring expertise in skill packaging, ecosystem compliance, and context injection patterns, while the user brings their completed skill and distribution requirements. Work together as equals.
11
13
 
@@ -56,7 +56,8 @@ Indexed format targeting ~80-120 tokens per skill:
56
56
  |IMPORTANT: {skill_name} v{version} — read SKILL.md before writing {skill_name} code. Do NOT rely on training data.
57
57
  |quick-start:{SKILL.md#quick-start}
58
58
  |api: {top-5 exports with () for functions}
59
- |gotchas: {1-2 most critical pitfalls if known}
59
+ |key-types:{SKILL.md#key-types} — {inline summary of most important type values}
60
+ |gotchas: {2-3 most critical pitfalls or breaking changes, inline}
60
61
  ```
61
62
 
62
63
  ## metadata.json Format
@@ -64,31 +65,42 @@ Indexed format targeting ~80-120 tokens per skill:
64
65
  ```json
65
66
  {
66
67
  "name": "{skill_name}",
67
- "version": "0.1.0",
68
+ "version": "{source-version or 1.0.0}",
69
+ "description": "{brief description of the skill}",
68
70
  "skill_type": "single",
69
71
  "source_authority": "community",
70
72
  "source_repo": "{repo_url}",
73
+ "source_root": "{resolved_source_path}",
74
+ "source_commit": "{commit_sha_if_available}",
71
75
  "source_package": "{package_name}",
72
76
  "language": "{language}",
73
77
  "generated_by": "quick-skill",
74
78
  "generation_date": "{date}",
75
79
  "confidence_tier": "Quick",
76
- "extraction_tier": "quick",
77
80
  "spec_version": "1.3",
78
81
  "exports": ["{export_1}", "{export_2}"],
79
82
  "confidence_distribution": {
80
83
  "t1": 0,
81
- "t1_low": "{exports_count}",
84
+ "t1_low": "{exports_count (integer, not string)}",
82
85
  "t2": 0,
83
86
  "t3": 0
84
87
  },
88
+ "tool_versions": {
89
+ "ast_grep": null,
90
+ "qmd": null,
91
+ "skf": "{skf_version}"
92
+ },
85
93
  "stats": {
86
94
  "exports_documented": "{number}",
87
95
  "exports_public_api": "{number}",
88
96
  "exports_internal": 0,
89
97
  "exports_total": "{number}",
90
98
  "public_api_coverage": 1.0,
91
- "total_coverage": 1.0
92
- }
99
+ "total_coverage": 1.0,
100
+ "scripts_count": 0,
101
+ "assets_count": 0
102
+ },
103
+ "dependencies": [],
104
+ "compatibility": "{semver-range}"
93
105
  }
94
106
  ```
@@ -107,7 +107,8 @@ Create context-snippet.md in Vercel-aligned indexed format (~80-120 tokens):
107
107
  |IMPORTANT: {skill_name} v{version} — read SKILL.md before writing {skill_name} code. Do NOT rely on training data.
108
108
  |quick-start:{SKILL.md#quick-start}
109
109
  |api: {top-5 exports with () for functions}
110
- |gotchas: {1-2 most critical pitfalls if known}
110
+ |key-types:{SKILL.md#key-types} — {inline summary of most important type values}
111
+ |gotchas: {2-3 most critical pitfalls or breaking changes, inline}
111
112
  ```
112
113
 
113
114
  **If fewer than 5 exports:** Use all available exports.
@@ -116,29 +117,48 @@ Create context-snippet.md in Vercel-aligned indexed format (~80-120 tokens):
116
117
 
117
118
  ### 4. Generate Metadata JSON
118
119
 
119
- Create metadata.json:
120
+ Generate metadata.json following the exact structure defined in {skillTemplateData} metadata.json section. Populate fields from extraction_inventory:
120
121
 
121
122
  ```json
122
123
  {
123
- "name": "{repo_name}",
124
- "version": "{extraction_inventory.version or 0.1.0}",
124
+ "name": "{skill_name}",
125
+ "version": "{extraction_inventory.version or 1.0.0}",
126
+ "description": "{brief description of the skill}",
125
127
  "skill_type": "single",
126
128
  "source_authority": "community",
127
129
  "source_repo": "{resolved_url}",
130
+ "source_root": "{resolved_source_path}",
131
+ "source_commit": "{commit_sha_if_available}",
128
132
  "source_package": "{package_name from manifest}",
129
133
  "language": "{language}",
130
134
  "generated_by": "quick-skill",
131
135
  "generation_date": "{current ISO date}",
132
136
  "confidence_tier": "Quick",
137
+ "spec_version": "1.3",
133
138
  "exports": ["{export_1}", "{export_2}"],
139
+ "confidence_distribution": {
140
+ "t1": 0,
141
+ "t1_low": "{number of exports found — must be integer, not string}",
142
+ "t2": 0,
143
+ "t3": 0
144
+ },
145
+ "tool_versions": {
146
+ "ast_grep": null,
147
+ "qmd": null,
148
+ "skf": "{skf_version}"
149
+ },
134
150
  "stats": {
135
151
  "exports_documented": "{number of exports found}",
136
152
  "exports_public_api": "{number of exports found}",
137
153
  "exports_internal": 0,
138
154
  "exports_total": "{number of exports found}",
139
155
  "public_api_coverage": 1.0,
140
- "total_coverage": 1.0
141
- }
156
+ "total_coverage": 1.0,
157
+ "scripts_count": 0,
158
+ "assets_count": 0
159
+ },
160
+ "dependencies": [],
161
+ "compatibility": "{semver-range or null}"
142
162
  }
143
163
  ```
144
164
 
@@ -116,7 +116,7 @@ Check context-snippet.md format compliance:
116
116
  Check metadata.json has required fields:
117
117
 
118
118
  - [ ] `name` — present, non-empty
119
- - [ ] `version` — present (auto-detected or "0.1.0")
119
+ - [ ] `version` — present (auto-detected or "1.0.0")
120
120
  - [ ] `source_authority` — must be "community"
121
121
  - [ ] `source_repo` — present, valid GitHub URL
122
122
  - [ ] `language` — present, non-empty
@@ -62,6 +62,9 @@ If directory already exists, confirm with user before overwriting:
62
62
 
63
63
  "**Directory `{skills_output_folder}/{repo_name}/` already exists.** Overwrite existing files? [Y/N]"
64
64
 
65
+ - **If user selects Y:** Proceed to section 2.
66
+ - **If user selects N:** Halt with: "Overwrite cancelled. Existing skill preserved. Run [QS] with a different skill name or remove the existing directory manually."
67
+
65
68
  ### 2. Write SKILL.md
66
69
 
67
70
  Write the compiled SKILL.md content to:
@@ -2,7 +2,7 @@
2
2
  name: quick-skill
3
3
  description: Brief-less fast skill with package-to-repo resolution
4
4
  web_bundle: true
5
- installed_path: '{project-root}/_bmad/skf/workflows/quick-skill'
5
+ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/quick-skill'
6
6
  ---
7
7
 
8
8
  # Quick Skill