agentsclimarketplace

Refactor

Skill Pamacea/smite/plugins/studio/skills/optional/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.

Install
npx -y skills add Pamacea/smite --skill refactor

Assembled 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

NeedToolExample
Search codegrepai search or /toolkit searchFind patterns across files
Read fileRead toolAccess file contents
Edit codeEdit toolReplace specific strings
Create fileWrite toolNew file with content

Quick Reference

ModeUsageBest For
--quickAuto-fix low-risk itemsSafe, fast improvements
--fullComplete refactoring workflowComprehensive changes
--analyzeAnalysis onlyUnderstanding code health
--profilePerformance profilingOptimization work
--securityOWASP Top 10 scanSecurity audits
--typesTypeScript improvementType 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

ScopeDescriptionExample
recentRecent changes onlyDefault mode
file:PATHSpecific file--scope=file:src/auth/jwt.ts
directory:PATHEntire directory--scope=directory:src/features/auth
allEntire codebase--scope=all
bugBug 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:

  1. Identifies safe improvements
  2. Applies refactoring patterns
  3. Tests after each change
  4. Commits verified changes

--full (Full Mode - Default)

Purpose: Complete refactoring workflow

Workflow:

  1. ANALYZE - Detect issues
  2. REVIEW - Classify and prioritize
  3. RESOLVE - Apply changes
  4. 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:

  1. Measure current performance
  2. Identify bottlenecks
  3. Apply optimizations
  4. 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 any with proper types
  • Adds Zod validation at boundaries
  • Removes unsafe type assertions
  • Improves type coverage

Success Criteria:

  • Zero any in production code
  • Type coverage ≥ 95%
  • tsc --strict passing

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

ModeAdditional Criteria
--profilePerformance improved ≥ 20%
--securityAll P0/P1 vulnerabilities fixed
--typesZero any, coverage ≥ 95%

Best Practices

  1. Always analyze first - Understand issues before acting
  2. Validate changes - Never skip validation step
  3. Start with quick wins - Build momentum
  4. Test continuously - After each small change
  5. Commit logically - Small, reviewable commits
  6. 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.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.