Start with a clear, action-oriented description (this is what triggers it). Write a short body with concrete rules and at least one example. Link out to supporting files for anything long.
A focused skill that loads on .tsx files and teaches the agent your project's React component conventions — the exact shape Cursor's docs recommend for per-file-type rules.
--- name: react-component-standards description: React component standards for frontend UI files. Use when creating or editing React components, presentational patterns, or anything under src/components. globs: src/components/**/*.tsx, src/components/**/*.ts alwaysApply: false --- # React Component Guidelines When writing or reviewing React components, enforce: 1. **Component type**: functional components only — no class components 2. **Props**: define a typed 'interface' at the top of the file 3. **Exports**: named exports only; never default-export components 4. **Styling**: Tailwind utility classes; avoid inline 'style={}' objects 5. **Server state**: use TanStack Query; never 'useEffect' + 'fetch' ## Example ❌ Bad: 'export default function card(props: any) { ... }' ✅ Good: 'export function Card({ title, onSelect }: CardProps) { ... }' @component-template.tsx
A different activation style — description-only so the agent loads it when it detects hook work. Different area: logic, not presentation. Enforces the rules-of-hooks and cleanup patterns.
--- name: review-react-hooks description: When reviewing or writing React custom hooks — functions prefixed with 'use', files under src/hooks, or any code that calls useState, useEffect, useMemo, or useCallback. --- # React Hooks Review When reviewing React hooks, check for: 1. **Naming**: custom hooks must start with 'use' (e.g. 'useAuth', 'useCart') 2. **Rules of Hooks**: never call hooks inside loops, conditions, or nested functions 3. **Dependencies**: every value referenced inside 'useEffect'/'useMemo'/'useCallback' must appear in the deps array 4. **Cleanup**: any subscription, timer, or abort controller must return a cleanup function 5. **Return shape**: return a stable object or tuple — not a new reference on every render ## Example ❌ Bad: 'useEffect(() => { fetchUser(id) }, [])' // missing dep ✅ Good: 'useEffect(() => { const c = new AbortController(); fetchUser(id, c.signal); return () => c.abort(); }, [id])'
Auditing a component for accessibility is explicit, occasional work — so this skill has empty frontmatter and is invoked with @a11y-audit. Covers yet another area: compliance.
--- name: a11y-audit description: Audits React components for WCAG 2.1 AA accessibility issues — semantic HTML, ARIA attributes, keyboard navigation, and color contrast. Use when the user asks for an accessibility review or types @a11y-audit. --- # Accessibility Audit for React When auditing a React component, verify: 1. **Semantic HTML**: use '<button>', '<nav>', '<main>' — never '<div onClick>' for interactive controls 2. **Keyboard support**: all interactive elements must be reachable by 'Tab' and activatable with 'Enter'/'Space' 3. **ARIA labels**: icon-only buttons need 'aria-label'; form fields need a '<label>' or 'aria-labelledby' 4. **Focus management**: visible focus outline; modals trap focus and return it on close 5. **Images**: every '<img>' has a meaningful 'alt' or 'alt=""' for decorative images ## Example ❌ Bad: '<div onClick={close}>×</div>' ✅ Good: '<button type="button" aria-label="Close dialog" onClick={close}>×</button>'
Synthesized from Anthropic's best-practices docs and Ivan Seleznov's 650-trial study on Medium in 2026.
"React helper" is vague. "Use when reviewing React components for prop typing, naming, or Tailwind usage" is specific enough that semantic matching actually works.
Mention the file types, user intents, and keywords that should fire the skill.
Skills tend to under-trigger by default. Anthropic's own skill-creator docs recommend this — vague descriptions cause skills to never fire.
"Processes Excel files" — not "I can help with Excel." Matches how agents reason about tool choice.
review-react-components.mdc is better than react.mdc. Keep each skill single-purpose — Atlan's engineering team recommends 1–3 "always-on" rules maximum; everything else is auto-attach or agent-requested.
CLAUDE.md/AGENTS.md under 60 lines