refactor

Analyze and refactor React/TypeScript files for maintainability and performance.

Updated Jul 25, 2025
One-click install
npx skills add https://github.com/narrative-io/data-collaboration-mcp --skill refactor-narrative-io
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/narrative-io/data-collaboration-mcp/tree/main/.claude/skills/refactor
Command: npx skills add https://github.com/narrative-io/data-collaboration-mcp --skill refactor-narrative-io

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Analyze and improve a React/TypeScript code file by identifying anti-patterns, improving component composition, hooks usage, and overall structure to enhance maintainability and performance.

Core Features & Use Cases

  • Analyze React components for idiomatic patterns, performance optimizations, and clean data flow.
  • Propose modularization strategies (split large files into smaller components and hooks) and consistent typing.
  • Use Case: Refactor a monolithic component into focused, reusable parts with clear props and state handling.

Quick Start

Provide the path to the React/TypeScript file you want refactored and I will propose a structured, maintainable rewrite.

Frequently Asked Questions about refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a React component to improve maintainability and performance?

To refactor a React component, you analyze its hooks usage, component composition, and data flow to propose a structured rewrite that enhances maintainability, readability, and performance.

What is the best way to split a monolithic React TypeScript file into smaller modules?

Splitting a monolithic React TypeScript file involves modularization strategies that break down large components into focused, reusable parts with clear props, state handling, and consistent typing.

Can I use this refactoring process for single-file React components?

Yes, the refactoring process applies to single-file components and small modules, handling patterns like hooks and component composition to meet code quality and accessibility requirements.

Does refactoring React TypeScript code require strong typing and error handling?

Yes, refactoring React TypeScript code requires strong typing and error handling to ensure the structured output meets code quality requirements and is ready for review workflows.

Why does my React component have anti-patterns and poor data flow?

React components develop anti-patterns and poor data flow when component composition and hooks usage are not optimized, which refactoring addresses by improving overall structure and clean data flow.

What are the limitations of refactoring a React TypeScript component?

Refactoring a React TypeScript component is limited to single-file components and small modules, proposing structured rewrites rather than automatically applying changes to large multi-file architectures.