Claude-skill-registry code-refactoring-assistant
Analyzes codebases by impact scope (low/medium/high), generates refactoring checklists, supports interactive review, executes refactors with QA, and produces detailed optimization reports.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/code-refactoring-assistant" ~/.claude/skills/majiayu000-claude-skill-registry-code-refactoring-assistant && rm -rf "$T"
skills/data/code-refactoring-assistant/SKILL.mdCode Refactoring Assistant
This skill is a comprehensive tool for safe code refactoring. It analyzes codebase changes by impact scope, creates prioritized checklists, facilitates user review, executes approved refactors, performs quality assurance, and generates before/after reports with metrics.
Distinguished from priority optimizers: Focuses on impact scope (files/modules/deps/tests) rather than business priority, with richer interactive review (yes/no/back/feedback).
Capabilities
- Impact Analysis: Assess refactoring scope (low: <5 files/local; medium: 5-20 files/module; high: >20 files/cross-module/deps)
- Checklist Generation: Structured lists grouped by impact, with risks and benefits
- Interactive Review: yes/no/back/other feedback per item
- Refactor Execution: Apply changes to files with git diffs
- QA Validation: Check style, tests, coverage, performance
- Reporting: Before/after comparisons, metrics delta, visualizations
Input Requirements
JSON format:
: {codebase
: [{files
,path
,lines
}],deps
: [...],tests
: ["improve modularity", "reduce complexity"]}goals
: Optional baseline (coverage %, perf ms)metrics- Data from Claude tools (Glob/Grep/Bash git status)
Quality: Accurate file lists, recent git state.
Output Formats
: Items with id/impact/desc/riskschecklist.json
: User choices per itemreview_decisions.json
: Executed diffschanges.diff
: Pass/fail metricsqa_report.json
: Full comparison (tables, charts)final_report.md
How to Use
@[code-refactoring-assistant] Analyze current repo for low-impact refactors to improve modularity, then review checklist.
Scripts
: Orchestrates 6 core classes (ImpactAnalyzer, RefactoringPlanner, ReviewInterface, RefactoringExecutor, QAValidator, RefactoringReporter)refactoring_assistant.py
Best Practices
- Start with low-impact items
- Backup repo (git stash/branch) before execution
- Provide test paths for accurate QA
- Review high-impact manually
- Iterate: Refactor → QA → Report → Re-analyze
Limitations
- Relies on Claude tools for real file access (no direct FS write)
- Simulated execution in samples; real uses git/Bash tools
- Complex deploys need human oversight
- Python sandbox limits (no external libs beyond std)