component-flattening-analysis

Detects orphaned classes in root namespaces and plans component hierarchy flattening.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Peterson-Benhame/agent-skills --skill component-flattening-analysis-peterson-benhame
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component-flattening-analysis
Source: https://github.com/Peterson-Benhame/agent-skills/tree/main/packages/skills-catalog/skills/%28architecture%29/component-flattening-analysis
Command: npx skills add https://github.com/Peterson-Benhame/agent-skills --skill component-flattening-analysis-peterson-benhame

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases often accumulate source files in root namespaces that have been extended by child components, leaving orphaned classes with no clear component ownership and violating the rule that components should exist only as leaf nodes. ## Core Features & Use Cases - Orphaned Class Detection: Maps namespace hierarchies, identifies root namespaces containing source files, and classifies orphaned code as domain, shared, or mixed. - Flattening Strategy Analysis: Evaluates three strategies per namespace — consolidate down, split up, or extract shared code — with effort and risk estimates. - Refactoring Plan Generation: Produces prioritized flattening plans with file move steps, import updates, and validation checklists. - Use Case: A monolith has 45 source files sitting in the ss.ticket root namespace alongside assign and route subcomponents. The skill recommends splitting them into maintenance, completion, and shared leaf components with a one-week effort estimate. ## Quick Start Ask the agent to find orphaned classes in root namespaces and create a plan to flatten the component hierarchies in this codebase.

Frequently Asked Questions about component-flattening-analysis

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

FAQPage Schema
How do I find orphaned classes in root namespaces?

Map the namespace tree to identify root namespaces that have been extended by child nodes, then scan those namespaces for source files. Any source file in an extended namespace is an orphaned class that should be moved to a leaf node component.

What is component flattening in software architecture?

Component flattening is the process of ensuring components exist only as leaf nodes in a namespace hierarchy. It removes orphaned classes from root namespaces by consolidating leaf code down, splitting root code into new leaf components, or extracting shared code into a dedicated component.

When should I consolidate down versus split up components?

Consolidate down when leaf nodes contain small, related functionality that can merge into the root namespace. Split up when the root namespace contains distinct functional areas, such as separating ticket maintenance from ticket completion logic.

Does this skill work with Java packages and Node.js directories?

Yes, the methodology applies to both. For Java it analyzes package structures like com.company.survey, and for Node.js it analyzes directory structures like services/survey, detecting orphaned files in either case.

When should I not use component flattening analysis?

Do not use it for dependency or coupling analysis between components, or for grouping components into business domains. Those tasks belong to dedicated coupling-analysis and domain-identification skills in the decomposition sequence.