원클릭으로
refactoring
Use when coordinating large changes across multiple files or performing significant code restructuring
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when coordinating large changes across multiple files or performing significant code restructuring
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Execute safe Git workflows — branching, committing, resolving conflicts, and managing PRs
Use when controlling AI spend, token budgets, model routing, or workflow efficiency before scaling usage
Use when handling incidents, outages, severe regressions, or operational emergencies before attempting broad fixes
Use when investigating latency, throughput, resource saturation, or performance regressions before changing implementation details
Use when reviewing code, preparing a PR for review, or processing review feedback
Use when diagnosing bugs, test failures, or unexpected behavior before attempting any fix
| name | refactoring |
| description | Use when coordinating large changes across multiple files or performing significant code restructuring |
Announce at start: "Following the refactoring skill for multi-file changes."
Interface first, implementation second. Define contracts before changing internals.
Before changing anything:
| Order | What | Why |
|---|---|---|
| First | Types/interfaces | Contracts must be stable before implementation |
| Second | Core logic | Internal changes behind stable interfaces |
| Third | Callers/consumers | Update after interfaces are settled |
| Last | Tests | Verify everything works together |
For each file in dependency order:
Do not batch multiple files into one uncommitted change.
| After Each File | After Each Layer | After All Changes |
|---|---|---|
| Type check passes | Build succeeds | Full test suite passes |
| Relevant tests pass | Integration tests pass | Manual verification |
| Git status is clean | No regressions | PR is reviewable size |
| Size | Recommendation |
|---|---|
| 1-50 lines | Ideal — easy to review |
| 50-200 lines | Acceptable — stay focused |
| 200-500 lines | Split if possible |
| 500+ lines | Must split into multiple PRs |
Before starting, define how to undo:
| Strategy | When |
|---|---|
git revert | Single-commit changes |
| Feature flag | Behavior changes |
| Separate revert PR | Multi-commit changes |
| Config toggle | Environment-specific |
| Signal | Action |
|---|---|
| Changing behavior during refactor | Separate into two PRs (refactor then feature) |
| Tests are failing and you don't know why | Stop, diagnose before continuing |
| Change touches more than 10 files | Break into smaller PRs |
| No test coverage for changed code | Add tests before refactoring |
| When | Invoke |
|---|---|
| Refactoring uncovers a bug | debugging |
| Need to update tests for refactored code | testing |
| Refactoring complete, ready to submit | pr-writing |
| Refactoring started without a plan | planning |
For principles, rationale, anti-patterns, and examples:
guides/multi-file-refactoring/multi-file-refactoring.md