Skip to content
Skills Library
Programming · Building & coding

refactor

/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".

Repository
dotclaude ↗
Licence
MIT
Last repository change
26.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 26.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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".

Arguments

/refactor [files-or-directories-or-semantic-query]
Original author description

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".

How it works

  1. Pre-operation Checks
  2. Phase 1: Determine Target Scope
  3. Phase 2: Launch Refactoring Agent
  4. Phase 3: Summary
  5. Requirements
Original SKILL.md headings · 54 lines, 318 words
SKILL.md preview
---
name: refactor
description: 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".
argument-hint: "[files-or-directories-or-semantic-query]"
allowed-tools: ["Task", "Read", "Bash(git:*)", "Grep", "Glob"]
user-invocable: true
---

# 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

CRITICAL: Never include `node_modules/`, `.git/`, `dist/`, `build/`, lock files, or compiled artifacts in refactoring scope — use Grep `--glob` exclusions to enforce.

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
Files in this package (4)
  • SKILL.md 3 KB
  • references/agent-configuration.md 5 KB
  • references/output-requirements.md 6 KB
  • references/scope-determination.md 3 KB

Versions

RepositoryScoreLicence
This page · FradSer/dotclaude100MIT
froglet-studio/cosmic-shore100MIT
mgiovani/cc-arsenal100MIT
jongio/skills100MIT
boshu2/agentops100Apache-2.0
y-miyazaki/terraform-aws-base100Apache-2.0
mickeyyaya/evolve-loop100Apache-2.0
j0hanz/j0hanz-marketplace100MIT
kriscard/kriscard-claude-plugins100MIT

Database snapshot: 13.11.2026 · package version 7c70b1853ea5 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 86simplify
    Use when the user asks to simplify, clean up or refactor recently changed code without changing what it does (duplication, dead code, needless complexity).
  • 90code-simplifier
    Use when user asks to simplify, clean up, or refactor recently modified code for readability, consistency, or maintainability without changing behavior, especially after implementation and before broader review.
  • 100refactor-project
    Executes automated project-wide refactoring with a focus on cross-file optimization. This skill should be used when the user asks for project-wide refactoring, cross-file simplification, consistency standardization across the codebase, duplication reduction, or invokes "/refactor-project".
  • 100code-simplify
    Use when code needs simplification — recently modified code by default, or a specified scope.
  • 86refactoring
    Use when the user asks to refactor code.
  • 100simplify-code
    Use to simplify recently modified code and human-facing docs while preserving behavior and stated facts.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.