Agent SkillsFradSer/dotclaude › refactor-project

refactor-project

GitHub

执行跨文件优化的项目级自动化重构,通过代码简化器减少重复、统一模式并清理遗留代码。适用于用户请求全项目重构或调用/refactor-project指令时,确保行为一致性和可回滚性。

refactor/skills/refactor-project/SKILL.md FradSer/dotclaude

Trigger Scenarios

用户请求项目级重构 调用 /refactor-project 命令

Install

npx skills add FradSer/dotclaude --skill refactor-project -g -y
More Options

Non-standard path

npx skills add https://github.com/FradSer/dotclaude/tree/main/refactor/skills/refactor-project -g -y

Use without installing

npx skills use FradSer/dotclaude@refactor-project

指定 Agent (Claude Code)

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

安装 repo 全部 skill

npx skills add FradSer/dotclaude --all -g -y

预览 repo 内 skill

npx skills add FradSer/dotclaude --list

SKILL.md

Frontmatter
{
    "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\".",
    "allowed-tools": [
        "Task",
        "Read",
        "Bash(git:*)",
        "Grep",
        "Glob"
    ],
    "argument-hint": "(no arguments needed)",
    "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

Version History

  • 6f2a0b2 Current 2026-08-20 11:01

Same Skill Collection

.claude/skills/reflect-skills-from-memory/SKILL.md
acpx/skills/use-acpx/SKILL.md
antigravity/skills/delegate/SKILL.md
antigravity/skills/research/SKILL.md
code-context/skills/code-context/SKILL.md
code-context/skills/get-context/SKILL.md
git-agent/skills/commit-and-push/SKILL.md
git-agent/skills/commit/SKILL.md
git-agent/skills/init/SKILL.md
git-agent/skills/related/SKILL.md
git/skills/commit-and-push/SKILL.md
git/skills/commit/SKILL.md
git/skills/finish-feature/SKILL.md
git/skills/finish-hotfix/SKILL.md
git/skills/finish-release/SKILL.md
git/skills/start-feature/SKILL.md
git/skills/start-hotfix/SKILL.md
git/skills/start-release/SKILL.md
github/skills/create-issues/SKILL.md
github/skills/create-pr/SKILL.md
github/skills/resolve-issues/SKILL.md
github/skills/review-pr/SKILL.md
hardware/skills/use-kicad-cli/SKILL.md
hardware/skills/use-openscad/SKILL.md
interfaces/skills/better-interface/SKILL.md
lark/skills/SKILL.md
marketing/skills/SKILL.md
mattpocock/skills/deprecated/design-an-interface/SKILL.md
mattpocock/skills/deprecated/qa/SKILL.md
mattpocock/skills/deprecated/request-refactor-plan/SKILL.md
mattpocock/skills/deprecated/ubiquitous-language/SKILL.md
mattpocock/skills/engineering/ask-matt/SKILL.md
mattpocock/skills/engineering/bdd/SKILL.md
mattpocock/skills/engineering/code-review/SKILL.md
mattpocock/skills/engineering/codebase-design/SKILL.md
mattpocock/skills/engineering/diagnosing-bugs/SKILL.md
mattpocock/skills/engineering/domain-modeling/SKILL.md
mattpocock/skills/engineering/grill-with-docs/SKILL.md
mattpocock/skills/engineering/implement/SKILL.md
mattpocock/skills/engineering/improve-codebase-architecture/SKILL.md
mattpocock/skills/engineering/prototype/SKILL.md
mattpocock/skills/engineering/research/SKILL.md
mattpocock/skills/engineering/resolving-merge-conflicts/SKILL.md
mattpocock/skills/engineering/setup-matt-pocock-skills/SKILL.md
mattpocock/skills/engineering/tdd/SKILL.md
mattpocock/skills/engineering/to-spec/SKILL.md
mattpocock/skills/engineering/to-tickets/SKILL.md
mattpocock/skills/engineering/triage/SKILL.md
mattpocock/skills/engineering/wayfinder/SKILL.md
mattpocock/skills/engineering/wizard/SKILL.md

Metadata

Files
0
Version
6f2a0b2
Hash
f9e6ce65
Indexed
2026-08-20 11:01

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-04 14:33
浙ICP备14020137号-1 $bản đồ khách truy cập$