Refactor
Au-delà de l'efficience, l'osmose. Plus que des scripts, ces agents Claude Code sont les membres fantômes de notre intellect : des extensions vitales plutôt que de simples exécutants.
npx -y skills add Pamacea/smite --skill refactorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
MANDATORY gate before ANY refactoring task. Systematic validation with 6 modes (--quick, --full, --analyze, --review, --resolve, --verify) plus 3 specialized modes (--profile for performance, --security for vulnerabilities, --types for TypeScript). Specific phrases: 'refactor this', 'clean up code', 'improve this function'.
SKILL.md
5.3 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
Refactor Skill - Unified Agent v2.0
Lazy-loaded skill - Only loaded when explicitly invoked via
/studio refactor
🛠️ Standard Tool Kit
✅ RECOMMENDED: grepai search "pattern" | /toolkit search "query"
✅ FOR READING: Read tool (optimized for file access)
✅ FOR EDITING: Edit tool (precise string replacement)
✅ FOR WRITING: Write tool (new file creation)
Tool Selection Guide
| Need | Tool | Example |
|---|---|---|
| Search code | grepai search or /toolkit search | Find patterns across files |
| Read file | Read tool | Access file contents |
| Edit code | Edit tool | Replace specific strings |
| Create file | Write tool | New file with content |
Quick Reference
| Mode | Usage | Best For |
|---|---|---|
--quick | Auto-fix low-risk items | Safe, fast improvements |
--full | Complete refactoring workflow | Comprehensive changes |
--analyze | Analysis only | Understanding code health |
--profile | Performance profiling | Optimization work |
--security | OWASP Top 10 scan | Security audits |
--types | TypeScript improvement | Type safety |
Examples
# Quick cleanup for low-risk items
/studio refactor --quick
# Complete workflow on recent changes
/studio refactor --full --scope=recent
# Performance profiling
/studio refactor --profile --scope=all
# Security audit on auth module
/studio refactor --security --scope=directory:src/auth
# Type safety improvement
/studio refactor --types --scope=recent
Scope Options
| Scope | Description | Example |
|---|---|---|
recent | Recent changes only | Default mode |
file:PATH | Specific file | --scope=file:src/auth/jwt.ts |
directory:PATH | Entire directory | --scope=directory:src/features/auth |
all | Entire codebase | --scope=all |
bug | Bug fixing | --scope=bug "TypeError in auth" |
Mode Details
--quick (Quick Mode)
Purpose: Auto-fix low-risk items with confidence
When to Use:
- Risk score < 30
- Complexity < 8
- Test coverage > 80%
What it does:
- Identifies safe improvements
- Applies refactoring patterns
- Tests after each change
- Commits verified changes
--full (Full Mode - Default)
Purpose: Complete refactoring workflow
Workflow:
- ANALYZE - Detect issues
- REVIEW - Classify and prioritize
- RESOLVE - Apply changes
- VERIFY - Validate results
--analyze (Analysis Only)
Purpose: Understand code health without changes
Analysis includes:
- Complexity metrics (cyclomatic, cognitive)
- Duplication detection
- Code smell identification
- Maintainability assessment
--profile (Performance Profiling)
Purpose: Identify and fix performance bottlenecks
When to Use:
- Functions are slow
- Memory usage is high
- Need optimization metrics
Workflow:
- Measure current performance
- Identify bottlenecks
- Apply optimizations
- Verify improvement
--security (Security Scanning)
Purpose: Detect and fix security vulnerabilities
OWASP Top 10 Checked:
- Injection attacks (SQL, NoSQL, XSS)
- Authentication/Authorization issues
- Sensitive data exposure
- Cryptographic failures
- Dependency vulnerabilities
Severity Levels:
- P0 - Critical (immediate fix)
- P1 - High (fix ASAP)
- P2 - Medium (fix soon)
- P3 - Low (fix when possible)
--types (TypeScript Improvement)
Purpose: Improve type safety and eliminate any
What it does:
- Replaces
anywith proper types - Adds Zod validation at boundaries
- Removes unsafe type assertions
- Improves type coverage
Success Criteria:
- Zero
anyin production code - Type coverage ≥ 95%
tsc --strictpassing
Core Principles
- Safety First - Validate all changes before implementation
- Incremental - Small, verifiable steps
- Evidence-Based - Use metrics to guide decisions
- Test Continuously - Run tests after each change
- Document Thoroughly - Explain what and why
Success Criteria
Universal
- ✅ All tests passing
- ✅ No type errors
- ✅ Complexity reduced
- ✅ No regressions
- ✅ Documentation complete
Mode-Specific
| Mode | Additional Criteria |
|---|---|
--profile | Performance improved ≥ 20% |
--security | All P0/P1 vulnerabilities fixed |
--types | Zero any, coverage ≥ 95% |
Best Practices
- Always analyze first - Understand issues before acting
- Validate changes - Never skip validation step
- Start with quick wins - Build momentum
- Test continuously - After each small change
- Commit logically - Small, reviewable commits
- Document thoroughly - Explain reasoning
Full Documentation
For complete documentation including advanced patterns, subagent collaboration, and configuration options, see the main refactor skill.
Version: 2.0.0 | Lazy Load: Enabled
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.