Agent skill

Component Colocation

by udecode in udecode/kitcn

Use after migrating/refactoring features (especially tables/data grids) when reviewing component structure - enforces merging over-split components, colocating files where used, removing unused…

Apache-2.0Auto-check passedDevelopment

Install Component Colocation

skills CLI
$ npx skills add udecode/kitcn --skill component-colocation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install udecode/kitcn component-colocation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/udecode/kitcn.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/component-colocation .claude/skills/component-colocation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
component-colocation
GitHub stars
450
Token cost
~1.3k tokens
SKILL.md length
444 words
Files
1
Skills in repo
33
Repo updated
First seen
Licence
Apache-2.0

At a glance

Use after migrating/refactoring features (especially tables/data grids) when reviewing component structure - enforces merging over-split components, colocating files where used, removing unused…

  • Works in 4 steps: Don't Over-Split Components → Large Files Are Fine → Colocate Where Used → …
  • Tasks that involve Refactoring
  • SKILL.md covers Overview, Kitcn Boundary, When to Use and Core Principles, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Component Colocation is an agent skill from udecode/kitcn. Use after migrating/refactoring features (especially tables/data grids) when reviewing component structure - enforces merging over-split components, colocating files where used, removing unused code, following vertical slice architecture. Prevents premature abstraction and over-engineering.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Refactoring and Code simplification. It works with React. The repository describes itself as: Convex + Better Auth + tRPC + Drizzle + TanStack Query + shadcn. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Refactoring
  • Tasks that involve Code simplification

Example prompts

  • “/component-colocation”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Don't Over-Split Components
  2. Large Files Are Fine
  3. Colocate Where Used
  4. Ask Before Splitting

What it can do on your machine

Read from SKILL.md and the folder at commit c6010f5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Component Colocation loads about 1.3k tokens when it runs. Until then it costs about 78 tokens; SKILL.md has 444 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~78
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from udecode/kitcn at commit c6010f5, republished under its Apache-2.0 licence (© udecode). 444 words, ~1,333 tokens.

Download SKILL.mdSave it as .claude/skills/component-colocation/SKILL.md (or your agent's skills folder).
name
component-colocation
description
Use after migrating/refactoring features (especially tables/data grids) when reviewing component structure - enforces merging over-split components, colocating files where used, removing unused code, following vertical slice architecture. Prevents premature abstraction and over-engineering.

Component Colocation & Refactoring

Overview

React Compiler removes many performance-only reasons to split components where it is enabled, including the canonical example app. Merge related code, colocate files where they are used, and delete unused files. Split only for genuine reuse, package boundaries, independent testing, or hook decoupling.

Kitcn Boundary

  • Apply this to example/**, www/**, and package UI modules after checking whether the affected app actually enables React Compiler.
  • Do not merge across public package exports, runtime entrypoints, generated boundaries, CLI template ownership, or React/Solid framework boundaries.
  • Scaffolded fixture output is generated. Improve its source template, then regenerate fixtures; never colocate by editing committed fixture output first.

When to Use

  • After implementing a new feature (especially tables/data grids)
  • When reviewing component structure during refactoring
  • When you notice files spread across multiple folders that are only used in one place
  • When cleaning up after removing a context/state management migration

Core Principles

1. Don't Over-Split Components

React Compiler handles memoization automatically. You don't need to split components into smaller pieces for performance.

tsx
// ❌ Over-split: separate files for each button group
FormDraftActionButtons.tsx;
FormEsignPendingActionButtons.tsx;
FormSignedActionButtons.tsx;
// ↑ Each file has similar hooks, similar logic, different render

// ✅ Single file with all logic colocated
ReportHistoryActionButtons.tsx;
// ↑ One component, switch/conditional for different states
2. Large Files Are Fine

Don't fear 300-500 line components. Splitting creates:

  • More files to navigate
  • Props drilling between components
  • Harder-to-follow data flow
  • Redundant hook calls
3. Colocate Where Used

Vertical slice architecture: Keep feature code together.

// ❌ Scattered across shared folders
src/components/shared/ActionButtons.tsx
src/components/shared/StatusBadge.tsx
src/hooks/useReportActions.ts

// ✅ Colocated in feature folder
src/app/(protected)/report-history/
  _components/
    report-history-action-buttons.tsx
    report-history-columns.tsx
    report-history-table.tsx
4. Ask Before Splitting

Only split components when:

  1. Hook decoupling: Component needs different hook contexts
  2. Genuine reuse: Used in 2+ unrelated features
  3. Explicit request: User asks for separation

Never split for:

  • "Readability" (large files are readable)
  • "Performance" (React Compiler handles it)
  • "Single responsibility" (SRP doesn't mean tiny files)
Show full SKILL.md (187 more words)Show less

Post-Feature Checklist

After implementing a feature, review:

  • Unused files: Delete components/hooks no longer referenced
  • Over-split components: Merge files that are only used together
  • Scattered locations: Move files to feature's _components folder if only used there
  • Prop drilling: If passing 5+ props between split components, merge them
  • Duplicate hooks: If multiple components call same hooks, merge components

Common Mistakes

PatternProblemFix
One component per file for "each variant"7 files instead of 1Merge into single component with conditionals
Shared folder for feature-specific codeHard to find, pollutes shared spaceMove to feature's _components
Keeping deleted context's componentsDead code, confusionDelete immediately
Splitting for "testability"Tests can test large componentsKeep together, test the whole thing

Red Flags - Merge Instead

  • Creating new file for component used in only one place
  • Passing props through 2+ levels just to reach a split component
  • Multiple small components with identical hook calls
  • "Shared" folder containing feature-specific code
  • Components named *Part1, *Section, *Inner

Example: Action Buttons Refactor

Before (over-split):

report-history-table/
  ActionButtons.tsx           # Router wrapper
  FormDraftActionButtons.tsx  # Draft state buttons
  FormEsignPendingActionButtons.tsx
  FormISOActionButtons.tsx
  FormMarkedCompleteActionButtons.tsx
  FormRefusedActionButtons.tsx
  FormSignedESignedActionButtons.tsx
  RefusedButton.tsx          # Single button extracted

After (colocated):

_components/
  report-history-action-buttons.tsx  # All logic in one file

Single 400-line file with switch statement for each form status. All hooks called once, no prop drilling, easy to follow.

© udecode, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/component-colocation of udecode/kitcn.

Open the folder on GitHubat commit c6010f5

Compare with similar skills

Component Colocation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Component Colocation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Component Colocation this skilludecode/kitcn450—~1.3kAutomated safety check: PassApache-2.0
PonytailDavidObando/gsharp5648 repos~1.7kAutomated safety check: PassMIT
Code Simplification for ego-litecitrolabs/ego-lite17k—~1.2kAutomated safety check: PassMIT
Nuqstrycompai/crm11k1 repos~1.7kAutomated safety check: PassMIT
Refactor Pass for Simplicitystar-history/star-history9.6k1 repos~168Automated safety check: PassMIT
RTK Rust Code Simplifierrtk-ai/rtk83k—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • Ponytail

    DavidObando/gsharp

    Forces the laziest solution that actually works, simplest, shortest, most minimal.

    564 GitHub starsUsed in 8 repos~1.7k tokens
    DevelopmentAuto-check passed
  • Finds and implements evidence-backed simplifications in the ego-lite repository, such as dead code, duplicated state and speculative abstractions, without hiding behavior changes.

    17k GitHub stars~1.2k tokensUpdated 14 days ago
    DevelopmentAuto-check passed
  • Nuqs

    trycompai/crm

    nuqs (type-safe URL query state) best practices for Next.js and other React frameworks.

    11k GitHub starsUsed in 1 repo~1.7k tokens
    DevelopmentAuto-check passed
  • Refactor Pass for Simplicity

    star-history/star-history

    Perform a refactor pass focused on simplicity after recent changes. Use when the user asks for a refactor/cleanup pass, simplification, or dead-code removal…

    9.6k GitHub starsUsed in 1 repo~168 tokens
    DevelopmentAuto-check passed
  • Reviews RTK's Rust code for over-engineering and verbose patterns, applying idioms like iterator chains and early returns while protecting a specific list of constraints from being simplified away.

    83k GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Deslop

    millionco/react-doctor

    Simplify and refine recently modified code while preserving functionality.

    15k GitHub stars~1.2k tokensUpdated today
    DevelopmentAuto-check passed

More from udecode/kitcn

All 33 skills in this repo
  • Walkthrough

    udecode/kitcn

    Create a short annotated visual walkthrough from real final-state screenshots or rendered artifacts.

    450 GitHub stars~1.6k tokensUpdated 6 days ago
    Auto-check passed
  • Avoid Feature Creep

    udecode/kitcn

    Prevent feature creep when building software, apps, and AI-powered products.

    450 GitHub stars~2.7k tokensUpdated 6 days ago
    Auto-check passed
  • Changeset Resolve

    udecode/kitcn

    Repair an unreleased .changeset/.md file so it matches the real branch delta against main.

    450 GitHub stars~922 tokensUpdated 6 days ago
    Auto-check passed
  • Audit newer Convex npm releases against kitcn. An agent skill from udecode/kitcn.

    450 GitHub stars~1.8k tokensUpdated 6 days ago
    Auto-check passed
  • Jotai X

    udecode/kitcn

    A skill your agent uses when working with Jotai X stores (createAtomStore), accessing state in components or callbacks, persisting state to cookies or localStorage

    450 GitHub stars~3.7k tokensUpdated 6 days ago
    Auto-check passed
  • Linear Backlog

    udecode/kitcn

    Run a scoped Linear backlog autonomously as a sequence of maximal safe parallel batches by composing orchestrator, autogoal, and task.

    450 GitHub stars~3.1k tokensUpdated 6 days ago
    Auto-check passed

Works with

Categories

Questions about Component Colocation

What does Component Colocation do?

Use after migrating/refactoring features (especially tables/data grids) when reviewing component structure - enforces merging over-split components, colocating files where used, removing unused…. Component Colocation is an agent skill from udecode/kitcn. Use after migrating/refactoring features (especially tables/data grids) when reviewing component structure - enforces merging over-split components, colocating files where used, removing unused code, following vertical slice architecture.

When should I use Component Colocation?

Component Colocation fits situations like: tasks that involve Refactoring; tasks that involve Code simplification.

How do I install Component Colocation in Claude Code?

Run `npx skills add udecode/kitcn --skill component-colocation -a claude-code`. Or copy the skill folder (.agents/skills/component-colocation in udecode/kitcn) into .claude/skills/component-colocation in your project. Claude Code loads it when a task matches its description.

How do I install Component Colocation in Codex?

Run `npx skills add udecode/kitcn --skill component-colocation -a codex`. Or copy the skill folder (.agents/skills/component-colocation in udecode/kitcn) into .agents/skills/component-colocation in your project. Codex loads it when a task matches its description.

Can I use Component Colocation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add udecode/kitcn --skill component-colocation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/component-colocation, .gemini/skills/component-colocation, .github/skills/component-colocation and .opencode/skills/component-colocation in your project.

What does Component Colocation need to run?

SKILL.md names no scripts, command-line tools or credentials: Component Colocation is instructions for the agent only.

Does Component Colocation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Component Colocation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Component Colocation use?

Component Colocation is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Component Colocation use?

About 1.3k tokens (SKILL.md is roughly 5.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Component Colocation?

Skills that share tags, products or a category with Component Colocation: Ponytail (DavidObando/gsharp, 564 stars), Code Simplification for ego-lite (citrolabs/ego-lite, 17k stars), Nuqs (trycompai/crm, 11k stars) and Refactor Pass for Simplicity (star-history/star-history, 9.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Component Colocation?

udecode (a GitHub organization) maintains it in udecode/kitcn, which has 450 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on October 1, 2026.

Source: udecode/kitcn on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.