Refactor Planner

Refactor Planner is a skill for Claude Code, Codex from Notysoty/openagentskills. It costs 22 tokens per session (1,534 once invoked), scanned A, original, MIT.

A guide for planning changes to messy code while keeping its existing behaviour. Refactoring means improving code structure without intentionally changing what it does.

In plain words
What is it for?
Use it to assess a function, module, or larger codebase that works but is difficult to maintain. It produces an ordered plan designed to keep tests passing and behaviour unchanged.
Why use it?
It breaks risky rewrites into smaller, reversible steps and identifies dependencies and likely regression points before changes are made.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for cline. Also seen: mentions Claude Code; mentions Codex; built for cline.

Good fit Use it to assess a function, module, or larger codebase that works but is difficult to maintain. It produces an ordered plan designed to keep tests passing and behaviour unchanged.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/notysoty/openagentskills/refactor-planner
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.

Any agent
npx skills add Notysoty/openagentskills --skill refactor-planner
Clone the repo
git clone --depth 1 https://github.com/Notysoty/openagentskills

Made for: Claude Code, Codex.

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/skills/notysoty/openagentskills/refactor-planner/github.svg)](https://agentmods.dev/skills/notysoty/openagentskills/refactor-planner)
Your own site
<a href="https://agentmods.dev/skills/notysoty/openagentskills/refactor-planner"><img src="https://agentmods.dev/badge/skills/notysoty/openagentskills/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/skills/notysoty/openagentskills/refactor-planner"><img src="https://agentmods.dev/badge/skills/notysoty/openagentskills/refactor-planner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,534 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.00022 $0.01534
Opus 5.5 $0.00009 $0.00614
Sonnet 5.5 $0.00004 $0.00307
Haiku 4.5 $0.00002 $0.00153

Measured 3mo ago against content hash be69ab8fea80, 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 3mo 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.

skills/refactor-planner/SKILL.md · 154 lines

How it starts

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

Refactor Planner

What this skill does

This skill directs the agent to analyze a block of code (or an entire module) and produce an ordered, safe refactoring plan. Rather than rewriting everything at once, it breaks the work into small, reversible steps — each one leaving the tests green and the behavior unchanged. It identifies code smells, maps dependencies, flags high-risk areas, and sequences the changes so you can ship incrementally without introducing regressions.

Use this when you have messy, hard-to-understand code that works but needs cleaning up before you can safely add features.

How to use

Claude Code / Cline

Copy this file to .agents/skills/refactor-planner/SKILL.md in your project root.

Then ask the agent:

  • "Use the Refactor Planner skill on src/utils/dataProcessor.ts."
  • "Plan a safe refactor of this function using the Refactor Planner skill."

Paste in the code you want refactored, or point to a file path.

Cursor

Add the "Prompt / Instructions" section below to your .cursorrules file, or paste it directly into the Cursor AI pane before sharing the code you want refactored.

Codex

Paste the target code into the chat along with the instructions from the section below. For large files, include the full file plus any files that import from it so Codex can map dependencies.

The Prompt / Instructions for the Agent

When asked to plan a refactor, follow these steps precisely:

  1. Read the code thoroughly. If a file path is given, read the full file. Also read any files that import from it or that it imports from, so you understand the dependency graph.

  2. Identify code smells. Look for:

    • Functions longer than 40 lines
    • Deeply nested conditionals (more than 3 levels)
    • Duplicated logic (copy-paste code)
    • Magic numbers and hardcoded strings
    • God objects or functions that do too many things
    • Inconsistent naming conventions
    • Mutable shared state
    • Missing or misleading comments
    • Dead code (unreachable or unused)

Read the full file on GitHub · 154 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. 3mo ago First seen · 154 lines · 22 tokens per session scan A be69ab8fea80

Subscribe to this mod's changes

Refactor Planner is a skill published in the GitHub repository Notysoty/openagentskills (9 stars, last pushed 3mo ago), licensed MIT. It adds 22 tokens to every session and 1,534 once invoked, about $0.0001 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

Refactor Planner compared with skills from other repositories

Refactor Planner next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Refactor PlannerNotysoty/openagentskillsSkill93mo agoMITA22Claude Code, Codex
absolute-simplifymaddhruv/absoluteSkill2234mo agoMITA178Claude Code
loud-errorsmikestangdevs/craft-skillsSkill420d agoMITA76Claude Code
setup-craft-skillsmikestangdevs/craft-skillsSkill420d agoMITA64Claude Code
boyscoutmikestangdevs/craft-skillsSkill420d agoMITA64Claude Code
delete-thismikestangdevs/craft-skillsSkill420d agoMITA68Claude Code
explain-backmikestangdevs/craft-skillsSkill420d agoMITA78Claude Code