원클릭으로
refactoring
Safe code refactoring with step-by-step approach
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Safe code refactoring with step-by-step approach
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Design RESTful APIs following best practices
Systematic bug investigation and root cause analysis
Review code quality, patterns, and best practices
Generate commit messages following conventional commits with scope detection
Generate and update technical documentation
Break down features into implementable tasks
| type | skill |
| name | Refactoring |
| description | Safe code refactoring with step-by-step approach |
| skillSlug | refactoring |
| phases | ["E"] |
| generated | "2026-02-08T00:00:00.000Z" |
| status | filled |
| scaffoldVersion | 2.0.0 |
Use this skill when restructuring existing code in the Smart Farming application. Refactoring must preserve behavior while improving code structure, readability, or maintainability.
Before ANY refactoring:
pytest — Establish the baseline (all tests must pass)When: Two or more use cases contain duplicate logic.
Where: src/app/core/commons/
# Before: duplicated in multiple use cases
class CreateSensorRecord:
def execute(self, data):
# validation logic here...
class EditSensorRecord:
def execute(self, data):
# same validation logic here...
# After: extracted to commons
# core/commons/validate_sensor_data.py
def validate_sensor_data(data):
# shared validation logic
# Use in both use cases
from core.commons.validate_sensor_data import validate_sensor_data
When: A use case has too many responsibilities (> 100 lines or multiple distinct operations).
Steps:
When: Multiple repository methods have similar SQL with minor variations.
# Before: separate methods with similar queries
def find_by_plant_id(self, plant_id): ...
def find_by_date_range(self, start, end): ...
def find_by_plant_and_date(self, plant_id, start, end): ...
# After: flexible query method
def find(self, filters: dict): ...
When: Names don't clearly communicate intent.
Checklist:
When: Code is in the wrong architectural layer.
| Code Type | Correct Location |
|---|---|
| Business rules | core/use_cases/ |
| Data validation | core/commons/ or infra/forms/ |
| SQL queries | infra/repositories/ |
| HTTP handling | infra/views/ |
| Configuration | infra/constants/ |
:recycle: refactor(scope): descriptioninit_database() — Can destroy development data