skill-usage-audit

$npx mdskill add Fr-e-d/GAAI-framework/skill-usage-audit

Scans artefacts for Base Rule #2 compliance and generates an audit report

  • Identifies Epic and Story files for scanning based on file patterns.
  • Depends on frontmatter to check for `skills_invoked` field in artefacts.
  • Decides compliance by verifying the presence of `generate-epics` in `skills_invoked`. Fails if missing or incorrect.
  • Delivers an audit report with pass/fail status per artefact and overall compliance rate.

SKILL.md

.github/skills/skill-usage-auditView on GitHub ↗
---
name: skill-usage-audit
description: Scan all artefacts (epics, stories, PRDs) for Base Rule #2 compliance — verify that every artefact declares skills_invoked and related_decs in frontmatter. Produces an audit report with pass/fail per artefact and overall compliance rate.
license: ELv2
compatibility: Works with any filesystem-based AI coding agent
metadata:
  author: gaai-framework
  version: "1.0"
  category: cross
  track: governance
  id: SKILL-CRS-028
  updated_at: 2026-03-21
  status: stable
inputs:
  - contexts/artefacts/epics/*.epic.md
  - contexts/artefacts/stories/*.story.md
outputs:
  - skill_usage_audit_report (inline)
---

# Skill Usage Audit

## Purpose / When to Activate

Activate:
- Periodically (e.g., after a Discovery session) to verify governance compliance
- Before a release or milestone to audit artefact quality
- When trust in agent compliance needs verification
- On demand by the human (`/gaai-status` or direct invocation)

This skill enforces **Base Rule #2 (Skill-first)** by scanning artefacts for the `skills_invoked` attestation field. It detects artefacts that were produced from cached knowledge without reading the corresponding skill file.

---

## Process

1. **Scan all Epic files** at `contexts/artefacts/epics/*.epic.md` (exclude `_template.epic.md`):
   - Check frontmatter for `skills_invoked` field
   - If present: verify it includes `generate-epics`
   - If missing: mark as **FAIL**

2. **Scan all Story files** at `contexts/artefacts/stories/*.story.md` (exclude `_template.story.md`):
   - Check frontmatter for `skills_invoked` field
   - If present: verify it includes `generate-stories`
   - If missing: mark as **FAIL**
   - Check frontmatter for `related_decs` field
   - If missing: mark as **FAIL** (separate from skills_invoked)
   - Check frontmatter for `epic` field
   - If missing: mark as **WARN**

3. **Produce audit report** with:
   - Per-artefact pass/fail status
   - Compliance rate: `(passing artefacts / total artefacts) × 100`
   - List of non-compliant artefacts for remediation
   - Timestamp of audit

---

## Outputs

```
Skill Usage Audit Report — {date}

Epics scanned: {count}
Stories scanned: {count}

Non-compliant artefacts:
- {id}: FAIL — missing skills_invoked
- {id}: FAIL — missing related_decs
- {id}: WARN — missing epic field

Compliance rate: {n}/{total} ({pct}%)

Verdict: CLEAN | {n} VIOLATIONS FOUND
```

---

## Remediation

For each non-compliant artefact, the human or agent must:
1. Read the corresponding skill file (`generate-stories/SKILL.md` or `generate-epics/SKILL.md`)
2. Verify the artefact content follows all process steps
3. Add the missing frontmatter fields
4. Commit the fix

This skill does NOT auto-fix artefacts — it reports only. Remediation is a conscious act.

---

## Quality Checks

- Every artefact file in the scan directories is checked (no silent skips)
- Template files (`_template.*`) are excluded from the scan
- The report clearly distinguishes FAIL (blocking) from WARN (advisory)
- Compliance rate is computed correctly

---

## Non-Goals

This skill must NOT:
- Auto-fix artefacts (report only — remediation is deliberate)
- Check artefact content quality (use `validate-artefacts` for that)
- Scan non-artefact files (memory, decisions, patterns)

More from Fr-e-d/GAAI-framework

SkillDescription
abort-safe-handlerOrchestrator-level Stage 4 entry gate for /gaai:bootstrap. Presents a pre-loop "Skip Q&A entirely" option, delegates to qa-loop-ui when the user proceeds, and returns a unified abort_safe_result with telemetry on every path. Guarantees no partial state on skip or abort.
ambiguity-detectorTakes surface scan results, optional LLM synthesis open-question entries, and optional tree-sitter AST signals to score project ambiguities (1-10). Outputs structured ambiguity_feed for smart-question-generator. Pure heuristic — no LLM calls. Designed for Stage 3.5 of the /gaai:bootstrap pipeline (between LLM synthesis and Q&A).
approach-evaluationResearch industry standards and best practices, identify viable approaches for a given technical or architectural problem, and produce a structured factual comparison against project-specific constraints. Reports options — does not decide.
architecture-extractConvert raw project structure into clear architectural understanding — module boundaries, data flows, service relationships, and architectural patterns. Activate after codebase-scan during Bootstrap.
bootstrap-llm-synthesisConstruct the LLM synthesis prompt from project surface scan + optional tree-sitter context + optional Q&A answers. Call the LLM. Parse and validate the response into 6-8 structured memory entries with clarity tags and source traceability. Used as Stage 3 of the /gaai:bootstrap pipeline.
bootstrap-memory-ingest-cloudWrite structured memory entries to the Cloud workspace via gaai_memory.store MCP tool with source='bootstrap'. Loops over entries from bootstrap-llm-synthesis, calls the tool per entry, collects success/fail counts. Used as Stage 5 of the /gaai:bootstrap pipeline (Cloud path only).
browser-journey-testValidate user stories by simulating real user journeys in a live browser against deployed application. Activate after implementation to verify actual user experience against acceptance criteria, not just code logic.
build-agents-indexScan all agent and sub-agent definition files in .gaai/core/agents/, extract YAML frontmatter, merge with specialists.registry.yaml, and generate a derived agents-index.yaml at .gaai/core/agents/agents-index.yaml. Activate after adding, modifying, or removing any agent, sub-agent, or specialist entry.
build-skills-indexScan SKILL.md files in .gaai/core/skills/ and .gaai/project/skills/, extract YAML frontmatter, and regenerate separate skills indices for each layer. Core index ships with the OSS framework; project index is project-specific.
ci-watch-and-fixWatch GitHub Actions CI after PR creation, detect failures, extract logs, apply minimal fixes, and re-push — keeping the delivery session alive until CI resolves or escalating after 3 cycles. Activate immediately after gh pr create and before marking the story done.