refactor
Executes automated refactoring for specific files, directories, or semantic queries. This skill should be used when the user asks to refactor specific files or directories, simplify recently changed code, clean up dead code in a limited scope, or invokes "/refactor".
What this skill does
# Refactor Command Execute automated refactoring for $ARGUMENTS using `refactor:code-simplifier` agent. ## Pre-operation Checks **Goal**: Ensure scope resolution is deterministic before launching the agent. **Actions**: 1. Run `git rev-parse --is-inside-work-tree` and continue even if false when explicit paths are provided 2. Normalize arguments by trimming whitespace and preserving quoted path segments 3. Treat an empty argument list as "recent changes" mode ## Phase 1: Determine Target Scope **Goal**: Identify files to refactor based on arguments or session context. **Actions**: 1. If arguments provided: verify as file/directory paths using Glob 2. If paths exist: use them directly as refactoring scope 3. If paths don't exist: treat arguments as semantic query, search codebase with Grep 4. If no arguments: run `git diff --name-only` to find recently modified code files 5. If no recent changes found: inform user and exit without refactoring See `references/scope-determination.md` for search strategies and edge cases. ## Phase 2: Launch Refactoring Agent **Goal**: Execute `refactor:code-simplifier` agent with aggressive mode enabled. **Actions**: 1. Launch `refactor:code-simplifier` agent with target scope and aggressive mode flag 2. Pass scope determination method (paths, semantic query, or session context) 3. Agent auto-loads `refactor:best-practices` skill and applies language-specific patterns See `references/agent-configuration.md` for detailed Task parameters. ## Phase 3: Summary **Goal**: Report comprehensive summary of changes. **Actions**: 1. Report total files refactored and changes categorized by improvement type 2. List best practices applied and legacy code removed 3. Suggest tests to run and provide rollback command tailored to actual scope (for example: `git restore --worktree --staged <files>`) See `references/output-requirements.md` for detailed summary format. ## Requirements - Execute immediately without user confirmation - Refactor ALL matching files when semantic search returns multiple results - Direct users to `/refactor-project` for project-wide scope - Preserve behavior and public interfaces unless user explicitly requests a behavior change
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.