init-cbc-sdk-web
Initialize a complete web-based chat application powered by CodeBuddy Agent SDK with React frontend and Express backend
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- init-cbc-sdk-web
- description
- Initialize a complete web-based chat application powered by CodeBuddy Agent SDK with React frontend and Express backend
02 资源文件 38
- 脚本copy-template.sh1.6 KB
- 参考文档examples/usage-example.md3.1 KB
- 参考文档templates/DEVELOPMENT.md31.3 KB
- 参考文档templates/index.html539 B
- 参考文档templates/package.json1.2 KB
- 脚本templates/postcss.config.js80 B
- 参考文档templates/README.md4.1 KB
- 脚本templates/server/db.ts6.2 KB
- 脚本templates/server/index.d.ts11 B
- 脚本templates/server/index.ts20.9 KB
- 其他templates/src/App.tsx6.1 KB
- 其他templates/src/components/AgentConfigDialog.tsx13.0 KB
- 其他templates/src/components/ChatInput.tsx5.3 KB
- 其他templates/src/components/ChatMessages.tsx6.6 KB
- 其他templates/src/components/Header.tsx3.0 KB
- 其他templates/src/components/InlinePermissionCard.tsx4.3 KB
- 其他templates/src/components/NewChatDialog.tsx7.0 KB
- 其他templates/src/components/NewChatView.tsx6.0 KB
- 其他templates/src/components/PermissionDialog.tsx7.1 KB
- 其他templates/src/components/SettingsPage.tsx28.0 KB
- 其他templates/src/components/Sidebar.tsx4.6 KB
- 其他templates/src/components/ToolCallsCollapse.tsx26.9 KB
- 脚本templates/src/config.ts372 B
- 脚本templates/src/hooks/useAgents.ts2.5 KB
- 脚本templates/src/hooks/useChat.ts13.5 KB
- 脚本templates/src/hooks/useModels.ts1.2 KB
- 脚本templates/src/hooks/useSessions.ts4.6 KB
- 脚本templates/src/hooks/useTheme.ts1.2 KB
- 其他templates/src/index.css15.0 KB
- 其他templates/src/main.tsx469 B
- 其他templates/src/pages/ChatPage.tsx3.6 KB
- 脚本templates/src/types.ts1.7 KB
- 脚本templates/src/utils/iconMap.ts273 B
- 脚本templates/tailwind.config.js1.3 KB
- 参考文档templates/tsconfig.json599 B
- 参考文档templates/tsconfig.node.json251 B
- 脚本templates/vite.config.d.ts76 B
- 脚本templates/vite.config.ts425 B
03 SKILL.md 正文
init-cbc-sdk-web
Initialize a complete web-based chat application powered by CodeBuddy Agent SDK.
Description
This skill scaffolds a full-stack chat application with:
- Backend: Express server with SSE support and CodeBuddy Agent SDK integration
- Frontend: React application with Vite, TypeScript, TDesign React, and Tailwind CSS
- Real-time Communication: SSE-based streaming with multi-chat support
- Database: SQLite for session and message persistence
- Modern Stack: TypeScript, React 18, TDesign React, Express 4, Vite 5
When to use this skill
Use this skill when you need to:
- Create a new chat application powered by AI agents
- Build a web interface for CodeBuddy Agent SDK
- Set up a starter project for agent-based conversations
- Prototype AI-powered chat features
- Learn how to integrate CodeBuddy Agent SDK in a web application
How to use this skill
Interactive Mode
/init-cbc-sdk-web
The skill will ask you for a project name.
Direct Mode
/init-cbc-sdk-web my-chat-app
Provide the project name directly as an argument.
Implementation Details
⚠️ This skill uses a template-based approach - DO NOT write code from scratch!
When implementing this skill, you MUST use the provided copy-template.sh script:
-
Locate the skill directory:
- Check
~/.codebuddy/skills/init-cbc-sdk-web/ - Or check
.codebuddy/skills/init-cbc-sdk-web/in current directory
- Check
-
Use the copy script:
bash <skill-directory>/copy-template.sh <project-name> -
The script will:
- Copy the complete template from
templates/directory - Update package.json with the project name
- Display next steps for the user
- Copy the complete template from
DO NOT manually read and write each template file. The script handles everything.
What this skill does
- Creates project directory with the specified name
- Scaffolds complete application including:
- Express backend with REST API and SSE server
- React frontend with TDesign React UI components
- TypeScript configuration
- TDesign React + Tailwind CSS styling
- SQLite database setup
- Build and development scripts
- Provides ready-to-use code for:
- Agent SDK integration (query, unstable_v2_createSession, unstable_v2_authenticate)
- Chat session management with persistence
- Real-time message streaming via SSE
- Multi-chat support with SQLite storage
- Permission control system
- Custom agent configuration
- Theme switching (light/dark)
Project Structure
your-project-name/
├── server/ # Backend code
│ ├── index.ts # Express + SSE server
│ ├── index.d.ts # Type definitions
│ └── db.ts # SQLite database operations
├── src/ # Frontend code
│ ├── App.tsx # Main React app
│ ├── components/ # UI components
│ │ ├── Header.tsx
│ │ ├── Sidebar.tsx
│ │ ├── ChatMessages.tsx
│ │ ├── ChatInput.tsx
│ │ ├── ToolCallsCollapse.tsx
│ │ ├── AgentConfigDialog.tsx
│ │ ├── PermissionDialog.tsx
│ │ ├── NewChatDialog.tsx
│ │ ├── NewChatView.tsx
│ │ └── SettingsPage.tsx
│ ├── hooks/ # React hooks
│ │ ├── useChat.ts
│ │ ├── useSessions.ts
│ │ ├── useAgents.ts
│ │ ├── useModels.ts
│ │ └── useTheme.ts
│ ├── pages/ # Page components
│ │ └── ChatPage.tsx
│ ├── utils/ # Utilities
│ │ └── iconMap.ts
│ ├── types.ts # Type definitions
│ ├── config.ts # Configuration
│ ├── main.tsx # Entry point
│ └── index.css # Global styles
├── data/ # Data storage
│ └── chat.db # SQLite database
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
├── vite.config.ts # Vite config
├── tailwind.config.js # Tailwind config
├── index.html # HTML template
├── README.md # Documentation
└── DEVELOPMENT.md # Development guide
Next Steps
After running this skill:
-
Navigate to project directory:
cd your-project-name -
Install dependencies:
npm install -
Set up environment variables:
cp .env.example .envEdit
.envand add yourCODEBUDDY_API_KEY -
Start development server:
npm run devThis starts both backend (port 3001) and frontend (port 5173)
-
Open in browser: Navigate to
http://localhost:5173
Features
- Multi-chat support: Create and manage multiple chat conversations with SQLite persistence
- Real-time streaming: See AI responses as they're generated via SSE
- Tool call visualization: View when the agent uses tools with expandable details
- Permission control: Support for multiple permission modes (default, acceptEdits, plan, bypassPermissions)
- Custom agents: Create and manage multiple agent configurations
- Theme switching: Support for light/dark themes
- Session persistence: Chat history and agent sessions stored in SQLite database
- Modern UI: Clean, responsive interface with TDesign React components
- TypeScript: Full type safety across frontend and backend
Keywords
chat, web, agent-sdk, react, express, websocket, typescript, vite, tailwind, ai, assistant, conversation, real-time, streaming
Requirements
- Node.js 18 or higher
- CodeBuddy API key (get from https://www.codebuddy.cn)
- Modern web browser
Customization
After initialization, you can customize:
- Agent configurations (system prompt, model, permissions) in Settings page or code
- UI components in
src/components/ - Styling in
src/index.css, TDesign theme, and Tailwind config - Server configuration in
server/index.ts - Database schema in
server/db.ts - Permission modes and tool allowances in agent settings
Learn More
- TypeScript SDK Documentation: https://www.codebuddy.ai/docs/zh/cli/sdk-typescript
- General SDK Documentation: https://www.codebuddy.ai/docs/zh/cli/sdk
- Project README.md for detailed setup instructions
- SDK guide in plugin rules for best practices
04 同仓库更多 Skills
vercel-sandbox
Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include "Vercel Sandbox browser", "microVM Chrome", "agent-browser in sandbox", "browser automation on Vercel", or any task requiring Chrome in a Vercel Sandbox.
slack
Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include "check my Slack", "what channels have unreads", "send a message to", "search Slack for", "extract from Slack", "find who said", or any task requiring programmatic Slack interaction.
electron
Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include "automate Slack app", "control VS Code", "interact with Discord app", "test this Electron app", "connect to desktop app", or any task requiring automation of a native Electron application.
dogfood
Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to "dogfood", "QA", "exploratory test", "find issues", "bug hunt", "test this app/site/platform", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.
agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
shadcn
Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", "switch to --preset", and for building a design system or applying a DESIGN.md or brand spec to shadcn/ui.