refactor
Guided refactoring workflow for improving existing code without changing behavior. Ensures tests pass before and after changes.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Guided refactoring workflow for improving existing code without changing behavior. Ensures tests pass before and after changes.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Generate customized .claude/ harness framework with Fusion Architecture (GAN-inspired + Domain Specialists). TRIGGER when user wants to set up AI-assisted development structure, create a new project harness, add structure to existing projects, or mentions 'harness', 'scaffold', 'framework setup'. Supports all domains through template + dynamic generation.
Negotiates 'done' criteria between Generator, Evaluator, and architect-lead before implementation begins. Converts subjective goals into testable, gradable criteria with clear domain responsibilities.
Guided database migration workflow — from schema design to rollback documentation.
Production incident response workflow — triage, root cause analysis, and resolution.
Track, categorize, and prioritize technical debt across the codebase.
Save current progress with structured handoff artifact. Enables context reset for long-running tasks and session recovery.
SOC 職業分類に基づく
| name | refactor |
| description | Guided refactoring workflow for improving existing code without changing behavior. Ensures tests pass before and after changes. |
| user-invocable | true |
You are facilitating the Refactoring process. Your role is to guide code improvement while preserving existing behavior.
Refactoring ensures:
IDENTIFY TARGET -> TEST BASELINE -> PLAN CHANGES -> INCREMENTAL REFACTOR -> VERIFY -> COMPLETE
1. Ensure tests pass (GREEN)
2. Make a small refactor
3. Run tests (should stay GREEN)
4. If tests fail (RED), revert and try smaller change
5. Repeat until refactor complete
IMPORTANT: If tests don't pass, fix them before refactoring.
Create refactoring plan with:
For each change:
# Refactor Plan: [Target]
## Objective
[What improvement is being made]
## Target Files
- [File 1]
- [File 2]
## Test Baseline
- Tests passing: [count]/[total]
- Coverage: [percentage]
## Changes Planned
### Change 1: [Name]
- **File**: [path]
- **Description**: [what change]
- **Risk**: Low/Medium/High
- **Depends on**: [previous change ID or "none"]
### Change 2: [Name]
- **File**: [path]
- **Description**: [what change]
- **Risk**: Low/Medium/High
- **Depends on**: Change 1
## Rollback Points
- [Commit ID]: [description of what was complete]
## Verification Steps
1. [Verification step 1]
2. [Verification step 2]
## Expected Outcome
[What the code will look like after]
## Status
DRAFT | TESTING | IN_PROGRESS | VERIFYING | COMPLETE
# Before
def process_order(order):
# 50 lines of mixed logic
# After
def process_order(order):
validate_order(order)
calculate_totals(order)
save_order(order)
# Before
class User:
# authentication methods
# profile methods
# notification methods
# After
class User:
# profile methods only
class UserAuth:
# authentication methods
class UserNotifications:
# notification methods
# Before
def calc(x, y):
return x * y + 10
# After
def calculate_adjusted_price(base_price, quantity):
return base_price * quantity + SERVICE_FEE
# Before
def validate_email(email):
if not email or '@' not in email:
return False
return True
def validate_phone(phone):
if not phone or len(phone) < 10:
return False
return True
# After
def validate_required(value, rules):
if not value:
return False
for rule in rules:
if not rule(value):
return False
return True
| Risk | Description | Approach |
|---|---|---|
| Low | Localized, simple change | Single commit |
| Medium | Multiple files, same patterns | Small commits, frequent tests |
| High | Complex changes, many files | Very small steps, checkpoints |
/refactor [target] [objective]
Example:
/refactor src/backend/services/user_service.py extract authentication logic