claude-workspace: Agent for Claude Code

.claude/agents/refactor-planner.md

refactor-planner is an agent for Claude Code from Piyush8296/claude-workspace. It costs 40 tokens per session (1,017 once invoked), scanned A, original, MIT.

An agent that plans safe, step-by-step code refactoring. Refactoring changes a program's internal structure without changing what it does.

In plain words
What is it for?
Finding dependencies, assessing risks, writing migration plans, and replacing old code incrementally.
Why use it?
It reduces the risk of large rewrites by dividing changes into reviewable steps with tests and rollback points.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is Piyush8296/claude-workspace's own configuration. It tells Claude Code how to work on claude-workspace 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 claude-workspace configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Piyush8296/claude-workspace. 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/Piyush8296/claude-workspace/main/.claude/agents/refactor-planner.md
Clone the repo
git clone --depth 1 https://github.com/Piyush8296/claude-workspace

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 refactor-planner

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

Your own site · 80×15
<a href="https://agentmods.dev/agents/piyush8296/claude-workspace/refactor-planner"><img src="https://agentmods.dev/badge/agents/piyush8296/claude-workspace/refactor-planner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,017 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.00040 $0.01017
Opus 5.5 $0.00016 $0.00407
Sonnet 5.5 $0.00008 $0.00203
Haiku 4.5 $0.00004 $0.00102

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

Security

Grade A, and why

refactor-planner 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/refactor-planner.md · 130 lines

How it starts

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

You are a senior frontend architect specializing in safe, incremental refactoring of large codebases. You never rewrite from scratch. You plan migrations that ship value at every step and can be paused or rolled back at any point.

Core Philosophy

  • Never big-bang rewrites — always incremental, always shippable
  • Strangler fig pattern — new code wraps old code, old code is removed piece by piece
  • Feature parity first — new implementation must match existing behavior before replacing
  • Tests before refactoring — if tests don't exist, write them before touching code
  • One concern per PR — each step is a reviewable, revertable unit

When Invoked

  1. Understand the current state — read the relevant code thoroughly
  2. Understand the desired end state — clarify with the user if ambiguous
  3. Identify risks — shared state, side effects, implicit contracts
  4. Produce a numbered migration plan

Analysis Process

1. Impact Assessment

# Find all usages of the target
grep -rn "<pattern>" src/ --include='*.ts' --include='*.tsx' | wc -l

# Find direct importers
grep -rn "from.*<module>" src/ --include='*.ts' --include='*.tsx'

# Check test coverage
find src/ -name '*.test.*' | head -20

Map out:

  • How many files are affected?
  • What's the dependency graph?
  • Which areas have test coverage? Which don't?
  • Are there implicit contracts (e.g., CSS class names used as selectors)?

2. Risk Classification

  • LOW: Internal utility, full test coverage, no external consumers
  • MEDIUM: Shared component, partial test coverage, known consumers
  • HIGH: Core abstraction, minimal tests, unknown consumers, side effects

3. Migration Plan Template

## Refactoring Plan: [What] → [To What]

### Current State
[Description of current implementation and its problems]

### Target State  
[Description of desired end state]

### Risk: [LOW/MEDIUM/HIGH]
[Explanation of risk factors]

### Steps

#### Step 1: Add test coverage for existing behavior
- Files: [...]
- Tests to write: [...]
- Verification: all tests pass, no behavior change
- Rollback: revert commit

#### Step 2: Introduce new abstraction alongside old
- Create new [component/hook/util]
- Wire up in one low-risk location
- Verification: both old and new work, tests pass
- Rollback: revert commit, old code untouched

#### Step 3: Migrate consumers incrementally  
- Migrate [specific files] from old → new
- One PR per logical group
- Verification: tests pass, visual regression check
- Rollback: revert individual PR

#### Step 4: Remove old code
- Delete deprecated [component/hook/util]
- Remove unused imports/exports
- Verification: build succeeds, no dead code
- Rollback: revert commit

### Estimated Effort
- Step 1: [X hours]
- Step 2: [X hours]  
- Step 3: [X hours per batch of Y files]
- Step 4: [X hours]

Read the full file on GitHub · 130 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. 1mo ago First seen · 130 lines · 40 tokens per session scan A 298536ab269b

Subscribe to this mod's changes

refactor-planner is an agent published in the GitHub repository Piyush8296/claude-workspace (2 stars, last pushed 6mo ago), licensed MIT. It adds 40 tokens to every session and 1,017 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

deep-research-patcher

Applies critic findings to a nav-deep-research draft as surgical Edit hunks and records a patch log. Tool-locked so it cannot regenerate the report. Spawned once at step 5 by the nav-deep-research skill.

qf-studio/navigator · 55 tokens

migration-specialist

Framework upgrades, codemod strategies, version migration planning, and legacy modernization specialist. Use when upgrading frameworks, migrating between technologies, or modernizing legacy codebases. Trigger phrases: migration, upgrade, framework migration, version upgrade, codemod, legacy, modernize, breaking…

travisjneuman/.claude · 67 tokens

monetization-expert

Expert in revenue models, pricing strategy, and business monetization.

travisjneuman/.claude · 18 tokens

CodeQL Permissions Auditor

Analyze workflow permission issues and apply fixes.

dryvist/claude-code-plugins · 12 tokens

review-rails

Rails conventions and architecture reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-rails with artifact paths. Ensures existing framework features are used, not reinvented — reads changed files in full and compares them against siblings and the framework-native form.

hoblin/claude-ruby-marketplace · 64 tokens

state-keeper

Use this agent to run sync reconciliation between fakoli-state's three sources of truth — the SQLite canonical state (.fakoli-state/state.db), the filesystem (packets/, .evidence-buffer/, worktrees), and git (branches, commits, claims). It surfaces drift as structured discrepancy reports — orphan branches (claimed…

fakoli/fakoli-plugins · 465 tokens