About
What this is
Refactoring In The Loop is a reference site that places three classic works on code quality side-by-side and adds a second column for AI coding agents.
- Refactoring (Fowler, Beck) — refactorings and code smells.
- Refactoring to Patterns (Kerievsky) — composite refactorings.
- Design Patterns (Gang of Four) — the 23 reusable object-oriented patterns.
The signature surface is the compare view. Each entry sits in a two-column layout: the human column on the left, the agent column on the right. Both columns carry the same six force fields — Symptom, Goal, Pressure, Tradeoff, Relief, Trap — so any row reads as a direct contrast. The names match Fowler, Kerievsky, or the Gang of Four; the agent row names a token-cost or context-window mechanism for the same name.
Entries cross-link by role. A smell links to the refactorings that relieve it; a refactoring links back to the smells it targets and to any composite refactoring or design pattern it composes into. The catalog forms a bidirectional graph — symptom to remedy in one direction, target shape back to smells in the other.
Terms from LLM research — context window, lost-in-the-middle, token cost — carry inline definitions throughout the catalog. Hover or tap any underlined term to read the definition and its citation without leaving the entry.
The catalog spans roughly 140 entries across the three books. Six force fields per entry, two actors per entry.
Who this is for
You are a developer pair-coding with LLM agents. You know the classic catalogs and want a second axis: how each smell, refactoring, and pattern plays out when the editor is an LLM rather than a person.
You are a tech lead writing AI coding standards. You need citable, per-smell reasoning grounded in agent mechanics rather than opinion.
You are a self-taught developer shipping with an agent. You need a vocabulary for the thing your agent just did and a lookup table to the canonical name.
The problem
No catalog mapped the classic vocabulary onto agent mechanics in a per-entry, mechanism-grounded way. The canon was written for human readers — Fowler, Kerievsky, the Gang of Four — and LLM-paired developers reach for the same names without a second axis that says why each smell costs an agent something different from what it costs a person.
Generic “AI is bad at long files” advice does no work. It names no mechanism, picks no entry, gives no remedy.
When an LLM is the editor, the binding constraints shift to context window (what fits, what falls outside, lost-in-the-middle) and token cost (tokens per read, tokens per branch walk, tokens for unrelated payload).
A Long Function is hard to read for a human. For an agent, every reasoning pass loads the whole body, and each extracted helper inflates context cost by one more definition. Same name, different force, different remedy.
A reader who knows Fowler can look up Mysterious Nameand see, in the same vocabulary, why it costs an agent more than a human, and which refactoring’s agent-side relief cancels which agent-side pressure. The classic vocabulary keeps its authority; the agent column carries the second axis.
Three example uses
The agent is drifting.Third file, same helper, three signatures. The plugin already named it — “Duplicated Code; I’ll apply Extract Function” — and the names are right. The signatures still drift. That’s a window problem, not a knowledge problem. Open Duplicated Code on the site. The agent-side pressuresays it plainly: each pass loads only the slice the agent is in. The canonical helper is out of sight. Paste the helper’s full signature into your next prompt. Three becomes one.
The team needs a standard, not an opinion. Pull up Mysterious Name on the compare view. The human column gives the team Fowler — they know that part. The agent column gives the sentence they don’t have yet: every reasoning pass re-derives meaning from surrounding context; chained edits compound the cost. Paste both columns into the doc. Link back. Repeat for Long Function and Primitive Obsession. Then put the plugin on every laptop so the agents speak the doc’s words back to the team.
A fourth switch (kind) block. One of the old three is broken. No plugin yet. You don’t have a name — only the word switch. That’s enough. Search the site, open Repeated Switches, read the human-side symptom. You have the name now. The agent-side trap spells the cost: a new case means finding every site; missing one ships a silent bug. The entry links to Replace Conditional with Polymorphism. Install the plugin: /plugin install refactor@ritl. Next time, the agent names Repeated Switches before the fourth block gets written.
Attributions
Source works
Every entry name, the category structures, and the conceptual frame are drawn from these books.
- Martin Fowler (with contributions by Kent Beck). Refactoring: Improving the Design of Existing Code, 2nd ed. Addison-Wesley, 2018. ISBN 978-0134757599.
- Joshua Kerievsky. Refactoring to Patterns. Addison-Wesley, 2004. ISBN 978-0321213358.
- Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1994. ISBN 978-0201633610.
This site does not reproduce the books’ prose, diagrams, or code listings. The agent-side force fields, the compare-view commentary, and any synthesized examples are original to Refactoring In The Loop. This is a reference and study aid; it is not a substitute for reading the originals. Where an example is derived from a source book, the entry carries a per-entry citation in its exampleSource field.
AI in production
Portions of this site’s prose, including the agent-side force fields, were drafted by AI coding agents (Anthropic Claude) working from the source books and reviewed and edited by the author. The architecture, voice rubric, and editorial decisions are the author’s.
Contact
Feedback to [email protected].