Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

tech-reacttech React 开发

Agent Skill

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

总安装

993

周安装

51

GitHub Stars

13

下载量

420
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/ravnhq/ai-toolkit --skill tech-react

简介

用于辅助 React、Next.js、Vue 等前端框架的开发与维护。

  • 适合生成组件代码、审查样式逻辑或定位布局问题。
  • 使用时需结合项目现有设计系统和路由结构进行整合。
  • 避免生成孤立代码片段,建议配合本地预览验证效果。
  • 涉及页面改动时应检查构建结果和交互一致性。tech-react 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Core Challenges

React patterns evolve with each major version. React 19 introduced the use() hook for promise handling and formalized Server Component boundaries with clearer client/server semantics. Common pitfalls include:

  • Hook ordering violations: Conditionally calling hooks breaks React's tracking system
  • Unnecessary memoization: useMemo/useCallback/React.memo add overhead without measurement
  • Oversized components: Mixing Server and Client logic prevents streaming optimization
  • Missing Suspense boundaries: Async data without Suspense blocks entire render
  • Stale closures: Effects with incorrect dependency arrays or missing cleanup
  • Key misuse: Index keys cause state to attach to wrong list items after reorder

React 19 improves these patterns: use() hook for consuming promises, Server Components for data fetching without extra requests, and useTransition() for non-blocking updates.

Workflow

  1. Identify component responsibilities: Determine if component should be Server (data-heavy) or Client (interactive)
  2. Define hooks at top level: All hooks must execute unconditionally before any returns
  3. Use Suspense for async: Wrap use() hook calls with Suspense boundaries for loading fallback
  4. Compose with keys: Use stable, unique keys for list items; use key prop to reset component state
  5. Measure before optimizing: Profile with React DevTools before adding memoization
  6. Clean up subscriptions: Always return cleanup function from effects that subscribe to systems
  7. Keep components small: Extract Client Components for interactivity, let Server Components handle data

Rules

See rules index for detailed patterns.

Examples

Positive Trigger

User: "Refactor this React component to reduce re-renders and clarify hook usage."

Expected behavior: Use tech-react guidance, follow its workflow, and return actionable output.

Positive Trigger: Server Component Boundary

User: "I'm fetching data on the client with useEffect. How should I refactor this with Server Components?"

Expected behavior: Move data fetch to Server Component, pass promise to Client Component via use() hook, wrap with Suspense boundary.

Non-Trigger

User: "Write a Bash script to package release artifacts."

Expected behavior: Do not prioritize tech-react; choose a more relevant skill or proceed without it.

Troubleshooting

Hook Call Violations ("Rendered more hooks than during the previous render")

  • Error: React throws "Rendered fewer/more hooks than during the previous render"
  • Cause: Hooks called inside conditions, loops, or early returns
  • Solution: Move hook calls before any conditional logic; use enabled option in data hooks to skip execution

Suspense Fallback Never Shows

  • Error: Loading fallback doesn't appear when use() suspends
  • Cause: Suspense boundary is not wrapping the component that calls use()
  • Solution: Ensure <Suspense> is a parent of the component, not a sibling

Server Component Can't Use State/Events

  • Error: useState, onClick handlers don't work in Server Components
  • Cause: Server Components render once on server; they can't respond to client interaction
  • Solution: Extract interactive parts to Client Components with "use client" directive; Server Component handles data fetching and passes to Client Component

useEffect Runs Twice or Creates Memory Leaks

  • Error: Effect side effect runs multiple times; cleanup doesn't execute
  • Cause: Missing dependency array or missing cleanup return function
  • Solution: Include dependency array; return cleanup function for subscriptions/timers/listeners

List Items Lose Focus or Appear in Wrong Order

  • Error: Input focus jumps between rows; items appear shuffled after sort
  • Cause: Using array index as key instead of stable unique identifier
  • Solution: Change key={index} to key={item.id} with unique property from data

Examples: Error Patterns

Error 1: Conditional Hook

Incorrect:

function UserProfile({ userId }: { userId: string | null }) {
  if (!userId) {
    return <div>Select a user</div>;
  }

  // Hook called conditionally - React can't track it!
  const [profile, setProfile] = useState(null);
  return <div>{profile?.name}</div>;
}

Correct:

function UserProfile({ userId }: { userId: string | null }) {
  const [profile, setProfile] = useState(null);

  // Early return AFTER hooks
  if (!userId) {
    return <div>Select a user</div>;
  }

  return <div>{profile?.name}</div>;
}

Error 2: Suspense Without use() Hook

Incorrect:

function Comments({ id }: { id: string }) {
  const [comments, setComments] = useState([]);

  useEffect(() => {
    fetchComments(id).then(setComments);
  }, [id]);

  return <ul>{comments.map(c => <li key={c.id}>{c.text}</li>)}</ul>;
}

Correct:

function Comments({ commentsPromise }: { commentsPromise: Promise<Comment[]> }) {
  const comments = use(commentsPromise);
  return <ul>{comments.map(c => <li key={c.id}>{c.text}</li>)}</ul>;
}

function CommentsSection({ id }: { id: string }) {
  return (
    <Suspense fallback={<div>Loading comments...</div>}>
      <Comments commentsPromise={fetchComments(id)} />
    </Suspense>
  );
}

Error 3: Server/Client Boundary Confusion

Incorrect:

// BAD: Server Component with useState
async function NotesPage() {
  const [selectedNote, setSelectedNote] = useState(null); // ERROR: Can't use state
  const notes = await db.notes.getAll();

  return (
    <div>
      {notes.map(note => (
        <button onClick={() => setSelectedNote(note)}>
          {note.title}
        </button>
      ))}
    </div>
  );
}

Correct:

// Server Component - fetch data
async function NotesPage() {
  const notes = await db.notes.getAll();

  return (
    <div>
      <NotesList notes={notes} />
    </div>
  );
}

// Client Component - handle interaction
"use client";

function NotesList({ notes }: { notes: Note[] }) {
  const [selectedNote, setSelectedNote] = useState<Note | null>(null);

  return (
    <div>
      {notes.map(note => (
        <button
          key={note.id}
          onClick={() => setSelectedNote(note)}
        >
          {note.title}
        </button>
      ))}
    </div>
  );
}

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

38.57%
按下载量换算162

Claude

32.17%
按下载量换算135

Cursor

17.15%
按下载量换算72

Gemini CLI

9.66%
按下载量换算41

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

来源信息

继续浏览同类 Skills