omh-frontend-refactor
What it does
It previews a refactor plan for an oversized or tangled interface component, then applies it in steps that keep behavior unchanged. It is for front-end developers with a component that has grown too large.
When to use it
- ✓When a UI component has grown too large or hard to follow.
- ✓When a component has many state flags that need consolidating.
- ✓When you want a refactor that does not change how the interface behaves.
Skill link
https://github.com/rlaope/oh-my-hermes/blob/main/agent-skills/omh-frontend-refactor/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“This dashboard component is 800 lines with six state flags. Refactor it without changing its behavior.”
5 new skills a week. 1 minute to read.
How it works
The agent first checks that the current behavior is locked by tests, previews the change plan with line references, and only applies it as a second, explicit step.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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-planfor the phased execution shape, orulw-planfirst 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
frontendwork 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 tofrontend, verdict-only review tocode-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
FAQ
Does it change the code without asking?
No. It shows the full plan first and applies changes only as a separate step.
Does it design a new interface?
No. Building or redesigning a UI is covered by a frontend skill.
Does it clean up code outside UI components?
Generic cleanup is covered by a separate code cleanup skill.
Details
Original description by the author
[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
Popularity
- GitHub stars
- 5.1k
- Ranking position
- #15109
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
omh-accessibility-audit
5.1kHelps your agent check a screen or flow for accessibility gaps, such as keyboard use, screen reader labels, contrast, and touch target size.
omh-adversarial-consensus
5.1kHelps your agent attack a technical proposal from several independent angles before you commit to it, then sums up what survives.
omh-agent-debug
5.1kHelps your agent work out why another AI agent is stuck, looping, or drifting, and suggests the smallest safe way to recover.
omh-agent-instructions
5.1kHelps your agent write or update the instruction file, such as AGENTS.md or CLAUDE.md, that tells AI tools how to work in a project.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.