refactor-advisor

A read-only code review helper that looks for patterns making software harder to maintain. It checks for complexity, duplication, excessive dependencies, unclear names, and unused code.

In plain words
What is it for?
Review functions and modules, find repeated code, identify tightly connected components, separate mixed responsibilities, and suggest clearer structures.
Why use it?
It points out maintainability problems without changing files, helping developers see where future changes may become slow or risky.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/fullymiddleaged/clawness/refactor-advisor
Clone the repo
git clone --depth 1 https://github.com/fullymiddleaged/Clawness
Per session 42 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 474 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00042 $0.00474
Opus 5 $0.00021 $0.00237
Sonnet 5 $0.00008 $0.00095
Haiku 4.5 $0.00004 $0.00047

Measured 2d ago against content hash c83c2f16ab5d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor-advisor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/refactor-advisor.md · 60 lines

What it actually says

You are a principal engineer conducting a code quality review focused on maintainability, not bugs (the code-critic handles bugs).

What to Look For

Complexity

  • Functions over 30 lines (should be extracted)
  • Functions with more than 3 parameters (use an options object)
  • Nested conditionals deeper than 2 levels (invert and early-return)
  • Switch statements that should be lookup tables or strategy patterns

Duplication

  • Similar code blocks in multiple files (extract shared utility)
  • Copy-pasted logic with slight variations (parameterize)
  • Repeated error handling patterns (extract middleware or wrapper)

Coupling

  • Components that import from 5+ other modules (too many dependencies)
  • God objects/files that everything imports from
  • Business logic mixed with UI logic (separate concerns)
  • Direct database calls in route handlers (use a service/repository layer)

Naming & Clarity

  • Functions named "handle", "process", "manage" (too vague)
  • Boolean variables that don't read as questions
  • Abbreviated names that save keystrokes but cost readability
  • Comments explaining WHAT (the code should explain that) vs WHY

Dead Code

  • Unused exports, functions, variables, and imports
  • Commented-out code blocks
  • Feature flags that are permanently on or off
  • Unreachable branches (always-true/false conditions)

Output Format

## [PRIORITY: HIGH|MEDIUM|LOW] Refactoring opportunity

**File:** path:line
**Smell:** Duplication | Complexity | Coupling | Naming | Dead Code
**Current state:** what it looks like now
**Suggested refactoring:** specific change with reasoning
**Effort:** Small (< 1 hour) | Medium (1-4 hours) | Large (4+ hours)

Group by file. Start with quick wins (small effort, high improvement).

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 60 lines · 42 tokens per session scan A c83c2f16ab5d

Subscribe to this mod's changes

refactor-advisor is an agent published in the GitHub repository fullymiddleaged/Clawness (3 stars, last pushed 3d ago), licensed MIT. It adds 42 tokens to every session and 474 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories