Skip to content
πŸ€– Consolidated, AI-optimized SKF docs: llms-full.txt. Fetch this plain text file for complete context.

Architecture

Skill Forge runs entirely inside the LLM context window through structured instructions. There is no external orchestrator β€” just an agent persona (Ferris), a set of workflows, and a curated knowledge base. This page covers the machinery. For an end-to-end walkthrough, see How It Works. For what a skill contains, see Skill Model.


BMAD tackles complex, open-ended work by decomposing it into repeatable workflows. Every workflow is a sequence of small, explicit steps, so the AI takes the same route on every run. A shared knowledge base of standards and patterns backs those steps, keeping outputs consistent instead of improvised. The formula is simple: structured steps + shared standards = reliable results.

SKF plugs into BMAD the same way a specialist plugs into a team. It uses the same step-by-step workflow engine and shared standards, but focuses exclusively on skill compilation and quality assurance.


Each workflow directory contains these files, and each has a specific job:

FileWhat it doesWhen it loads
SKILL.mdHuman-readable entry point β€” goals, role definition, initialization sequence, invocation contract, routes to first stepEntry point per workflow
steps-c/*.mdCreate steps β€” primary execution, 4–10 sequential files per workflow (the last one always chains to the shared health check)One at a time (just-in-time)
references/*.mdWorkflow-specific reference data β€” rules, patterns, protocolsRead by steps on demand
assets/*.mdWorkflow-specific output formats β€” schemas, templates, heuristicsRead by steps on demand
templates/*.mdOutput skeletons with placeholder vars β€” steps fill these in to produce the final artifactRead by steps when generating output
scripts/*.pyDeterministic Python scripts β€” scoring, validation, structural diffing, manifest operationsInvoked by steps via uv run for reproducible computation

Module-level shared files (not per-workflow β€” loaded by the agent or referenced across workflows):

FileWhat it doesWhen it loads
skf-forger/SKILL.mdExpert persona β€” identity, principles, critical actions, menu of triggersFirst β€” always in context
knowledge/skf-knowledge-index.csvKnowledge fragment index β€” id, name, tags, tier, file pathRead by steps to decide which fragments to load
knowledge/*.md14 reusable fragments + overview.md index β€” cross-cutting principles and patterns (e.g., zero-hallucination.md, confidence-tiers.md, ccc-bridge.md)Selectively read into context when a step directs
shared/scripts/*.py7 cross-workflow Python scripts β€” preflight checks, manifest ops, managed-section rebuilds, frontmatter validation, severity classification, structural diffing, skill inventoryInvoked by any workflow that needs deterministic computation
flowchart LR
  U[User] --> A[Agent Persona]
  A --> W[Workflow Entry: SKILL.md]
  W --> S[Step Files: steps-c/]
  S --> K[Knowledge Fragments<br/>skf-knowledge-index.csv β†’ knowledge/*.md]
  S --> D[References & Assets<br/>references/*.md, assets/*.md, templates/*.md]
  S --> P[Scripts<br/>scripts/*.py, shared/scripts/*.py]
  S --> O[Outputs: skills/, forge-data/, sidecar<br/>when a step writes output]
  1. Trigger β€” User types @Ferris CS (or fuzzy match like create-skill). The agent menu in skf-forger/SKILL.md maps the trigger to the workflow path.
  2. Agent loads β€” skf-forger/SKILL.md injects the persona (identity, principles, critical actions) into the context window. Sidecar files (forge-tier.yaml, preferences.yaml) are loaded for persistent state.
  3. Workflow loads β€” SKILL.md presents the mode choice and routes to the first step file.
  4. Step-by-step execution β€” Only the current step file is in context (just-in-time loading). Each step explicitly names the next one. The LLM reads, executes, saves output, then loads the next step. No future steps are ever preloaded.
  5. Sub-agent delegation β€” When a step needs to process large files (full SKILL.md documents, multiple references/*.md files, parallel per-library extraction), it spawns sub-agents via the Agent tool instead of loading the content into the parent context. Each sub-agent receives a file path, extracts a compact JSON summary, and returns it. Up to 8 sub-agents run concurrently. The parent collects JSON summaries without ever loading the full source β€” context isolation by design, preventing one step’s data from bloating the window for the next. Used in TS (coverage check), RA (gap analysis), VS (integration verification), AS (structural diff), and SS (parallel extraction).
  6. Knowledge injection β€” Steps consult skf-knowledge-index.csv and selectively load fragments from knowledge/ by tags and relevance. Cross-cutting principles (zero hallucination, confidence tiers, provenance) are loaded only when a step directs β€” not preloaded.
  7. Reference and asset injection β€” Steps read references/*.md and assets/*.md files as needed (rules, patterns, schemas, heuristics). This is deliberate context engineering: only the data relevant to the current step enters the context window.
  8. Script execution β€” Steps invoke deterministic Python scripts (scripts/*.py, shared/scripts/*.py) via uv run for computation that must be reproducible: scoring, structural diffing, manifest operations, frontmatter validation. The LLM prepares inputs, the script computes, the LLM uses the output. Same inputs always produce the same result.
  9. Templates β€” When a step produces output (e.g., a skill brief or test report), it reads the template file and fills in placeholders with computed results. The template provides consistent structure; the step provides the content.
  10. Progress tracking β€” Each step appends to an output file with state tracking. Resume mode reads this state and routes to the next incomplete step.

Ferris operates in five workflow-driven modes (mode is determined by which workflow is running, not conversation state):

ModeWorkflowsBehavior
ArchitectSF, AN, BS, CS, QS, SS, RAExploratory, assembling, refining β€” discovers structure, scopes skills, and improves architecture
SurgeonUSPrecise, semantic diffing β€” preserves [MANUAL] sections during regeneration
AuditAS, TS, VSJudgmental, scoring β€” evaluates quality and detects drift
DeliveryEXValidates package, generates snippets, injects into context files
ManagementRS, DSTransactional rename/drop β€” copy-verify-delete with platform context rebuild

ToolWrapsPurpose
gh_bridgeGitHub CLI (gh)Source code access, issue mining, release tracking, PR intelligence
skill-checkthedaviddias/skill-checkValidation + auto-fix (check --fix), quality scoring (0-100), security scan, split-body, diff comparison
tessltesslContent quality review, actionability scoring, progressive disclosure evaluation, AI judge with suggestions
ast_bridgeast-grep CLIStructural extraction, custom AST queries, co-import detection
ccc_bridgecocoindex-codeSemantic code search, project indexing, file discovery pre-ranking
qmd_bridgeQMD (local search)BM25 keyword search, vector semantic search, collection indexing
doc_fetcherEnvironment web toolsRemote documentation fetching for T3-confidence content. Tool-agnostic β€” uses whatever web fetching is available (Firecrawl, WebFetch, curl, etc.). Output quarantined as T3.

Bridge names are conceptual interfaces used throughout workflow steps. Each bridge resolves to concrete MCP tools, CLI commands, or fallback behavior depending on the IDE environment. See src/knowledge/tool-resolution.md for the complete resolution table.

When tools disagree, higher priority wins for instructions. Lower priority is preserved as annotations:

PrioritySourceTool
1 (highest)AST extractionast_bridge
1bCCC discovery (pre-ranking)ccc_bridge
2QMD evidenceqmd_bridge
3Source reading (non-AST)gh_bridge
4External documentationdoc_fetcher

Stack skill workflows detect project dependencies by scanning for manifest files. This isn’t a tool β€” it’s a reference pattern (skf-create-stack-skill/references/manifest-patterns.md) consulted by workflow steps:

EcosystemManifest Files
JavaScript / TypeScriptpackage.json
Pythonrequirements.txt, setup.py, pyproject.toml, Pipfile
RustCargo.toml
Gogo.mod
Javapom.xml, build.gradle
RubyGemfile
PHPcomposer.json
.NET*.csproj

Detection runs at depth 0-1 from project root, excluding dependency trees (node_modules/, .venv/, vendor/), build output (dist/, target/, __pycache__/), and VCS directories.


Build artifacts are committable β€” another developer can reproduce the same skill:

forge-data/{skill-name}/
β”œβ”€β”€ skill-brief.yaml # Compilation config (version-independent)
└── {version}/
β”œβ”€β”€ provenance-map.json # Source map with AST bindings
β”œβ”€β”€ evidence-report.md # Build audit trail
└── extraction-rules.yaml # Language-specific ast-grep schema

The provenance-map.json includes per-export entries with a source_library field identifying which library each export belongs to. For stack skills, it also includes an integrations array (cross-library patterns) and a constituents array (compose-mode only β€” tracks the compose-time snapshot of each source skill for staleness detection via metadata hash comparison). The file_entries array handles script/asset file-level provenance (SHA-256 hashes, source paths).

Pipeline-facing workflows write a machine-readable result JSON file alongside their human-readable output. This enables reliable CI integration and pipeline chaining β€” downstream workflows or scripts can verify what the prior step produced without parsing markdown. Each run writes two files: a timestamped per-run record ({skill-name}-result-{YYYYMMDD-HHmmss}.json) that preserves the full audit trail across retries and aborts, and a stable {skill-name}-result-latest.json copy that pipeline consumers read without enumerating timestamps. The schema follows a consistent format: skill, status (success/failed/partial), timestamp, outputs (array of produced artifacts with type and path), and a skill-specific summary object.

skills/ and forge-data/ are committed. Agent memory (_bmad/_memory/forger-sidecar/) is gitignored.


SKF relies on a curated skill compilation knowledge base:

Workflows load only the fragments required for the current task to stay focused and compliant.


src/
β”œβ”€β”€ skf-forger/ # Agent skill (SKILL.md + manifest)
β”œβ”€β”€ skf-setup/ # Setup skill (forge initialization)
β”œβ”€β”€ skf-analyze-source/
β”œβ”€β”€ skf-brief-skill/
β”œβ”€β”€ skf-create-skill/
β”œβ”€β”€ skf-quick-skill/
β”œβ”€β”€ skf-create-stack-skill/
β”œβ”€β”€ skf-verify-stack/
β”œβ”€β”€ skf-refine-architecture/
β”œβ”€β”€ skf-update-skill/
β”œβ”€β”€ skf-audit-skill/
β”œβ”€β”€ skf-test-skill/
β”œβ”€β”€ skf-export-skill/
β”œβ”€β”€ skf-rename-skill/
β”œβ”€β”€ skf-drop-skill/
β”œβ”€β”€ forger/
β”‚ β”œβ”€β”€ forge-tier.yaml
β”‚ β”œβ”€β”€ preferences.yaml
β”‚ └── README.md
β”œβ”€β”€ knowledge/
β”‚ β”œβ”€β”€ skf-knowledge-index.csv
β”‚ └── *.md (14 knowledge fragments + overview.md index)
β”œβ”€β”€ shared/ # Cross-workflow resources
β”œβ”€β”€ module.yaml # Module metadata (code, name, config vars)
└── module-help.csv # Skill menu for bmad-help integration

  • All tool wrappers use array-style subprocess execution β€” no shell interpolation
  • Input sanitization: allowlist characters for repo names, file paths, patterns
  • File paths validated against project root (no directory traversal)
  • Source code never leaves the machine. All processing is local (AST, QMD, validation).
  • doc_fetcher informs users which URLs will be fetched externally before processing

SKF produces skills compatible with the agentskills.io ecosystem:


DecisionRationale
Solo agent (Ferris), not multi-agentOne domain (skill compilation) doesn’t benefit from handoffs. Shared knowledge base (AST patterns, provenance maps) is the core asset.
Workflows drive modes, not conversationFerris doesn’t auto-switch based on question content. Invoke a workflow to change mode. Predictable behavior.
Hub-and-spoke cross-knowledgeEach skill covers one source repository. Stack skills compose cross-library integration patterns in references/integrations/, citing each library’s own skill.
Stack skill = compositionalSKILL.md is the integration layer. references/ contains per-library + integration pairs. Partial regeneration on dependency updates.
Snippet updates only at exportCreate/update write a draft context-snippet.md to skills/. Export regenerates the final context-snippet.md and publishes it to the platform context file (CLAUDE.md/AGENTS.md/.cursorrules). No managed-section updates in draft workflows.
Bundle spec, version-pin at releaseOffline-capable. SKF ships with a vendored agentskills.io spec pinned at release time; spec drift is a maintainer concern handled at SKF release, not a runtime concern for users.