raphaelmansuy/edgequake/copilotkit-nextjs-integration
Claude Code and agent skill by raphaelmansuy/edgequake
- community
Checking that the SKILL.md file is still in the repository.
Integrate CopilotKit AI components into Next.js frontend for building agentic UIs. Enables context-aware AI agents that can read app state and trigger tools/actions. Supports custom adapters for self-hosted LLMs and multiple provider integrations.
Install
npx vskill@latest install raphaelmansuy/edgequake/copilotkit-nextjs-integrationSKILL.md
The same SKILL.md was published earlier as raphaelmansuy/edgequake/copilotkit-nextjs-integration.
CopilotKit for Next.js Integration
Integrate CopilotKit AI components into your Next.js application to build intelligent, context-aware interfaces where AI agents can read application state and trigger actionable tools.
When to use
Use this skill when you need to:
- Build AI-powered chat interfaces in your Next.js app
- Create context-aware AI agents that understand current UI state
- Enable AI to trigger actions and mutate app state
- Integrate custom or self-hosted LLM endpoints
- Implement human-in-the-loop AI workflows
- Add AI copilots to SaaS dashboards or productivity tools
- Support multiple LLM providers with custom adapters
- Build agentic UIs with sidebar, popup, or headless chat
Core concepts
Mental Model
CopilotKit is a bridge between your Next.js frontend and an LLM runtime endpoint:
The runtime:
- Manages conversation history
- Calls your LLM provider through an adapter
- Executes tools/actions triggered by the model
- Syncs generated content back to your UI
Key Primitives
- Copilot Runtime: Self-hosted endpoint managing message history, tool calls, and provider integration
- Readable State: App data exposed to the model via
useCopilotReadablehooks for context - Actions/Tools: Executable functions the model can trigger via
useCopilotAction - UI Components:
CopilotPopup,CopilotSidebar, or custom headless chat - Adapters: Provider integration layer (OpenAI, Groq, Google, custom self-hosted, etc.)
- Generative UI: Structured responses for interactive UI updates
Quick start
Basic Setup
Minimal Example
Share State with AI
Enable AI-Triggered Actions
Capabilities
Context-Aware AI
- Read App State: Expose UI state, data, and context to the AI model
- Conversation History: Maintain conversation context across messages
- Dynamic Context: Update what the model sees as app state changes
- Structured Responses: Return structured data for interactive UI updates
Tool & Action System
- Define Custom Tools: Any JavaScript function can become an AI-callable tool
- Parameter Validation: Define required and optional parameters with types
- Error Handling: Handle tool failures gracefully with retry logic
- State Mutations: Actions can update React state, trigger API calls, or run complex workflows
- Human-in-the-Loop: Get user confirmation before executing critical actions
Provider Flexibility
- OpenAI Integration: Out-of-the-box support for GPT-4, GPT-4o, etc.
- Alternative Providers: Support for Groq, Google, Anthropic, etc.
- Custom Adapters: Implement adapters for proprietary or self-hosted models
- Provider Agnostic: Switch providers without changing your UI code
- Self-Hosting: Deploy your own LLM runtime for privacy and cost control
UI Options
- Popup UI: Floating chat popup component
- Sidebar UI: Embedded sidebar copilot
- Headless: Build completely custom UI while using CopilotKit runtime
- Customizable Styling: Theme and style components to match your app
- Accessibility: Built-in keyboard navigation and screen reader support
Workflow
When implementing CopilotKit in your Next.js app:
- Setup Runtime: Deploy or configure Copilot Runtime endpoint
- Wrap App: Wrap your Next.js app with
<CopilotKit>provider - Share State: Use
useCopilotReadableto expose relevant app data - Define Actions: Use
useCopilotActionto enable AI-triggered operations - Add UI: Include
<CopilotPopup>,<CopilotSidebar>, or custom chat UI - Test & Refine: Iterate on state exposure and action definitions
Configuration Options
Runtime Configuration
Readable State Configuration
Action Configuration
Best Practices
State Sharing
- ✅ Expose only relevant state that the AI needs
- ✅ Use clear, descriptive names for readable state
- ✅ Update readables reactively as state changes
- ✅ Keep exposed state serializable
- ❌ Don't expose sensitive data (tokens, passwords)
- ❌ Don't expose extremely large objects
Actions
- ✅ Keep actions focused and single-purpose
- ✅ Include clear parameter descriptions
- ✅ Validate parameters before execution
- ✅ Handle errors gracefully with user feedback
- ✅ Use async/await for long-running operations
- ❌ Don't expose dangerous operations without confirmation
- ❌ Don't rely on implicit context
Security
- ✅ Validate all AI-triggered actions on the backend
- ✅ Implement proper authentication/authorization
- ✅ Log AI actions for auditing
- ✅ Use rate limiting on action endpoints
- ✅ Sanitize AI outputs before rendering
- ❌ Don't trust client-side validation alone
- ❌ Don't expose internal APIs directly
Provider Integration
OpenAI Adapter (Default)
Custom Provider Adapter
Self-Hosted LLM
Real-World Patterns
Pattern 1: Task Automation in SaaS Dashboard
Pattern 2: Productivity App Assistant
Pattern 3: E-Commerce Copilot
Troubleshooting
Runtime Connection Issues
- ✓ Verify runtime endpoint is accessible
- ✓ Check CORS configuration
- ✓ Ensure credentials are correct
- ✓ Check browser console for connection errors
Actions Not Triggering
- ✓ Verify action names are unique
- ✓ Check parameter types match definitions
- ✓ Ensure handler function is provided
- ✓ Check for JavaScript errors in handler
State Not Updating
- ✓ Verify readables are wrapped with useCopilotReadable hook
- ✓ Ensure state is being updated in parent component
- ✓ Check that readables run on every render
- ✓ Verify state is serializable
Related Skills
- makefile-dev-workflow: Development workflow for the full stack
- playwright-ux-ui-capture: UI capture automation
- ux-ui-analyze-single-page: Single page UX analysis
Resources
- CopilotKit Official Documentation
- CopilotKit GitHub Repository
- Next.js Documentation
- React Hooks Documentation
Support
For issues or questions:
- Check the CopilotKit documentation
- Review the examples in the skill directory
- Check runtime logs for errors
- File an issue with reproduction steps
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/copilotkit-nextjs-integration/SKILL.md
Popularity
- Repository stars
- 1,983
- Repository forks
- 222
- 7-day trend score
- 38
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/raphaelmansuy/edgequake/copilotkit-nextjs-integration)