Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

refactor-component

Skill by hyperdxio

Refactor a large React component file into a directory of smaller files without changing behaviour. Built for developers who need to split a big component while keeping imports and tests working.

  • Score 91
  • 10k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install refactor-component

Built from the published package, never by AI.

git clone --depth 1 https://github.com/hyperdxio/hyperdx /tmp/hyperdx && mkdir -p ~/.claude/skills && cp -r /tmp/hyperdx/.claude/skills/refactor-component ~/.claude/skills/refactor-component

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install refactor-component in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This agent skill guides an AI assistant through splitting a monolithic React component file into a directory. The new directory keeps the original name and includes an index.ts barrel, a main component file, one file per sub-component, a utils.ts file, and a __tests__ folder. The workflow asks the assistant to first check that E2E tests cover the component's key flows, then analyse the file and present a plan for approval before writing code.

The skill sets rules for the split. Relative imports in extracted files are converted to @/-prefixed absolute imports, sibling imports use ./ paths, and test files and mocks are moved and updated. It also covers tidy-up steps such as extracting pure logic into utils.ts, using named prop types, and writing unit tests for extracted code. It is aimed at developers working on React codebases in a monorepo layout that uses make, yarn and Playwright.

Written from the project's SKILL.md and checked against it.

What it can do

  • E2E coverage checkVerifies that Playwright E2E tests cover the component's key user flows before any code is changed.
  • File analysis and planReads the target file and lists the new files, their contents and the import changes for approval.
  • Directory splitCreates a directory with an index.ts barrel, a main component, sub-component files and utils.ts.
  • Import path updatesConverts relative imports in extracted files to @/ absolute imports and moves test mocks.
  • Pure logic extractionMoves pure functions, constants and config builders from components into utils.ts.
  • Unit test writingWrites unit tests for utils.ts and for each extracted component.
  • Verification stepsRuns lint, unit tests and E2E tests and lists a self-review checklist before presenting the result.

What you need

  • Playwright for E2E tests
  • yarn for unit tests
  • make for lint and E2E commands

Try asking

  • Refactor the ChartEditor component file into a directory of smaller files
  • Split the big DashboardPanel component into sub-components and a barrel index
  • Break up AlertForm.tsx and move its tests into the new directory

Good to know

  • Assumes a monorepo layout with packages/app/src/components and specific make and yarn commands
  • Requires E2E coverage to be verified or added before refactoring starts
  • Each split needs user approval of the plan before code is written

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: .claude/skills/refactor-component/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md11 KB

Alternatives to refactor-component

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

refactor-component: common questions

What does the refactor-component skill do?

It splits one large React component file into a directory of smaller files without functionality changes. The source says the directory keeps the original name so external imports still resolve.

Does it change how the component behaves?

The source says the refactor must be pure file reorganisation with no functionality changes. It also says no exports should be added, removed or renamed.

Will it update the tests?

Yes. The skill moves the test file into the new __tests__ folder and updates the main import and mock paths.

How do I install refactor-component?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is refactor-component free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is refactor-component safe to use?

It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to refactor-component?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

refactor-component Install

Add to stack

Loading.