schema0-ai
Installation
SKILL.md
AI Integration
AI SDK integration with ORPC for chat, prompt-response, and tool-calling features.
Generator Commands
# Full-stack chat with streaming
schema0 sandbox exec "bun run .claude/skills/ai-integration/scripts/generate.ts chat <name>"
# Simple prompt-response (no streaming)
schema0 sandbox exec "bun run .claude/skills/ai-integration/scripts/generate.ts simple <name>"
# Backend router only
schema0 sandbox exec "bun run .claude/skills/ai-integration/scripts/generate.ts router <name>"
# Tool definition for function calling
schema0 sandbox exec "bun run .claude/skills/ai-integration/scripts/generate.ts tool <name>"
Prerequisites
- Add API key using
manage-secretsskill to securely add it and updatepackages/auth/env.ts - Install dependencies:
schema0 sandbox exec "bun add ai @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google @orpc/ai-sdk @orpc/client" - Add key to env schema in
packages/auth/env.ts(e.g.,OPENAI_API_KEY: z.string().optional())
Generated Files
| Template | Output Location | Purpose |
|---|---|---|
ai-router.hbs |
packages/api/src/routers/[name].ts |
ORPC router with AI SDK streaming |
ai-chat-route.hbs |
apps/web/src/routes/_auth.[name].tsx |
Full chat UI with streaming |
ai-simple.hbs |
apps/web/src/routes/_auth.[name].tsx |
Simple prompt-response UI |
ai-tool.hbs |
packages/api/src/tools/[name].ts |
Tool definitions for function calling |
Post-Generation Steps
- Register router in
packages/api/src/routers/index.ts - Add route to sidebar in
apps/web/src/components/app-sidebar.tsx - Set the API key environment variable during build/deploy
References
references/patterns.md-- Chat mode, simple mode, tool calling, provider examples (OpenAI, Anthropic, Google), streaming, naming conventions
Related skills
More from schema0/skills
schema0-dev
>-
23schema0-mobile
Mobile platform patterns — React Native / Expo, worker architecture, ORPC client, and navigation
17schema0-rls
Row-level security setup — RLS policies, authenticated database connections, and user-scoped data access
17schema0-testing
Testing guide for web and mobile platforms — bun:test, Jest, PGlite, 3-layer validation, and test templates
17schema0-web-crud
Web frontend CRUD features — query collections, table columns, dialogs, forms, views, sidebar, and orchestration
17schema0-cli
CLI commands for sandbox execution, deployment, version management, secrets, and third-party integrations
17