udecode/plate/react
Claude Code and agent skill by udecode/plate
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
React patterns with destructured props, compiler optimization, Effects, and Tailwind v4 syntax. ALWAYS use when using React.
Install
npx vskill@latest install udecode/plate/reactSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as udecode/plate/react.
Requirements
- Always use destructured props in function parameters
- Define TypeScript types inline with the destructured props
- Avoid creating separate interfaces for component props
- Avoid non-destructured props that require additional destructuring inside the component
- Use available UI components from the component library
- Use CSS variables from globals.css for consistent theming
- Use Tailwind v4 syntax (see Tailwind v4 Syntax)
- DO NOT add icon margin in Button, DropdownMenuItem: use gap-2 instead
- Use
useEffectEventto extract non-reactive logic from Effects (see Separating Events from Effects) - NEVER suppress the dependency linter with
eslint-disable- useuseEffectEventinstead - Use custom breakpoint syntax for responsive design (see App-Specific Rules)
Tailwind v4 Syntax
- Inline opacity: Use
/for opacity (bg-black/50 text-white/80) - v3:
bg-black bg-opacity-50 text-white text-opacity-80 - Removed:
bg-opacity-*,text-opacity-*,border-opacity-* - Renamed utilities:
shadow-sm→shadow-xs,rounded-sm→rounded-xs,blur-sm→blur-xs - CSS variables: Use parentheses
bg-(--brand-color)instead of bracketsbg-[--brand-color] - Important modifier: Exclamation mark at the end (
size-5!) instead of beginning (!size-5) - Descendant selectors: Use
**:for all descendants (replaces[&_*]:) and*:for direct children (replaces[&>*]:) - All descendants:
**:px-4instead of[&_*]:px-4 - Direct children:
*:px-4instead of[&>*]:px-4 - Element filtering:
*:[a]:underlineinstead of[&>a]:underline,**:[a]:underlineinstead of[&_a]:underline - Data attributes:
*:data-[slot=field-label]:flex-autoinstead of*:[[data-slot=field-label]]:flex-auto. Keep[[data-...]]if there are other selectors. - Context-aware (in-):
in-data-[slot=tooltip-content]:text-backgroundinstead of[[data-slot=tooltip-content]_&]:text-background - Composable variants: Chain variants together (
group-has-data-selected:opacity-100,data-highlighted:ring-2) - Canonical classes: Always prefer built-in utilities over arbitrary values (e.g.,
w-fullinstead ofw-[100%],translate-x-fullinstead oftranslate-x-[100%]) - Default changes: Border color now
currentColor(wasgray-200), ring width now 1px (was 3px)
Component Patterns
Design Tokens
Design tokens are semantic CSS variables that separate theme, context, and usage. Rather than hardcoding colors, use a semantic naming convention that creates layers of abstraction.
Variable Architecture
Common tokens:
--background- Page background color--foreground- General text color--primary- Main brand color--primary-foreground- Text color against primary
This creates a maintainable, flexible system that scales across applications.
Data Attribute Styling Patterns
Shadcn/ui and Radix UI components use data attributes (data-state, data-slot) to enable flexible styling without prop explosion. Use these patterns when working with components that expose data attributes.
Styling with data-state
Components expose their state through data-state attributes. Use Tailwind's arbitrary variant syntax to style based on component state:
For commonly-used states, extend Tailwind's configuration:
Then use shorthand:
Radix UI Data Attributes
Radix UI automatically applies data attributes to its primitives:
Common Radix data attributes:
data-state- open/closed, active/inactive, on/offdata-side- top/right/bottom/left (for positioned elements)data-align- start/center/end (for positioned elements)data-orientation- horizontal/verticaldata-disabled- present when disableddata-placeholder- present when showing placeholder
Common State Patterns
Use data attributes for all kinds of component state:
Using data-slot for Component Targeting
Components use data-slot attributes for stable identifiers that can be targeted by parents.
Using `has-[]` for parent-aware styling:
Using `[&_]` for descendant targeting:
Global CSS with data-slot
Use global CSS for theme-wide component styling:
data-slot Naming Conventions
Follow these conventions for consistent data-slot naming:
- Use kebab-case -
data-slot="form-field"notdata-slot="formField" - Be specific -
data-slot="submit-button"notdata-slot="button" - Match component purpose - Name reflects what it does, not how it looks
- Avoid implementation details -
data-slot="user-avatar"notdata-slot="rounded-image"
When to Use Data Attributes vs Props
Use `data-state` for:
- Visual states (open/closed, active/inactive, loading)
- Layout states (orientation, side, alignment)
- Interaction states (hover, focus, disabled when styling children)
Use `data-slot` for:
- Component identification with stable identifiers
- Parent-child composition patterns
- Theme-wide component styling
- Variant-independent targeting
Use props for:
- Variants (primary, secondary, destructive)
- Sizes (sm, md, lg)
- Behavioral configuration (controlled/uncontrolled, defaults)
- Event handlers (onClick, onChange)
Combined example:
React Compiler
Context
This project uses React Compiler, which automatically optimizes your React code through automatic memoization at build time. Manual memoization with useMemo, useCallback, and React.memo is rarely needed and often introduces unnecessary complexity.
Core Principle
Write clean, idiomatic React code. Let the compiler optimize it.
React Compiler automatically applies optimal memoization based on data flow analysis. It can even optimize cases that manual memoization cannot handle, such as memoizing values after conditional returns or within complex control flow.
Requirements
DO NOT Use Manual Memoization
- NEVER wrap components with
React.memounless you have a specific, documented reason - NEVER use
useMemofor performance optimization - the compiler handles this - NEVER use
useCallbackfor performance optimization - the compiler handles this - NEVER create inline functions and then wrap them in
useCallback- this is redundant
When Manual Memoization IS Acceptable
Manual memoization should only be used as an escape hatch for precise control in specific scenarios:
- Effect Dependencies: When a memoized value is used as a dependency in
useEffectto prevent unnecessary effect re-runs - External Library Integration: When passing callbacks to non-React libraries that don't handle reference changes well
- Precise Control: When you have profiled and verified that the compiler's automatic memoization is insufficient for a specific hotspot
CRITICAL: If you use manual memoization, you MUST document why with a comment explaining the specific reason.
Examples
Component Memoization
<example>
The compiler automatically memoizes components and values, ensuring optimal re-rendering without manual intervention. </example>
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtemplates/plate-template/.agents/skills/react/SKILL.md
Popularity
- Repository stars
- 16,707
- Repository forks
- 998
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/udecode/plate/react)