Token导航 LogoToken导航

Agent Skill · 研究检索

react-hooks(React hooks 工具)

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

react-hooks 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 45,958。

总安装 816周安装 33GitHub Stars 3下载 256核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/codestackr/livekit-skills --skill react-hooks

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

LiveKit React Hooks 构建实时音视频应用的定制化 React UI 组件库。集成 LiveKit MCP 服务器工具,提供最新文档查询和代码示例检索能力。支持 docs_search、get_pages、changelog 和 code_search 等多种辅助接口。

适用于需要实时通信功能的 Web 应用开发和现有项目功能增强场景。react-hooks 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/react-hooks

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/codestackr/livekit-skills --skill react-hooks;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

react-hooks 怎么安装?

在终端执行 npx skills add https://github.com/codestackr/livekit-skills --skill react-hooks。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

react-hooks 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

react-hooks 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

react-hooks 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

react-hooks 用的人多吗?

公开数据是累计安装 816 次,近一周安装 33 次,下载 256 次,GitHub 3 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

react-hooks 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
react-hooks

React hooks 工具 · 本页

8163调用外部服务未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

LiveKit React Hooks

Build custom React UIs for realtime audio/video applications with LiveKit hooks.

LiveKit MCP server tools

This skill works alongside the LiveKit MCP server, which provides direct access to the latest LiveKit documentation, code examples, and changelogs. Use these tools when you need up-to-date information that may have changed since this skill was created.

Available MCP tools:

  • docs_search - Search the LiveKit docs site
  • get_pages - Fetch specific documentation pages by path
  • get_changelog - Get recent releases and updates for LiveKit packages
  • code_search - Search LiveKit repositories for code examples
  • get_python_agent_example - Browse 100+ Python agent examples

When to use MCP tools:

  • You need the latest API documentation or feature updates
  • You're looking for recent examples or code patterns
  • You want to check if a feature has been added in recent releases
  • The local references don't cover a specific topic

When to use local references:

  • You need quick access to core concepts covered in this skill
  • You're working offline or want faster access to common patterns
  • The information in the references is sufficient for your needs

Use MCP tools and local references together for the best experience.

Scope

This skill covers hooks only from @livekit/components-react. These hooks provide low-level access to LiveKit room state, participants, tracks, and agent data for building fully custom UIs.

Important: For agent applications, do NOT use UI components from @livekit/components-react. All UI components should come from the livekit-agents-ui skill, which provides shadcn-based components:

  • AgentSessionProvider - Session wrapper with audio rendering
  • AgentControlBar - Media controls
  • AgentAudioVisualizerBar/Grid/Radial - Audio visualizers
  • AgentChatTranscript - Chat display
  • And more

Use hooks from this skill only when you need custom behavior that the Agents UI components don't provide. The Agents UI components use these hooks internally.

References

Consult these resources as needed:

  • ./references/livekit-overview.md -- LiveKit ecosystem overview and how these skills work together
  • ./references/participant-hooks.md -- Hooks for accessing participant data and state
  • ./references/track-hooks.md -- Hooks for working with audio/video tracks
  • ./references/room-hooks.md -- Hooks for room connection and state
  • ./references/session-hooks.md -- Hooks for managed agent sessions (useSession, useSessionMessages)
  • ./references/agent-hooks.md -- Hooks for voice AI agent integration
  • ./references/data-hooks.md -- Hooks for chat and data channels

Installation

npm install @livekit/components-react livekit-client

Quick start

Using hooks with AgentSessionProvider (standard approach)

For agent apps, use AgentSessionProvider from the livekit-agents-ui skill for the session provider. The useSession hook from this package is required to create the session for AgentSessionProvider.

Required hook: Use useSession to create the session object:

import { useRef, useEffect } from 'react';
import { useSession } from '@livekit/components-react';
import { TokenSource, TokenSourceConfigurable } from 'livekit-client';
import { AgentSessionProvider } from '@/components/agents-ui/agent-session-provider';

function App() {
  const tokenSource: TokenSourceConfigurable = useRef(
    TokenSource.endpoint('/api/token')
  ).current;

  // Create session using useSession hook (required for AgentSessionProvider)
  const session = useSession(tokenSource, { agentName: 'your-agent' });

  useEffect(() => {
    session.start();
    return () => session.end();
  }, []);

  return (
    <AgentSessionProvider session={session}>
      <MyAgentUI />
    </AgentSessionProvider>
  );
}

Additional hook for agent state: Use useVoiceAssistant to access agent state, audio tracks, and transcriptions:

import { useVoiceAssistant } from '@livekit/components-react';

// This component must be inside an AgentSessionProvider
function CustomAgentStatus() {
  const { state, audioTrack, agentTranscriptions } = useVoiceAssistant();

  return (
    <div>
      <p>Agent state: {state}</p>
      {agentTranscriptions.map((t) => (
        <p key={t.id}>{t.text}</p>
      ))}
    </div>
  );
}

See the livekit-agents-ui skill for full component documentation.

Custom microphone toggle

import { useTrackToggle } from '@livekit/components-react';
import { Track } from 'livekit-client';

// Use this inside an AgentSessionProvider for custom toggle behavior
function CustomMicrophoneButton() {
  const { enabled, toggle, pending } = useTrackToggle({
    source: Track.Source.Microphone,
  });

  return (
    <button onClick={() => toggle()} disabled={pending}>
      {enabled ? 'Mute' : 'Unmute'}
    </button>
  );
}

Fully custom approach: useSession + SessionProvider (not recommended)

Note: This pattern uses UI components from @livekit/components-react directly. For agent applications, use AgentSessionProvider from livekit-agents-ui instead, which wraps these components and provides a better developer experience.

For fully custom implementations without Agents UI components, you can use useSession with SessionProvider and RoomAudioRenderer directly. This gives you complete control but requires more manual setup.

Use this pattern only when you cannot use AgentSessionProvider from Agents UI:

import { useEffect, useRef } from 'react';
import { useSession, useAgent, SessionProvider, RoomAudioRenderer } from '@livekit/components-react';
import { TokenSource, TokenSourceConfigurable } from 'livekit-client';

function AgentApp() {
  // Use useRef to prevent recreating TokenSource on each render
  const tokenSource: TokenSourceConfigurable = useRef(
    TokenSource.sandboxTokenServer('your-sandbox-id')
  ).current;

  const session = useSession(tokenSource, {
    agentName: 'your-agent-name',
  });
  const agent = useAgent(session);

  // Auto-start session with cleanup
  useEffect(() => {
    session.start();
    return () => {
      session.end();
    };
  }, []);

  return (
    <SessionProvider session={session}>
      <RoomAudioRenderer />
      <div>
        <p>Connection: {session.connectionState}</p>
        <p>Agent: {agent.state}</p>
      </div>
    </SessionProvider>
  );
}

For production, use TokenSource.endpoint() instead of the sandbox:

const tokenSource: TokenSourceConfigurable = useRef(
  TokenSource.endpoint('/api/token')
).current;

const session = useSession(tokenSource, {
  roomName: 'my-room',
  participantIdentity: 'user-123',
  participantName: 'John',
  agentName: 'my-agent',
});

Hook categories

Participant hooks

Access participant data and state:

  • useParticipants() - All participants (local + remote)
  • useLocalParticipant() - Local participant with media state
  • useRemoteParticipants() - All remote participants
  • useRemoteParticipant(identity) - Specific remote participant
  • useParticipantInfo() - Identity, name, metadata
  • useParticipantAttributes() - Participant attributes

Track hooks

Work with audio/video tracks:

  • useTracks(sources) - Array of track references
  • useParticipantTracks(sources, identity) - Tracks for specific participant
  • useTrackToggle({source}) - Toggle mic/camera/screen
  • useIsMuted(trackRef) - Check if track is muted
  • useIsSpeaking(participant) - Check if participant is speaking
  • useTrackVolume(track) - Audio volume level

Room hooks

Room connection and state:

  • useConnectionState() - Room connection state
  • useRoomInfo() - Room name and metadata
  • useLiveKitRoom(props) - Create and manage room instance
  • useIsRecording() - Check if room is being recorded
  • useMediaDeviceSelect({kind}) - Select audio/video devices

Session hooks (beta)

For session management (required for AgentSessionProvider):

  • useSession(tokenSource, options) - Create and manage agent session with connection lifecycle. Required for AgentSessionProvider.
  • useSessionMessages(session) - Combined chat and transcription messages

Agent hooks (beta)

Voice AI agent integration:

  • useVoiceAssistant() - Primary hook for agent state, tracks, and transcriptions. Works inside AgentSessionProvider.
  • useAgent(session) - Full agent state with lifecycle helpers. Requires session from useSession.

Data hooks

Chat and data channels:

  • useChat() - Send/receive chat messages
  • useDataChannel(topic) - Low-level data messaging
  • useTextStream(topic) - Subscribe to text streams (beta)
  • useTranscriptions() - Get transcription data (beta)
  • useEvents(instance, event, handler) - Subscribe to typed events from session/agent

Context requirement

Most hooks require a room context. For agent applications, there are two approaches:

Option 1: useSession + AgentSessionProvider (standard)

Use useSession to create a session, then pass it to AgentSessionProvider from livekit-agents-ui. The AgentSessionProvider wraps SessionProvider and includes RoomAudioRenderer for audio playback. Hooks like useVoiceAssistant, useTrackToggle, useChat, and others work automatically inside this provider.

import { useRef, useEffect } from 'react';
import { useSession, useVoiceAssistant } from '@livekit/components-react';
import { TokenSource, TokenSourceConfigurable } from 'livekit-client';
import { AgentSessionProvider } from '@/components/agents-ui/agent-session-provider';

function App() {
  const tokenSource: TokenSourceConfigurable = useRef(
    TokenSource.endpoint('/api/token')
  ).current;

  // Create session using useSession hook (required)
  const session = useSession(tokenSource, { agentName: 'your-agent' });

  useEffect(() => {
    session.start();
    return () => session.end();
  }, []);

  return (
    <AgentSessionProvider session={session}>
      {/* Hooks from @livekit/components-react work here */}
      <MyAgentComponent />
    </AgentSessionProvider>
  );
}

function MyAgentComponent() {
  // useVoiceAssistant works inside AgentSessionProvider
  const { state, audioTrack } = useVoiceAssistant();
  return <div>Agent: {state}</div>;
}

Option 2: useSession + SessionProvider (not recommended)

Note: This pattern uses UI components from @livekit/components-react directly. For agent applications, use Option 1 with AgentSessionProvider from livekit-agents-ui instead.

Only use this pattern if you need full manual control without using Agents UI components. You must include RoomAudioRenderer manually.

import { useRef, useEffect } from 'react';
import { useSession, useAgent, SessionProvider, RoomAudioRenderer } from '@livekit/components-react';
import { TokenSource, TokenSourceConfigurable } from 'livekit-client';

function App() {
  const tokenSource: TokenSourceConfigurable = useRef(
    TokenSource.sandboxTokenServer('your-sandbox-id')
  ).current;

  const session = useSession(tokenSource, { agentName: 'your-agent' });
  const agent = useAgent(session); // Pass session explicitly when using useSession

  useEffect(() => {
    session.start();
    return () => session.end();
  }, []);

  return (
    <SessionProvider session={session}>
      <RoomAudioRenderer />
      <MyAgentComponent agent={agent} />
    </SessionProvider>
  );
}

Best practices

General

  1. Use Agents UI for standard UIs - For most agent applications, use the pre-built components from livekit-agents-ui. Use these hooks only when you need custom behavior.
  2. Optimize with updateOnlyOn - Many hooks accept updateOnlyOn to limit re-renders to specific events.
  3. Handle connection states - Always check useConnectionState() before accessing room data.
  4. Memoize TokenSource - Always use useRef when creating a TokenSource to prevent recreation on each render.

For agent applications

  1. Use useSession with AgentSessionProvider - For most agent apps, create a session with useSession and pass it to AgentSessionProvider from livekit-agents-ui. The AgentSessionProvider handles audio rendering automatically.
  2. Use useVoiceAssistant for agent state - Inside AgentSessionProvider, use useVoiceAssistant to access agent state and transcriptions. This is simpler than useAgent.
import { useVoiceAssistant } from '@livekit/components-react';

function AgentDisplay() {
  const { state, audioTrack, agentTranscriptions } = useVoiceAssistant();
  // state: "disconnected" | "connecting" | "initializing" | "listening" | "thinking" | "speaking"
}
  1. Handle agent states properly - When using useAgent, handle all states including 'idle', 'pre-connect-buffering', and 'failed':
const agent = useAgent(session);

if (agent.state === 'failed') {
  console.error('Agent failed:', agent.failureReasons);
}

if (agent.isPending) {
  // Show loading state
}
  1. Always use AgentSessionProvider - Use useSession + AgentSessionProvider from livekit-agents-ui for all agent applications. This is the standard and recommended approach.

Performance

  1. Use LiveKit's built-in hooks for media controls - For track toggling, device selection, and similar features, use the provided hooks (useTrackToggle, useMediaDeviceSelect) rather than implementing your own. These hooks handle complex state management and have been rigorously tested.
  2. Subscribe to events with useEvents - Instead of manually managing event listeners, use useEvents to subscribe to session and agent events with proper cleanup:
useEvents(agent, AgentEvent.StateChanged, (state) => {
  console.log('Agent state:', state);
});

Beta hooks

Several hooks in @livekit/components-react are marked as beta and may change:

  • useSession, useSessionMessages
  • useAgent, useVoiceAssistant
  • useTextStream, useTranscriptions

Check the LiveKit components changelog for updates to these hooks.

平台分布

Codex

35.83%
按下载量换算92

Claude

28.89%
按下载量换算74

Cursor

16.27%
按下载量换算42

Gemini CLI

9.33%
按下载量换算24

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills