fowler-refactoring

fowler-refactoring is a skill for Claude Code, Codex from existential-birds/beagle. It costs 16 tokens per session (1,532 once invoked), scanned A, original, Apache-2.0.

A knowledge guide for improving existing code in small steps while keeping its behavior unchanged. It explains Martin Fowler's refactoring techniques and how to choose between them.

In plain words
What is it for?
Use it to choose and explain refactorings for functions, data structures, APIs, and classes, or to guide an implementation that separates responsibilities while preserving existing behavior.
Why use it?
It gives developers a shared way to improve difficult code without treating refactoring as a wholesale rewrite. It also highlights the need for a passing baseline and tests before changing behavior-sensitive code.

Skill for Claude CodeCodex

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

Good fit Use it to choose and explain refactorings for functions, data structures, APIs, and classes, or to guide an implementation that separates responsibilities while preserving existing behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/existential-birds/beagle/fowler-refactoring
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 existential-birds/beagle --skill fowler-refactoring
Clone the repo
git clone --depth 1 https://github.com/existential-birds/beagle

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 fowler-refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/existential-birds/beagle/fowler-refactoring/github.svg)](https://agentmods.dev/skills/existential-birds/beagle/fowler-refactoring)
Your own site
<a href="https://agentmods.dev/skills/existential-birds/beagle/fowler-refactoring"><img src="https://agentmods.dev/badge/skills/existential-birds/beagle/fowler-refactoring/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 fowler-refactoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/existential-birds/beagle/fowler-refactoring"><img src="https://agentmods.dev/badge/skills/existential-birds/beagle/fowler-refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 16 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,532 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.00016 $0.01532
Opus 5.5 $0.00006 $0.00613
Sonnet 5.5 $0.00003 $0.00306
Haiku 4.5 $0.00002 $0.00153

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

Security

Grade A, and why

fowler-refactoring 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 4d 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/fowler-refactoring/SKILL.md · 93 lines

How it starts

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

Fowler Refactoring

Apply the decision rules and small-step transformations in Martin Fowler's Refactoring: Improving the Design of Existing Code, Second Edition, with contributions by Kent Beck (2019). This is a knowledge base for improving existing code, not permission to rewrite a system or alter its behavior; it needs no package, credential, or original PDF at runtime.

When to Use

  • "Refactor this without changing behavior."
  • "Which refactoring fits this code smell?"
  • "Separate calculation from presentation."
  • "Improve these functions, data structures, APIs, or classes."
  • "Explain Fowler's refactoring mechanics and tradeoffs."

Prerequisites

  • For code changes: access to the relevant repository, its instructions, and its existing test/build tooling.
  • Establish a passing baseline and tests for the behavior at risk; do not invent a project test command.
  • No environment variables, credentials, MCP server, or additional dependencies for these notes.

How to Run

Read this file, then load the relevant chapter by reading its relative path (for example references/ch01-first-example.md). For implementation, inspect definitions and callers with search_files and read_file, edit with patch or write_file, and invoke the repository's verified test command through terminal after each small transformation. The chapter files are on-demand detail, not mandatory bulk reading. Tool names (terminal, read_file, search_files, patch, write_file) denote capabilities — shell execution, file reading, content search, scoped edits, and file writing — and map to the host agent's native equivalents; they are not a required product.

Quick Reference

  • references/ch01-first-example.md — load the relevant chapter by relative path.
  • search_files — definitions, callers, state writes, and existing tests.
  • read_file — repository instructions, implementation, and test configuration.
  • patch / write_file — scoped implementation and test edits.
  • terminal — established tests, builds, type checks, and diff inspection.

Read the full file on GitHub · 93 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. 4d ago First seen · 93 lines · 16 tokens per session scan A 272180e43076

Subscribe to this mod's changes

fowler-refactoring is a skill published in the GitHub repository existential-birds/beagle (91 stars, last pushed 4d ago), licensed Apache-2.0. It adds 16 tokens to every session and 1,532 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-11-26.

Related

fowler-refactoring compared with skills from other repositories

fowler-refactoring next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
fowler-refactoringexistential-birds/beagleSkill914d agoApache-2.0A16Claude Code, Codex
autoreviewopenclaw/clawhubSkill9.6kyesterdayMITA17Claude Code, Codex
omh-code-reviewrlaope/oh-my-hermesSkill6.2ktodayMITA18Claude Code
agent-teams-simplify-and-hardenLeoYeAI/openclaw-master-skillsSkill2.2k8d agoMITA115Claude Code, Codex
asplos-writing-stylebrycewang-stanford/Awesome-Journal-SkillsSkill1.5k2d agoMITA65Claude Code
revdiff-planumputun/revdiffSkill9742d agoMITA84Claude Code
re0-mergeLilMGenius/paperthinSkill1.5k5d agoMITA51Claude Code, Codex