Install
openclaw skills install copilotkit-reactCopilotKit React best practices for agentic applications. Use when writing, reviewing, or refactoring React code that uses CopilotKit hooks (useAgent, useFrontendTool, useRenderTool, useCopilotAction, useCopilotReadable), providers (CopilotKit), or chat UI components (CopilotChat, CopilotSidebar, CopilotPopup). Triggers on tasks involving agent integration, tool rendering, shared state, or generative UI in React.
openclaw skills install copilotkit-reactBest practices for building agentic React applications with CopilotKit. Contains 25 rules across 6 categories, prioritized by impact to guide code generation and refactoring. Covers both v1 (@copilotkit/react-core) and v2 (@copilotkit/react-core/v2) APIs.
Reference these guidelines when:
CopilotKit provider in a React application| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Provider Setup | CRITICAL | provider- |
| 2 | Agent Hooks | HIGH | agent- |
| 3 | Tool Rendering | HIGH | tool- |
| 4 | Context & State | MEDIUM | state- |
| 5 | Chat UI | MEDIUM | ui- |
| 6 | Suggestions | LOW | suggestions- |
provider-runtime-url - Always configure runtimeUrl to connect to your agent backendprovider-single-endpoint - Configure the agent prop for CoAgent routingprovider-nested-providers - Scope agent configurations with nested CopilotKit providersprovider-tool-registration - Register tools via hooks inside provider, not as props when possibleagent-use-agent-updates - Specify update subscriptions to avoid unnecessary re-rendersagent-agent-id - Always pass agentId when running multiple agentsagent-context-description - Write descriptive context values for useCopilotReadableagent-frontend-tool-deps - Declare dependency arrays for useFrontendToolagent-stable-tool-handlers - Use useCallback for tool handler functionstool-typed-args - Define Zod schemas for useRenderTool parameters (v2)tool-status-handling - Handle all three tool call statuses (inProgress, executing, complete)tool-wildcard-fallback - Register a wildcard renderer as fallback for unknown toolstool-render-vs-frontend - Use useRenderTool for display-only, useFrontendTool for side effectstool-component-hook - Use useFrontendTool render prop for simple component renderingstate-minimal-context - Provide only relevant context to agents, not entire app statestate-structured-values - Use structured objects in useCopilotReadable, not serialized stringsstate-context-granularity - Split context into multiple useCopilotReadable calls by domainstate-avoid-stale-closures - Use functional state updates in tool handlersui-chat-layout - Choose CopilotSidebar for persistent chat, CopilotPopup for on-demandui-custom-labels - Always customize labels for your domain instead of defaultsui-welcome-screen - Provide a welcome screen with suggested promptsui-input-mode - Use appropriate inputMode for your use casesuggestions-configure - Use useConfigureSuggestions (v2) or useCopilotChatSuggestions (v1)suggestions-context-driven - Provide rich context so suggestions are relevantsuggestions-loading-state - Handle suggestion loading states via useSuggestions (v2)Read individual rule files for detailed explanations and code examples:
rules/provider-runtime-url.md
rules/agent-use-agent-updates.md
rules/tool-typed-args.md
Each rule file contains:
For the complete guide with all rules expanded: AGENTS.md