$npx -y skills add armelhbobdad/bmad-module-skill-forge --skill skf-audit-skillDrift detection between skill and current source code. Use when the user requests to "audit a skill" or "audit skill" for drift.
| 1 | # Audit Skill |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Detects drift between an existing skill and its current source code, producing a severity-graded drift report with AST-backed findings and actionable remediation suggestions. Analysis depth adapts based on detected forge tier (Quick/Forge/Forge+/Deep) with graceful degradation. Stack skills are supported: code-mode stacks are audited per-library against their sources; compose-mode stacks check constituent freshness via metadata hash comparison. |
| 6 | |
| 7 | ## Conventions |
| 8 | |
| 9 | - Bare paths (e.g. `references/<name>.md`) resolve from the skill root. |
| 10 | - **Module-level path exception:** bare paths beginning with `knowledge/` or `shared/` resolve from the SKF module root (`{project-root}/_bmad/skf/` installed, `src/` in dev), not the skill root — stage files reference `knowledge/version-paths.md` and `knowledge/tool-resolution.md`, and the terminal step chains to `shared/health-check.md`. |
| 11 | - `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. |
| 12 | - `{skill-root}` resolves to this skill's installed directory (where `customize.toml` lives, if present). |
| 13 | - `{project-root}`-prefixed paths resolve from the project working directory. |
| 14 | - `{skill-name}` resolves to the skill directory's basename. |
| 15 | |
| 16 | ## Role |
| 17 | |
| 18 | You are a skill auditor in Ferris Audit mode: a deterministic drift-detection workflow where the source code is the ground truth and every finding traces back to it. |
| 19 | |
| 20 | ## Workflow Rules |
| 21 | |
| 22 | These rules apply to every step in this workflow: |
| 23 | |
| 24 | - Never fabricate findings — all data must trace to source code with file:line citations |
| 25 | - Only load one step file at a time — never preload future steps |
| 26 | - Update `stepsCompleted` in output file frontmatter before loading next step |
| 27 | - Always communicate in `{communication_language}` |
| 28 | - If `{headless_mode}` is true, auto-proceed through confirmation gates with their default action and log each auto-decision |
| 29 | |
| 30 | ## Stages |
| 31 | |
| 32 | | # | Step | File | Auto-proceed | |
| 33 | |---|------|------|--------------| |
| 34 | | 1 | Initialize & Baseline | references/init.md | No (confirm) | |
| 35 | | 2 | Re-Index Source | references/re-index.md | Yes | |
| 36 | | 3 | Structural Diff | references/structural-diff.md | Yes | |
| 37 | | 4 | Semantic Diff | references/semantic-diff.md | Yes (skip at non-Deep) | |
| 38 | | 5 | Severity Classification | references/severity-classify.md | Yes | |
| 39 | | 5a | Doc Drift | references/step-doc-drift.md | Yes | |
| 40 | | 6 | Report | references/report.md | Yes | |
| 41 | | 7 | Workflow Health Check | references/health-check.md | Yes | |
| 42 | |
| 43 | ## Invocation Contract |
| 44 | |
| 45 | | Aspect | Detail | |
| 46 | |--------|--------| |
| 47 | | **Inputs** | `skill_name` [required], `skill_path` [optional override — full path to skill directory; bypasses manifest/symlink resolution], `tier_override` [optional: Quick / Forge / Forge+ / Deep — overrides detected tier], `degraded` [optional bool — pre-confirm degraded-mode opt-in when no provenance map exists], `upstream_drift_choice` [optional: C / S / X — pre-supplied answer for the upstream-drift gate at init.md §5b], `dirty_worktree_choice` [optional: T / A / F — pre-supplied answer for the dirty-worktree sub-gate at init.md §5b], `force` [optional bool — when paired with `dirty_worktree_choice=F` or used for any future destructive-action gate, signals consent to skip the confirmation] | |
| 48 | | **Gates** | step 1: Manifest-vs-Symlink Gate [N] · Upstream-Drift Gate [C/S/X] · Dirty-Worktree Sub-Gate [T/A/F] · Degraded-Mode Gate [D/X] · Baseline Confirm Gate [C] | |
| 49 | | **Outputs** | `drift-report-{timestamp}.md` at `{forge_version}/` with `drift_score` and `nextWorkflow` frontmatter; per-run result contract at `{forge_version}/audit-skill-result-{timestamp}.json` plus `-latest.json` copy; final `SKF_AUDIT_RESULT_JSON` line on stdout when `{headless_mode}` is true | |
| 50 | | **Headless** | All gates auto-resolve with default action when `{headless_mode}` is true; pre-supplied inputs (`upstream_drift_choice`, `dirty_worktree_choice`, `degraded`, `tier_override`) consumed at the gates that would otherwise prompt | |
| 51 | | **Exit codes** | See "Exit Codes" below | |
| 52 | |
| 53 | ## Exit Codes |
| 54 | |
| 55 | Every hard halt in this workflow exits with a stable code so headless automators can branch on the failure class without grepping message text: |
| 56 | |
| 57 | | Code | Meaning | Raised by | |
| 58 | | ---- | -------------------- | ------------------------------------------------------------------------------------------------------------------ | |
| 59 | | 0 | success | step 7 (terminal health-check) | |
| 60 | | 2 | input-missing | step 1 §1 — no `skill_name` supplied in headless |