refactor-without-breaking

refactor-without-breaking is a skill for Claude Code, Codex from ArdurAI/ardur-agent. It costs 22 tokens per session (1,167 once invoked), scanned A, original, Apache-2.0.

A guide for reorganising code while keeping its behaviour unchanged. Refactoring means changing how code is structured without changing what it does.

In plain words
What is it for?
Use it when moving, renaming or extracting code, especially to establish tests first and check that the same tests pass before and after each structural step.
Why use it?
It reduces the risk of hidden regressions by requiring current behaviour to be tested and structural changes to be verified separately from behaviour changes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

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 skills/ardurai/ardur-agent/refactor-without-breaking
Any agent
npx skills add ArdurAI/ardur-agent --skill refactor-without-breaking
Clone the repo
git clone --depth 1 https://github.com/ArdurAI/ardur-agent

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-without-breaking

README.md
[![agentmods](https://agentmods.dev/badge/skills/ardurai/ardur-agent/refactor-without-breaking.svg)](https://agentmods.dev/skills/ardurai/ardur-agent/refactor-without-breaking)
Your own site
<a href="https://agentmods.dev/skills/ardurai/ardur-agent/refactor-without-breaking"><img src="https://agentmods.dev/badge/skills/ardurai/ardur-agent/refactor-without-breaking.svg" alt="Measured on agentmods" 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,167 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.01167
Opus 5 $0.00011 $0.00583
Sonnet 5 $0.00004 $0.00233
Haiku 4.5 $0.00002 $0.00117

Measured 5d ago against content hash 33d2da6d417c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

refactor-without-breaking 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 5d 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.

examples/skills/refactor-without-breaking/SKILL.md · 115 lines

How it starts

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

Refactoring without breaking things

Refactoring means changing the structure of code without changing what it does. The discipline that makes it safe is keeping those two things — structure and behavior — strictly separate, and proving behavior is unchanged after every step. If you cannot tell whether behavior changed, you are not refactoring; you are rewriting and hoping.

The one rule

Never change behavior and structure in the same commit. A commit either:

  • changes behavior (tests change, output changes) and leaves structure as-is, or
  • changes structure (moves, renames, extracts) and every test passes before and after, unchanged.

When the two are mixed and something breaks, you cannot tell which change broke it. Keeping them separate means a green test suite after a structural commit is a real guarantee, and a failing one points at exactly the move you just made.

1. Lock in current behavior first

Before changing any structure, make sure the current behavior is covered.

  • Run the existing tests. Note what passes. That green is your reference point — you are going to preserve it exactly.
  • Find the gaps. The code you are about to move is only as safe as its test coverage. If a branch you will touch is untested, it can break silently.
  • Write characterization tests for uncovered behavior: tests that assert what the code currently does, even if that behavior is ugly or arguably wrong. You are not fixing it now; you are pinning it so you notice if a refactor changes it. See @./characterization.md for how to write tests for code you do not fully understand yet.
  • Resist fixing bugs you find. Note them. A bug fix is a behavior change and belongs in its own commit, after the refactor, when you can see it clearly.

2. Refactor in small steps

Small enough that each step is obviously correct and easy to revert.

  • Make one structural change: extract a function, rename a variable, inline a helper, move a type to another module, replace a magic number with a named constant.
  • Run the full test suite. It must be exactly as green as before — same tests passing, none newly failing, none newly skipped.
  • Commit. A passing structural commit is a safe point you can return to.
  • Repeat.

Read the full file on GitHub · 115 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 5d ago First seen · 115 lines · 22 tokens per session scan A 33d2da6d417c

Subscribe to this mod's changes

refactor-without-breaking is a skill published in the GitHub repository ArdurAI/ardur-agent (2 stars, last pushed 2d ago), licensed Apache-2.0. It adds 22 tokens to every session and 1,167 once invoked, about $0.0001 per session on Opus 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 skills, from other repositories

agent-communication-protocol

Open protocol for AI agent interoperability enabling standardized communication between agents, applications, and humans across different frameworks.

majiayu000/claude-skill-registry · 25 tokens

worktree

当用户明确要求使用 Git worktree,或需要为一项独立开发工作创建、查找、复用、交接或清理隔离工作目录时使用。普通只读任务、非 Git 仓库,以及当前工作无需独立分支或工作目录时不使用。.

murray17/rovai-ai · 66 tokens

analyze-agent-codebase

当用户希望依据源码、配置、schema 和测试,分析 Coding Agent、Agent 框架或多 Agent 系统的真实架构、执行流程、上下文、记忆、工具、权限或扩展点时使用。继续回答同一分析中的定向机制问题或整理专题文档时也使用。普通代码评审、实现或修复任务,以及不需要仓库证据的概念问答不使用。.

murray17/rovai-ai · 99 tokens

member-studio

当用户希望创建新的 Rovai 队员,或继续调整、确认本次创建中尚未写入的队员名牌和头像方案时使用。普通成员资料咨询、编辑已创建队员,以及只设计角色或头像但不加入名册的任务不使用。.

murray17/rovai-ai · 65 tokens

campfire

当用户希望 Camp 中多位成员共同讨论、从不同角度分析、比较方案、评估利弊或讨论后形成建议时使用。主持人发起和继续整理讨论,成员在收到本次讨论任务时也使用。普通单人问题、无关发言、迟到补充和已经结束的讨论不使用。.

murray17/rovai-ai · 77 tokens

Read-only review

Review the selected implementation and report correctness, security, and maintainability findings. Do not modify workspace files.

Ryder-MHumble/Meldwork · 3 tokens