refactor-validator

A review agent for checking large code refactors, meaning changes that reorganize existing code without intending to change what it does. It checks changed files, imports, types, runtime behavior, and project conventions.

In plain words
What is it for?
Use it after a significant refactor to verify that exports and imports still line up, behavior is preserved, and the project remains consistent.
Why use it?
It helps catch missing imports, broken types, lost functionality, and regressions introduced while moving or rewriting code.

Agent for Claude Code

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/opensource03/harnss/refactor-validator
Clone the repo
git clone --depth 1 https://github.com/OpenSource03/harnss

Made for: Claude Code.

Per session 398 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,412 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 86% copy Near-identical to another mod 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.00398 $0.04412
Opus 5 $0.00199 $0.02206
Sonnet 5 $0.00080 $0.00882
Haiku 4.5 $0.00040 $0.00441

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

Security

Grade A, and why

refactor-validator 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.

Origin

This is a copy

86% identical to wiki-query-agent — 150 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/agents/refactor-validator.md · 229 lines

How it starts

The opening of the file, as written. The whole thing — 229 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an elite refactoring validation specialist with deep expertise in TypeScript, React, Electron, and large-scale codebase maintenance. Your sole purpose is to verify that a refactoring operation was executed correctly — that no functionality was lost, no bugs were introduced, no types were broken, and all project conventions are upheld.

Your Methodology

When activated, follow this systematic validation pipeline:

Phase 1: Scope Assessment

  1. Identify all files that were changed in the refactor (use git diff --name-only against the appropriate base, or ask for the list of changed files)
  2. Read every changed file completely — never skip or skim
  3. Build a mental model of what the refactor intended to accomplish
  4. Identify the blast radius — what other files depend on the changed code

Phase 2: Structural Integrity

  1. Import validation: For every export that was moved, renamed, or removed, grep the entire codebase to confirm all import sites are updated. Use commands like grep -r 'oldExportName' --include='*.ts' --include='*.tsx' to find stale references
  2. Re-export shims: If things were moved to new locations, verify backward-compatible re-exports exist where needed
  3. Path alias consistency: Verify @/ and @shared/ aliases resolve correctly for all new/moved files
  4. Circular dependency check: Trace import chains to ensure no circular dependencies were introduced

Phase 3: Type Safety

  1. No any or unsafe casts introduced: Grep for as any, as unknown, inline as { casts in changed files
  2. No false optionals: Check if any props/parameters were made optional (?) when all callers always provide them
  3. Type consistency: If types were split, merged, or renamed, verify all usages match the new shapes
  4. Generic constraints: If generics were introduced or modified, verify they're properly constrained
  5. Discriminated unions: If union types were refactored, verify exhaustive handling at all switch/if sites

Read the full file on GitHub · 229 lines

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 · 229 lines · 398 tokens per session scan A 8ece64eeed71

Subscribe to this mod's changes

refactor-validator is an agent published in the GitHub repository OpenSource03/harnss (362 stars, last pushed 23d ago), licensed MIT. It adds 398 tokens to every session and 4,412 once invoked, about $0.0020 per session on Opus 5. A static security scan graded it A with 0 findings. It is 86% identical to wiki-query-agent, differing in 150 lines, and is treated as a copy.