# design-system-compound-components

design-system-compound-components is a Claude Code rule that forbids raw string children in non-text components. It enforces compound structures like ButtonText and ButtonIcon across the design system.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 88 repo stars
- Author: alexj11324
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/alexj11324/Mikka/tree/HEAD/.claude/skills/react-native-skills/rules/design-system-compound-components.md
- Updated: 2026-11-17
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/design-system-compound-components

## What it does

This rule stops the coding agent from creating elements that take raw strings unless the element is explicitly built as a dedicated text node. Whenever an interface block combines containers, icons, and labels, the agent must construct them as compound components.

Rather than typing props as `string | React.ReactNode` and inspecting the child type at runtime, the guideline requires dedicated subcomponents such as `ButtonText` and `ButtonIcon`. This structure keeps props explicit and prevents ambiguous markup.

The rule lives as a standalone Markdown file inside your project settings. It operates without external dependencies or build tools.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/design-system-compound-components.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/design-system-compound-components.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/design-system-compound-components.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/design-system-compound-components.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/design-system-compound-components.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/alexj11324/Mikka/tree/HEAD/.claude/skills/react-native-skills/rules/design-system-compound-components.md

## When to use it
- stop ambiguous string children in container components
- split complex UI elements into compound parts
- remove runtime type checking inside children
- keep button and card APIs consistent across a design system

## Example prompts
- Create a button with an icon and label following design system guidelines
- Refactor this card component into compound parts with dedicated text nodes

## Similar
- [architecture-compound-components](https://affpapa.org/en/nevibecode/rules/architecture-compound-components.md) — rule · ★ 7191 repo stars
- [expo-design-system](https://affpapa.org/en/nevibecode/skills/expo-design-system.md) — skill · 22700 installs
- [tailwind-design-system](https://affpapa.org/en/nevibecode/skills/giuseppe-trisciuoglio-tailwind-design-system.md) — skill · 4800 installs
- [design-system](https://affpapa.org/en/nevibecode/skills/microsoft-design-system.md) — skill · ★ 1167 repo stars
- [generic-react-design-system](https://affpapa.org/en/nevibecode/skills/generic-react-design-system.md) — skill · 191 installs
- [design-system-creation](https://affpapa.org/en/nevibecode/skills/design-system-creation.md) — skill · 545 installs

From the same set: [alexj11324/mikka](https://affpapa.org/en/nevibecode/by/alexj11324/mikka.md) — 47 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
