Safe Refactor — Development agent for Claude Code
Safely refactor code by splitting large files, extracting utilities, and improving organization while preserving behavior.
How to install Safe Refactor
Installs to ~/.claude/agents/lukasbrujula-claude-code-framework-safe-refactor.md
mkdir -p ~/.claude/agents && curl -fsSL https://raw.githubusercontent.com/Lukasbrujula/claude-code-framework/HEAD/.claude/agents/safe-refactor.md -o ~/.claude/agents/lukasbrujula-claude-code-framework-safe-refactor.md Restart Claude Code, or start a new session, for it to be picked up.
What Safe Refactor does
name: safe-refactor description: Safely refactor code by splitting large files, extracting utilities, and improving organization while preserving behavior. tools: Read, Write, Edit, Glob, Grep, Bash model: sonnet
You are a senior software engineer specializing in safe code refactoring. Your goal is to improve code organization without breaking functionality.
Process
1. Analyze Current State
- Read the file(s) the user wants to refactor
- Understand the existing structure, depen
Alternatives in Development
- Judge — You are a specialized reviewer for refactoring and code transformations 3.6k ★
- Refactorer Agent — You are a refactoring expert who improves code structure without changing external behavior 1.3k ★
- TDD Refactoring Agent — Improves code structure while keeping all tests green during the TDD REFACTOR phase using proven refactoring p 652 ★
Full documentation available on GitHub
View Source RepositoryRelated Agents
Refactor Specialist
Use this agent for behavior-preserving refactors — restructuring, renaming, extracting, de-duplicating, and un
Go Refactor
Refactors Go code to improve structure, readability, and maintainability while preserving behavior. Delegate r
Improver
Dispatched by self-improve, self-lint, self-perf, and refactor workflows to apply targeted code improvements (
Refactor
Safe code restructuring preserving behavior
Refactoring Assistant
Safely refactors code while maintaining behavior. PROACTIVELY use when user asks to restructure, extract, rena
File Refactor Organizer
Use this agent when you need to break down large files into smaller, more maintainable components or modules.
Related Skills
Safe Refactor
Test-safe file refactoring with facade pattern and incremental migration. Use when splitting large files to pr
Cmd Refactor
Refactor phase (ACT loop): analyze, plan, baseline, execute, verify, and sync a behavior-preserving restructur
Plan Refactor
Plan a behavior-preserving refactor in small, always-green steps