AgentSkillsCN

react-frontend

运用 Vite、TanStack Query、Zustand 以及 shadcn/ui,开展 React 19 + TypeScript 前端开发。当您需要构建 React 组件、配置 Vite 项目、使用 TanStack Query 管理服务端状态、借助 Zustand 管理 UI 状态、采用 Tailwind CSS 进行样式设计,或引入 shadcn/ui 组件时,此技能将为您提供强大助力。触发条件包括 .tsx、.ts 文件、React Hook、API 集成、状态管理、表单处理以及 UI 组件开发等场景。

SKILL.md
--- frontmatter
name: react-frontend
description: >
  React 19 + TypeScript frontend development with Vite, TanStack Query, Zustand, and shadcn/ui.
  Use this skill when: building React components, configuring Vite projects, managing server state 
  with TanStack Query, handling UI state with Zustand, styling with Tailwind CSS, or implementing 
  shadcn/ui components. Triggers include .tsx, .ts files, React hooks, API integration, state 
  management, form handling, and UI component development.
license: MIT
compatibility: Claude Code, OpenCode, Codex, Gemini-Cli, bun/pnpm package managers, Node LTS
metadata:
  author: razobeckett
  version: "1.0"
  stack: react-vite-tanstack-zustand-shadcn

React Frontend Development

Vite + React 19 + TypeScript + TanStack Query + Zustand + shadcn/ui

Quick Reference

LayerToolPurpose
FrameworkReact 19 + ViteUI rendering + dev server
StylingTailwind CSS + shadcn/uiUtility-first CSS + components
Server StateTanStack Query + AxiosFetch, cache, sync server data
UI StateZustandClient-only state (dialogs, filters)
Iconslucide-animated > lucide-reactPrefer animated variants
AnimationMotion (framer-motion)Shared presets only
Lint/FormatBiomeSingle tool for both

Critical Rules

ALWAYS

  • TypeScript strict mode (no any, no @ts-ignore)
  • Prefer bun package manager, fallback to pnpm (NEVER npm)
  • Use Biome for linting AND formatting
  • TanStack Query for ALL server data
  • Zustand for UI-only state
  • lucide-animated icons when available

NEVER

  • Suppress type errors (as any, @ts-ignore, @ts-expect-error)
  • Use npm as package manager
  • Mix server state in Zustand
  • Custom animations outside shared presets
  • Paste secrets or production data in code

ASK FIRST

  • Auth implementation (WorkOS vs better-auth)
  • Major refactors affecting 3+ files
  • Changing core dependencies (icons, auth, state management)
  • Non-obvious architectural decisions

State Management Decision Tree

code
Is it from an API/server?
├─ YES → TanStack Query (useQuery, useMutation)
└─ NO → Is it UI-related?
         ├─ YES → Zustand (dialogs, selections, filters)
         └─ NO → Consider if state is needed at all

Commands

bash
# Setup (use bun, fallback pnpm)
bun install        # or: pnpm install

# Development
bun run dev        # or: pnpm dev

# Build
bun run build      # or: pnpm build

# Lint & Format
bun run check      # biome check
bun run format     # biome format --write

Detailed References

TopicFile
Tech stack configurationreferences/stack.md
Code patterns & conventionsreferences/patterns.md
Agentic workflow rulesreferences/workflow.md
Project structurereferences/structure.md

Quality Gates (Pre-commit)

Required before any commit:

  1. biome check - Lint + format validation
  2. tsc --noEmit - TypeScript type checking

Husky + lint-staged enforces these automatically.