본문으로 건너뛰기
cccskills
무료GitHub에 공개

fec-refactoring

Use when restructuring existing frontend code while preserving observable behavior, including responsibility extraction, module movement, conditional simplification, API cleanup, or data organization. Do not use for new feature behavior, behavior-changing bug fixes, dependency or framework migrations, or proven dead-code cleanup.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(5)

  • SKILL.md5.2 KB
  • references/principles.md3.1 KB
  • references/refactoring-vs-feature-change.md1.7 KB
  • references/when-to-refactor.md1.5 KB
  • references/workflow.md2.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Skill: Behavior-Preserving Refactoring

Purpose

Restructure live frontend code in small, evidence-backed steps while preserving the behavior users, callers, tests, routes, and integrations can observe.

Core Contract

Every execution follows these rules:

  1. Behavior Preservation — pure refactoring intentionally changes structure, not observable behavior.
  2. Green Baseline First — record available verification before editing.
  3. One Refactoring at a Time — one primary structural intent per step.
  4. Verify Every Step — run the narrowest meaningful check immediately after each step.
  5. Revert Before Repairing — if a new regression appears, revert that step before widening the edit.
  6. Separate Refactoring from Feature Work — behavior changes belong in a different workflow.
  7. Smallest Safe Refactoring First — prefer the narrowest transformation that fits the evidence.
  8. Stay Within the Diff Budget — stop when actual scope materially exceeds the planned scope.

Pure refactoring uses GREEN → REFACTOR → GREEN. Do not manufacture a failing behavioral test merely to make a structural change look like feature TDD.

Procedure

  1. Classify the request. Confirm that the intended result is structural and behavior-preserving.
  2. Discover context. Read project configuration, affected modules, public exports, routes, state boundaries, tests, and current diff.
  3. Record observable contracts. Capture inputs, outputs, errors, side effects, UI states, events, network calls, state transitions, routes, and public APIs that matter.
  4. Establish the baseline. Run existing narrow checks first; record pre-existing failures rather than attributing them to later edits.
  5. Diagnose structural evidence. Identify the concrete smell or responsibility problem and check likely false positives.
  6. Build the safety net. Reuse relevant tests; add characterization coverage only when needed to preserve existing behavior.
  7. Plan ordered micro-refactorings. For each step record technique, rationale, prerequisites, risk, Diff Budget, verification, and rollback boundary.
  8. Apply exactly one primary transformation. Avoid opportunistic cleanup, formatting churn, or unrelated redesign.
  9. Verify immediately. Compare actual scope with the Diff Budget and run targeted checks.
  10. Handle regression. Revert the current step, confirm the prior baseline, shrink or reorder the transformation, then retry only with evidence.
  11. Run broad final validation. Escalate from targeted checks to typecheck, tests, build, E2E, accessibility, or specialty checks when relevant.
  12. Report proof strength. Use PASS, PARTIAL, or NOT PROVEN and state remaining risk.

Risk Classification

RiskTypical scopeDefault action
SAFELocal/private code, stable contracts, easy rollbackExecute with step-level verification
CAUTIONCross-module movement, shared state, imports, hooks/composables, lifecycleExecute only with adequate safety evidence
DANGERPublic API, routes, persistence, network contracts, auth, SSR/hydration, broad state or inheritance redesignPlan and stop for explicit approval unless already authorized

Risk is contextual. A technique name alone never proves that a change is safe.

Diff Budget

Before each executable step record:

Expected files: N
Expected functions/components: N
Expected public API changes: 0
Expected behavior changes: 0

If the actual diff materially exceeds that budget, stop and reassess instead of silently expanding into redesign.

References

  • Load principles.md for the safety rules, evidence model, and risk language.
  • Load workflow.md for the state machine, baseline handling, rollback, and reporting contract.
  • Load when-to-refactor.md when deciding whether restructuring is timely or should be deferred.
  • Load refactoring-vs-feature-change.md when ownership overlaps feature work, debugging, cleanup, migration, or review.

Constraints

  • Do not alter tests merely to accept behavior changed by the refactoring.
  • Do not label auth, permission, routing, persistence, protocol, or public package changes SAFE without specific evidence.
  • Do not stack additional structural edits after a newly introduced failure.
  • Do not install a new test framework automatically when the project has none.
  • Do not treat line count, complexity metrics, comments, a switch, or chaining as sufficient proof of a code smell.
  • Do not perform remote Git writes by default.

Expected Output

A small-step refactoring plan or implementation with explicit evidence, risk, Diff Budget, per-step verification, rollback history when applicable, and a final PASS/PARTIAL/NOT PROVEN behavior-preservation verdict.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

用于审查或改进前端无障碍、语义结构、键盘支持、焦点管理、ARIA 标签、屏幕阅读器行为、WCAG 2.2 问题、触控无障碍或辅助技术回归;中文触发词包括 无障碍、accessibility、a11y、WCAG、屏幕阅读器。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

Use when reviewing or improving frontend accessibility, semantic structure, keyboard support, focus management, ARIA labels, screen reader behavior, WCAG 2.2 issues, touch accessibility, or assistive-technology regressions; Chinese triggers include accessibility, accessibility, a11y, WCAG, screen reader.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

Use when absorbing ideas, capabilities, workflows, architecture, quality systems, ecosystem extensions, or engineering practices from any reference system into the current project through original, project-native redesign rather than copying.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

用于从参考系统中吸收想法、能力、工作流、架构、质量体系、生态扩展或工程实践,并通过原创的项目内重设计转化为当前项目能力,而不是复制原实现。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

Use when designing, implementing, or reviewing frontend-to-backend API integration, typed API clients, REST/tRPC/OpenAPI client choices, auth refresh, API error mapping, upload flows, SSE/WebSocket/polling choices, CORS-facing frontend behavior, or cross-boundary loading/error states. Do not use for backend-only service architecture or TanStack Query cache policy alone; Chinese triggers include API integration, front-end and back-end joint debugging, typed API client, Interface error handling, SSE, WebSocket.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

用于设计、实现或审查前后端 API 集成、类型化 API client、REST/tRPC/OpenAPI 客户端选型、认证刷新、API 错误映射、上传流程、SSE/WebSocket/轮询选择、CORS 相关前端行为或跨边界 loading/error 状态。不要用于纯后端服务架构或仅 TanStack Query 缓存策略;中文触发词包括 API 集成、前后端联调、typed API client、接口错误处理、SSE、WebSocket。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

bovinphang의 스킬 모두 보기

이 스킬의 문제 신고