component-consolidation

Audit duplicate UI components for unique logic and update all consumers.

2|1|Updated Aug 24, 2024
One-click install
npx skills add https://github.com/armanisadeghi/ai-matrx --skill component-consolidation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component-consolidation
Source: https://github.com/armanisadeghi/ai-matrx/tree/main/.cursor/skills/component-consolidation
Command: npx skills add https://github.com/armanisadeghi/ai-matrx --skill component-consolidation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Safely consolidate duplicate or redundant components by auditing for unique logic before deletion, updating all consumers, and cleaning up exports/indexes. Use when asked to remove a component in favor of another, eliminate duplicates, reduce two versions of something to one, or clean up redundant UI components.

Core Features & Use Cases

  • Audit both components for unique logic, state management, props, and edge cases to determine what should be kept vs removed
  • Find all usages across direct imports, dynamic imports, index re-exports, and documentation to prevent dangling references
  • Update consumers and exports in a controlled, auditable sequence, then remove the redundant component
  • Provide a phase-by-phase plan to preserve functionality and minimize breaking changes across teams

Quick Start

Audit two target components to identify unique logic, usages, and required callers, then consolidate by updating imports/exports and removing the redundant component.

Frequently Asked Questions about component-consolidation

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

FAQPage Schema
How do I safely consolidate duplicate UI components in a codebase?

To consolidate duplicate UI components safely, audit both files for unique logic and edge cases, trace all usage paths including dynamic imports and re-exports, update consumers, and remove the redundant component. This prevents dangling references and minimizes breaking changes.

What is the best way to audit a component before removing it from a codebase?

Auditing a component before removal involves scanning for unique state management, props, and edge cases. You must trace all direct imports, dynamic imports, and index re-exports to identify required callers and ensure no unique logic is lost during the consolidation process.

How do I find all usages and re-exports of a component before refactoring?

Finding all usages of a component requires a comprehensive scan of direct imports, dynamic imports, index re-exports, and documentation. Tracing these usage paths ensures you identify every consumer and prevents dangling references during the refactor.

Can I reduce two versions of a UI component to one without breaking existing features?

Yes, you can reduce two versions of a component to one by applying a phase-by-phase consolidation plan. This approach audits unique logic, updates all consumers and exports in a controlled sequence, and uses guardrails to preserve functionality and minimize breaking changes.

What steps are needed to update consumers and clean up exports after a component consolidation?

Updating consumers and cleaning up exports requires updating imports in a controlled, auditable sequence, then removing the redundant component. You must ensure references, exports, and tests are consistently updated across the codebase to complete the consolidation safely.

When should I not use a component consolidation refactor?

You should reconsider component consolidation if a comprehensive scan reveals that the duplicate components contain significantly divergent logic, state management, or edge cases that cannot be safely merged without risking breaking changes across consuming features.