composition · devin-axis — Claude Code rule: what it does, how to install
Enforces component composition patterns: wraps list items in groups, requires modal titles for accessibility, and swaps custom divs for UI primitives.
LicenseRef-Proprietary ★ 7,523 updated 2026-10-29
.claude/rules/composition.mdWhat composition does
The rule guides coding agents through strict UI composition patterns. Dropdown and menu elements such as SelectItem or CommandItem must live inside their corresponding group wrappers like SelectGroup or CommandGroup. Similarly, TabsTrigger requires a TabsList parent, and Avatar must include an AvatarFallback element.
It explicitly stops the agent from guessing non-existent isLoading or isPending flags on buttons. Loading indicators must use a nested Spinner paired with the standard disabled attribute. Overlay components like Dialog, Sheet, and Drawer strictly require a title element, relying on sr-only classes when hidden visually.
Without a Radix-style UI library and sonner present in the project, the generated imports and markup will break your build.
What it helps with
- stop agents from adding imaginary loading props to buttons
- enforce accessible title elements on dialogs and sheets
- nest dropdown and select items inside proper group parents
- replace raw divider lines and custom badges with design system primitives
Example prompts for the agent
- Build an account settings modal using the
Dialogcomponent - Create a team member overview card with header and footer actions
- Set up a project category filter using
Select
How to install composition
Manually: put the files in place
.claude/rules/composition.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/composition.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/composition.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/composition.mdManually: put the files in place
.clinerules/composition.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about composition
How do I install composition in Claude Code?
Save the rule file to .claude/rules/composition.md in your repository root.
What does the composition rule do?
It stops the model from writing malformed UI hierarchies, enforcing group wrappers, proper card sections, and accessible dialog headers.
How does this rule handle pending states on buttons?
It disables the button and embeds a Spinner component with data-icon="inline-start" instead of passing boolean loading flags.
Similar IDE rules
All IDE rules for Frontend and UI →composition by other authors comes first.