Skip to content
Agentmart
Submit a tool

refactor-audit

Audit a codebase for architecture drift and produce a `refactor-audit.md` with evidence, recommendation, and guardrail candidates.

Skill by clemens33

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/clemens33-refactor-audit

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Audit a codebase for architecture drift and produce a `refactor-audit.md` with evidence, recommendation, and guardrail candidates. Use when asked "is this codebase getting messy?", "should we refactor?", "run a refactor audit", or before a release-hardening pass. Collects hard / soft / tooling-gap signals, compares against the previous audit, and applies a two-stage decision rule to recommend improve-codebase-architecture or the large-feature playbook. Does NOT execute the refactor itself.

Use cases: security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/refactor-audit

What's inside

Skill name
refactor-audit
Description
Audit a codebase for architecture drift and produce a `refactor-audit.md` with evidence, recommendation, and guardrail candidates. Use when asked "is this codebase getting messy?", "should we refactor?", "run a refactor audit", or before a release-hardening pass. Collects hard / soft / tooling-gap signals, compares against the previous audit, and applies a two-stage decision rule to recommend improve-codebase-architecture or the large-feature playbook. Does NOT execute the refactor itself.
License
MIT
Metadata
category: preference
Instructions
216 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Refactor Audit

Decide whether structural refactoring is warranted, with evidence. The skill answers *"is there enough architecture drift to justify a separate refactor right now?"* and routes to the right next workflow. It does not perform the refactor.

## When to invoke

Any of:

- Explicit user request — *"audit this codebase"*, *"are we drifting?"*, *"run a refactor audit"*
- After completing a cluster of related feature slices (post-feature-cluster review)
- Before a tagged release (release-hardening pass)
- When `zoom-out` skill flags drift during long-running work
- When the same agent mistake recurs across sessions (Hashimoto's harness rule)
- When review bandwidth feels disproportionate to PR size

**No calendar cadence default.** Calendar sweeps are busywork unless the team already runs scheduled maintenance windows. Trigger-based is the default.

## Output artifact

Produces `.local/refactor-audit-YYYY-MM-DD.md` with the structure below. The artifact is the deliverable — never just inline a verbal answer.

```
# Refactor Audit — <repo> — <date>

## Previous audit reviewed
<path to latest prior .local/refactor-audit-*.md, or "none">

## Tooling discovered
<commands found in justfile / Makefile / pyproject.toml / package.json /
.github/workflows / sonar-project.properties — what CAN be measured here>

## Signals

### Hard signals (CI/baseline-backed metrics)
| Signal | Fired? | Evidence | Baseline |

### Soft signals (judgment / agent observations)
| Signal | Fired? | Evidence (commit refs, session notes) |

### Tooling-gap signals (plausible but no tool/baseline exists)
| Signal | Why we can't measure | Candidate tool to add |

## Repeated soft signals
<soft signals that ALSO fired in the previous audit — names + brief
diff vs prior evidence; empty list if no prior audit or no repeats>

## Decision

### Stage 1 — Separate refactor work warranted?
<yes / no, with the trigger row that fired from the Stage 1 table>

### Stage 2 — Workflow routing (only if Stage 1 = yes)
<one of:
  improve-codebase-architecture (requires-plan: no) /
  improve-codebase-architecture (requires-plan: yes — scope first) /
  large-feature playbook>

## Rationale
<2-4 sentences citing which signals support the decision, and how the
Repeated soft signals list (if any) influenced Stage 1>

## Guardrail candidates
<repeated soft signals → CI checks/lints/import-linter contracts/coverage
thresholds that would convert these into hard signals next time>

## Validation gaps
<things we couldn't check because tooling is missing; record explicitly,
do not silently skip>
```

## Discover tooling first

Read these files to discover what's actually measurable in *this* repo before claiming any signal:

- `justfile`, `Makefile`, `package.json`, `pyproject.toml`
- `.github/workflows/*`, `.gitlab-ci.yml`
- `sonar-project.properties`, `.semgrep.yml`, `import-linter.cfg`
- Repo `AGENTS.md` / `CLAUDE.md` for declared conventions
- `docs/adr/` for prior architectural decisions

If a signal's tool isn't present in the repo, record it under **tooling-gap**, not under hard signals.

## Signals — three tiers

### Hard signals (CI/baseline-backed)

These have evidence the agent can produce; they require the repo to have the tool configured.

- **Test walltime regression** vs. the repo's own baseline. Python: `pytest --durations=10`. JS/TS: jest/vitest reporters.
- **Coverage regression** vs. baseline. Python: `pytest-cov`. JS/TS: `c8`/`nyc`/jest coverage.
- **Repeated CI failures in the same area** — git log + CI history; same module failing on unrelated PRs is a structural smell.
- **Lint/type complexity threshold crossed** — Python: `ruff` complexity rules (`C90`, `PLR`), `mypy --strict` regressions. JS/TS: eslint complexity rules.
- **Import cycle detected** — Python: `import-linter`, `grimp`, `pydeps --max-bacon`. JS/TS: `madge --circular`.
- **Duplication threshold breach** — Python: `pylint duplicate-code`, `radon`. JS/TS: `jscpd`.
- **Sonar / Trail-of-Bits / fp-check findings cluster** in one module.

Always compare against the **repo's own baseline**. There is no universal "20% slower" threshold; if no baseline exists, record under tooling-gap and propose recording one.

### Soft signals (judgment / observation)

These rely on session notes, commit history, or agent recall.

- Same agent mistake recurring across two or more sessions (Hashimoto's harness trigger)
- "Just one more thing" responsibility creep — one module growing across unrelated features
- Repeated cross-file edits to express one concept — coupling smell
- Review burden disproportionate to PR size — review requires repeated clarification rounds, multiple missed-caller findings, or reviewer cannot validate a small PR without reconstructing several modules
- `zoom-out` skill flagged drift during long-running work
- Multiple recent slices needed an unplanned "fix this adjacent thing" detour
- Missed-caller surprises during reviews (Sourcegraph/Amp lens — completeness gaps)

### Tooling-gap signals

Plausible signals we cannot currently observe because the tool isn't configured. Examples:
- "Import cycles" in a Python repo that has no `import-linter` or `grimp` — log as tooling-gap, propose adding the tool.
- "Duplication" in a JS/TS repo with no `jscpd` configured — same.

Tooling-gap signals do NOT count toward the decision rule. They DO appear in the guardrail-candidates section.

## Prior-audit comparison

From clemens33/dotfiles, MIT.

More from clemens33/dotfiles

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Aug 12, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from clemens33

Cite this page

refactor-audit skill. Agent Mart. https://agentmart.dev/skills/clemens33-refactor-audit (last updated 2026-10-24)