skills/coding/react-component-extraction/SKILL.md
Extracts reusable UI or stateful logic into independent components or custom Hooks. Analyzes context dependencies, evaluates extraction boundaries, and ensures zero breakage for existing callers. Should be used when the user wants to extract, split, or isolate a piece of React code — creating reusable components, custom Hooks, or separating concerns within a large component. Distinguished from react-component-refactor which restructures the entire component, this skill focuses on extracting specific reusable pieces.
npx skillsauth add ImaginerLabs/skill-manager react-component-extractionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Systematically analyze a target logic's external dependencies, evaluate extraction boundaries, design sensible component/Hook interfaces, and achieve zero-breakage extraction while keeping the code safe and robust.
The key insight: extraction isn't just moving code around. It's about finding the right boundary — the seam where responsibilities naturally separate — and designing an interface that preserves all existing behavior.
1. Context dependency analysis
2. Evaluate extraction boundary (minimization principle)
3. Design interface structure
4. Confirm file location
5. Execute extraction
6. Verify compatibility
Identify every external dependency the target logic relies on:
| Dependency type | What to check | | ------------------ | ---------------------------------------------------------------------------------- | | Props | Which parent props does the target logic use? | | State | Which state values are used? Do they need to be lifted or passed in? | | Context | Does it consume useContext? Will it still be within the Provider after extraction? | | Ref | Does it depend on DOM refs or component refs? | | External functions | Does it call parent callbacks, utility functions, or global methods? | | Side effects | Does it contain useEffect? Are dependencies complete? | | Styles | Does it depend on parent CSS classes or style variables? |
Choose the lightest extraction that solves the problem:
| Scenario | Recommended approach | | ----------------------------------------------------- | ----------------------------------------------- | | Complex logic but simple UI | Extract as custom Hook | | Independent, reusable UI structure | Extract as child component | | Logic + UI tightly coupled, reused in multiple places | Extract as full component (with internal state) | | Only used in current component, just too long | Extract as sub-component within the same file |
Search the project's existing structure, then present candidates to the user for confirmation:
Suggested location for `UserCard` component:
Option A: src/components/business/user/UserCard.tsx
(Reason: same level as existing UserList, UserAvatar)
Option B: src/pages/profile/components/UserCard.tsx
(Reason: currently only used by Profile page)
Where would you like to place it?
?. guards## Component Extraction Report
### Extraction Overview
- **Extraction type**: [Child component / Custom Hook / Full component]
- **File location**: `[confirmed file path]`
- **Original caller**: `[original file path]` ([modified / unmodified])
### Dependency Analysis
| Dependency type | Item | Handling |
| --------------- | ---- | ------------------------------- |
| Props | — | Passed via props |
| State | — | Extracted with logic |
| Context | — | Confirmed within Provider scope |
### Generated Files
`[new file path]` - Complete component/Hook code
### Compatibility Verification
- [ ] Original caller interface preserved
- [ ] Optional Props have default values or null guards
- [ ] useEffect has cleanup functions
- [ ] Async operations handle loading/error states
development
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
devops
Create a new implementation plan file for new features, refactoring existing code or upgrading packages, design, architecture or infrastructure.
tools
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
documentation
Generates standardized porting documentation from completed feature changes. Analyzes commit diffs or file contents, extracts change intent, and outputs Markdown documentation for cross-team understanding. Should be used when the user needs to document a change for cross-team or cross-project consumption. Distinguished from cross-branch-fix-porter which actively re-implements fixes, this skill documents changes.