# Audit

> Scan the codebase for deficiencies, generate a prioritized report ranked by efficiency (points per iteration), and optionally transition into focused improve loops area-by-area until the user stops or the score hits 100.

- **Type:** Skill
- **Install:** `agentstack add skill-benmarte-autoimprove-audit`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [benmarte](https://agentstack.voostack.com/s/benmarte)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [benmarte](https://github.com/benmarte)
- **Source:** https://github.com/benmarte/autoimprove/tree/main/skills/audit

## Install

```sh
agentstack add skill-benmarte-autoimprove-audit
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Audit Skill

## Pre-flight

1. Check `.claude/autoimprove/config.md` exists. If not, stop: "Run /autoimprove:setup first."
2. Check git is available and working tree is clean.

## Step 1: Run Measurement Suite

Run the measure skill to get the composite score and per-metric breakdown. Capture both the scores AND the raw command output for each metric.

For each metric defined in the config:
- Run the command (e.g., `tsc --noEmit 2>&1`, `pnpm test 2>&1`, `pnpm lint 2>&1`)
- Record the score (using the measure skill's scoring logic)
- Also capture the raw output for deficiency counting

## Step 2: Count Individual Deficiencies

Parse the raw output from each command to count specific issues:

- **Type errors:** Count lines matching error patterns (e.g., `error TS` for TypeScript, `error:` for Rust). Group by file.
- **Build:** Pass/fail only — no granular count. If build fails, it becomes top priority.
- **Tests:** Count passing vs total from test runner output. Identify failing test names if any.
- **Lint:** Count warning/error lines from linter output. Group by rule if possible.

## Step 3: Calculate Efficiency

For each metric with a gap (score 
```

If the user picks a number, use that area's estimate. If they press Enter, use the most efficient area.

### Starting the improve loop

Count all `**Branch:** autoimprove/experiment-` entries in `.claude/autoimprove/log.md` (if it exists) to determine the experiment offset.

Invoke the improve-loop skill directly with:
- **iterations:** The estimated count for the selected area
- **focus:** Generated focus string for that area:
  - Type safety → "Fix type errors"
  - Build → "Fix build errors"
  - Tests → "Add unit tests for untested functions"
  - Lint → "Fix lint warnings"
- **session_mode:** `new`
- **baseline_score:** The score just measured
- **start_iteration:** 1
- **total_iterations:** Same as iterations
- **experiment_offset:** Count of existing experiments

### After area completes

Re-run the measurement suite (Step 1-3) to get updated scores. Then show:

```
━━━ Area Complete: [area name] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Score: XX → YY/100 (+delta)
  [area]:  WW/WW  ██████████  ✓ maxed

Remaining work:
  #  Area     Gap    Est. iterations  Efficiency
  1  [next]   Xpts   M iterations     X.X pts/iter
  ...

  Remaining: ~N iterations (~XXXK tokens)

Continue to next area? (Y/n)
```

**If yes:** Repeat the selection prompt (or auto-select if only one area left). Start a new improve-loop session for that area.

**If no:** Stop. Print final score.

**If all areas maxed:** "🎉 Codebase score: 100/100. All areas maxed!"

### If area doesn't fully improve

If the improve loop finishes its estimated iterations but the area isn't maxed yet, show actual results:

```
Area [name] partially improved: XX → YY (expected ZZ)
Run more iterations on this area? (Y/n)
```

If yes, run more iterations (re-estimate based on remaining gap). If no, move to the next area.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [benmarte](https://github.com/benmarte)
- **Source:** [benmarte/autoimprove](https://github.com/benmarte/autoimprove)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-benmarte-autoimprove-audit
- Seller: https://agentstack.voostack.com/s/benmarte
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
