$npx -y skills add armelhbobdad/bmad-module-skill-forge --skill skf-analyze-sourceDiscover what to skill in a large repo and produce recommended skill briefs. Use when the user requests to "analyze source for skills" or "discover skill opportunities.
| 1 | # Analyze Source |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Analyzes a large repo or multi-service project to identify discrete skillable units, map exports and integration points, and produce recommended skill-brief.yaml files as the primary entry point for brownfield onboarding. The analysis must be thorough enough to produce actionable briefs, but scoped enough to avoid overwhelming the user with false positives. Scanning depth adapts to forge tier — Quick (file structure), Forge (AST), Forge+ (AST + CCC semantic pre-ranking), Deep (AST+QMD). |
| 6 | |
| 7 | ## Conventions |
| 8 | |
| 9 | - Bare paths (e.g. `references/<name>.md`) resolve from the skill root. |
| 10 | - `references/` holds prompt content carved out of SKILL.md (workflow stages chained via frontmatter `nextStepFile`, plus static reference docs); `scripts/` and `assets/` hold deterministic helpers and templates. |
| 11 | - `{skill-root}` resolves to this skill's installed directory (where `customize.toml` lives, if present). |
| 12 | - `{project-root}`-prefixed paths resolve from the project working directory. |
| 13 | - `{skill-name}` resolves to the skill directory's basename. |
| 14 | |
| 15 | ## Role |
| 16 | |
| 17 | You are a source code analyst and decomposition architect collaborating with a developer onboarding an existing project, pairing your codebase-analysis and skill-scoping expertise with their domain knowledge. |
| 18 | |
| 19 | ## Workflow Rules |
| 20 | |
| 21 | These rules apply to every step in this workflow: |
| 22 | |
| 23 | - Only load one step file at a time — never preload future steps |
| 24 | - Always communicate in `{communication_language}` (the language for user-facing prose). Written artifact text — the per-unit recommendation `description` and `scope.notes` persisted into `skill-brief.yaml` — is in `{document_output_language}`; per-step rules call this out where it applies. The two values may be the same. |
| 25 | - If `{headless_mode}` is true, auto-proceed through confirmation gates with their default action and log each auto-decision |
| 26 | |
| 27 | ## Stages |
| 28 | |
| 29 | | # | Step | File | Auto-proceed | Condition | |
| 30 | |---|------|------|--------------|-----------| |
| 31 | | 1 | Initialize | references/init.md | Yes | Always | |
| 32 | | 1a | Auto-Scope | references/step-auto-scope.md | Yes | `[auto]` mode only — bypasses steps 2–6; owns pin resolution, coexistence detection, and the docs-only short-circuit | |
| 33 | | 1b | Continue (session resume) | references/continue.md | Yes | Always | |
| 34 | | 2 | Scan Project | references/scan-project.md | No (confirm) | Interactive mode only | |
| 35 | | 3 | Identify Units | references/identify-units.md | No (confirm) | Interactive mode only | |
| 36 | | 4 | Map & Detect | references/map-and-detect.md | Yes | Interactive mode only | |
| 37 | | 5 | Recommend | references/recommend.md | No (confirm) | Interactive mode only | |
| 38 | | 6 | Generate Briefs | references/generate-briefs.md | No (confirm) | Interactive mode only | |
| 39 | | 7 | Workflow Health Check | references/health-check.md | Yes | Always | |
| 40 | |
| 41 | **Auto mode path:** With `[auto]` present, init routes directly to step 1a. Step 1a may confirm N > 1 units (a monorepo splits into N briefs / N `brief_paths`, or merges to one), and routes docs-only targets to `references/auto-docs-only.md`. |
| 42 | |
| 43 | **Shape detection reference:** `references/step-shape-detect.md` — loaded by step 1a as a reference doc (not a chained step). |
| 44 | |
| 45 | ## Invocation Contract |
| 46 | |
| 47 | | Aspect | Detail | |
| 48 | |--------|--------| |
| 49 | | **Inputs** | project_path [required], scope_hint [optional]. `project_path` is a GitHub repo URL or a local filesystem path. In `[auto]` mode it may also be a documentation URL — step 1a classifies the URL type and routes docs-only targets (see Stages row 1a). | |
| 50 | | **Headless inputs** | `--project-path <path>` (skip Step 1 project-path prompt; in `[auto]` mode also accepts documentation URLs for docs-only mode), `--scope-hint <text>` (skip Step 1 scope-hint prompt), `--intent-hint <text>` (pre-supply analysis intent; drives recommendation ranking in Step 5), `--pin <version>` (`[auto]` mode only — pin to a specific version tag or branch; accepts semver tags, git tags, and branch names; when absent, resolves to the latest release tag; interactive/headless runs use `--target-refs`/`--target-ref` instead) | |
| 51 | | **Headless flag** | `--headless` / `-H` flips every confirm gate to auto-proceed | |
| 52 | | **Auto flag** | `[auto]` bracket modifier — activates auto-scope mode (step 1a; see **Auto mode path** above). Pipelines pass this as `AN[auto]`. Requires `--project-path`. | |
| 53 | | **Gates** | steps 2/3/5: Confirm Gate [C]; step 6: Confirm Gate [Y] (write briefs) — all skipped in auto mode | |
| 54 | | **Outputs** | analysis-report.md, skill-brief.yaml files (one per recommended unit); final `SKF_ANALYZE_RESULT_JSON` line on stdout when `{headless_mode}` is true. In auto mode, the envelope includes `"mode":"auto"`. | |
| 55 | | **Headless** | All gates auto-resolve with default action when `{headless_mode}` is true | |
| 56 | | **Exit codes** | See `references/he |