component-layout

Splits oversized component files into organized folders with defined import direction.

2|1|Updated Jun 28, 2026
One-click install
npx skills add https://github.com/lxsmnsyc/overwander --skill component-layout-lxsmnsyc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: component-layout
Source: https://github.com/lxsmnsyc/overwander/tree/main/.agents/skills/component-layout
Command: npx skills add https://github.com/lxsmnsyc/overwander --skill component-layout-lxsmnsyc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Long component files become unreadable past a few hundred lines, and ad-hoc splitting creates circular imports, vague utility files, and broken import paths. This Skill defines a repeatable folder layout for splitting a component without changing how the rest of the codebase imports it. ## Core Features & Use Cases - Folder structure convention: Converts a component file like CatchDialog.tsx into a kebab-case folder with index.tsx, pure helper files, and one-file-per-section sub-components, keeping external import paths unchanged. - Import direction rules: Enforces that parts never import from index, pushes shared types down into parts, and resolves cycles by extracting shared code into a third file. - Prioritized extraction order: Pulls pure functions and constants first, then markup sections with explicit props, then the reading half of a resource. - Use Case: A Solid or React component has grown past 600 lines. Apply this layout to split it into index.tsx, describe.ts, and a sections/ folder while every existing importer keeps working unchanged. ## Quick Start Split this oversized component file into a folder following the component-layout conventions, keeping all existing import paths working.

Frequently Asked Questions about component-layout

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

FAQPage Schema
How do I split a large React or Solid component into multiple files?▼

Convert the component file into a kebab-case folder with an index.tsx holding the exported component, lowercase files for pure helpers, and one PascalCase file per sub-component. External importers keep their old path minus the file name, so the split is invisible outside the folder.

When should a component file become a folder?▼

A component becomes a folder when it grows past roughly 600 lines and nobody reads it top to bottom anymore. Size alone is not the trigger; two hundred lines that are read together should stay together.

How do I avoid circular imports when splitting a component?▼

Parts must never import from index. If a part needs a type the index declares, move the type down into the part and re-export it from index. A cycle between two parts means their shared code belongs in a third file.

What should I extract first when refactoring a big component?▼

Extract pure functions and constants first since they move with no props to thread and are easiest to test. Next extract markup sections taking explicit props, then the reading half of a resource while its declaration stays in index.tsx.

Should I create a utils.ts file for shared component helpers?▼

No. A file is named for what it answers, not for what it is, so use names like describe.ts, metrics.ts, or summary.ts. Constants shared by two parts live in metrics.ts rather than a generic utility file.