Agent skill
component-organization
Enforces single-component-per-file pattern for React feature pages. Use when creating new pages, refactoring page.tsx files, or when components are mixed in a single file.
Install this agent skill to your Project
npx add-skill https://github.com/dinogit/motocho/tree/main/.claude/skills-disabled/component-organization
SKILL.md
Component Organization
When creating React components for a feature page, never put multiple component functions in a single page.tsx file.
Pattern
Instead of this (BAD):
features/analytics/
page.tsx <- Contains Page + SummaryCard + DailyActivityChart + etc.
Do this (GOOD):
features/analytics/
page.tsx <- Only imports and composes components
components/
summary-card.tsx
daily-activity-chart.tsx
hourly-activity-chart.tsx
tokens-chart.tsx
model-usage-card.tsx
Implementation
-
page.tsx should only contain:
- Imports from
./components/ - The main
Pagefunction that composes the imported components - Data fetching/loader logic if needed
- Imports from
-
components/ folder should contain:
- One component per file
- File names in kebab-case matching the component name
- Each file exports a single named component
Example
page.tsx:
import { SummaryCard } from './components/summary-card'
import { DailyActivityChart } from './components/daily-activity-chart'
export function Page() {
return (
<div>
<SummaryCard />
<DailyActivityChart />
</div>
)
}
components/summary-card.tsx:
export function SummaryCard({ title, value, icon }: SummaryCardProps) {
return (...)
}
When to Apply
- Creating a new feature page with 2+ custom components
- Refactoring an existing page with inline components
- The page.tsx file exceeds ~100 lines
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
react-hook-form
Build forms in React using React Hook Form and Zod validation. Use when creating forms with useForm, Controller, or useFieldArray.
tanstack-form
Build forms in React using TanStack Form and Zod validation. Use when creating forms, handling form validation, or working with form fields.
feature-scaffolding
Scaffolds new feature pages following project patterns. Use when creating new pages, features, routes, or when user asks to set up a new section. Works with component-organization skill for structure.
task-estimation
Provides task estimation before starting work. Use when planning new features, refactoring, bug fixes, or any non-trivial changes. Triggered by keywords like estimate, plan, complexity, tokens, approach.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Didn't find tool you were looking for?