Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

chatkit-botbuilder

БесплатноБез исполняемых скриптовНе проверен

Guide for creating production-grade ChatKit chatbots that integrate OpenAI Agents SDK with MCP tools and custom backends. Use when building AI-powered…

aiskillstoreот aiskillstore★ 509 звёзд на GitHub

Об этом скилле

ChatKit Botbuilder

Overview

Create production-grade chatbots using the OpenAI ChatKit framework. This skill enables building chatbots that:

  • Integrate AI Agents: Use OpenAI Agents SDK for intelligent conversation handling
  • Execute Tools: Connect MCP (Model Context Protocol) tools for real-world task execution
  • Support Custom Backends: Build FastAPI backends with full protocol support
  • Ensure User Isolation: Implement multi-user systems with JWT authentication
  • Real-Time Synchronization: Enable live UI updates when chatbot performs actions
  • Flexible Deployment: Deploy to web, mobile, or desktop applications

This skill provides the complete architecture pattern for ChatKit integration, from frontend configuration to backend server implementation.


When to Use This Skill

Use this skill when you need to:

  1. Build a task management chatbot - Create conversational interfaces for task creation, updates, completion
  2. Integrate AI into existing apps - Add ChatKit to dashboards, web apps, or platforms
  3. Create specialized AI assistants - Build domain-specific chatbots with custom tool integrations
  4. Implement multi-user chatbots - Create systems where each user has isolated conversations and data
  5. Add real-time capabilities - Build chatbots that trigger actual application changes
  6. Deploy AI conversations - Create chatbots that interact with your database and APIs

Architecture Overview

High-Level Flow

User Message
    ↓
ChatKit Frontend (React/Next.js)
    ↓ [JWT Token in Authorization Header]
    ↓
FastAPI Backend (ChatKit Server)
    ↓ [Extract user_id from JWT]
    ↓
OpenAI Agent (Agents SDK)
    ↓ [Needs tool execution]
    ↓
MCP Tools (Custom Tool Functions)
    ↓ [Creates/Updates/Lists data]
    ↓
Database (User-Isolated Data)
    ↓
Response → ChatKit → Frontend → User

Key Components

  1. Frontend (Next.js + ChatKit SDK)

    • ChatKit UI component with conversation history
    • JWT token management in localStorage
    • Custom fetch wrapper with Bearer token authentication
    • Real-time auto-refresh to sync with backend changes
  2. Backend (FastAPI + ChatKit Server)

    • ChatKit protocol endpoint handling requests
    • MyChatKitServer class extending ChatKitServer
    • User isolation through JWT middleware
    • Tool wrapper functions for automatic user_id injection
  3. Agent (OpenAI Agents SDK)

    • Task management agent with instructions
    • Tool registration and execution
    • Session management
  4. Tools (MCP + Custom Functions)

    • Wrapped functions injecting user_id automatically
    • Database operations with user isolation
    • Consistent error handling
  5. Database

    • SQLModel ORM models
    • Per-user task filtering
    • Conversation persistence

Quick Start Workflow

Phase 1: Backend Setup (FastAPI)

1. Create ChatKit Server Class

from chatkit.server import ChatKitServer
from chatkit.store import Store

class MyChatKitServer(ChatKitServer):
    def __init__(self):
        store = CustomChatKitStore()
        super().__init__(store=store)

    async def respond(self, thread, input, context):
        """Process user message and stream AI response"""
        user_id = getattr(context, 'user_id', None)
        # Create agent with wrapped tools
        # Stream response using official pattern

2. Create MCP Tool Wrappers

# Extract user_id from context and inject into tool calls
def add_task_wrapper(title: str, description: str = None):
    return mcp_add_task(user_id=user_id, title=title, description=description)

def list_tasks_wrapper(status: str = "all"):
    return mcp_list_tasks(user_id=user_id, status=status)

3. Create FastAPI Endpoint

@router.post("/api/v1/chatkit")
async def chatkit_protocol_endpoint(request: Request):
    user_id = request.state.user_id  # From JWT middleware
    context = create_context_object(user_id=user_id)
    result = await chatkit_server.process(body, context)
    return StreamingResponse(result, media_type="text/event-stream")

4. Configure JWT Middleware

class JWTAuthMiddleware(BaseHTTPMiddleware):
    async def dispatch(self, request, call_next):
        # Extract JWT token from Authorization header
        # Decode and set request.state.user_id
        # All endpoints have access to authenticated user_id

Phase 2: Frontend Setup (Next.js + React)

1. Configure ChatKit SDK

const chatKitConfig: UseChatKitOptions = {
  api: {
    url: `${API_BASE_URL}/api/v1/chatkit`,
    domainKey: 'your-domain-key',
    fetch: authenticatedFetch, // Custom fetch with JWT
  },
  theme: 'light',
  header: { enabled: true, title: { text: 'AI Chat' } },
  history: { enabled: true },
}

2. Create Authenticated Fetch Wrapper

async function authenticatedFetch(input, options) {
  const token = localStorage.getItem('access_token')
  const
Полный SKILL.md на GitHub

Установить chatkit-botbuilder в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

CHATKIT_SKILL_SUMMARY.mdreferences/backend_architecture.mdreferences/frontend_integration.mdreferences/mcp_wrapper_guide.mdreferences/user_isolation.mdskill-report.json

FAQ

Что делает скилл chatkit-botbuilder?

Guide for creating production-grade ChatKit chatbots that integrate OpenAI Agents SDK with MCP tools and custom backends. Use when building AI-powered chatbots with specialized capabilities, real-time task execution, and user isolation for any application.

Как установить скилл chatkit-botbuilder?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл chatkit-botbuilder запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить chatkit-botbuilder с