mp-decompose

Split oversized source files into modular units while preserving behavior and public interfaces.

1|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/MartinoPolo/mpx-claude-code --skill mp-decompose
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mp-decompose
Source: https://github.com/MartinoPolo/mpx-claude-code/tree/main/skills/mp-decompose
Command: npx skills add https://github.com/MartinoPolo/mpx-claude-code --skill mp-decompose

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Large files are hard to understand, test, and change, which often leads to duplicated logic and risky edits that can accidentally change behavior.

Core Features & Use Cases

  • Behavior-preserving decomposition: Split oversized files into logical modules while keeping runtime behavior and the public API unchanged.
  • Role-based organization: Reorganize code into clear categories such as constants, utils, types, hooks, context, components, and services.
  • Parallel multi-file handling: Decompose multiple targets by dispatching separate subagents per large-file unit to avoid mixing unrelated changes.

Quick Start

Ask: "Decompose the file src/megaComponent.ts into logical modules while preserving behavior and public API, and update imports/exports and references."

Frequently Asked Questions about mp-decompose

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

FAQPage Schema
How do I split a large source file into smaller modules without changing behavior?

Behavior-preserving decomposition splits oversized files into logical modules while keeping runtime behavior and the public API unchanged. It reorganizes code into clear categories like constants, utils, types, and services to improve maintainability.

What is the best way to refactor a huge component file for better code organization?

Role-based organization restructures oversized files into clear categories such as constants, utils, types, hooks, context, components, and services. This refactoring approach targets one or more files to improve DRY-ness and overall maintainability.

Can I decompose multiple large files at once without mixing unrelated changes?

Parallel multi-file handling dispatches separate subagents per large-file unit to avoid mixing unrelated changes. This allows you to decompose multiple targets simultaneously while preserving behavior and updating imports and exports independently.

How do I update imports and exports when refactoring code into separate modules?

Decomposition includes automatic import and export updates alongside dead-code removal and targeted validation via static verification. This ensures that references across your codebase are correctly updated when splitting files into modular units.

Does file decomposition require static verification or checks afterward?

Targeted validation via checks or static verification is required after decomposing files. This step ensures that the behavior-preserving refactoring maintained the public interface correctly and that no unintended feature or behavior changes occurred during module separation.