Skip to content
Back to skills

Frontend Mastery

ASecurity

Advanced React patterns, performance optimization, and state management rules.

  • 666 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 8, 2026
developmentreactfrontendperformance

Works with

  • cli

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill frontend-mastery --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Frontend Mastery?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Frontend Mastery
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-frontend-mastery/badge)](https://www.skillsdirectory.com/skills/majiayu000-frontend-mastery)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: frontend_mastery
description: Advanced React patterns, performance optimization, and state management rules.
allowed-tools: Read, Edit, Write
---

# Frontend Mastery Protocol (React + Vite + Tailwind)

## 1. Performance "Pro" Checklist

**Before submitting any UI component, verify:**

- [ ] **Re-renders**: Are we re-rendering unnecessarily? Use `React.memo` or `useCallback` for stable props.
- [ ] **Lazy Loading**: Are strict routes lazy-loaded? (`React.lazy`)
- [ ] **Image Optimization**: Are images using proper formats (WebP/AVIF) and `loading="lazy"`?
- [ ] **Zustand Selectors**: Are we selecting _only_ what we need?
  - ❌ `const { user, token } = useAuthStore()`
  - ✅ `const user = useAuthStore((s) => s.user)`
- [ ] **Bundle Size**: Did we import a huge library for one function? (e.g. import `lodash` vs `lodash/debounce`)

## 2. State Management Rules (Zustand + React Query)

- **Server State**: MUST use `React Query`.
  - NEVER store server data in global Zustand store manually (unless caching for UI sync).
  - Use `staleTime` and `cacheTime` appropriately.
- **Client State**: Use `Zustand` for global, `useState` for local.
  - Avoid "Prop Drilling" > 2 levels. Use Context or Zustand.

## 3. Architectectural Patterns

- **Container/Presenter**: Separate logic (Hooks) from View (JSX).
  - Complex components should have a custom hook (e.g., `useComponentLogic.ts`).
- **Composition**: Use `children` prop instead of passing components as props where possible.
- **Custom Hooks**: Extract reusable logic immediately. `useBoolean`, `useToggle`, etc.

## 4. Code Quality & Formatting

- **Naming**: `use[Action]` for hooks, `handle[Event]` for handlers.
- **CSS (Tailwind)**:
  - Group layout (`flex`, `grid`) first, then spacing, then visual (`bg`, `text`).
  - Use `clsx` or `tailwind-merge` for conditional classes.
  - NO inline styles (`style={{}}`) except for dynamic coordinates.

## 6. Error Boundaries

- Critical UI parts MUST have an `<ErrorBoundary>`.
- Async components (Suspense) must handle loading states gracefully.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.