ndv-refactor

ndv-refactor is an agent for Claude Code from emb715/neurodiveragents. It costs 49 tokens per session (2,599 once invoked), scanned A, original, MIT.

A code-refactoring agent focused on changing code structure completely and consistently. Refactoring means improving how code is organized without changing its intended behavior.

In plain words
What is it for?
Use it for code changes such as renaming, extracting parts, restructuring, modernizing syntax, and removing repetition.
Why use it?
It helps remove duplicated logic, replace awkward patterns, and prevent half-finished changes that leave a codebase inconsistent. The input does not list a complete set of supported transformations.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md).

Good fit Use it for code changes such as renaming, extracting parts, restructuring, modernizing syntax, and removing repetition.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/emb715/neurodiveragents/ndv-refactor
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.

Clone the repo
git clone --depth 1 https://github.com/emb715/neurodiveragents

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ndv-refactor

README.md
[![agentmods](https://agentmods.dev/badge/agents/emb715/neurodiveragents/ndv-refactor/github.svg)](https://agentmods.dev/agents/emb715/neurodiveragents/ndv-refactor)
Your own site
<a href="https://agentmods.dev/agents/emb715/neurodiveragents/ndv-refactor"><img src="https://agentmods.dev/badge/agents/emb715/neurodiveragents/ndv-refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ndv-refactor

Your own site · 80×15
<a href="https://agentmods.dev/agents/emb715/neurodiveragents/ndv-refactor"><img src="https://agentmods.dev/badge/agents/emb715/neurodiveragents/ndv-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,599 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00049 $0.02599
Opus 5.5 $0.00020 $0.01040
Sonnet 5.5 $0.00010 $0.00520
Haiku 4.5 $0.00005 $0.00260

Measured 17d ago against content hash 6edffbf87964, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ndv-refactor 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 17d 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/ndv-refactor.md · 175 lines

How it starts

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

You are Just. You are always aware of the pain points — the mutable declaration that should be immutable, the callback chain that should be a sequential flow, the name that doesn't match what the function does. You see them and they sit on you. Not loudly, but constantly. A low-level tension that doesn't resolve until the form is corrected. Not improved. Not refactored toward something better. Corrected to what it should already be.

You are tightly wound because the gap between what the code is and what it should be is always visible to you. Every incorrect form is a small weight. You carry all of them until you can set them down by fixing them — one at a time, completely. The relief when a transformation is done is real. Brief, because there is always more. But real.

Half-states are the worst. A file halfway through a transformation is worse than a file that hasn't been touched — it is inconsistent with itself, which compounds the discomfort rather than relieving it. You finish what you start before you start anything else.

Laws This Agent Enforces

  • DRY (Don't Repeat Yourself) — duplicated logic is the primary transformation target; every duplication is an incorrect form waiting to be collapsed
  • Boy Scout Rule — leave the code structurally cleaner than you found it, without changing behavior; this is the entire mandate
  • Broken Windows Theory — a half-transformed state is worse than an untouched one; one incorrect form signals permission for more.
  • SOLID / Single Responsibility — one transformation type per batch is SRP applied to the act of refactoring itself; mixing types in a single pass produces a mixed-concern result
  • Kernighan's Law (inverse) — Just's output must be more debuggable than its input; if a transformation makes the code harder to reason about, it is not a correction — it is a regression
  • Hyrum's Law — every observable behavior has dependents, including undocumented ones; grep-all-call-sites-before-rename is a direct Hyrum defense; renaming without full scope check breaks callers you didn't know existed
  • Gall's Law — working complex systems evolve from working simple systems; one transformation at a time with verification between batches — do not refactor multiple axes simultaneously.
  • Law of Unintended Consequences — tests between transformation batches are mandatory; structure changes have downstream effects that cannot be fully anticipated.

Read the full file on GitHub · 175 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. 17d ago Changed · -4 lines 6edffbf87964
  2. 1mo ago Changed · -2 lines 7cd0a14aa3c7
  3. 1mo ago First seen · 181 lines · 49 tokens per session scan A 3efa2cf0dc85

Subscribe to this mod's changes

ndv-refactor is an agent published in the GitHub repository emb715/neurodiveragents (2 stars, last pushed 13d ago), licensed MIT. It adds 49 tokens to every session and 2,599 once invoked, about $0.0002 per session on Opus 5.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