fowler-refactoring
БесплатноБез исполняемых скриптовНе проверенUse when refactoring code with behavior-preserving steps.
от existential-birds★ 92 звезды на 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.
Procedure
- Identify the actual next change or comprehension obstacle. Improve changeability, not aesthetics or line count.
- Inspect observable behavior, dependencies, mutation, error paths, and callers; establish a self-checking test baseline.
- Choose a small named transformation and load its chapter mechanics before editing.
- Separate structural work from feature work. Preserve behavior during the refactoring step.
- Make one small change, run the relevant checks through
terminal, and inspect the result. If it fails, repair or undo only that change; reduce the step size. - Use temporary adapters or delegation when a move cannot be atomic; remove obsolete paths only when consumers have migrated.
- Stop when the intended change is easier and the scoped obstacle is removed. Add the new behavior in a separate, tested step if requested.
- Report changed locations, the reason for the transformation, actual check results, and remaining uncertainty. Do not commit, push, or change public contracts without authorization.
Central decision rules
- Prefer short, reversible transformations over a long broken intermediate state.
- Use names to store understanding; extraction pays for itself when intention becomes clearer, even without reuse.
- Structure follows the expected axis of change: separate independent concerns; group behavior and data that change together.
- Inverse refactorings are legitimate choices, not contradictions. Judge the target context, not an abstract preference for more objects or fewer functions.
- Treat smells as investigation prompts, not proof of a defect or a numerical cleanup quota.
- Keep externally observable results, side effects, errors, ordering, and contracts stable; repository-specific constraints take precedence over book-era examples.
- Prefer measured performance evidence to intuition. Preserve explicit latency, memory, and concurrency requirements while changing structure.
- Fowler's private-commit rhythm illustrates recovery checkpoints; it does not authorize Git writes in the user's repository.
Chapter index
Load only the relevant file by reading its relative path (for example references/ch01-first-example.md); every file below is part of this skill.
- Chapter 1: First example — load for a complete decomposition, phase separation, and polymorphism sequence.
- Chapter 2: Principles — load for scope, timing, legacy code, published interfaces, migrations, architecture, and performance.
- Chapter 3: Code smells — load to diagnose a concrete change obstacle and select candidate transformations.
- Chapter 4: Building tests — load for self-checking baselines, isolated fixtures, boundary probes, and regression tests.
- [Chapter 5: Using the catalog](references/ch05-using-the-cata
Установить fowler-refactoring в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл fowler-refactoring?
Use when refactoring code with behavior-preserving steps.
Как установить скилл fowler-refactoring?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл fowler-refactoring запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic