agentsclimarketplace

Refactor

Skill Pamacea/smite/plugins/studio/skills/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 in smite project. Invoke FIRST when cleaning up code, improving structure, or optimizing - provides systematic validation with 6 modes (--quick, --full, --analyze, --review, --resolve, --verify) plus 3 specialized modes (--profile for performance, --security for vulnerabilities, --types for TypeScript) with auto-team activation for complex refactors. Specific phrases: 'refactor this', 'clean up code', 'improve this function', 'optimize this', 'restructure this module'. (user)

SKILL.md

6.0 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it

Refactor Skill

Mission

Provide unified, systematic code refactoring through comprehensive validation, ensuring safe improvements while preserving functionality.

What this skill accomplishes:

  • Cleans up code while maintaining functionality
  • Improves structure and maintainability
  • Optimizes performance with measured improvements
  • Enhances security through vulnerability scanning
  • Strengthens type safety in TypeScript codebases

Scope Definition

This skill applies to:

  • Code cleanup and simplification
  • Structure improvement and reorganization
  • Performance optimization with metrics
  • Security vulnerability remediation
  • Type safety enhancement
  • Duplication elimination

Related Skills

For tasks outside this scope, consider:

  • /studio build - New feature implementation
  • /studio review - Code review without refactoring
  • Edit tool - Simple renames or documentation updates
  • /studio build --test - Test writing

Tool Selection Standards

TaskRecommended ToolAvoid
Find code by meaninggrepai searchgrep/egrep/find
Read file contentsRead toolcat/head/tail
List filesGlob toolls/dir/find
Search file contentsGrep toolgrep/rg

Decision Guide:

  • Need to search? → grepai search or /toolkit search
  • Need to read? → Read tool
  • Need to list? → Glob tool
  • Need to grep? → Grep tool

Execution Protocol

Step 1: Analysis (Always First)

Understand before acting:

  1. Use semantic search to locate relevant code
  2. Read files with the Read tool
  3. Identify complexity hotspots
  4. Detect duplication patterns
  5. Assess test coverage

Step 2: Planning (For Multi-File Changes)

Create a plan when:

  • Modifying 3+ files
  • Restructuring a module
  • Running subagents
  • Using analyze/full/resolve modes

Step 3: Execution (Incremental)

Apply changes safely:

  1. Make small, verifiable changes
  2. Run tests after each change
  3. Commit logical units
  4. Document rationale

Step 4: Verification

Confirm success:

  • All tests passing
  • No type errors
  • Metrics documented
  • No regressions detected

Quality Gates

Pre-Refactor Checklist

Analysis Complete:
- [ ] Semantic search performed
- [ ] Relevant files read
- [ ] Complexity assessed
- [ ] Test coverage verified

Post-Refactor Checklist

Validation Complete:
- [ ] All tests passing
- [ ] No type errors
- [ ] No regressions
- [ ] Metrics improved
- [ ] Documentation updated

Mode-Specific Gates

ModeAdditional Gates
--profilePerformance improved >= 20%
--securityAll P0/P1 vulnerabilities fixed
--typesZero any, coverage >= 95%
--cleanNet code reduction achieved

Success Metrics

Universal Metrics

  • Test Status: All tests passing
  • Type Safety: No type errors
  • Complexity: Reduced from baseline
  • Coverage: Increased from baseline
  • Regressions: Zero detected
  • Documentation: Complete and accurate

Mode-Specific Metrics

ModeKey Metrics
--profileExecution time, memory usage, query count
--securityP0/P1 vulnerabilities fixed
--typesType coverage %, any count
--cleanLines removed, duplication eliminated

Mode Quick Reference

ModePurposeWhen to Use
--quickAuto-fix low-risk itemsRisk < 30, complexity < 8
--fullComplete workflow (default)Standard refactoring
--analyzeAnalysis onlyDetect and catalog issues
--reviewCreate action planPrioritize by severity
--resolveApply validated changesFrom review results
--verifyComprehensive verificationValidate results
--profilePerformance optimizationSlow functions, high memory
--securitySecurity scanOWASP compliance, audit
--typesTypeScript improvementPoor types, any usage

Scope Options

OptionPurposeExample
--scope=recentRecent changes only (default)/studio refactor --quick
--scope=file:PATHSpecific file--scope=file:src/auth/jwt.ts
--scope=directory:PATHEntire directory--scope=directory:src/features/auth
--scope=allEntire codebase--scope=all
--scope=bugBug fixing--scope=bug "TypeError in auth"

Auto-Team System

Agent teams activate automatically for complex refactors:

CriterionThresholdTeam Size
Files to analyze>= 52 agents
Modesanalyze/full/profile/security/types2-3 agents
Complexity detectedHigh2-3 agents

Disable teams: Add --no-team flag


Examples

# Quick refactor
/studio refactor --quick

# Full workflow with performance profiling
/studio refactor --full --profile

# Security audit
/studio refactor --security --scope=all

# Type safety improvement
/studio refactor --types --scope=directory:src/features

# Bug-specific refactor
/studio refactor --scope=bug "TypeError in auth"

# Team-based performance + security
/studio refactor --profile --security --team

See Also

Full documentation: @REFERENCE.md

  • Mode details (workflow, examples, success criteria)
  • Specialized modes (profile, security, types)
  • Subagent collaboration
  • Common patterns (Extract Method, etc.)
  • Configuration
  • Integration

Refactor Skill v2.1.0

What ships with it: 1 file

12.9 KB alongside SKILL.md

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.