compose-atoms

Splits heavy React domains into composable atoms across page, portal, share, and micro-app hosts.

Updated Jan 27, 2026
One-click install
npx skills add https://github.com/SmallAi-API/smaihub --skill compose-atoms-smallai-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-atoms
Source: https://github.com/SmallAi-API/smaihub/tree/main/.agents/skills/compose-atoms
Command: npx skills add https://github.com/SmallAi-API/smaihub --skill compose-atoms-smallai-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Large React feature folders often become a single fat component tree controlled by mode, readOnly, and variant flags, forcing every host (page, portal, share, micro-app) to ship code it never uses. This Skill guides the restructuring of such domains into independently mountable atoms with sunk state, so each host ships only what it imports. ## Core Features & Use Cases - Atom Grain Analysis: Defines the right split granularity — the smallest unit a host is allowed not to mount — with concrete too-coarse/too-fine examples. - State Sinking Rules: Specifies which state (fetch, view model, transient UI, mutations) moves into atoms and which stays on the assembler, preventing hidden module-graph coupling. - Kit Taxonomy: Classifies pieces as domain primitives, data access, read/write/workflow atoms, domain slots, host seams, and assemblers, with ownership rules for each. - Use Case: A Conversation feature must ship to both the in-app page and a lightweight share host. Apply the 10-step procedure to extract read atoms, isolate the shared SWR hook, and rewrite each host as a pure import list, then prove the cut with a module trace. ## Quick Start Ask the AI to split the heavy feature folder into composable atoms with sunk state so the light host only imports read atoms by deep path.

Frequently Asked Questions about compose-atoms

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

FAQPage Schema
How do I split a large React component for multiple hosts?

List the hosts, list capabilities as verbs, and map hosts to verbs. Each verb a host can skip becomes an atom; sink its fetch, view model, and handlers into the atom, then rewrite each host as an import list plus layout.

When should I use compose-atoms instead of a simple component split?

Use it when the folder is a product surface with multiple hosts or a growing set of mode/readOnly/variant flags. If the file is large but has one capability and one host, use a plain React component split instead.

Should shared data be lifted to the page to fetch once?

No. Multiple atoms calling the same SWR hook share the cache by key, so lifting is unnecessary. Lift state only when it is the assembler's job, such as which workflow is on screen or whether a rail is open.

What is the difference between a domain slot and a host seam?

A domain slot is a ReactNode hole for an optional same-domain capability, like an editSlot filled by a write atom. A host seam is runtime-specific UI (chat store, Electron) whose context defaults to null so light hosts never import the provider.

How do I verify the light host does not ship write atoms?

Trace the light entry's import tree with a build-time module trace, for example WORKBENCH_TRACE_MODULE pointing at the write atom. If the light assembler appears on the importer chain, a static import remains via a barrel, flag, or page-level action.