Scan entire codebase for files that need refactoring
Analyzes codebase to identify files needing refactoring based on size, complexity, and pattern violations.
/plugin marketplace add MaxBoiko21/claude-plugins-marketplace/plugin install code-splitter@own-plugins-marketplaceAnalyze the entire project to identify files needing refactoring based on:
/split-codeRead project configuration from .claude/code-splitter.local.md if it exists (use Read tool).
Default thresholds (can be overridden in project config):
Use package.json, composer.json, and file structure to determine:
Based on project type, identify relevant file patterns:
Laravel/Symfony:
app/**/*Controller.php, src/**/Controller/app/**/Service.php, src/**/Service/app/**/*.php excluding Controllers, ActionsReact/Vue:
src/components/**/*.{jsx,tsx,vue}src/sections/**/*.{jsx,tsx,vue}src/pages/**/*.{jsx,tsx,vue}src/hooks/**/*.ts, src/composables/**/*.tsNode.js:
src/services/**/*.tssrc/routes/**/*.ts, src/handlers/**/*.tsFor each file:
Count lines: Total lines of code (excluding comments/blanks for accuracy)
Count methods/functions:
public function, private function, protected functionfunction, async function, const x = () => {}function, exports, methodsAssess pattern violations:
Calculate refactoring score:
Present results as an interactive selection menu:
📊 Code Splitter Scan Report
=============================
Project Type: Laravel
Files Analyzed: 42
Candidates Found: 7
Refactoring Candidates:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
□ app/Http/Controllers/UserController.php
Lines: 425 | Methods: 15 | Score: 2/3
Issues: Size violation (125 lines over), complexity violation (5 extra methods)
□ app/Services/OrderService.php
Lines: 380 | Methods: 18 | Score: 2/3
Issues: Too many methods, mixed concerns (creation, payment, shipping)
□ app/Models/User.php
Lines: 220 | Methods: 12 | Score: 1/3
Issues: Complexity violation (2 extra methods)
✓ All other files are within thresholds
Recommended Action:
Use `/split-code <file-path>` on any candidate above to refactor it.
If user wants, present a checkbox interface to select multiple candidates:
Select files to analyze further:
[✓] app/Http/Controllers/UserController.php
[ ] app/Services/OrderService.php
[ ] app/Models/User.php
Press to analyze selected files
Present as:
/split-code <file-path> to refactorLaravel Project:
File: app/Http/Controllers/UserController.php
Type: Controller
Lines: 425 (threshold: 300, 125 over)
Methods: 15 (threshold: 10, 5 over)
Violations:
• Size: 425 lines exceeds 300 line threshold
• Complexity: 15 methods exceeds 10 method threshold
• Pattern: Heavy business logic should be in Action classes
Score: 3/3 - High Priority
React Project:
File: src/components/Dashboard.tsx
Type: Component
Lines: 380 (threshold: 300, 80 over)
Methods: 8 hooks + embedded logic
Violations:
• Size: 380 lines exceeds 300 line threshold
• Logic: Data fetching, form state, and rendering mixed
• Pattern: Should split into sub-components and custom hooks
Score: 2/3 - Medium Priority
Read .claude/code-splitter.local.md for overrides:
line_threshold: Override 300 line defaultmethod_threshold: Override 10 method default