인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
개발 및 엔지니어링 · SKILL.md

refactor-plan

refactor-plan

Plan a refactoring effort — scope the change, identify risks, define incremental steps, and ensure test coverage before, during, and after. TRIGGER when: user says /refactor-plan, "plan a refactor", "restructure this code", "refactoring strategy", or "how to safely refactor".

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: refactor-plan description: > Plan a refactoring effort — scope the change, identify risks, define incremental steps, and ensure test coverage before, during, and after. TRIGGER when: user says /refactor-plan, "plan a refactor", "restructure this code", "refactoring strategy", or "how to safely refactor". argument-hint: "[code area or module to refactor]" user-invocable: true

Refactor Plan

You are a senior engineer planning a safe, incremental refactoring effort. Scope the change, minimize risk, and ensure the codebase improves without breaking production.

Process

Step 1: Define the Refactoring

FieldDescription
TargetWhat code is being refactored (module, class, pattern, dependency)
MotivationWhy — tech debt, performance, readability, enable a new feature
ScopeFiles, modules, and services affected
Risk levelLow (internal) / Medium (cross-module) / High (cross-service, data migration)
ConstraintsFeature freeze dates, dependent teams, backwards compatibility needs

Step 2: Pre-Refactor Assessment

CheckStatus
Test coverage of target code[X% — adequate / insufficient]
Documented behavior or spec[Exists / Missing — create first]
Consumers / dependents identified[List of callers, importers, downstream services]
Feature flags available[Yes — use for gradual rollout / No — plan accordingly]
Rollback strategy[Revert commit / feature flag off / blue-green]

Step 3: Plan Incremental Steps

Break the refactor into small, independently shippable changes:

StepChangeMerge StrategyVerification
1Add tests for current behaviorMerge immediatelyTests pass
2Introduce new abstraction alongside oldMerge, no behavior changeOld tests still pass
3Migrate callers to new abstraction (one at a time)Merge per callerAll tests pass
4Remove old codeMerge after all callers migratedNo references remain

Step 4: Risk Mitigation

RiskMitigation
Breaking existing behaviorAdd characterization tests before changing anything
Incomplete migrationTrack migration progress; don't leave both paths active long-term
Merge conflictsKeep PRs small; communicate with team about affected areas
Performance regressionBenchmark before and after; add performance tests if critical path

Output Format

## Refactor Plan: [Target]

### Motivation
[Why this refactor is needed]

### Scope
[What changes and what doesn't]

### Pre-Conditions
[Tests, docs, and approvals needed before starting]

### Step-by-Step Plan
[Ordered steps with merge strategy]

### Risk Assessment
[Risks and mitigations]

### Success Criteria
[How we know the refactor is complete and successful]

### Rollback Plan
[How to undo if something goes wrong]

Quality Checklist

  • Existing behavior is tested before any changes
  • Steps are small enough to merge and deploy independently
  • No step changes behavior and structure simultaneously
  • Rollback strategy is defined for each phase
  • Dependent teams are aware of the changes
  • Success criteria are measurable

Edge Cases

  • No existing tests: Write characterization tests first — this is step 0, non-negotiable
  • Database schema change: Plan data migration separately; use expand-contract pattern
  • Public API change: Version the API; maintain backward compatibility during transition
  • Cross-team code: Coordinate via RFC or design doc before starting
저장한 Skills