bmad-module-skill-forge 0.6.0 → 0.7.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 (136) 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 +85 -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 +1 -1
  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 +10 -7
  21. package/src/knowledge/progressive-capability.md +3 -2
  22. package/src/knowledge/qmd-registry.md +4 -1
  23. package/src/knowledge/skf-knowledge-index.csv +1 -0
  24. package/src/knowledge/skill-lifecycle.md +26 -2
  25. package/src/knowledge/split-body-strategy.md +16 -2
  26. package/src/knowledge/zero-hallucination.md +11 -8
  27. package/src/module-help.csv +9 -6
  28. package/src/module.yaml +3 -0
  29. package/src/workflows/README.md +35 -17
  30. package/src/workflows/analyze-source/data/skill-brief-schema.md +18 -5
  31. package/src/workflows/analyze-source/steps-c/step-01-init.md +2 -2
  32. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +1 -1
  33. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +1 -1
  34. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +1 -1
  35. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +1 -1
  36. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +1 -1
  37. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +2 -2
  38. package/src/workflows/analyze-source/workflow.md +2 -2
  39. package/src/workflows/audit-skill/data/severity-rules.md +1 -1
  40. package/src/workflows/audit-skill/steps-c/step-01-init.md +1 -0
  41. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +5 -0
  42. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +1 -1
  43. package/src/workflows/audit-skill/workflow.md +2 -1
  44. package/src/workflows/brief-skill/data/scope-templates.md +10 -0
  45. package/src/workflows/brief-skill/data/skill-brief-schema.md +25 -23
  46. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +1 -1
  47. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +3 -0
  48. package/src/workflows/create-skill/data/skill-sections.md +12 -11
  49. package/src/workflows/create-skill/data/source-resolution-protocols.md +1 -1
  50. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +13 -9
  51. package/src/workflows/create-skill/steps-c/step-03-extract.md +15 -19
  52. package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +3 -3
  53. package/src/workflows/create-skill/steps-c/step-03c-fetch-docs.md +3 -1
  54. package/src/workflows/create-skill/steps-c/step-04-enrich.md +1 -1
  55. package/src/workflows/create-skill/steps-c/step-05-compile.md +4 -3
  56. package/src/workflows/create-skill/steps-c/step-06-validate.md +2 -2
  57. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +33 -44
  58. package/src/workflows/create-skill/steps-c/step-08-report.md +25 -11
  59. package/src/workflows/create-skill/workflow.md +2 -2
  60. package/src/workflows/create-stack-skill/data/compose-mode-rules.md +65 -0
  61. package/src/workflows/create-stack-skill/data/stack-skill-template.md +28 -6
  62. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +23 -7
  63. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +35 -2
  64. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +26 -2
  65. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +24 -0
  66. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +30 -2
  67. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +5 -1
  68. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +53 -5
  69. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +3 -3
  70. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +8 -2
  71. package/src/workflows/create-stack-skill/workflow.md +2 -2
  72. package/src/workflows/export-skill/data/managed-section-format.md +8 -1
  73. package/src/workflows/export-skill/data/snippet-format.md +1 -1
  74. package/src/workflows/export-skill/steps-c/step-04-update-context.md +7 -2
  75. package/src/workflows/export-skill/steps-c/step-05-token-report.md +1 -1
  76. package/src/workflows/export-skill/workflow.md +3 -1
  77. package/src/workflows/quick-skill/data/skill-template.md +18 -6
  78. package/src/workflows/quick-skill/steps-c/step-04-compile.md +26 -6
  79. package/src/workflows/quick-skill/steps-c/step-05-validate.md +1 -1
  80. package/src/workflows/quick-skill/steps-c/step-06-write.md +3 -0
  81. package/src/workflows/quick-skill/workflow.md +1 -1
  82. package/src/workflows/refine-architecture/data/refinement-rules.md +102 -0
  83. package/src/workflows/refine-architecture/steps-c/step-01-init.md +188 -0
  84. package/src/workflows/refine-architecture/steps-c/step-02-gap-analysis.md +179 -0
  85. package/src/workflows/refine-architecture/steps-c/step-03-issue-detection.md +182 -0
  86. package/src/workflows/refine-architecture/steps-c/step-04-improvements.md +169 -0
  87. package/src/workflows/refine-architecture/steps-c/step-05-compile.md +200 -0
  88. package/src/workflows/refine-architecture/steps-c/step-06-report.md +147 -0
  89. package/src/workflows/refine-architecture/workflow.md +61 -0
  90. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +2 -1
  91. package/src/workflows/setup-forge/steps-c/step-01b-ccc-index.md +1 -1
  92. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +15 -16
  93. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +1 -1
  94. package/src/workflows/setup-forge/steps-c/step-04-report.md +2 -2
  95. package/src/workflows/setup-forge/workflow.md +3 -2
  96. package/src/workflows/test-skill/data/scoring-rules.md +3 -0
  97. package/src/workflows/test-skill/data/source-access-protocol.md +1 -1
  98. package/src/workflows/test-skill/steps-c/step-01-init.md +1 -0
  99. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +2 -0
  100. package/src/workflows/test-skill/workflow.md +2 -2
  101. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +2 -2
  102. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +5 -2
  103. package/src/workflows/update-skill/steps-c/step-05-validate.md +7 -11
  104. package/src/workflows/update-skill/steps-c/step-06-write.md +5 -2
  105. package/src/workflows/update-skill/workflow.md +1 -1
  106. package/src/workflows/verify-stack/data/coverage-patterns.md +45 -0
  107. package/src/workflows/verify-stack/data/feasibility-report-template.md +63 -0
  108. package/src/workflows/verify-stack/data/integration-verification-rules.md +73 -0
  109. package/src/workflows/verify-stack/steps-c/step-01-init.md +174 -0
  110. package/src/workflows/verify-stack/steps-c/step-02-coverage.md +181 -0
  111. package/src/workflows/verify-stack/steps-c/step-03-integrations.md +195 -0
  112. package/src/workflows/verify-stack/steps-c/step-04-requirements.md +168 -0
  113. package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +191 -0
  114. package/src/workflows/verify-stack/steps-c/step-06-report.md +197 -0
  115. package/src/workflows/verify-stack/workflow.md +61 -0
  116. package/src/workflows/analyze-source/validation-report.md +0 -657
  117. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +0 -385
  118. package/src/workflows/audit-skill/validation-report.md +0 -545
  119. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +0 -318
  120. package/src/workflows/brief-skill/validation-report.md +0 -630
  121. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +0 -360
  122. package/src/workflows/create-skill/validation-report.md +0 -189
  123. package/src/workflows/create-skill/workflow-plan-create-skill.md +0 -525
  124. package/src/workflows/create-stack-skill/validation-report.md +0 -401
  125. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +0 -481
  126. package/src/workflows/export-skill/validation-report.md +0 -263
  127. package/src/workflows/export-skill/workflow-plan-export-skill.md +0 -369
  128. package/src/workflows/quick-skill/validation-report.md +0 -543
  129. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +0 -405
  130. package/src/workflows/setup-forge/validation-report.md +0 -504
  131. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +0 -430
  132. package/src/workflows/test-skill/validation-report.md +0 -390
  133. package/src/workflows/test-skill/workflow-plan-test-skill.md +0 -292
  134. package/src/workflows/update-skill/data/tier-degradation-rules.md +0 -46
  135. package/src/workflows/update-skill/validation-report.md +0 -559
  136. package/src/workflows/update-skill/workflow-plan-update-skill.md +0 -441
@@ -73,17 +73,17 @@ Where `{primary_confidence}` is the predominant confidence tier (T1 if Forge/Dee
73
73
  |------|-------|-------------|
74
74
  | T1 (AST) | {t1_count} | Structurally verified via ast-grep |
75
75
  | T1-low (Source) | {t1_low_count} | Inferred from source reading |
76
- | T2 (QMD) | {t2_count} | Enriched with temporal context |
76
+ | T2 (QMD) | {t2_count} | QMD-enriched semantic context |
77
77
  | T3 (External) | {t3_count} | Sourced from external documentation URLs |
78
78
 
79
79
  **Output Files:**
80
- - `skills/{name}/SKILL.md` — Active skill with trigger-based usage
81
- - `skills/{name}/context-snippet.md` — Passive context for CLAUDE.md
82
- - `skills/{name}/metadata.json` — Machine-readable birth certificate
83
- - `skills/{name}/references/` — Progressive disclosure ({ref_count} files)
84
- - `forge-data/{name}/provenance-map.json` — Source map with AST bindings
85
- - `forge-data/{name}/evidence-report.md` — Build audit trail
86
- - `forge-data/{name}/extraction-rules.yaml` — Reproducible extraction schema"
80
+ - `{skills_output_folder}/{name}/SKILL.md` — Active skill with trigger-based usage
81
+ - `{skills_output_folder}/{name}/context-snippet.md` — Passive context for CLAUDE.md
82
+ - `{skills_output_folder}/{name}/metadata.json` — Machine-readable birth certificate
83
+ - `{skills_output_folder}/{name}/references/` — Progressive disclosure ({ref_count} files)
84
+ - `{forge_data_folder}/{name}/provenance-map.json` — Source map with AST bindings
85
+ - `{forge_data_folder}/{name}/evidence-report.md` — Build audit trail
86
+ - `{forge_data_folder}/{name}/extraction-rules.yaml` — Reproducible extraction schema"
87
87
 
88
88
  ### 3. Display Warnings (If Any)
89
89
 
@@ -100,7 +100,7 @@ If no warnings, omit this section entirely.
100
100
 
101
101
  "**Recommended next steps:**
102
102
  - **[TS] Test Skill** — verify completeness and accuracy before export
103
- - **[ES] Export Skill** — publish to your skill library or agentskills.io
103
+ - **[EX] Export Skill** — publish to your skill library or agentskills.io
104
104
  - **[US] Update Skill** — edit specific sections or add manual content
105
105
 
106
106
  To use this skill immediately, add the context snippet to your CLAUDE.md:
@@ -116,9 +116,23 @@ To use this skill immediately, add the context snippet to your CLAUDE.md:
116
116
 
117
117
  {If more remaining:} Proceeding to next brief: {next_skill_name}..."
118
118
 
119
- Update sidecar checkpoint with batch progress, then loop back to step-01 for the next brief.
119
+ Update the batch checkpoint in `{sidecar_path}/batch-state.yaml` with:
120
120
 
121
- **If not batch mode or all batch briefs complete:**
121
+ ```yaml
122
+ batch_active: true
123
+ brief_list: [{full list of brief paths}]
124
+ current_index: {index of next brief to process, 0-based}
125
+ completed: [{list of completed skill names}]
126
+ last_updated: {ISO timestamp}
127
+ ```
128
+
129
+ Then loop back to step-01 for the next brief. Step-01 detects an active batch via `batch-state.yaml` and loads the brief at `current_index`.
130
+
131
+ **If all batch briefs complete:**
132
+
133
+ Set `batch_active: false` in `{sidecar_path}/batch-state.yaml` to prevent stale state. Display: "Batch complete. {completed_count} skills compiled."
134
+
135
+ **If not batch mode:**
122
136
 
123
137
  End workflow. No further steps.
124
138
 
@@ -9,13 +9,13 @@ installed_path: '{project-root}/_bmad/skf/workflows/skillforge/create-skill'
9
9
 
10
10
  **Goal:** Compile a verified agent skill from a skill-brief.yaml and source code, producing an agentskills.io-compliant SKILL.md with provenance map, evidence report, and progressive disclosure references.
11
11
 
12
- **Your Role:** You are a skill compilation engine performing structural extraction and assembly. This workflow is mostly autonomous with three interaction points — one after ecosystem check (if a match is found), one after source extraction (to confirm findings before compilation), and one after content quality review (when tessl produces suggestions). All other steps auto-proceed. Apply zero hallucination tolerance: every instruction in the output must trace to source code with a confidence tier citation.
12
+ **Your Role:** You are operating in **Ferris Architect mode** — a skill compilation engine performing structural extraction and assembly. This workflow is mostly autonomous with three interaction points — one after ecosystem check (if a match is found), one after source extraction (to confirm findings before compilation), and one after content quality review (when tessl produces suggestions). All other steps auto-proceed. Apply zero hallucination tolerance: every instruction in the output must trace to source code with a confidence tier citation.
13
13
 
14
14
  ## WORKFLOW ARCHITECTURE
15
15
 
16
16
  ### Core Principles
17
17
 
18
- - **Micro-file Design**: Each step of the overall goal is a self contained instruction file that you will adhere too 1 file as directed at a time
18
+ - **Micro-file Design**: Each step of the overall goal is a self contained instruction file that you will adhere to 1 file as directed at a time
19
19
  - **Just-In-Time Loading**: Only 1 current step file will be loaded, read, and executed to completion - never load future step files until told to do so
20
20
  - **Sequential Enforcement**: Sequence within the step files must be completed in order, no skipping or optimization allowed
21
21
  - **Tier-Aware Execution**: Steps adapt behavior based on forge tier (Quick/Forge/Forge+/Deep) loaded from sidecar at init
@@ -0,0 +1,65 @@
1
+ # Compose Mode Rules
2
+
3
+ Rules for synthesizing a stack skill from pre-generated individual skills and an architecture document, without requiring a codebase.
4
+
5
+ ## Skill Loading
6
+
7
+ 1. Scan `{skills_output_folder}` for subdirectories containing both `SKILL.md` and `metadata.json`
8
+ 2. **Filter:** Skip any subdirectory named `{project_name}-stack` or any skill where `metadata.json` has `"skill_type": "stack"` — stack skills must not be loaded as source dependencies to avoid self-referencing loops
9
+ 3. Skip any subdirectory missing either `SKILL.md` or `metadata.json` — log a warning and skip
10
+ 4. Load each `metadata.json` and extract: `name`, `language`, `confidence_tier`, `source_repo`, `exports` (count), `version`
11
+ 5. Store the subdirectory name as `skill_dir` (distinct from `name` — the directory may differ from the metadata name)
12
+ 6. Store loaded skills as `raw_dependencies` with `source: "existing_skill"`
13
+
14
+ ## Architecture Integration Mapping
15
+
16
+ **If `{architecture_doc_path}` is null or the file does not exist:** Skip this section and proceed to [Inferred Integrations (No Architecture Document)](#inferred-integrations-no-architecture-document) below.
17
+
18
+ 1. Load the architecture document from `{architecture_doc_path}`
19
+ 2. Parse section headers and prose paragraphs for references to loaded skill names
20
+ 3. A **co-mention** is detected when a paragraph or section references 2+ loaded skill names
21
+ 4. For each co-mention pair, load both skills' export lists and API signatures from their `SKILL.md`
22
+ 5. Compose an integration section describing how the two libraries connect based on:
23
+ - Shared types or interfaces between the two skills' API surfaces
24
+ - Architecture document prose describing their interaction
25
+ - Complementary domain roles (e.g., one produces data the other consumes)
26
+
27
+ ## Confidence Tier Inheritance
28
+
29
+ - All compose-mode evidence inherits confidence tiers from the source individual skills
30
+ - If both skills in a pair are T1, the integration is T1
31
+ - If either skill is T1-low, the integration is T1-low
32
+ - If either skill is T2, the structural confidence still inherits the lower of T1/T1-low from the pair — the T2 temporal annotations from that skill are carried as an additive enrichment marker, not a tier upgrade
33
+ - T1 + T2 pair: inherits `T1 [composed, +T2 annotations]` — the T1 skill provides full structural confidence
34
+ - T1-low + T2 pair: inherits `T1-low [composed, +T2 annotations]` — T1-low structural confidence with T2 temporal annotations noted
35
+ - If both skills are T2 (no T1/T1-low base available): the integration confidence is `T1-low [composed, +T2 annotations from both]` — T2 temporal enrichment depends on structural extraction, so the most conservative structural tier is assumed
36
+ - Compose-mode integrations add suffix: `[composed]` — e.g., `T1 [composed]`, `T1-low [composed, +T2 annotations]`
37
+
38
+ ## Integration Evidence Format
39
+
40
+ Each integration entry must cite both source skills by name with function signatures:
41
+
42
+ ```
43
+ {Skill A name} + {Skill B name}
44
+ Type: [pattern type from integration-patterns.md]
45
+ Evidence:
46
+ [from skill: {Skill A name}] {exported_function_signature}
47
+ [from skill: {Skill B name}] {exported_function_signature}
48
+ Architecture reference: "{quoted prose from architecture doc}"
49
+ Confidence: {inherited_tier} [composed]
50
+ ```
51
+
52
+ ## Feasibility Report Integration
53
+
54
+ If a feasibility report (`feasibility-report-{project_name}.md`) exists in `{forge_data_folder}/`:
55
+ - Load the VS overall verdict from the report's YAML frontmatter `overall_verdict` field (`FEASIBLE`, `CONDITIONALLY FEASIBLE`, or `NOT FEASIBLE`) and parse per-pair verdicts from the `## Integration Verdicts` markdown table (`Verified`, `Plausible`, `Risky`, or `Blocked`)
56
+ - Include the verdict in the integration evidence: `VS overall: {FEASIBLE|CONDITIONALLY FEASIBLE|NOT FEASIBLE}`, `VS pair: {Verified|Plausible|Risky|Blocked}`
57
+ - Flag any pairs where VS reported `Risky` or `Blocked` verdicts
58
+
59
+ ## Inferred Integrations (No Architecture Document)
60
+
61
+ When no architecture document is available:
62
+ - Infer potential integrations from skills sharing the same `language` field
63
+ - Infer from skills sharing domain keywords in their `SKILL.md` descriptions
64
+ - Mark all inferred integrations: `[inferred from shared domain]`
65
+ - Inferred integrations default to lowest confidence of the pair with `[inferred from shared domain]` suffix (use this instead of `[composed]` for inferred integrations)
@@ -70,17 +70,39 @@ Indexed format targeting ~80-120 tokens per stack:
70
70
  "version": "1.0.0",
71
71
  "generation_date": "{ISO-8601}",
72
72
  "confidence_tier": "{Quick|Forge|Forge+|Deep}",
73
+ "spec_version": "1.3",
73
74
  "source_authority": "{official|community|internal}",
75
+ "generated_by": "create-stack-skill",
74
76
  "exports": [],
75
77
  "library_count": 0,
76
78
  "integration_count": 0,
77
79
  "libraries": ["lib1", "lib2"],
78
80
  "integration_pairs": [["lib1", "lib2"]],
81
+ "language": "{primary language or list of languages from constituent skills}",
82
+ "ast_node_count": "{number-or-omitted-if-no-ast}",
79
83
  "confidence_distribution": {
80
- "T1": 0,
81
- "T1-low": 0,
82
- "T2": 0
83
- }
84
+ "t1": 0,
85
+ "t1_low": 0,
86
+ "t2": 0,
87
+ "t3": 0
88
+ },
89
+ "tool_versions": {
90
+ "ast_grep": "{version-or-null}",
91
+ "qmd": "{version-or-null}",
92
+ "skf": "{skf_version}"
93
+ },
94
+ "stats": {
95
+ "exports_documented": 0,
96
+ "exports_public_api": 0,
97
+ "exports_internal": 0,
98
+ "exports_total": 0,
99
+ "public_api_coverage": 0.0,
100
+ "total_coverage": 0.0,
101
+ "scripts_count": 0,
102
+ "assets_count": 0
103
+ },
104
+ "dependencies": [],
105
+ "compatibility": "{semver-range}"
84
106
  }
85
107
  ```
86
108
 
@@ -90,7 +112,7 @@ Indexed format targeting ~80-120 tokens per stack:
90
112
  # {library_name} Reference
91
113
 
92
114
  **Version:** {version_from_manifest}
93
- **Import count:** {count} files
115
+ **Import count:** {count} files *(compose-mode: replace with **Export count:** {count} exports)*
94
116
  **Confidence:** {T1/T1-low/T2}
95
117
 
96
118
  ## Key Exports
@@ -110,7 +132,7 @@ Indexed format targeting ~80-120 tokens per stack:
110
132
 
111
133
  **Type:** {pattern_type}
112
134
  **Co-import files:** {count}
113
- **Confidence:** {T1/T1-low}
135
+ **Confidence:** {T1/T1-low/T2 [composed]}
114
136
 
115
137
  ## Integration Pattern
116
138
  [Detailed description of how these libraries connect]
@@ -81,6 +81,7 @@ Extract:
81
81
  **Tier-dependent tools:**
82
82
  - **Quick:** gh_bridge (source reading) — graceful degradation to local file reading if unavailable
83
83
  - **Forge:** ast_bridge (ast-grep structural analysis) — required for Forge tier
84
+ - **Forge+:** ast_bridge + ccc_bridge (ccc semantic co-import augmentation) — ccc available for step-05
84
85
  - **Deep:** qmd_bridge (QMD temporal enrichment) — required for Deep tier
85
86
 
86
87
  Report tool availability. If a tier-required tool is missing, downgrade tier and note:
@@ -99,6 +100,18 @@ Check if the user provided:
99
100
  - If provided, store as `scope_overrides` for use in step 03
100
101
  - Format: `library_name: include|exclude`
101
102
 
103
+ **Compose mode detection:**
104
+
105
+ Set `compose_mode: false` as the default.
106
+
107
+ - If user provides an architecture document path for composition or explicitly requests compose mode → set `compose_mode: true` and store `architecture_doc_path`
108
+ - If no manifest files exist in project root AND at least one subdirectory in `{skills_output_folder}` contains both `SKILL.md` and `metadata.json` → suggest compose mode to the user and ask for optional architecture document path
109
+ - If user accepts → set `compose_mode: true` and store `architecture_doc_path` (may be `null` if user chose not to provide one)
110
+ - If user declines → `compose_mode` remains `false`, continue with code-mode
111
+
112
+ If compose_mode:
113
+ - Display: "**Compose mode detected.** Synthesizing stack skill from existing skills + architecture document."
114
+
102
115
  If no optional inputs provided, auto-detection will be used.
103
116
 
104
117
  ### 4. Display Initialization Summary
@@ -106,16 +119,19 @@ If no optional inputs provided, auto-detection will be used.
106
119
  "**Stack Skill Forge initialized.**
107
120
 
108
121
  **Project:** {project_name}
109
- **Forge Tier:** {tier_description}
110
- - Quick: Source reading and import counting
111
- - Forge: + AST-backed structural analysis
112
- - Forge+: + CCC semantic co-import augmentation
113
- - Deep: + Temporal integration evolution
122
+ **Forge Tier:** {forge_tier} — {tier_description}
123
+
124
+ Where tier_description follows positive capability framing:
125
+ - Quick: "Source reading and import counting"
126
+ - Forge: "AST-backed structural analysis"
127
+ - Forge+: "AST structural + CCC semantic co-import augmentation"
128
+ - Deep: "Full intelligence — structural + contextual + temporal"
114
129
 
115
130
  **Available Tools:** {tool_list}
116
- **Input Mode:** {auto-detect | explicit dependency list}
131
+ **Input Mode:** {auto-detect | explicit dependency list | compose mode}
117
132
 
118
- **Proceeding to manifest detection...**"
133
+ **If compose mode:** Proceeding to skill loading...
134
+ **If code mode:** Proceeding to manifest detection..."
119
135
 
120
136
  ### 5. Auto-Proceed to Next Step
121
137
 
@@ -38,7 +38,7 @@ Scan the project root for dependency manifest files, parse each to extract depen
38
38
  - 🎯 Load manifest-patterns.md for detection rules
39
39
  - 💾 Store manifests found and raw dependency list as workflow state
40
40
  - 📖 Auto-proceed to step 03 after successful detection
41
- - 🚫 HALT if no manifests found and no explicit list provided
41
+ - 🚫 HALT if no manifests found and no explicit list provided — **unless `compose_mode` is true** (compose mode skips manifest detection)
42
42
 
43
43
  ## CONTEXT BOUNDARIES:
44
44
 
@@ -50,6 +50,39 @@ Scan the project root for dependency manifest files, parse each to extract depen
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 AND `explicit_deps` was provided in step 01:**
56
+
57
+ Use the explicit dependency list directly. Store the explicit list as `raw_dependencies` with `source: "explicit"` and skip to [Auto-Proceed to Next Step](#5-auto-proceed-to-next-step).
58
+
59
+ **If `compose_mode` is true AND `explicit_deps` was NOT provided:**
60
+
61
+ Scan `{skills_output_folder}` for subdirectories containing SKILL.md and metadata.json.
62
+
63
+ **Filter:** Skip any subdirectory named `{project_name}-stack` or any skill where `metadata.json` has `"skill_type": "stack"` — stack skills must not be loaded as source dependencies to avoid self-referencing loops.
64
+
65
+ **If zero skills remain after filtering:** HALT with: "**Cannot proceed in compose-mode.** No individual skills found in `{skills_output_folder}` (after filtering stack skills). Run [CS] Create Skill or [QS] Quick Skill to generate individual skills first, then re-run [SS]."
66
+
67
+ For each skill found:
68
+ 1. Read metadata.json
69
+ 2. Extract: name, language, confidence_tier, source_repo, exports count, version
70
+ 3. Store the subdirectory name as `skill_dir` (distinct from `name` — the directory may differ from the metadata name)
71
+ 4. Store as `raw_dependencies` with source: "existing_skill"
72
+
73
+ Display:
74
+ "**Loaded {N} existing skills as dependencies.**
75
+
76
+ | Skill | Language | Tier | Exports | Source |
77
+ |-------|----------|------|---------|--------|
78
+ | {name} | {lang} | {tier} | {count} | {repo} |
79
+
80
+ **Proceeding to scope confirmation...**"
81
+
82
+ Skip to [Auto-Proceed to Next Step](#5-auto-proceed-to-next-step) — the skills table above serves as the detection summary.
83
+
84
+ **If not compose_mode:** Continue with section 1 (existing flow).
85
+
53
86
  ### 1. Check for Explicit Dependency List
54
87
 
55
88
  **If `explicit_deps` was provided in step 01:**
@@ -58,7 +91,7 @@ Scan the project root for dependency manifest files, parse each to extract depen
58
91
 
59
92
  **Dependencies:** {explicit_deps_count} libraries provided"
60
93
 
61
- Store the explicit list as `raw_dependencies` and skip to section 4.
94
+ Store the explicit list as `raw_dependencies` and skip to [Display Detection Summary](#4-display-detection-summary).
62
95
 
63
96
  **If no explicit list:** Continue to section 2.
64
97
 
@@ -52,6 +52,30 @@ Count import frequency for each dependency across the codebase, rank by usage, a
52
52
 
53
53
  ### 1. Count Import Frequency
54
54
 
55
+ **If `compose_mode` is true:**
56
+
57
+ Skip import counting entirely. All skills are included by default.
58
+
59
+ Set `confirmed_dependencies` = all `raw_dependencies` (the list already stored as workflow state from Step 02).
60
+
61
+ **Apply scope_overrides:** If `scope_overrides` were provided in step 01, apply them now — force-include or force-exclude skills as specified. Log any overrides applied.
62
+
63
+ Present skills sorted by architectural layer (from architecture doc if available):
64
+ - If `architecture_doc_path` is not null: parse architecture doc for section headers to determine layer grouping
65
+ - If `architecture_doc_path` is null or layers not detectable: present alphabetically
66
+
67
+ Display skills as a table:
68
+
69
+ | # | Skill | Language | Tier | Architecture Layer |
70
+ |---|-------|----------|------|--------------------|
71
+ | 1 | {name} | {language} | {confidence_tier} | {layer or 'Unclassified'} |
72
+
73
+ User confirms inclusion/exclusion at the gate (same [C] menu as code-mode).
74
+
75
+ Skip to [Present MENU OPTIONS](#5-present-menu-options).
76
+
77
+ **If not compose_mode:**
78
+
55
79
  For each dependency in `raw_dependencies`:
56
80
 
57
81
  **Launch a subprocess** that runs grep across all source files in the project to count import statements for each library. Return only the counts, not file contents.
@@ -136,8 +160,8 @@ Display: **Select:** [C] Continue to Extraction
136
160
 
137
161
  #### Menu Handling Logic:
138
162
 
139
- - IF C: Store confirmed_dependencies, then load, read entire file, then execute {nextStepFile}
140
- - IF Any other: Process as scope modification, redisplay updated list, then [Redisplay Menu Options](#5-present-menu-options)
163
+ - IF C: Store current `confirmed_dependencies` (including any modifications made since initial presentation), then load, read entire file, then execute {nextStepFile}
164
+ - IF Any other: Process as scope modification (add/remove skills from `confirmed_dependencies`), update the in-memory `confirmed_dependencies` list accordingly, redisplay the updated skills table, then [Redisplay Menu Options](#5-present-menu-options)
141
165
 
142
166
  ---
143
167
 
@@ -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):**
@@ -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
@@ -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,6 +62,33 @@ 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.
@@ -85,7 +113,7 @@ CCC failures: skip augmentation silently, proceed with grep-only results.
85
113
 
86
114
  Load `{integrationPatterns}` for classification rules.
87
115
 
88
- For each qualifying pair (2+ co-import files), analyze the co-import files to classify the integration type:
116
+ 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
117
 
90
118
  - **Type 1: Middleware Chain** — Sequential function calls piping output between libraries
91
119
  - **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