bmad-module-skill-forge 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/.nvmrc +1 -0
  2. package/LICENSE +26 -0
  3. package/README.md +213 -0
  4. package/docs/404.md +20 -0
  5. package/docs/agents.md +73 -0
  6. package/docs/architecture.md +301 -0
  7. package/docs/examples.md +144 -0
  8. package/docs/getting-started.md +198 -0
  9. package/docs/index.md +75 -0
  10. package/docs/workflows.md +190 -0
  11. package/package.json +109 -0
  12. package/src/agents/forger.agent.yaml +93 -0
  13. package/src/forger/README.md +17 -0
  14. package/src/forger/forge-tier.yaml +13 -0
  15. package/src/forger/preferences.yaml +10 -0
  16. package/src/knowledge/agentskills-spec.md +158 -0
  17. package/src/knowledge/confidence-tiers.md +153 -0
  18. package/src/knowledge/manual-section-integrity.md +156 -0
  19. package/src/knowledge/overview.md +56 -0
  20. package/src/knowledge/progressive-capability.md +120 -0
  21. package/src/knowledge/provenance-tracking.md +163 -0
  22. package/src/knowledge/skf-knowledge-index.csv +9 -0
  23. package/src/knowledge/skill-lifecycle.md +150 -0
  24. package/src/knowledge/zero-hallucination.md +101 -0
  25. package/src/module-help.csv +12 -0
  26. package/src/module.yaml +22 -0
  27. package/src/workflows/README.md +148 -0
  28. package/src/workflows/analyze-source/data/skill-brief-schema.md +75 -0
  29. package/src/workflows/analyze-source/data/unit-detection-heuristics.md +88 -0
  30. package/src/workflows/analyze-source/steps-c/step-01-init.md +191 -0
  31. package/src/workflows/analyze-source/steps-c/step-01b-continue.md +144 -0
  32. package/src/workflows/analyze-source/steps-c/step-02-scan-project.md +208 -0
  33. package/src/workflows/analyze-source/steps-c/step-03-identify-units.md +199 -0
  34. package/src/workflows/analyze-source/steps-c/step-04-map-and-detect.md +222 -0
  35. package/src/workflows/analyze-source/steps-c/step-05-recommend.md +236 -0
  36. package/src/workflows/analyze-source/steps-c/step-06-generate-briefs.md +239 -0
  37. package/src/workflows/analyze-source/templates/analysis-report-template.md +41 -0
  38. package/src/workflows/analyze-source/validation-report.md +657 -0
  39. package/src/workflows/analyze-source/workflow-plan-analyze-source.md +385 -0
  40. package/src/workflows/analyze-source/workflow.md +61 -0
  41. package/src/workflows/audit-skill/data/drift-report-template.md +62 -0
  42. package/src/workflows/audit-skill/data/severity-rules.md +52 -0
  43. package/src/workflows/audit-skill/steps-c/step-01-init.md +195 -0
  44. package/src/workflows/audit-skill/steps-c/step-02-re-index.md +191 -0
  45. package/src/workflows/audit-skill/steps-c/step-03-structural-diff.md +194 -0
  46. package/src/workflows/audit-skill/steps-c/step-04-semantic-diff.md +199 -0
  47. package/src/workflows/audit-skill/steps-c/step-05-severity-classify.md +210 -0
  48. package/src/workflows/audit-skill/steps-c/step-06-report.md +217 -0
  49. package/src/workflows/audit-skill/validation-report.md +545 -0
  50. package/src/workflows/audit-skill/workflow-plan-audit-skill.md +318 -0
  51. package/src/workflows/audit-skill/workflow.md +63 -0
  52. package/src/workflows/brief-skill/data/skill-brief-schema.md +82 -0
  53. package/src/workflows/brief-skill/steps-c/step-01-gather-intent.md +184 -0
  54. package/src/workflows/brief-skill/steps-c/step-02-analyze-target.md +203 -0
  55. package/src/workflows/brief-skill/steps-c/step-03-scope-definition.md +225 -0
  56. package/src/workflows/brief-skill/steps-c/step-04-confirm-brief.md +185 -0
  57. package/src/workflows/brief-skill/steps-c/step-05-write-brief.md +156 -0
  58. package/src/workflows/brief-skill/validation-report.md +630 -0
  59. package/src/workflows/brief-skill/workflow-plan-brief-skill.md +360 -0
  60. package/src/workflows/brief-skill/workflow.md +57 -0
  61. package/src/workflows/create-skill/data/extraction-patterns.md +63 -0
  62. package/src/workflows/create-skill/data/skill-sections.md +166 -0
  63. package/src/workflows/create-skill/steps-c/step-01-load-brief.md +176 -0
  64. package/src/workflows/create-skill/steps-c/step-02-ecosystem-check.md +143 -0
  65. package/src/workflows/create-skill/steps-c/step-03-extract.md +184 -0
  66. package/src/workflows/create-skill/steps-c/step-04-enrich.md +152 -0
  67. package/src/workflows/create-skill/steps-c/step-05-compile.md +198 -0
  68. package/src/workflows/create-skill/steps-c/step-06-validate.md +162 -0
  69. package/src/workflows/create-skill/steps-c/step-07-generate-artifacts.md +165 -0
  70. package/src/workflows/create-skill/steps-c/step-08-report.md +160 -0
  71. package/src/workflows/create-skill/validation-report.md +189 -0
  72. package/src/workflows/create-skill/workflow-plan-create-skill.md +491 -0
  73. package/src/workflows/create-skill/workflow.md +52 -0
  74. package/src/workflows/create-stack-skill/data/integration-patterns.md +61 -0
  75. package/src/workflows/create-stack-skill/data/manifest-patterns.md +35 -0
  76. package/src/workflows/create-stack-skill/data/stack-skill-template.md +110 -0
  77. package/src/workflows/create-stack-skill/steps-c/step-01-init.md +142 -0
  78. package/src/workflows/create-stack-skill/steps-c/step-02-detect-manifests.md +145 -0
  79. package/src/workflows/create-stack-skill/steps-c/step-03-rank-and-confirm.md +161 -0
  80. package/src/workflows/create-stack-skill/steps-c/step-04-parallel-extract.md +155 -0
  81. package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +154 -0
  82. package/src/workflows/create-stack-skill/steps-c/step-06-compile-stack.md +160 -0
  83. package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +202 -0
  84. package/src/workflows/create-stack-skill/steps-c/step-08-validate.md +193 -0
  85. package/src/workflows/create-stack-skill/steps-c/step-09-report.md +137 -0
  86. package/src/workflows/create-stack-skill/validation-report.md +401 -0
  87. package/src/workflows/create-stack-skill/workflow-plan-create-stack-skill.md +481 -0
  88. package/src/workflows/create-stack-skill/workflow.md +59 -0
  89. package/src/workflows/export-skill/data/managed-section-format.md +70 -0
  90. package/src/workflows/export-skill/data/snippet-format.md +32 -0
  91. package/src/workflows/export-skill/steps-c/step-01-load-skill.md +184 -0
  92. package/src/workflows/export-skill/steps-c/step-02-package.md +153 -0
  93. package/src/workflows/export-skill/steps-c/step-03-generate-snippet.md +166 -0
  94. package/src/workflows/export-skill/steps-c/step-04-update-context.md +222 -0
  95. package/src/workflows/export-skill/steps-c/step-05-token-report.md +126 -0
  96. package/src/workflows/export-skill/steps-c/step-06-summary.md +167 -0
  97. package/src/workflows/export-skill/validation-report.md +263 -0
  98. package/src/workflows/export-skill/workflow-plan-export-skill.md +369 -0
  99. package/src/workflows/export-skill/workflow.md +56 -0
  100. package/src/workflows/quick-skill/data/registry-resolution.md +91 -0
  101. package/src/workflows/quick-skill/data/skill-template.md +66 -0
  102. package/src/workflows/quick-skill/steps-c/step-01-resolve-target.md +165 -0
  103. package/src/workflows/quick-skill/steps-c/step-02-ecosystem-check.md +143 -0
  104. package/src/workflows/quick-skill/steps-c/step-03-quick-extract.md +177 -0
  105. package/src/workflows/quick-skill/steps-c/step-04-compile.md +180 -0
  106. package/src/workflows/quick-skill/steps-c/step-05-validate.md +150 -0
  107. package/src/workflows/quick-skill/steps-c/step-06-write.md +160 -0
  108. package/src/workflows/quick-skill/validation-report.md +543 -0
  109. package/src/workflows/quick-skill/workflow-plan-quick-skill.md +405 -0
  110. package/src/workflows/quick-skill/workflow.md +56 -0
  111. package/src/workflows/setup-forge/data/tier-rules.md +50 -0
  112. package/src/workflows/setup-forge/steps-c/step-01-detect-and-tier.md +140 -0
  113. package/src/workflows/setup-forge/steps-c/step-02-write-config.md +141 -0
  114. package/src/workflows/setup-forge/steps-c/step-03-auto-index.md +116 -0
  115. package/src/workflows/setup-forge/steps-c/step-04-report.md +131 -0
  116. package/src/workflows/setup-forge/validation-report.md +504 -0
  117. package/src/workflows/setup-forge/workflow-plan-setup-forge.md +428 -0
  118. package/src/workflows/setup-forge/workflow.md +49 -0
  119. package/src/workflows/test-skill/data/output-section-formats.md +96 -0
  120. package/src/workflows/test-skill/data/scoring-rules.md +74 -0
  121. package/src/workflows/test-skill/steps-c/step-01-init.md +185 -0
  122. package/src/workflows/test-skill/steps-c/step-02-detect-mode.md +162 -0
  123. package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +222 -0
  124. package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +249 -0
  125. package/src/workflows/test-skill/steps-c/step-05-score.md +222 -0
  126. package/src/workflows/test-skill/steps-c/step-06-report.md +175 -0
  127. package/src/workflows/test-skill/templates/test-report-template.md +24 -0
  128. package/src/workflows/test-skill/validation-report.md +390 -0
  129. package/src/workflows/test-skill/workflow-plan-test-skill.md +288 -0
  130. package/src/workflows/test-skill/workflow.md +57 -0
  131. package/src/workflows/update-skill/data/manual-section-rules.md +44 -0
  132. package/src/workflows/update-skill/data/merge-conflict-rules.md +62 -0
  133. package/src/workflows/update-skill/steps-c/step-01-init.md +208 -0
  134. package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +184 -0
  135. package/src/workflows/update-skill/steps-c/step-03-re-extract.md +187 -0
  136. package/src/workflows/update-skill/steps-c/step-04-merge.md +230 -0
  137. package/src/workflows/update-skill/steps-c/step-05-validate.md +187 -0
  138. package/src/workflows/update-skill/steps-c/step-06-write.md +204 -0
  139. package/src/workflows/update-skill/steps-c/step-07-report.md +201 -0
  140. package/src/workflows/update-skill/validation-report.md +559 -0
  141. package/src/workflows/update-skill/workflow-plan-update-skill.md +441 -0
  142. package/src/workflows/update-skill/workflow.md +56 -0
  143. package/tools/cli/commands/install.js +33 -0
  144. package/tools/cli/commands/status.js +195 -0
  145. package/tools/cli/commands/uninstall.js +226 -0
  146. package/tools/cli/commands/update.js +63 -0
  147. package/tools/cli/lib/compiler.js +306 -0
  148. package/tools/cli/lib/ide-commands.js +244 -0
  149. package/tools/cli/lib/installer.js +307 -0
  150. package/tools/cli/lib/manifest.js +109 -0
  151. package/tools/cli/lib/ui.js +277 -0
  152. package/tools/cli/lib/version-check.js +86 -0
  153. package/tools/cli/skf-cli.js +45 -0
  154. package/tools/skf-npx-wrapper.js +36 -0
@@ -0,0 +1,101 @@
1
+ # Zero Hallucination Principle
2
+
3
+ ## Principle
4
+
5
+ Every instruction, signature, parameter, and behavioral claim in a generated skill must trace to a verifiable source location. Content that cannot be cited from source code, documentation, or verified external references is excluded — never guessed, inferred, or fabricated.
6
+
7
+ ## Rationale
8
+
9
+ Agent skills direct other AI agents to use libraries and APIs. A hallucinated parameter name, an invented default value, or a fabricated usage pattern will cause the consuming agent to generate broken code. Unlike documentation aimed at humans who can cross-reference, skills are consumed by agents that treat every statement as ground truth.
10
+
11
+ Without zero hallucination enforcement:
12
+ - Agents follow fabricated instructions and produce broken code
13
+ - Confidence in the entire skill degrades when any claim proves false
14
+ - Users lose trust in the forge pipeline and revert to manual documentation
15
+
16
+ With zero hallucination enforcement:
17
+ - Every claim is backed by a source citation with file, line number, and confidence tier
18
+ - Gaps in knowledge produce explicit "not extracted" markers rather than guesses
19
+ - Skills become machine-verifiable evidence documents, not prose summaries
20
+
21
+ ## Pattern Examples
22
+
23
+ ### Example 1: Export Signature Extraction
24
+
25
+ **Context:** Creating a skill for a TypeScript library with exported functions.
26
+
27
+ **Implementation:** The extraction step reads source files and records each export with its exact signature, parameters, return type, and source location. If a parameter has no explicit type annotation, the skill records it as `unknown` with a T1-low citation rather than inferring the type from usage patterns.
28
+
29
+ ```
30
+ ## `parseConfig(input: string): Config`
31
+ [AST:src/parser.ts:L42]
32
+
33
+ ## `validate(data: unknown): boolean`
34
+ [SRC:src/validator.ts:L18] — parameter type not annotated in source
35
+ ```
36
+
37
+ **Key Points:**
38
+ - Exact signatures from source, not from README examples
39
+ - Missing type information acknowledged, not filled in
40
+ - Citation format includes file path and line number
41
+
42
+ ### Example 2: Handling Undocumented Behavior
43
+
44
+ **Context:** Source code contains a function with side effects not described in JSDoc.
45
+
46
+ **Implementation:** The skill documents only what can be structurally verified. Observable side effects (file writes, network calls) are noted only if they appear in the function body with verifiable call sites. Behavioral nuances described nowhere in source are omitted with a coverage gap note.
47
+
48
+ ```
49
+ ### Coverage Gaps
50
+ - `initializeCache()` — internal caching behavior not fully traceable;
51
+ implementation references external service not available for inspection
52
+ ```
53
+
54
+ **Key Points:**
55
+ - Absence is documented as a gap, not filled with speculation
56
+ - Coverage gaps inform the test-skill scoring (reduces coverage score, not coherence)
57
+ - Gaps are actionable — they tell the user what to add via \[MANUAL\] sections
58
+
59
+ ### Example 3: Quick Tier Without AST
60
+
61
+ **Context:** Operating at Quick tier where ast-grep is unavailable.
62
+
63
+ **Implementation:** Extraction relies on source reading and pattern matching. All citations use `[SRC:file:Lnn]` format (T1-low confidence). The skill clearly states its extraction tier so consuming agents understand the confidence level.
64
+
65
+ ```yaml
66
+ # metadata.json (excerpt)
67
+ confidence_distribution:
68
+ t1: 0
69
+ t1_low: 47
70
+ t2: 0
71
+ t3: 3
72
+ extraction_tier: quick
73
+ ```
74
+
75
+ **Key Points:**
76
+ - Quick tier skills are legitimate — lower confidence, not lower integrity
77
+ - T1-low citations still reference real source locations
78
+ - Metadata makes the confidence distribution transparent
79
+
80
+ ## Anti-Patterns
81
+
82
+ - Inferring return types from variable names or function names — use `unknown` if not annotated
83
+ - Copying usage examples from README without verifying they match current source signatures
84
+ - Describing "typical usage patterns" from training data rather than from the actual codebase
85
+ - Omitting the confidence tier from citations — every citation must declare its trust level
86
+
87
+ ## Checklist
88
+
89
+ - [ ] Every API signature extracted from source, not from memory or documentation alone
90
+ - [ ] Missing information produces gaps, not guesses
91
+ - [ ] All citations include source file, line number, and confidence tier
92
+ - [ ] metadata.json reflects actual confidence distribution
93
+ - [ ] Quick tier skills clearly labeled as T1-low extraction
94
+
95
+ ## Related Fragments
96
+
97
+ - [confidence-tiers.md](confidence-tiers.md) — defines the T1/T1-low/T2/T3 trust model
98
+ - [provenance-tracking.md](provenance-tracking.md) — the mechanism for recording and verifying citations
99
+ - [progressive-capability.md](progressive-capability.md) — how tier affects extraction without compromising integrity
100
+
101
+ _Source: distilled from agent principles, create-skill extraction logic, and update-skill merge rules_
@@ -0,0 +1,12 @@
1
+ module,phase,name,code,sequence,workflow-file,command,required,agent,options,description,output-location,outputs,
2
+ skf,anytime,Setup Forge,SF,,_bmad/skf/workflows/skillforge/setup-forge/workflow.md,skf_setup_forge,false,ferris,Create Mode,"Initialize forge environment — detect tools and set capability tier (Quick/Forge/Deep)",,forge-config.yaml,
3
+ skf,anytime,Analyze Source,AN,,_bmad/skf/workflows/skillforge/analyze-source/workflow.md,skf_analyze_source,false,ferris,Create Mode,"Discover what to skill in a large repo — produces recommended skill briefs",forge_data_folder,skill-brief.yaml,
4
+ skf,anytime,Brief Skill,BS,,_bmad/skf/workflows/skillforge/brief-skill/workflow.md,skf_brief_skill,false,ferris,Create Mode,"Design a skill scope through guided discovery",forge_data_folder,skill-brief.yaml,
5
+ skf,anytime,Create Skill,CS,,_bmad/skf/workflows/skillforge/create-skill/workflow.md,skf_create_skill,false,ferris,Create Mode,"Compile a skill from a brief — supports --batch for multiple briefs",skills_output_folder,SKILL.md,
6
+ skf,anytime,Quick Skill,QS,,_bmad/skf/workflows/skillforge/quick-skill/workflow.md,skf_quick_skill,false,ferris,Create Mode,"Fast skill from a package name or GitHub URL — no brief needed",skills_output_folder,SKILL.md,
7
+ skf,anytime,Stack Skill,SS,,_bmad/skf/workflows/skillforge/create-stack-skill/workflow.md,skf_create_stack_skill,false,ferris,Create Mode,"Consolidated project stack skill with integration patterns",skills_output_folder,SKILL.md,
8
+ skf,anytime,Update Skill,US,,_bmad/skf/workflows/skillforge/update-skill/workflow.md,skf_update_skill,false,ferris,Create Mode,"Smart regeneration preserving [MANUAL] sections after source changes",skills_output_folder,SKILL.md,
9
+ skf,anytime,Audit Skill,AS,,_bmad/skf/workflows/skillforge/audit-skill/workflow.md,skf_audit_skill,false,ferris,Create Mode,"Drift detection between skill and current source code",,"drift report",
10
+ skf,anytime,Test Skill,TS,,_bmad/skf/workflows/skillforge/test-skill/workflow.md,skf_test_skill,false,ferris,Create Mode,"Cognitive completeness verification — quality gate before export",,"completeness score",
11
+ skf,anytime,Export Skill,EX,,_bmad/skf/workflows/skillforge/export-skill/workflow.md,skf_export_skill,false,ferris,Create Mode,"Package for distribution and inject context into CLAUDE.md/AGENTS.md",skills_output_folder,"agentskills.io package",
12
+ skf,anytime,Knowledge Index,KI,,_bmad/skf/knowledge/skf-knowledge-index.csv,skf_knowledge_index,false,ferris,Reference,"Cross-cutting principles and patterns — JiT loaded by workflows via index lookup",,"knowledge fragments",
@@ -0,0 +1,22 @@
1
+ code: skf
2
+ name: "SKF: Skill Forge — Evidence-Based Agent Skills Compiler"
3
+ header: "Automated skill compiler — AST-verified, provenance-backed agent skills from code repositories, documentation, and developer discourse"
4
+ subheader: "Zero hallucination tolerance. Every instruction traces to code."
5
+ description: "Skill Forge transforms code repositories, documentation, and developer discourse into agentskills.io-compliant, version-pinned, provenance-backed agent skills. Uses ast-grep for structural truth, QMD for knowledge intelligence, and a progressive capability model (Quick/Forge/Deep). Standalone module — no other modules required. Recommended alongside BMM for full development workflow integration."
6
+ default_selected: false
7
+
8
+ skills_output_folder:
9
+ prompt: "Where should generated skills be saved?"
10
+ default: "skills"
11
+ result: "{project-root}/{value}"
12
+
13
+ forge_data_folder:
14
+ prompt: "Where should forge workspace artifacts be stored?"
15
+ default: "forge-data"
16
+ result: "{project-root}/{value}"
17
+
18
+ # Variables from Core Config inserted:
19
+ ## user_name
20
+ ## communication_language
21
+ ## document_output_language
22
+ ## output_folder
@@ -0,0 +1,148 @@
1
+ # SKF Workflows
2
+
3
+ Ten workflows covering the full skill compilation lifecycle — from source discovery through verified export.
4
+
5
+ All workflows are triggered via Ferris (`@Ferris <code>`) and execute as step-by-step sequences with just-in-time step loading.
6
+
7
+ ## Workflow Index
8
+
9
+ | Code | Workflow | Steps | Mode | Purpose |
10
+ | --- | --- | --- | --- | --- |
11
+ | SF | [setup-forge](setup-forge/workflow.md) | 4 | Architect | Initialize environment, detect tools, set capability tier |
12
+ | AN | [analyze-source](analyze-source/workflow.md) | 7 | Architect | Discover skillable units in a repo, produce recommended briefs |
13
+ | BS | [brief-skill](brief-skill/workflow.md) | 5 | Architect | Design a skill scope through guided discovery |
14
+ | CS | [create-skill](create-skill/workflow.md) | 8 | Surgeon | Compile a skill from brief with provenance (supports --batch) |
15
+ | QS | [quick-skill](quick-skill/workflow.md) | 6 | Surgeon | Fast skill from package name or GitHub URL — no brief needed |
16
+ | SS | [create-stack-skill](create-stack-skill/workflow.md) | 9 | Surgeon | Consolidated project stack skill with integration patterns |
17
+ | US | [update-skill](update-skill/workflow.md) | 7 | Surgeon | Regenerate after source changes, preserving \[MANUAL\] sections |
18
+ | AS | [audit-skill](audit-skill/workflow.md) | 6 | Audit | Drift detection between skill and current source code |
19
+ | TS | [test-skill](test-skill/workflow.md) | 6 | Audit | Cognitive completeness verification — quality gate before export |
20
+ | EX | [export-skill](export-skill/workflow.md) | 6 | Delivery | Package for distribution, inject into CLAUDE.md/AGENTS.md |
21
+
22
+ ## Typical Flows
23
+
24
+ **First-time setup:**
25
+
26
+ ```
27
+ SF → AN → CS (batch) → TS → EX
28
+ ```
29
+
30
+ **Single skill (full quality):**
31
+
32
+ ```
33
+ SF → BS → CS → TS → EX
34
+ ```
35
+
36
+ **Single skill (fast):**
37
+
38
+ ```
39
+ SF → QS → EX
40
+ ```
41
+
42
+ **Maintenance:**
43
+
44
+ ```
45
+ AS → US → TS → EX
46
+ ```
47
+
48
+ ## Knowledge vs. Data
49
+
50
+ The module uses two kinds of reference material, loaded just-in-time during workflow execution:
51
+
52
+ | Aspect | Knowledge (`knowledge/`) | Data (`{workflow}/data/`) |
53
+ | --- | --- | --- |
54
+ | Scope | Cross-cutting, multi-workflow | Single workflow, single step |
55
+ | Content | Principles, patterns, judgment rules | Schemas, templates, scoring formulas |
56
+ | Index | `skf-knowledge-index.csv` | Referenced directly by step files |
57
+ | Examples | zero-hallucination, confidence-tiers | skill-brief-schema.md, scoring-rules.md |
58
+
59
+ **Knowledge files** live in `src/knowledge/` and capture principles Ferris applies across multiple workflows — zero hallucination, confidence tiers, provenance tracking, \[MANUAL\] preservation. Workflow steps reference these when they need cross-cutting judgment, not step-specific rules.
60
+
61
+ **Data files** live in each workflow's `data/` directory and contain operational artifacts tightly coupled to specific steps — schemas, templates, scoring formulas, extraction patterns.
62
+
63
+ Neither duplicates the other. Knowledge files reference (not repeat) data files where the detailed operational rules live.
64
+
65
+ ## Directory Structure
66
+
67
+ Each workflow follows a consistent structure:
68
+
69
+ ```
70
+ {workflow}/
71
+ ├── workflow.md # Entry point — goals, mode routing, step sequence
72
+ ├── steps-c/ # Create-mode steps (sequential execution)
73
+ │ ├── step-01-*.md
74
+ │ ├── step-02-*.md
75
+ │ └── ...
76
+ ├── data/ # Reference data — schemas, rules, patterns
77
+ │ └── *.md
78
+ ├── templates/ # Output skeletons (only analyze-source, test-skill)
79
+ │ └── *-template.md
80
+ ├── workflow-plan-*.md # Design plan (build artifact)
81
+ └── validation-report.md # BMAD validation results (build artifact)
82
+ ```
83
+
84
+ ### Step Loading
85
+
86
+ Steps execute sequentially via just-in-time loading. Only the current step is in context. Each step explicitly names the next step file. Data and template files are loaded on demand by the steps that need them.
87
+
88
+ ## Workflow Details
89
+
90
+ ### setup-forge (SF)
91
+
92
+ **4 steps** | **Data:** tier-rules.md
93
+
94
+ Detects available tools (ast-grep, gh, QMD), determines the capability tier (Quick/Forge/Deep), writes `forge-tier.yaml` to the sidecar, and optionally indexes the project. Run this first — all other workflows adapt behavior to the detected tier.
95
+
96
+ ### analyze-source (AN)
97
+
98
+ **7 steps** | **Data:** skill-brief-schema.md, unit-detection-heuristics.md | **Templates:** analysis-report-template.md
99
+
100
+ Brownfield onboarding entry point. Scans project structure, identifies skillable units using confidence-tiered heuristic signals, maps exports and integration points, presents recommendations for user confirmation, then generates `skill-brief.yaml` files ready for `create-skill --batch`.
101
+
102
+ ### brief-skill (BS)
103
+
104
+ **5 steps** | **Data:** skill-brief-schema.md
105
+
106
+ Interactive guided discovery. Gathers user intent (target repo, language, what to skill), analyzes the target to understand boundaries, walks through scope definition with the user, confirms the brief, then writes a validated `skill-brief.yaml`.
107
+
108
+ ### create-skill (CS)
109
+
110
+ **8 steps** | **Data:** extraction-patterns.md, skill-sections.md
111
+
112
+ The core compilation engine. Loads a brief, checks ecosystem context, extracts source with AST-backed provenance (T1 confidence when ast-grep available), enriches with usage patterns, compiles into agentskills.io-compliant sections, validates structural integrity, generates the `SKILL.md` artifact, and produces an evidence report. Supports `--batch` for processing multiple briefs.
113
+
114
+ ### quick-skill (QS)
115
+
116
+ **6 steps** | **Data:** registry-resolution.md, skill-template.md
117
+
118
+ Fastest path to a skill. Accepts a GitHub URL or package name, resolves to source via registry lookup, performs ecosystem check, extracts public API surface without requiring a brief, compiles best-effort `SKILL.md`, validates, and writes output.
119
+
120
+ ### create-stack-skill (SS)
121
+
122
+ **9 steps** | **Data:** integration-patterns.md, manifest-patterns.md, stack-skill-template.md
123
+
124
+ Analyzes dependency manifests (package.json, requirements.txt, Cargo.toml, etc.) to detect libraries, ranks by import frequency, discovers co-import integration patterns between libraries, compiles a consolidated stack skill documenting how libraries connect, validates, and generates output.
125
+
126
+ ### update-skill (US)
127
+
128
+ **7 steps** | **Data:** manual-section-rules.md, merge-conflict-rules.md
129
+
130
+ Surgical update engine. Loads the existing skill, detects what changed in source since last compilation, re-extracts only affected exports with fresh provenance, merges new extractions while preserving all `[MANUAL]` developer-authored content, validates the merged result, writes the updated skill, and produces a change report.
131
+
132
+ ### audit-skill (AS)
133
+
134
+ **6 steps** | **Data:** drift-report-template.md, severity-rules.md
135
+
136
+ Drift detection engine. Loads the skill under audit, re-indexes current source to build a fresh reference, performs structural diff (signature changes, missing exports), performs semantic diff (behavioral divergence), classifies each finding by severity using defined rules, and produces a graded drift report.
137
+
138
+ ### test-skill (TS)
139
+
140
+ **6 steps** | **Data:** output-section-formats.md, scoring-rules.md | **Templates:** test-report-template.md
141
+
142
+ Quality gate before export. Loads the skill, detects test mode (naive for Quick tier, contextual for Forge/Deep), runs coverage checks against source, runs coherence checks for internal consistency, scores using weighted rubric, and produces a completeness report with pass/fail gate decision.
143
+
144
+ ### export-skill (EX)
145
+
146
+ **6 steps** | **Data:** managed-section-format.md, snippet-format.md
147
+
148
+ Distribution packaging. Loads the completed skill, packages as agentskills.io-compliant bundle, generates context snippets optimized for token efficiency, updates managed sections in `CLAUDE.md` / `AGENTS.md` with platform-aware injection, produces a token budget report, and summarizes the export.
@@ -0,0 +1,75 @@
1
+ # Skill Brief Schema
2
+
3
+ ## Purpose
4
+
5
+ Defines the output contract for skill-brief.yaml files generated by analyze-source. Each generated brief must conform to this schema to be consumable by brief-skill and create-skill downstream workflows.
6
+
7
+ ## Required Fields (9)
8
+
9
+ | Field | Type | Constraint | Description |
10
+ |-------|------|------------|-------------|
11
+ | name | string | kebab-case `[a-z0-9-]+` | Unique skill identifier |
12
+ | version | string | Semantic `X.Y.Z` | Defaults to `1.0.0` |
13
+ | source_repo | string | GitHub URL or local path | Repository or project root |
14
+ | language | string | Recognized language | Primary programming language |
15
+ | scope | object | See Scope Object below | Boundary definition |
16
+ | description | string | 1-3 sentences | What the skill covers |
17
+ | forge_tier | string | `quick` / `forge` / `deep` | Inherited from forge-tier.yaml |
18
+ | created | string | ISO date `YYYY-MM-DD` | Generation date |
19
+ | created_by | string | user_name from config | Who generated the brief |
20
+
21
+ ## Scope Object
22
+
23
+ ```yaml
24
+ scope:
25
+ type: full-library | specific-modules | public-api
26
+ include:
27
+ - 'src/**/*.ts' # At least one required
28
+ exclude:
29
+ - 'src/**/*.test.ts' # Optional
30
+ notes: 'Optional rationale for scope decision'
31
+ ```
32
+
33
+ ### Scope Types
34
+
35
+ | Type | Use When |
36
+ |------|----------|
37
+ | full-library | Entire codebase of a unit |
38
+ | specific-modules | Selected components or packages |
39
+ | public-api | Only exported interfaces |
40
+
41
+ ## YAML Template
42
+
43
+ ```yaml
44
+ name: '{unit-name}'
45
+ version: '1.0.0'
46
+ source_repo: '{project_path}'
47
+ language: '{detected_language}'
48
+ scope:
49
+ type: '{detected_scope_type}'
50
+ include:
51
+ - '{include_pattern}'
52
+ exclude:
53
+ - '{exclude_pattern}'
54
+ notes: '{scope_rationale}'
55
+ description: '{1-3 sentence description}'
56
+ forge_tier: '{forge_tier}'
57
+ created: '{current_date}'
58
+ created_by: '{user_name}'
59
+ ```
60
+
61
+ ## Validation Rules
62
+
63
+ 1. **Name uniqueness**: No duplicate names within forge_data_folder
64
+ 2. **Source accessibility**: source_repo path must exist or be reachable
65
+ 3. **Language recognized**: Must be a known programming language
66
+ 4. **Scope type valid**: Must match one of the three defined types
67
+ 5. **Include patterns**: At least one include glob pattern required
68
+ 6. **Forge tier match**: Must match value in forge-tier.yaml
69
+
70
+ ## Output Location
71
+
72
+ Each skill-brief.yaml is written to:
73
+ ```
74
+ {forge_data_folder}/{unit-name}/skill-brief.yaml
75
+ ```
@@ -0,0 +1,88 @@
1
+ # Unit Detection Heuristics
2
+
3
+ ## Purpose
4
+
5
+ Rules for identifying discrete skillable units within a project. A "skillable unit" is a self-contained component with clear boundaries that can be documented as an independent skill.
6
+
7
+ ## Detection Signals
8
+
9
+ ### Strong Signals (High Confidence)
10
+
11
+ | Signal | Description | Example |
12
+ |--------|-------------|---------|
13
+ | Independent package.json / Cargo.toml / go.mod | Unit has its own dependency manifest | `packages/auth/package.json` |
14
+ | Separate entry point | Unit has a main/index file | `services/api/src/index.ts` |
15
+ | Docker/service definition | Unit runs as an independent service | `docker-compose.yml` service entry |
16
+ | Distinct export surface | Unit exports a public API consumed by others | `src/lib/index.ts` with re-exports |
17
+ | Workspace member | Listed in root workspace configuration | `pnpm-workspace.yaml` packages |
18
+
19
+ ### Moderate Signals (Medium Confidence)
20
+
21
+ | Signal | Description | Example |
22
+ |--------|-------------|---------|
23
+ | Directory depth boundary | Top-level directory with self-contained structure | `src/modules/payments/` |
24
+ | Naming convention | Follows organizational naming pattern | `@org/package-name` |
25
+ | Separate test suite | Has its own test directory or config | `packages/auth/__tests__/` |
26
+ | README.md presence | Has documentation at directory level | `libs/utils/README.md` |
27
+ | CI/CD pipeline reference | Referenced in build/deploy configuration | `.github/workflows/deploy-auth.yml` |
28
+
29
+ ### Weak Signals (Low Confidence — Require Corroboration)
30
+
31
+ | Signal | Description | Example |
32
+ |--------|-------------|---------|
33
+ | Large directory | Many files in a subtree | 50+ files under one directory |
34
+ | Comment boundaries | Code comments marking sections | `// --- Auth Module ---` |
35
+ | Import clustering | Files that import primarily from each other | Tight import graph cluster |
36
+
37
+ ## Boundary Classification
38
+
39
+ ### Service Boundary
40
+ - Independent deployable unit
41
+ - Own process, port, or container
42
+ - Clear network interface (REST, gRPC, message queue)
43
+ - Scope type: `full-library`
44
+
45
+ ### Package Boundary
46
+ - Workspace member or independently versioned package
47
+ - Own dependency manifest
48
+ - Exports consumed by other packages
49
+ - Scope type: `full-library` or `specific-modules`
50
+
51
+ ### Module Boundary
52
+ - Logical grouping within a single package
53
+ - Shared namespace or directory structure
54
+ - Internal cohesion, external coupling through defined interface
55
+ - Scope type: `specific-modules` or `public-api`
56
+
57
+ ### Library Boundary
58
+ - Third-party dependency with significant project-specific usage patterns
59
+ - Custom wrappers, configurations, or integration code
60
+ - Scope type: `public-api`
61
+
62
+ ## Disqualification Rules
63
+
64
+ Do NOT recommend as a skillable unit if:
65
+
66
+ 1. **Too small**: Fewer than 3 source files or 100 lines of code
67
+ 2. **Generated code**: Auto-generated files (protobuf, GraphQL codegen, etc.)
68
+ 3. **Pure configuration**: Only config files with no logic
69
+ 4. **Test-only**: Test utilities with no production code
70
+ 5. **Vendor/dependency**: Third-party code copied into project
71
+ 6. **Already skilled**: Existing skill found in forge_data_folder (recommend update-skill instead)
72
+
73
+ ## Stack Skill Candidate Detection
74
+
75
+ Flag units as stack skill candidates when:
76
+
77
+ 1. **Co-import frequency**: Two or more units are imported together in 3+ files
78
+ 2. **Integration adapter**: A unit exists primarily to bridge two other units
79
+ 3. **Shared state**: Multiple units read/write to the same data store
80
+ 4. **Orchestration layer**: A unit coordinates calls across multiple other units
81
+
82
+ ## Tier-Aware Scanning Depth
83
+
84
+ | Forge Tier | Scanning Approach |
85
+ |------------|-------------------|
86
+ | Quick | File structure analysis: directory trees, manifest files, entry points, naming conventions |
87
+ | Forge | AST analysis: export surfaces, import graphs, dependency trees, type hierarchies |
88
+ | Deep | AST + QMD: temporal evolution, refactoring patterns, semantic relationships, architectural drift |
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: 'step-01-init'
3
+ description: 'Initialize analysis workflow — load config, detect continuation, accept project path, check existing skills, create report'
4
+
5
+ nextStepFile: './step-02-scan-project.md'
6
+ continueFile: './step-01b-continue.md'
7
+ outputFile: '{output_folder}/analyze-source-report-{project_name}.md'
8
+ templateFile: '../templates/analysis-report-template.md'
9
+ ---
10
+
11
+ # Step 1: Initialize Analysis
12
+
13
+ ## STEP GOAL:
14
+
15
+ To initialize the analyze-source workflow by loading configuration, detecting continuation state, accepting the target project path, checking for existing skills, and creating the analysis report document.
16
+
17
+ ## MANDATORY EXECUTION RULES (READ FIRST):
18
+
19
+ ### Universal Rules:
20
+
21
+ - 🛑 NEVER generate content without user input
22
+ - 📖 CRITICAL: Read the complete step file before taking any action
23
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
24
+ - 📋 YOU ARE A FACILITATOR, not a content generator
25
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
26
+ - ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
27
+
28
+ ### Role Reinforcement:
29
+
30
+ - ✅ You are a source code analyst and decomposition architect (Ferris Architect mode)
31
+ - ✅ If you already have been given a name, communication_style and identity, continue to use those while playing this new role
32
+ - ✅ Prescriptive precision — zero-hallucination, only report what is found
33
+ - ✅ File:line citation tracing for all claims
34
+
35
+ ### Step-Specific Rules:
36
+
37
+ - 🎯 Focus only on initialization — do NOT begin scanning or analysis
38
+ - 🚫 FORBIDDEN to analyze source code in this step
39
+ - 💬 Collect project path and scope hints from user
40
+ - 📋 Verify prerequisites before proceeding
41
+
42
+ ## EXECUTION PROTOCOLS:
43
+
44
+ - 🎯 Follow the MANDATORY SEQUENCE exactly
45
+ - 💾 Create output document from template when initialization complete
46
+ - 📖 Update output frontmatter with initialization data
47
+ - 🚫 FORBIDDEN to proceed without valid project path and forge-tier.yaml
48
+
49
+ ## CONTEXT BOUNDARIES:
50
+
51
+ - Available: SKF module config (loaded by workflow.md), forge_data_folder, skills_output_folder, forge_tier
52
+ - Focus: Setup and validation only — no analysis
53
+ - Limits: Do not read source files beyond checking prerequisites
54
+ - Dependencies: setup-forge must have been run (forge-tier.yaml must exist)
55
+
56
+ ## MANDATORY SEQUENCE
57
+
58
+ **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
59
+
60
+ ### 1. Check for Existing Report (Continuation Detection)
61
+
62
+ Look for {outputFile}.
63
+
64
+ **IF the file exists AND has `stepsCompleted` with entries:**
65
+ - "**Found an existing analysis report. Resuming previous session...**"
66
+ - Load, read entirely, then execute {continueFile}
67
+ - **STOP HERE** — do not continue this sequence
68
+
69
+ **IF the file does not exist OR stepsCompleted is empty:**
70
+ - Continue to section 2
71
+
72
+ ### 2. Verify Prerequisites
73
+
74
+ **Check forge-tier.yaml:**
75
+ - Look for `{forge_data_folder}/forge-tier.yaml`
76
+ - **IF missing:** HARD HALT — "**Cannot proceed.** forge-tier.yaml not found at `{forge_data_folder}/forge-tier.yaml`. Please run the setup-forge workflow first to configure your forge tier (Quick/Forge/Deep)."
77
+ - **IF found:** Read and note the forge tier value
78
+
79
+ "**Forge tier detected:** {tier} — analysis depth will be calibrated accordingly."
80
+
81
+ ### 3. Collect Project Path
82
+
83
+ "**Welcome to Analyze Source — the SKF decomposition engine.**
84
+
85
+ I'll analyze your project to identify discrete skillable units and produce skill-brief.yaml files for each recommended unit.
86
+
87
+ **Please provide the project root path to analyze:**
88
+
89
+ This should be the root directory of the repo or multi-service project you want to decompose."
90
+
91
+ Wait for user input.
92
+
93
+ **Validate the path:**
94
+ - Check that the path exists and contains source files
95
+ - **IF invalid:** "That path doesn't appear to be a valid project directory. Please provide the correct path."
96
+
97
+ ### 4. Collect Optional Scope Hints
98
+
99
+ "**Optional: Do you have scope hints to narrow the analysis?**
100
+
101
+ For example:
102
+ - Specific packages to focus on (e.g., `packages/auth`, `services/api`)
103
+ - Directories to exclude (e.g., `vendor/`, `node_modules/`, `dist/`)
104
+
105
+ Enter scope hints, or press Enter to analyze the entire project."
106
+
107
+ Wait for user input. Document any hints provided.
108
+
109
+ ### 5. Check for Existing Skills
110
+
111
+ Scan `{forge_data_folder}/` for existing `skill-brief.yaml` files.
112
+
113
+ **IF existing skills found:**
114
+ "**Existing skills detected:**
115
+ {list each existing skill name and path}
116
+
117
+ These units will be flagged as 'already skilled' during analysis. If source changes are detected, I'll recommend running update-skill instead of generating new briefs."
118
+
119
+ **IF no existing skills found:**
120
+ "**No existing skills found.** All identified units will be treated as new."
121
+
122
+ ### 6. Create Analysis Report
123
+
124
+ Create {outputFile} from {templateFile}.
125
+
126
+ **Populate frontmatter:**
127
+ ```yaml
128
+ stepsCompleted: ['step-01-init']
129
+ lastStep: 'step-01-init'
130
+ lastContinued: ''
131
+ date: '{current_date}'
132
+ user_name: '{user_name}'
133
+ project_name: '{project_name}'
134
+ project_path: '{provided_project_path}'
135
+ forge_tier: '{detected_tier}'
136
+ existing_skills: [{list of existing skill names}]
137
+ confirmed_units: []
138
+ stack_skill_candidates: []
139
+ nextWorkflow: ''
140
+ ```
141
+
142
+ "**Initialization complete.**
143
+
144
+ **Project:** {project_path}
145
+ **Forge Tier:** {forge_tier}
146
+ **Existing Skills:** {count}
147
+ **Scope Hints:** {hints or 'None — full project analysis'}
148
+
149
+ **Proceeding to project scan...**"
150
+
151
+ ### 7. Proceed to Next Step
152
+
153
+ Display: "**Proceeding to project scan...**"
154
+
155
+ #### Menu Handling Logic:
156
+
157
+ - After initialization is complete and report is created, immediately load, read entire file, then execute {nextStepFile}
158
+
159
+ #### EXECUTION RULES:
160
+
161
+ - This is an auto-proceed initialization step with no user choices at this point
162
+ - Proceed directly to next step after setup
163
+
164
+ ## CRITICAL STEP COMPLETION NOTE
165
+
166
+ ONLY WHEN the output report has been created with populated frontmatter (project_path, forge_tier, existing_skills) will you load and read fully {nextStepFile} to execute and begin the project scan.
167
+
168
+ ---
169
+
170
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
171
+
172
+ ### ✅ SUCCESS:
173
+
174
+ - Continuation detection performed correctly
175
+ - forge-tier.yaml verified present and tier noted
176
+ - Valid project path collected from user
177
+ - Optional scope hints collected
178
+ - Existing skills scanned and documented
179
+ - Analysis report created from template with populated frontmatter
180
+ - Auto-proceeded to step 02
181
+
182
+ ### ❌ SYSTEM FAILURE:
183
+
184
+ - Skipping forge-tier.yaml check
185
+ - Accepting an invalid project path
186
+ - Not checking for existing skills
187
+ - Not creating the output report before proceeding
188
+ - Beginning source analysis in this step
189
+ - Hardcoded paths instead of using frontmatter variables
190
+
191
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.