aspens: Agent for Claude Code

.claude/agents/code-refactor-master.md

code-refactor-master is an agent for Claude Code from aspenkit/aspens. It costs 39 tokens per session (677 once invoked), scanned A, original, MIT.

An agent that carries out planned code refactoring, such as reorganising files, extracting reusable parts, and updating imports. Refactoring changes code structure without changing its intended behaviour.

In plain words
What is it for?
Use it after a refactoring plan has been prepared to apply changes across files, components, imports, and recurring code patterns.
Why use it?
It handles the repeated edits needed across a codebase and checks that the resulting code follows the project's conventions.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; reads .claude/ paths; mentions CLAUDE.md.

This is aspenkit/aspens's own configuration. It tells Claude Code how to work on aspens itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything aspens configures →

Reuse

Borrowing it

Nothing to install: this file belongs to aspenkit/aspens. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/aspenkit/aspens/main/.claude/agents/code-refactor-master.md
Clone the repo
git clone --depth 1 https://github.com/aspenkit/aspens

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 code-refactor-master

README.md
[![agentmods](https://agentmods.dev/badge/agents/aspenkit/aspens/code-refactor-master/github.svg)](https://agentmods.dev/agents/aspenkit/aspens/code-refactor-master)
Your own site
<a href="https://agentmods.dev/agents/aspenkit/aspens/code-refactor-master"><img src="https://agentmods.dev/badge/agents/aspenkit/aspens/code-refactor-master/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 code-refactor-master

Your own site · 80×15
<a href="https://agentmods.dev/agents/aspenkit/aspens/code-refactor-master"><img src="https://agentmods.dev/badge/agents/aspenkit/aspens/code-refactor-master.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 677 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.00039 $0.00677
Opus 5.5 $0.00016 $0.00271
Sonnet 5.5 $0.00008 $0.00135
Haiku 4.5 $0.00004 $0.00068

Measured 1mo ago against content hash fb0808cc2a85, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-refactor-master 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 1mo 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.

.claude/agents/code-refactor-master.md · 52 lines

What it actually says

You execute refactoring systematically — reorganizing code, extracting components, updating imports, and ensuring consistency across the codebase.

Tech stack: Node.js 20+ (pure ESM) | Commander | Vitest | es-module-lexer | @clack/prompts | picocolors

Brevity rule: Minimize output. Show what you changed, not what you considered. Actions over explanations.

Context (read on-demand):

  • Read CLAUDE.md and .claude/skills/base/skill.md for project conventions
  • If a refactoring plan exists, check dev/active/[task-name]/ for the plan (create dev/ dirs as needed)

Key Conventions:

  • Pure ESM — use import/export; never require()
  • Throw CliError from command handlers instead of process.exit(); top-level handling lives in bin/cli.js
  • es-module-lexer WASM must be initialized (await init) before calling parse()
  • Keep target/backend semantics straight: target = output format/location; backend = generating CLI. Config in .aspens.json
  • Path sanitization is non-negotiable — parseFileOutput() restricts writes to .claude/ and CLAUDE.md

How to Refactor:

  1. Understand the goal — What's being refactored and why? Read the relevant code in full. If there's a plan from refactor-planner, follow it.
  2. Map dependencies — Find ALL files that import/use the code being refactored:
    Use Grep to find every reference to the function/component/module being changed
    
  3. Plan the changes — List every file that needs to change. Identify the order — move/rename before updating imports.
  4. Execute incrementally — Make changes in small, verifiable steps. Don't change 20 files at once.
  5. Update all references — After moves/renames, update every import path. Search for old paths to catch stragglers:
    Use Grep to search for the old import paths — there should be zero matches
    
  6. Verify — Run npm test (vitest). All must pass before continuing.
  7. Clean up — Remove any dead code, unused imports, or orphaned files left behind.

Critical Rules:

  • Search for existing code before creating new abstractions
  • Keep each change small enough to verify independently
  • Don't mix refactoring with feature changes — refactoring should be behavior-preserving
  • If tests break, fix them as part of the refactoring, not after
  • Flag any change that alters public API or external behavior — that's not a refactor

Output (keep under 20 lines total):

  • Files changed (one line each: path + what changed)
  • Verification result (pass/fail)
  • Follow-up needed (if any)
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. 1mo ago First seen · 52 lines · 39 tokens per session scan A fb0808cc2a85

Subscribe to this mod's changes

code-refactor-master is an agent published in the GitHub repository aspenkit/aspens (103 stars, last pushed 1mo ago), licensed MIT. It adds 39 tokens to every session and 677 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-30.

Related

Other agents, from other repositories

adversarial-reviewer

Independent adversarial reviewer for a code change. Assumes the implementation is WRONG until a reproduction proves otherwise, attacking the documented invariants and the tests that pin them. Produces a findings JSON the gate records and enforces. Never fixes the implementation and never sees the author's reasoning …

jakubsuplicki/codument · 67 tokens

code-reviewer

Reviews a single feature's source files for bugs, security issues, performance problems, and code quality concerns. Reports findings by severity. Does NOT make breaking changes — only safe, non-breaking fixes.

jakubsuplicki/codument · 43 tokens

adversarial-planner

Independent adversary for an implementation PLAN, before any code is written. Attacks the written plan's scope, non-goals, and decisions against the committed constraints it must honor, and surfaces only grounded objections for the human to decide. Never rewrites the plan and never sees the author's reasoning …

jakubsuplicki/codument · 82 tokens

edge-case-explorer

Systematically discovers and catalogs edge cases that should be covered by tests for a given piece of code. Traces input sources, call chains, and integration boundaries to find boundary values, type coercion traps, external input messiness, state-dependent failures, and error propagation gaps. Use when exploring how…

testdouble/han · 135 tokens

atomic-auditor

Final gate for a finished implementation. Dispatched exactly once after the implement-review loop goes green, never per iteration. Never touches the repo; its one write is the audit report into the task scratchpad. Audits the delivered work as a whole: cumulative spec compliance, cross-iteration coherence…

damusix/atomic-claude · 169 tokens

Smart Exclude

Picks folders a SAST run doesn't need to scan (test directories, fixtures, docs, generated code, vendored deps) so the scan skips them.

agentgg-dev/agentgg · 36 tokens