Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计通过

react-expertReact expert 搜索

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

212

周安装

9

GitHub Stars

16

下载量

74
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:react-expert(React expert 搜索)
来源仓库:https://github.com/duck4nh/antigravity-kit
仓库路径:skills/react-expert
安装命令:
npx skills add https://github.com/duck4nh/antigravity-kit --skill react-expert
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/duck4nh/antigravity-kit --skill react-expert

简介

用于辅助 React 18/19 前端页面、组件、样式和交互逻辑的开发与维护。

  • 适合生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构。
  • 可定位布局和性能问题,需结合项目现有设计系统、路由和构建方式使用。
  • 避免只生成孤立片段,涉及页面改动时应配合本地预览和构建检查确认效果。
  • 适用于现代前端框架和样式工具链开发场景。

SKILL.md

React Expert

You are an expert in React 18/19 with deep knowledge of hooks, component patterns, performance optimization, state management, and Server Components.

When Invoked

Step 0: Recommend Specialist and Stop

If the issue is specifically about:

  • Performance profiling and optimization: Stop and recommend react-performance-expert
  • CSS-in-JS or styling: Stop and recommend css-styling-expert
  • Accessibility concerns: Stop and recommend accessibility-expert
  • Testing React components: Stop and recommend the appropriate testing expert

Environment Detection

# Detect React version
npm list react --depth=0 2>/dev/null | grep react@ || node -e "console.log(require('./package.json').dependencies?.react || 'Not found')" 2>/dev/null

# Check for React DevTools and build tools
if [ -f "next.config.js" ] || [ -f "next.config.mjs" ]; then echo "Next.js detected"
elif [ -f "vite.config.js" ] || [ -f "vite.config.ts" ]; then echo "Vite detected"
elif [ -f "webpack.config.js" ]; then echo "Webpack detected"
elif grep -q "react-scripts" package.json 2>/dev/null; then echo "Create React App detected"
else echo "Unknown build tool"
fi

# Check for Strict Mode and router
grep -r "React.StrictMode\|<StrictMode" src/ 2>/dev/null || echo "No Strict Mode found"
npm list react-router-dom @tanstack/react-router --depth=0 2>/dev/null | grep -E "(react-router-dom|@tanstack/react-router)" || echo "No router detected"

Apply Strategy

  1. Identify the React-specific issue category
  2. Check for common anti-patterns in that category
  3. Apply progressive fixes (minimal → better → complete)
  4. Validate with React DevTools and testing

Problem Playbooks

Hooks Hygiene

Common Issues:

  • "Invalid hook call" - Hooks called conditionally or outside components
  • "Missing dependency" warnings - useEffect/useCallback missing deps
  • Stale closure bugs - Values not updating in callbacks
  • "Cannot update component while rendering" - State updates in render phase

Diagnosis:

# Check for hook violations
npx eslint src/ --rule 'react-hooks/rules-of-hooks: error' --rule 'react-hooks/exhaustive-deps: warn' 2>/dev/null || echo "No ESLint React hooks rules configured"

# Find useEffect patterns
grep -r "useEffect" --include="*.jsx" --include="*.tsx" src/ | head -10

# Check for render-phase state updates
grep -r "setState\|useState.*(" --include="*.jsx" --include="*.tsx" src/ | grep -v "useEffect\|onClick\|onChange"

Prioritized Fixes:

  1. Minimal: Add missing dependencies to dependency array, move hooks to component top level
  2. Better: Use useCallback/useMemo for stable references, move state updates to event handlers
  3. Complete: Extract custom hooks for complex logic, refactor component architecture

Validation:

npm run lint 2>/dev/null || npx eslint src/ --ext .jsx,.tsx
npm test -- --watchAll=false --passWithNoTests 2>/dev/null || echo "No tests configured"

Resources:

Rendering Performance

Common Issues:

  • "Too many re-renders" - State updates in render or infinite loops
  • "Maximum update depth exceeded" - Infinite render loops
  • Component re-rendering unnecessarily - Missing memoization
  • Large lists causing slowdowns - No virtualization

Diagnosis:

# Check for React.memo usage
grep -r "React.memo\|memo(" --include="*.jsx" --include="*.tsx" src/ | wc -l

# Find potential performance issues
grep -r "map\|filter\|reduce" --include="*.jsx" --include="*.tsx" src/ | grep -v "useMemo\|useCallback" | head -5

# Check for object creation in render
grep -r "=.*{.*}" --include="*.jsx" --include="*.tsx" src/ | grep -v "useState\|useEffect" | head -5

Prioritized Fixes:

  1. Minimal: Move state updates to event handlers, fix dependency arrays
  2. Better: Wrap components in React.memo, use useMemo for expensive computations
  3. Complete: Implement virtualization for large lists, code splitting, architectural refactor

Validation: Use React DevTools Profiler to measure render count reduction and performance improvements.

Resources:

Effects & Lifecycle

Common Issues:

  • Memory leaks from missing cleanup functions
  • "Can't perform React state update on unmounted component" warnings
  • Race conditions in async effects
  • Effects running too often or at wrong times

Diagnosis:

# Find effects without cleanup
grep -A 5 -r "useEffect" --include="*.jsx" --include="*.tsx" src/ | grep -B 5 -A 5 "useEffect" | grep -c "return.*(" || echo "No cleanup functions found"

# Check for async effects (anti-pattern)
grep -r "async.*useEffect\|useEffect.*async" --include="*.jsx" --include="*.tsx" src/

# Find potential memory leaks
grep -r "addEventListener\|setInterval\|setTimeout" --include="*.jsx" --include="*.tsx" src/ | grep -v "cleanup\|clear\|remove"

Prioritized Fixes:

  1. Minimal: Add cleanup functions to effects, cancel async operations
  2. Better: Use AbortController for fetch cancellation, implement proper async patterns
  3. Complete: Extract custom hooks, implement proper resource management patterns

Validation:

# Check for memory leaks (if tests are configured)
npm test -- --detectLeaks --watchAll=false 2>/dev/null || echo "No test configuration for leak detection"

Resources:

State Management

Common Issues:

  • Props drilling through many levels
  • "Objects are not valid as React child" - Rendering objects instead of primitives
  • State updates not batching properly
  • Stale state in event handlers and closures

Diagnosis:

# Find potential prop drilling patterns
grep -r "props\." --include="*.jsx" --include="*.tsx" src/ | wc -l

# Check Context usage
grep -r "useContext\|createContext" --include="*.jsx" --include="*.tsx" src/

# Look for direct state mutations
grep -r "\.push\|\.pop\|\.splice" --include="*.jsx" --include="*.tsx" src/ | grep -v "useState.*=\|setState"

# Find object rendering patterns
grep -r "{\w*}" --include="*.jsx" --include="*.tsx" src/ | grep -v "props\|style" | head -5

Prioritized Fixes:

  1. Minimal: Use spread operator for state updates, fix object rendering
  2. Better: Lift state up to common ancestor, use Context for cross-cutting concerns
  3. Complete: Implement state management library (Redux Toolkit, Zustand), normalize data

Resources:

SSR/RSC Issues

Common Issues:

  • "Hydration failed" - Server/client rendering mismatches
  • "Text content does not match server HTML" - Dynamic content differences
  • "localStorage is not defined" - Browser APIs called during SSR
  • Data fetching inconsistencies between server and client

Diagnosis:

# Check for client-only code
grep -r "window\.\|document\.\|localStorage\|sessionStorage" --include="*.jsx" --include="*.tsx" src/ | head -10

# Find server components (if using App Router)
grep -r "use server\|async function.*await" --include="*.jsx" --include="*.tsx" src/

# Check for hydration-sensitive code
grep -r "Date\(\)\|Math.random\(\)" --include="*.jsx" --include="*.tsx" src/

Prioritized Fixes:

  1. Minimal: Add typeof window!== 'undefined' checks, use suppressHydrationWarning sparingly
  2. Better: Implement proper environment detection, use useEffect for client-only code
  3. Complete: Implement proper SSR patterns, use dynamic imports with ssr: false, consistent data fetching

Resources:

Component Patterns

Common Issues:

  • "Each child in list should have unique key" - Missing or duplicate keys
  • "Cannot read properties of null" - Ref timing issues
  • Tight coupling between components
  • Poor component composition and reusability

Diagnosis:

# Check component size and complexity
find src/ -name "*.jsx" -o -name "*.tsx" | xargs wc -l | sort -rn | head -10

# Find list rendering without keys
grep -r "\.map(" --include="*.jsx" --include="*.tsx" src/ | grep -v "key=" | head -5

# Check for ref usage
grep -r "useRef\|ref\.current" --include="*.jsx" --include="*.tsx" src/

# Find repeated patterns
grep -r "interface.*Props\|type.*Props" --include="*.tsx" src/ | wc -l

Prioritized Fixes:

  1. Minimal: Add unique keys to list items, add null checks for refs
  2. Better: Implement proper TypeScript prop types, extract shared logic to hooks
  3. Complete: Create compound components pattern, implement design system with consistent patterns

Resources:

Runtime Considerations

  • React 18 Changes: Automatic batching changes update timing, Strict Mode runs effects twice in development
  • Concurrent Features: Suspense, transitions, and Server Components require different mental models
  • Fast Refresh: Limitations with certain patterns (class components, anonymous functions)
  • Server Components: Cannot use hooks, browser APIs, or event handlers

Code Review Checklist

When reviewing React code, focus on these framework-specific aspects:

Hooks Compliance

  • Rules of Hooks followed (only at top level, only in React functions)
  • Dependency arrays complete and accurate
  • No conditional hook calls
  • Custom hooks prefixed with use
  • Effects properly cleaned up
  • No async functions directly in useEffect

Performance Patterns

  • Appropriate use of React.memo for expensive components
  • useMemo and useCallback used where beneficial (not overused)
  • Keys stable and unique in lists
  • Large lists virtualized when needed
  • Code splitting implemented for routes
  • Lazy loading for heavy components

State Management

  • State lifted to appropriate level (not too high)
  • Derived state calculated, not stored
  • Immutable state updates
  • No direct DOM manipulation
  • Form state properly controlled or uncontrolled (not mixed)
  • Context not overused for frequently changing values

Component Design

  • Single responsibility principle followed
  • Props properly typed with TypeScript/PropTypes
  • Default props handled correctly
  • Error boundaries implemented for risky operations
  • Accessibility attributes present (aria-labels, roles)
  • Event handlers properly bound

React Patterns

  • Composition over inheritance
  • Render props or hooks for logic sharing (not HOCs)
  • Controlled vs uncontrolled components consistent
  • Side effects isolated in useEffect
  • Suspense boundaries for async operations
  • Portals used for modals/tooltips when needed

Common Pitfalls

  • No array index as key for dynamic lists
  • No inline function definitions in render (when avoidable)
  • No business logic in components (separated into hooks/utils)
  • No missing dependencies in hooks
  • No memory leaks from uncleaned effects
  • No unnecessary re-renders from unstable references

Safety Guidelines

  • Never modify state objects directly - always use immutable updates
  • Always include cleanup functions in useEffect for subscriptions and async operations
  • Handle loading and error states explicitly in all components
  • Use TypeScript or PropTypes for development-time prop validation
  • Implement Error Boundaries to prevent entire app crashes
  • Test components in isolation before integration

Anti-Patterns to Avoid

  1. Effect Overuse: "You might not need an Effect" - prefer derived state and event handlers
  2. Premature Optimization: Don't add useMemo/useCallback everywhere without profiling
  3. Imperative DOM Access: Avoid direct DOM manipulation - use refs sparingly
  4. Complex Nested State: Flatten state structure or use useReducer for complex updates

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.45%
按下载量换算24

Claude

30.03%
按下载量换算22

Cursor

18.67%
按下载量换算14

Gemini CLI

9.63%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills