refactoring
Guide for safe and effective code refactoring. Focuses on improving code structure without changing external behavior. Covers patterns like extraction…
от s-hiraoku★ 19 звёзд на GitHub
Установить refactoring в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Refactoring Guide Skill
Refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior.
Core Refactoring Patterns
1. Composing Methods
- Extract Method: If a method is too long or complex, turn a fragment of it into its own method.
- Inline Method: If a method body is as clear as its name, move the body into the callers and delete the method.
2. Moving Features Between Objects
- Move Method/Field: Relocate logic to the class where it most naturally belongs to reduce coupling.
3. Simplifying Expressions
- Decompose Conditional: Extract complex conditional logic into clearly named methods.
- Consolidate Conditional Expression: Merge multiple conditional checks that lead to the same result.
4. Clean Code & Naming
- Rename: Use clear, intention-revealing names for variables, methods, and classes.
- Replace Magic Number with Symbolic Constant: Use named constants instead of literal numbers.
Safe Refactoring Workflow
- Verify Tests: Ensure you have a solid test suite that passes before starting.
- Small Steps: Make one tiny change at a time.
- Run Tests: Execute the test suite after every small change to catch regressions immediately.
- Commit Often: Commit your changes once a small refactoring step is complete and verified.
When to Refactor
- Rule of Three: Refactor when you find yourself doing something for the third time.
- Code Smells: Refactor when you encounter long methods, large classes, or duplicated code.
- Adding Features: Refactor before adding new functionality to make the implementation easier.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл refactoring?
Guide for safe and effective code refactoring. Focuses on improving code structure without changing external behavior. Covers patterns like extraction, inlining, and naming improvements.
Как установить скилл refactoring?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл refactoring запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis 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…