askill
component-refactoring

component-refactoringSafety 50Repository

Refactor high-complexity React components. Use when components exceed 300 lines, when the user asks for code splitting, hook extraction, or complexity reduction, or when the agent detects high cognitive load.

0 stars
1.2k downloads
Updated 2/8/2026

Package Files

Loading files...
SKILL.md

Component Refactoring Skill

Refactor high-complexity React components with the patterns and workflow below.

Complexity Threshold: Components with lineCount > 300 should be considered for refactoring.

Core Refactoring Patterns

  • Pattern 1: Extract Custom Hooks (for complex state/business logic)
  • Pattern 2: Extract Sub-Components (for monolithic JSX)
  • Pattern 3: Simplify Conditional Logic (for deep nesting/complex ternaries)
  • Pattern 4: Extract API/Data Logic (use @tanstack/react-query or similar hooks)
  • Pattern 5: Extract Modal/Dialog Management (isolated open/close states)

Refactoring Workflow

  1. Analyze Component (Check file size and search for long functions/JSX blocks)
  2. Plan Refactoring based on identified patterns.
  3. Execute Incrementally (extract logic/JSX into new files, verify lint and type-checks)
  4. Verify that the component is now more readable and maintainable.

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

58/100Analyzed 2/18/2026

A moderately useful skill for React component refactoring with clear patterns (5 core approaches) and a defined workflow. Provides a concrete complexity threshold (300 lines) and structured guidance. However, it lacks actionable details like specific tools, commands, code examples, and safety measures (tests, rollback). The mismatched tags (api, github-actions, linting) hurt discoverability for a React refactoring skill. Decent foundational structure but needs more depth for high actionability.

50
75
70
55
50

Metadata

Licenseunknown
Version-
Updated2/8/2026
Publisherluxunxiansheng

Tags

apigithub-actionslinting