Skip to main content
skill CX Codex

refactor-project — Claude Code skill: project-wide refactoring

refactor-project — a skill for Claude Code, Codex, Cursor and other agents that runs automated refactoring across every file in the project at once. Cuts duplication, normalises patterns, and strips legacy code in a single pass.

MIT 122 installs ★ 597 updated 2026-10-09

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add FradSer/dotclaude --skill refactor-project -a claude-code
Open on GitHub

What refactor-project does

The skill opens by checking for a git workspace via git rev-parse --is-inside-work-tree — project-wide mode won't start outside one. The current commit hash is captured and included in the final summary so you can roll back with git restore --worktree --staged ..

Execution runs in three phases. First, Glob discovers all source files and filters out node_modules/, .git/, dist/, build/, vendor/, and .venv/. Then the refactor:code-simplifier agent launches with an aggressive mode flag for legacy removal; it auto-loads the refactor:best-practices skill and applies language-specific patterns. No confirmation prompt interrupts the run after the scope summary is shown.

The summary lists files changed, cross-file duplicates removed, and practices applied. Public interfaces and existing behaviour stay intact unless you explicitly ask for a change.

What it helps with

  • eliminate duplicated code across multiple files in one run
  • standardise naming conventions and style throughout the codebase
  • remove legacy code with aggressive-mode cleanup
  • record a rollback point before a large-scale refactor
  • run project-wide refactoring without per-step confirmations

Example prompts for the agent

  • Run /refactor-project to refactor the entire codebase
  • Clean up duplicate logic and unify style across all source files
  • Remove legacy code from the whole project

How to install refactor-project

1Skills CLI (Vercel)

npx skills add FradSer/dotclaude --skill refactor-project -a claude-code

2Manually: put the files in place

~/.claude/skills/refactor-project/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/refactor-project/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about refactor-project

How do I install refactor-project in Claude Code?

Run npx skills add FradSer/dotclaude --skill refactor-project -a claude-code. The skill file will be placed at ~/.claude/skills/refactor-project/SKILL.md.

What does the refactor-project skill do?

It scans all source files, launches the refactor:code-simplifier agent with cross-file optimisation, and produces a summary with a rollback command tied to the recorded commit.

Does refactor-project require a git repository?

Yes. The skill runs git rev-parse --is-inside-work-tree on startup; project-wide mode is blocked if the check fails.

Source text

SKILL.md · MIT
---
name: refactor-project
description: 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".
argument-hint: (no arguments needed)
allowed-tools: ["Task", "Read", "Bash(git:*)", "Grep", "Glob"]
user-invocable: true
---

# Refactor Project Command

Execute automated project-wide refactoring using `refactor:code-simplifier` agent with cross-file optimization focus.

## Pre-operation Checks
**Goal**: Ensure project-wide execution is explicit and reproducible.

**Actions**:
1. Run `git rev-parse --is-inside-work-tree`; if false, inform user that project-wide mode requires a git workspace
2. Record current revision with `git rev-parse --short HEAD` and include it in final summary for rollback context
3. Ignore command arguments and proceed with full-project discovery

## Phase 1: Analyze Project Scope
**Goal**: Discover all code files and display scope summary.

**Actions**:
1. Find all code files using Glob patterns for common extensions
2. Filter out `node_modules/`, `.git/`, `dist/`, `build/`, `vendor/`, `.venv/`
3. Group files by language/extension and identify primary source directories
4. Display scope summary (file count, languages, directories) then proceed automatically

See `references/scope-analysis.md` for exclusion patterns and edge cases.

## Phase 2: Launch Refactoring Agent
**Goal**: Execute `refactor:code-simplifier` agent with project-wide scope and cross-file focus.

**Actions**:
1. Launch `refactor:code-simplifier` agent with all discovered code files
2. Pass cross-file optimization emphasis: duplication reduction, consistent patterns
3. Pass aggressive mode flag for legacy code removal
4. 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 project-wide changes.

**Actions**:
1. Report total files refactored (count and percentage of project)
2. List changes categorized by improvement type and cross-file improvements made
3. List best practices applied and legacy code removed
4. Suggest test suite to run and recommend reviewing changes in logical groups
5. Provide safer rollback command tied to recorded baseline (for example: `git restore --worktree --staged .`)

See `references/output-requirements.md` for detailed summary format.

## Requirements

- Execute immediately after displaying scope (no confirmation needed)
- Refactor entire project across all discovered code files
- Prioritize cross-file duplication reduction and consistent patterns
- Preserve behavior and public interfaces unless user explicitly requests a behavior change

© FradSer · MIT · FradSer/dotclaude

Similar skills

All skills for Code review and refactoring →

From the same set16

The whole set →
executing-plans executing-plans — a skill for Claude Code, Codex, and Cursor. Executes written implementation plans in task batches using isolated coordinator sub-agents and a single final commit. CX Codex +1 126installs commit-and-push commit-and-push — a skill for Claude Code, Codex, Cursor, and other platforms that generates atomic commits using Conventional Commits standard via git-agent and pushes them to the remote repository. CX Codex +1 126installs brainstorming brainstorming — a skill for Claude Code and five other tools that turns raw ideas into ready BDD specs. It researches your codebase autonomously and commits the technical design without asking questions mid-run. CX Codex +1 124installs writing-plans writing-plans — a skill for Claude Code, Codex, Cursor and other platforms that transforms a finished design into an executable implementation plan. CX Codex +1 123installs plugin-best-practices plugin-best-practices validates Claude Code plugin structure, manifests, and architecture against framework standards. Ensures your plugin meets requirements before marketplace submission. CX Codex +1 121installs commit This skill creates atomic conventional commits through git-agent. Use it when a short intent should become a focused Git commit. CX Codex +1 121installs optimize-plugin optimize-plugin validates Claude plugin structure, runs Python sanity checks, and fixes issues via a subagent. Useful when auditing or refactoring plugin manifests and components. CX Codex +1 117installs create-prd The create-prd skill turns product ideas into a structured PRD through a guided interview, then saves it as Markdown or creates a Feishu document. CX Codex +1 117installs

Project sponsors

Companies that keep this analytics open