Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)5.1k · #15109

omh-frontend-refactor

Skill này làm gì

Skill này xem trước kế hoạch tái cấu trúc cho một component giao diện quá lớn hoặc rối, rồi áp dụng theo các bước giữ nguyên hành vi. Skill dành cho lập trình viên frontend có một component đã phình quá to.

Khi nào nên dùng

  • ✓Khi một component giao diện đã quá lớn hoặc khó theo dõi.
  • ✓Khi một component có nhiều cờ trạng thái cần gom lại.
  • ✓Khi bạn muốn một đợt tái cấu trúc không thay đổi cách giao diện hoạt động.

Liên kết skill

https://github.com/rlaope/oh-my-hermes/blob/main/agent-skills/omh-frontend-refactor/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/rlaope/oh-my-hermes/blob/main/agent-skills/omh-frontend-refactor/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Component dashboard này dài 800 dòng và có sáu cờ trạng thái. Tái cấu trúc nó mà không thay đổi hành vi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent trước tiên kiểm tra rằng hành vi hiện tại được khóa bởi kiểm thử, xem trước kế hoạch thay đổi với tham chiếu dòng, rồi chỉ áp dụng như một bước thứ hai, rõ ràng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Frontend Refactor

This is an OMH frontend-refactor workflow skill, projected for Agent Skills hosts (Claude Code, Codex, Cursor, opencode, OpenClaw, pi).

Why This Exists

frontend-refactor exists so UI restructuring runs as a previewed, behavior-locked, impact-ordered process instead of ad-hoc rewrites: the plan comes before any edit, state fixes come before polish, and every change carries its safety reason.

Do Not Use When

  • The target is not UI code, or the smell is generic slop, duplication, or dead code outside a component tree; use omh-ai-slop-cleaner.
  • The user wants new UI built or redesigned rather than restructured; use omh-frontend.
  • The user wants findings and a verdict without changing the code; use omh-code-review.
  • The restructuring crosses module boundaries or changes architecture beyond the component tree; use omh-refactor-plan for the phased execution shape, or ulw-plan first when the direction itself is still contested.

Examples

Good example:

  • Prompt: This dashboard component is 800 lines and has six useState booleans - refactor it without changing behavior.
  • Expected behavior: Preview first: characterization-test gate, then a plan that folds the booleans into one state union, extracts along change reasons found by the scroll test, and lists per-change line refs with safety reasons; apply only as the explicit second step.
  • Why: Oversized component plus flag-cluster state is exactly the impact-ordered, behavior-locked restructuring this workflow owns.

Bad example:

  • Prompt: Refactor and also add the dark-mode feature while you are in there.
  • Expected behavior: Split the request: the behavior-preserving refactor runs under this workflow, and the dark-mode feature is new frontend work planned separately.
  • Why: A refactor that changes behavior cannot claim behavior preservation; mixing the two hides the feature from review.

Completion Checklist

  • The preview plan was emitted before any file changed, and the apply step was an explicit second decision.
  • Behavior evidence exists on both sides of apply, and unsafe-in-isolation changes are listed as notes, not half-applied.
  • Pass order was impact-first and each finding names its category and safety reason.
  • Out-of-scope smells were routed: generic slop to ai-slop-cleaner, new UI to frontend, verdict-only review to code-review.

Recovery Notes

  • If no tests exist, write the characterization checks first or hand the user the smallest set to approve; do not start the macro pass on unlocked behavior.
  • If a change turns out to alter behavior mid-apply, revert that change, record it as a finding, and keep the rest of the pass.
  • If the component resists extraction because state is tangled, run the state ladder first and re-attempt decomposition after.

When to Use

Use when existing UI code needs restructuring without behavior change - an oversized component, boolean-flag state, effect chains, prop drilling - and the user wants a previewed, pass-ordered refactor plan rather than a new build or a verdict-only review.

Strong routing signals: `frontend-refactor`, `front-refactor`, `frontend refactor`, `refactor this component`, `refactor the component`, `refactor my component`, `component refactor`, `react refactor`, `refactor this hook`, `split this component`, `split the component`, `this component is too big`, `component is too large`, `state management review`, `state management`, `state colocation`, `too many useeffects`, `useeffect cleanup`, `clean up useeffect`, `prop drilling`, `컴포넌트 리팩터링`, `컴포넌트 리팩토링`, `컴포넌트 분리`, `컴포넌트가 너무 커`, `상태 관리 정리`, `상태 관리 리뷰`, `프론트 리팩터링`, `프론트엔드 리팩터링`, `useEffect 정리`, `рефакторинг компонента`, `раздели компонент`, `компонент слишком большой`, `рефакторинг фронта`, `разбей компонент`

Catalog Metadata

Category: maintenance Phase: frontend-refactor Quality tier: behavior-lock-gated Reasoning demand: heavy

Quality bar:

  • Work the ladder impact-first: state architecture before hook patterns before decomposition before naming and style - a state fix usually deletes the code a style pass would have polished.
  • Make impossible states unrepresentable before memoizing anything: flag clusters become one discriminated union or reducer, and a state machine only when transitions carry retries, resets, or races.
  • Treat effects as synchronization with external systems: deriving, event responses, prop-change resets, parent notification, and effect chains each hav
Câu hỏi thường gặp

Nó có thay đổi mã mà không hỏi không?

Không. Nó hiển thị toàn bộ kế hoạch trước và chỉ áp dụng thay đổi như một bước riêng.

Nó có thiết kế giao diện mới không?

Không. Xây dựng hoặc thiết kế lại giao diện được bao phủ bởi một skill frontend.

Nó có dọn dẹp mã ngoài các component giao diện không?

Dọn dẹp chung được bao phủ bởi một skill dọn dẹp mã riêng.

Chi tiết

Mô tả gốc của tác giả

[omh] Oversized or tangled UI component: behavior-preserving refactor of UI code - preview the full change plan first, apply as a second explicit step, and work impact-ordered from state architecture down to naming polish. Use when the user says: frontend-refactor, front-refactor, frontend refactor, refactor this component, refactor the component, refactor my component, component refactor, react refactor.

repo: rlaope/oh-my-hermes

Độ phổ biến

Sao GitHub
5.1k
Vị trí xếp hạng
#15109
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự