mui-base
MUI Headless UI Best Practices
Comprehensive style guide for building headless React component libraries following MUI Base UI patterns. Contains 48 rules across 5 categories, prioritized by impact.
When to Apply
Reference these guidelines when:
- Building headless/unstyled component libraries
- Creating compound components with context-based composition
- Implementing accessible UI primitives with ARIA patterns
- Using render props and className callbacks for styling flexibility
- Writing components that support both controlled and uncontrolled modes
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Component Patterns | CRITICAL | comp- |
| 2 | Naming Conventions | HIGH | name- |
| 3 | Organization | HIGH | org- |
| 4 | Error Handling | HIGH | err- |
| 5 | Style | MEDIUM | style- |
Quick Reference
1. Component Patterns (CRITICAL)
comp-forward-ref-named- Use forwardRef with Named Functioncomp-props-parameter-naming- Name Props Parameter componentPropscomp-use-render-element- Use useRenderElement for DOM Renderingcomp-context-undefined-default- Create Context with Undefined Defaultcomp-context-error-message- Context Error Messages with Hierarchycomp-use-controlled- Use useControlled Hook for Dual Modescomp-state-memoization- Memoize State Objectscomp-context-value-memo- Memoize Context Provider Valuescomp-plain-function-root- Plain Function for Non-DOM Rootscomp-hook-namespace-exports- Hook Namespace Exportscomp-props-destructure-order- Props Destructuring Ordercomp-use-client-directive- Add use client Directive
2. Naming Conventions (HIGH)
name-component-naming- Component Naming as ParentPartname-file-matches-export- File Name Matches Primary Exportname-directory-kebab-case- Directory Naming kebab-casename-part-directory-lowercase- Part Directory Naming lowercasename-context-suffix- Context Naming with Suffixname-context-hook- Context Hook as useComponentContextname-props-interface- Props Interface as ComponentPropsname-state-interface- State Interface as ComponentStatename-namespace-type-exports- Namespace Type Exportsname-event-type- Event Type Naming Conventionname-constants- Constant Naming SCREAMING_SNAKE_CASEname-data-attributes- Data Attribute Naming lowercasename-hooks- Hook Naming with use Prefixname-refs- Ref Variable Naming with Suffixname-handlers- Handler Naming Convention
3. Organization (HIGH)
org-component-directory- Component Directory Structureorg-dual-barrel-exports- Dual Barrel Export Patternorg-test-colocation- Test File Colocationorg-context-placement- Context File Placementorg-data-attributes-file- Data Attributes Documentation Fileorg-state-attributes-mapping- State Attributes Mapping Fileorg-css-vars-file- CSS Variables Documentation Fileorg-package-exports- Package-Level Wildcard Exports
4. Error Handling (HIGH)
err-dev-only-warnings- Development-Only Warningserr-deduplicated-warnings- Deduplicated Warning Messageserr-message-prefix- Message Prefix Standarderr-context-error-guidance- Context Error Guidanceerr-prop-validation-timing- Prop Validation Timingerr-cancelable-events- Cancelable Event Patternerr-event-reason-constants- Event Reason Constantserr-typed-event-reasons- Type-Safe Event Reasons
5. Style (MEDIUM)
style-react-import- React Import as Namespacestyle-internal-imports- Internal Import Pathsstyle-explicit-undefined- Explicit Undefined in Prop Typesstyle-default-values- Default Values in Destructuringstyle-jsdoc-documentation- JSDoc Documentation
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
- Example: comp-forward-ref-named
- Example: org-component-directory
Source
Extracted from MUI Base UI codebase on 2026-01-17.
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
More from pproenca/dot-skills
zod
Zod schema validation best practices for type safety, parsing, and error handling. This skill should be used when defining z.object schemas, using z.string validations, safeParse, or z.infer. This skill does NOT cover React Hook Form integration patterns (use react-hook-form skill) or OpenAPI client generation (use orval skill).
2.0Kclean-architecture
Clean Architecture principles and best practices from Robert C. Martin's book. This skill should be used when designing software systems, reviewing code structure, or refactoring applications to achieve better separation of concerns. Triggers on tasks involving layers, boundaries, dependency direction, entities, use cases, or system architecture.
1.4Kemilkowal-animations
Emil Kowalski's animation best practices for web interfaces. Use when writing, reviewing, or implementing animations in React, CSS, or Framer Motion. Triggers on tasks involving transitions, easing, gestures, toasts, drawers, or motion.
918vitest
Vitest testing framework patterns for test setup, async testing, mocking with vi.*, snapshots, and test performance (formerly test-vitest). This skill should be used when writing or debugging Vitest tests. This skill does NOT cover TDD methodology (use test-tdd skill), API mocking with MSW (use test-msw skill), or Jest-specific APIs.
907typescript
This skill should be used when the user asks to "optimize TypeScript performance", "speed up tsc compilation", "configure tsconfig.json", "fix type errors", "improve async patterns", or encounters TS errors (TS2322, TS2339, "is not assignable to"). Also triggers on .ts, .tsx, .d.ts file work involving type definitions, module organization, or memory management. Does NOT cover TypeScript basics, framework-specific patterns, or testing.
821nuqs
nuqs (type-safe URL query state) best practices for Next.js applications. This skill should be used when writing, reviewing, or refactoring code that uses nuqs for URL state management. Triggers on tasks involving useQueryState, useQueryStates, search params, URL state, query parameters, nuqs parsers, or Next.js routing with state.
735