component-composition
БесплатноБез исполняемых скриптовНе проверенUse on every UI change - Atomic Design levels, reuse-before-build, correct placement, and import direction through the shared component library.
от makifbaysal★ 123 звезды на GitHubОб этом скилле
Component Composition (Atomic Design)
Overview
All web UI follows Atomic Design on top of a shared component library. The quality bar is reuse and correct placement: a new screen is assembled from existing atoms and molecules, and anything genuinely new is added at the right level so the next screen reuses it too.
Core principle: Reuse before you build, and place new components at the level the import-direction rule expects — ui → atoms → molecules → organisms → templates → pages.
No design system yet in this repo (no tokens, no components/ levels, no INVENTORY.md)? Lay the foundation with web-design-system-foundation first — this skill assumes it already exists.
The Levels
| Level | What | Web examples |
|---|---|---|
ui/ |
Vendor layer: generated/wrapped Radix-shadcn primitives | Dialog, Popover, Tabs, Tooltip |
| Atom | Smallest reusable UI, no app logic, variants only | Button, Input, Label, Badge, Icon, Heading, Text, Container, Stack, Link |
| Molecule | A few atoms as one reusable unit | FormField (label+input+error), NavLink, PriceTag, Rating, SearchBar |
| Organism | A page section composed of molecules/atoms (may contain another organism) | SiteHeader, MobileNav, PricingTable, ContactForm, SiteFooter |
| Template | Page skeleton: owns the grid + breakpoints, no data | MarketingLayout, DashboardLayout |
| Page | Route component: data + state wiring, composes templates/organisms | PricingPage, ProjectBoardPage |
The reuse procedure (every time, before writing a component)
- Read
src/components/INVENTORY.md. - Grep the level folders for the noun (
grep -ri button src/components). - Found a close match → reuse it, or extend it with a new variant backward-compatibly (add a
cvavariant, don't change an existing one's output). - Nothing close → create it at the right level (see placement below) and add its
INVENTORY.mdline in the same commit.
Placement decision list
- Does it fetch data or own app state? → page (or a container that wraps a page-level hook).
- Is it a page skeleton with no content, owning only the grid/breakpoints? → template.
- Several molecules/atoms forming a page section (pricing grid, contact form, header)? → organism.
- Label + input + error, or icon + text pairing — two or three atoms as one reusable unit? → molecule.
- A single element with variants and no composition (one button, one badge)? → atom.
- A generated/wrapped Radix or shadcn primitive with no app-specific variants of its own? →
ui/.
Import direction
ui ← atoms ← molecules ← organisms ← templates ← pages. A level imports only from levels to its left, plus lib/. Same-level imports are allowed ONLY for organisms (an organism may contain another organism). hooks/ and api/ are imported only by pages/. Where the repo runs ui-guard (from web-design-system-foundation), it enforces this on every build — a violation fails npm run build, it isn't a style note.
Atom API rules
- No outer margin or absolute positioning — the parent lays out with
gap-*; an atom that sets its own margin breaks every layout that reuses it. - Variants through
cva, never a pile of boolean props;classNameis merged last viacn()and callers use it for layout only (width, grid placement, alignment) — never to restyle the atom; a new look is a new variant. - Every interactive state is styled: hover,
focus-visible, active, disabled,aria-invalid, loading where relevant. - Accepts
refas a plain prop (React 19) orforwardRef(React 18) — a shared atom that can't take a ref breaks the first caller that needs to measure or focus it.
Composition over prop explosions
Three or more isX booleans on one component is a sign it's actually two components, or that it needs children/named slots instead. Prefer:
// ❌ boolean-prop explosion
<Card isHighlighted isCompact hasFooter footerText="Save" />
// ✅ composition: the variant is a real prop, content is children/slots
<Card variant="highlighted" size="compact">
<Card.Footer>Save</Card.Footer>
</Card>
An explicit variant component (PrimaryCard vs <Card variant="primary">) is fine when the two really don't share markup — don't force one component to branch internally just to avoid two small ones.
Templates and organisms are container-aware
A template owns the grid and the breakpoints (sm:/md:/lg: live here) — organisms placed inside it should not assume a specific viewport width. Where an organism's internal layout depends on the space it's given rather than the screen, use a @container query or let the parent grid/flex sizing drive it, so the same organism works in a full-width template and a narrower sidebar slot.
Existing repos
Map the repo's own folders onto these levels (e.g. components/common/ ≈ atoms+molecules) and follow them as found. Never restructure an existing repo's component layout inside a feature t
Установить component-composition в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл component-composition?
Use on every UI change - Atomic Design levels, reuse-before-build, correct placement, and import direction through the shared component library.
Как установить скилл component-composition?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл component-composition запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic