emil-component-design
БесплатноБез исполняемых скриптовНе проверенDesign React component APIs that are composable, predictable, and hard to misuse — composition over configuration, compound components…
от freekmurze★ 1 019 звёзд на GitHubОб этом скилле
Component Design
A component API is a contract. Good ones make the common case a one-liner and the uncommon case possible without forking. The failure modes are always the same: too rigid (users fork or hack around you) or too configurable (30 props nobody can hold in their head). Reach for composition before configuration, name things the way the platform names them, and support both controlled and uncontrolled state when state is involved.
Quick Reference
| Topic | Where |
|---|---|
| Core API decisions (composition, compound, props, state) | This file |
| Implementation patterns (context, controlled/uncontrolled, asChild, refs, slots, file structure) | implementation.md |
Core Principles
1. Composition over configuration
Expose structure as JSX children, not configuration objects:
// Good - composable
<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
<CardDescription>Description</CardDescription>
</CardHeader>
<CardContent>Content here</CardContent>
<CardFooter>
<Button>Action</Button>
</CardFooter>
</Card>
// Bad - configuration object
<Card
header={{ title: "Title", description: "Description" }}
content="Content here"
footer={{ actions: [{ label: "Action", onClick: () => {} }] }}
/>
2. Compound components for multi-part UI
When a component has multiple related parts sharing implicit state, split it into compound components instead of prop-drilling everything through one root:
// Good - compound components
<Dialog>
<Dialog.Trigger>Open</Dialog.Trigger>
<Dialog.Content>
<Dialog.Title>Are you sure?</Dialog.Title>
<Dialog.Description>This action cannot be undone.</Dialog.Description>
<Dialog.Close>Cancel</Dialog.Close>
</Dialog.Content>
</Dialog>
// Bad - prop drilling everything
<Dialog
trigger="Open"
title="Are you sure?"
description="This action cannot be undone."
closeText="Cancel"
/>
Use compound components when:
- Multiple related elements share implicit state
- The component has slots (header, body, footer)
- The order or presence of children varies between usages
- Consumers need flexible composition
Don't use them when:
- The component is simple with a fixed structure
- It has 1-3 props
- The structure never changes
Share the implicit state through React context — the root provides, the parts consume. Implementation in implementation.md.
3. The Goldilocks level of customization
Too little customization and users fork your component or add hacky workarounds. Too much and the API becomes confusing and a maintenance nightmare. Aim for the middle:
// Too rigid - no customization
<Button>Click me</Button>
// Too flexible - overwhelming API
<Button
backgroundColor="#000"
hoverBackgroundColor="#333"
activeBackgroundColor="#111"
borderRadius={4}
paddingX={16}
paddingY={8}
fontSize={14}
fontWeight={500}
// ... 30 more props
>
Click me
</Button>
// Just right - variants + escape hatch
<Button variant="primary" size="md" className="custom-override">
Click me
</Button>
Layer customization in this order:
- Variants — predefined options (
primary,secondary,destructive) - Size — predefined sizes (
sm,md,lg) - className — escape hatch for one-off overrides
- asChild — render as a different element (Radix pattern)
When implementing variants, express the styles in the project's existing styling system (Tailwind, CSS Modules, vanilla-extract, styled-components — whatever the codebase already uses). Don't impose a new one.
4. Name props like the platform does
Be consistent across every component, mirror HTML where possible:
// Good - consistent patterns
<Input disabled />
<Button disabled />
<Select disabled />
// Bad - inconsistent
<Input disabled />
<Button isDisabled />
<Select readonly />
Boolean props get positive names — never double negatives:
// Good
<Input disabled />
<Modal open />
// Bad
<Input notEnabled />
<Modal isNotClosed />
Event handlers are prefixed with on:
// Good
<Input onChange={} onBlur={} />
<Dialog onOpenChange={} onClose={} />
// Bad
<Input handleChange={} blurHandler={} />
5. Support both controlled and uncontrolled state
Any stateful component should work both ways — internal state by default, external state when the consumer needs it:
// Uncontrolled
<Input defaultValue="hello" />
// Controlled
<Input value={value} onChange={setValue} />
Full dual-mode implementation in implementation.md.
6. Play nice with the DOM
- Forward refs on every component that wraps a DOM element — otherwise focus management, tooltips, and popover positioning break for composers.
- Spread remaining props (
{...props}) soaria-*,data-testid, and other HTML attributes pass through. - Pick defaults that work for 80% of usages — e.g.
variant = "primary",size = "md", and `type =
Установить emil-component-design в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл emil-component-design?
Design React component APIs that are composable, predictable, and hard to misuse — composition over configuration, compound components, controlled/uncontrolled state, and sensible props. Use when creating or refactoring React components, designing a component library, reviewing a props API, or deciding how a component should expose customization. Triggers on: component API, props design, compound components, composition, configuration props, controlled, uncontrolled, defaultValue, asChild, Slot, render props, forwardRef, ref forwarding, variants, className override, design system components, reusable components, component library, Radix, shadcn, prop drilling, boolean props, slots, children, context.
Как установить скилл emil-component-design?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл emil-component-design запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic