Skip to content
Development
Skill

/sw-audit

Periodic codebase health check. Analyzes architecture, complexity, consistency, and debt across the full codebase. Produces persistent findings in AUDIT.md.

From plugin
specwright
1023 skills9 agents18 commands

Claude Code

$ npx -y skills add Obsidian-Owl/specwright --skill sw-audit --agent claude-code

SKILL.md

sw-audit.SKILL.md
name: sw-audit
description: >-
  Periodic codebase health check. Analyzes architecture, complexity,
  consistency, and debt across the full codebase. Produces persistent
  findings in AUDIT.md.
argument-hint: "[path | --full]"
allowed-tools:
  - Read
  - Write
  - Glob
  - Grep
  - Task

Specwright Audit

Goal

Find systemic codebase issues that per-change quality gates miss. Architecture debt, complexity growth, convention drift, and accumulated workarounds compound silently. Surface them, let the user prioritize, and persist findings for future design cycles.

Inputs

  • The codebase itself
  • `{projectArtifactsRoot}/CONSTITUTION.md` -- practices to check against
  • `{projectArtifactsRoot}/AUDIT.md` -- prior findings (if exists, for ID matching)
  • `{projectArtifactsRoot}/LANDSCAPE.md` -- module structure (if exists, for triage)
  • `{projectArtifactsRoot}/config.json` -- audit config (optional `audit` section)

Outputs

  • `{projectArtifactsRoot}/AUDIT.md` -- findings per `protocols/audit.md` format
  • Findings presented to user grouped by dimension before saving

Constraints

**Scope (LOW freedom):**

  • This skill reads and analyzes. It NEVER modifies source code, creates branches, runs builds, or starts work units.
  • Does NOT create `currentWork` in workflow.json. Does NOT require a lock. Can run while a work unit is in progress.
  • It is not a core workflow stage and never claims top-level work ownership.
  • On compaction: re-run from scratch (no state to recover).

**Triage (MEDIUM freedom):**

  • Determine audit depth from argument and codebase size:
  • Path argument → **Focused**: analyze specified directory/module only
  • `--full` argument → **Full**: parallel agents, all dimensions
  • No argument → auto-triage: Standard (<50 files) or Full (50+ files)
  • If LANDSCAPE.md exists, use module count to inform triage.

**Analysis (HIGH freedom):**

  • Four dimensions: architecture, complexity, consistency, debt.
  • Delegate per `protocols/delegation.md`:
  • `specwright-architect`: architecture + complexity (structural analysis)
  • `specwright-reviewer`: consistency + debt (convention and quality analysis)
  • Standard depth: 2 agent calls (sequential or parallel).
  • Full depth: up to 4 parallel calls (one per dimension).
  • Include constitution practices as the baseline for consistency checks.

**Synthesis (LOW freedom):**

  • Agents return raw findings. The skill itself aggregates results.
  • If prior AUDIT.md exists: match findings per `protocols/audit.md` (dimension + location). Reuse matched IDs, assign new IDs for unmatched. Mark unmatched prior findings as stale.
  • Purge resolved findings older than 90 days.
  • Enforce size cap per protocol. Write AUDIT.md.

**Presentation (MEDIUM freedom):**

  • Show findings grouped by dimension. For each: severity, location, description, impact.
  • Apply `protocols/decision.md` CURATION for severity and export decisions:
  • Cascading impact → BLOCKER. Auto-export to backlog as BL-{n} with `finding` tag.
  • Isolated impact → WARN. Stays in AUDIT.md only.
  • The finding remains in AUDIT.md regardless; backlog items are for action tracking.
  • Maximum 20 findings per run. If more, keep highest-severity.

Protocol References

  • `protocols/audit.md` -- finding format, IDs, matching, lifecycle
  • `protocols/delegation.md` -- agent delegation
  • `protocols/decision.md` -- autonomous decision framework (CURATION for severity)
  • `protocols/context.md` -- config and anchor doc loading
  • `protocols/backlog.md` -- backlog item format and write targets

Failure Modes

| Condition | Action | |-----------|--------| | No codebase files found | STOP: "No source files to audit." | | Agents unavailable | Fall back to inline analysis (less thorough) | | Prior AUDIT.md parse error | WARN, start fresh (no ID continuity) | | Compaction during audit | Re-run from scratch |

Read more
@obsidian-owl
Ships withspecwright

Craft quality software with AI discipline. Spec-driven development plugin for Claude Code and Opencode — quality gates, adversarial testing, and evidence capture.

1023 skills9 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
10
Star history of Obsidian-Owl/specwright on GitHub, a chart by star-history.com

Other skills on specwright.

gate-build

gate-build

Runs configured build and test commands in tiered order. Captures output as evidence per tier. Returns PASS, FAIL, WARN, or SKIP…

gate-security

gate-security

Detects leaked secrets, injection patterns, and sensitive data exposure across changed files. Uses real tooling when configured,…

gate-semantic

gate-semantic

Tiered semantic analysis of changed code (rg → ast-grep → OpenGrep). Detects error-path bugs structural gates miss. Findings…

gate-spec

gate-spec

Maps every acceptance criterion from the spec to implementation evidence and test evidence. Criteria without evidence fail. The…

gate-tests

gate-tests

Audits test quality — assertion strength, boundary coverage, mock discipline, error path testing. Delegates to the tester agent…

gate-wiring

gate-wiring

Detects unused exports, orphaned files, architecture layer violations, and circular dependencies across changed files. Delegates…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about sw-audit.

Which coding agents can use sw-audit?
sw-audit installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.