$npx -y skills add jackspace/ClaudeSkillz --skill better-chatbotThis skill provides project-specific coding conventions, architectural principles, repository structure standards, testing patterns, and contribution guidelines for the better-chatbot project (https://github.com/cgoinglove/better-chatbot). Use this skill when contributing to or w
| 1 | # better-chatbot Contribution & Standards Skill |
| 2 | |
| 3 | **Status**: Production Ready |
| 4 | **Last Updated**: 2025-11-04 (v2.1.0 - Added extension points + UX patterns) |
| 5 | **Dependencies**: None (references better-chatbot project) |
| 6 | **Latest Versions**: Next.js 15.3.2, Vercel AI SDK 5.0.82, Better Auth 1.3.34, Drizzle ORM 0.41.0 |
| 7 | |
| 8 | --- |
| 9 | |
| 10 | ## Overview |
| 11 | |
| 12 | **better-chatbot** is an open-source AI chatbot platform for individuals and teams, built with Next.js 15 and Vercel AI SDK v5. It combines multi-model AI support (OpenAI, Anthropic, Google, xAI, Ollama, OpenRouter) with advanced features like MCP (Model Context Protocol) tool integration, visual workflow builder, realtime voice assistant, and team collaboration. |
| 13 | |
| 14 | **This skill teaches Claude the project-specific conventions and patterns** used in better-chatbot to ensure contributions follow established standards and avoid common pitfalls. |
| 15 | |
| 16 | --- |
| 17 | |
| 18 | ## Project Architecture |
| 19 | |
| 20 | ### Directory Structure |
| 21 | |
| 22 | ``` |
| 23 | better-chatbot/ |
| 24 | ├── src/ |
| 25 | │ ├── app/ # Next.js App Router + API routes |
| 26 | │ │ ├── api/[resource]/ # RESTful API organized by domain |
| 27 | │ │ ├── (auth)/ # Auth route group |
| 28 | │ │ ├── (chat)/ # Chat UI route group |
| 29 | │ │ └── store/ # Zustand stores |
| 30 | │ ├── components/ # UI components by domain |
| 31 | │ │ ├── layouts/ |
| 32 | │ │ ├── agent/ |
| 33 | │ │ ├── chat/ |
| 34 | │ │ └── export/ |
| 35 | │ ├── lib/ # Core logic and utilities |
| 36 | │ │ ├── action-utils.ts # Server action validators (CRITICAL) |
| 37 | │ │ ├── ai/ # AI integration (models, tools, MCP, speech) |
| 38 | │ │ ├── db/ # Database (Drizzle ORM + repositories) |
| 39 | │ │ ├── validations/ # Zod schemas |
| 40 | │ │ └── [domain]/ # Domain-specific helpers |
| 41 | │ ├── hooks/ # Custom React hooks |
| 42 | │ │ ├── queries/ # Data fetching hooks |
| 43 | │ │ └── use-*.ts |
| 44 | │ └── types/ # TypeScript types by domain |
| 45 | ├── tests/ # E2E tests (Playwright) |
| 46 | ├── docs/ # Setup guides and tips |
| 47 | ├── docker/ # Docker configs |
| 48 | └── drizzle/ # Database migrations |
| 49 | ``` |
| 50 | |
| 51 | --- |
| 52 | |
| 53 | ## API Architecture & Design Patterns |
| 54 | |
| 55 | ### Route Structure Philosophy |
| 56 | |
| 57 | **Convention**: RESTful resources with Next.js App Router conventions |
| 58 | |
| 59 | ``` |
| 60 | /api/[resource]/route.ts → GET/POST collection endpoints |
| 61 | /api/[resource]/[id]/route.ts → GET/PUT/DELETE item endpoints |
| 62 | /api/[resource]/actions.ts → Server actions (mutations) |
| 63 | ``` |
| 64 | |
| 65 | ### Standard Route Handler Pattern |
| 66 | |
| 67 | **Location**: `src/app/api/` |
| 68 | |
| 69 | **Template structure**: |
| 70 | ```typescript |
| 71 | export async function POST(request: Request) { |
| 72 | try { |
| 73 | // 1. Parse and validate request body with Zod |
| 74 | const json = await request.json(); |
| 75 | const parsed = zodSchema.parse(json); |
| 76 | |
| 77 | // 2. Check authentication |
| 78 | const session = await getSession(); |
| 79 | if (!session?.user.id) return new Response("Unauthorized", { status: 401 }); |
| 80 | |
| 81 | // 3. Check authorization (ownership/permissions) |
| 82 | if (resource.userId !== session.user.id) return new Response("Forbidden", { status: 403 }); |
| 83 | |
| 84 | // 4. Load/compose de |