Development instructions for building and maintaining the Claude Code Web UI project
You are working on the Claude Code Web UI project - a web-based interface for the `claude` command line tool that provides streaming responses in a chat interface.
```bash
lefthook install
lefthook run pre-commit
echo "PORT=9000" > .env
```
```bash
cd backend
deno task dev # Deno runtime
npm run dev # Node.js runtime
cd frontend
npm run dev
```
**Access**: Frontend at http://localhost:3000, Backend at http://localhost:8080
**Testing Stack**:
Backend uses Claude Code SDK with:
**Message Types**: System (initialization), Assistant (response), Result (execution summary)
1. First message starts new Claude session
2. Frontend extracts `session_id` from SDK messages
3. Subsequent messages include `session_id` for context
4. Backend passes `session_id` to SDK via `options.resume`
Universal detection supporting npm, pnpm, asdf, yarn:
1. Auto-discovery in system PATH
2. Script path tracing with temporary node wrapper
3. Version validation with `claude --version`
4. Fallback handling with logging
**Implementation**: `backend/cli/validation.ts`
Playwright MCP server for automated browser testing. Configure in claude config:
```json
{
"mcpServers": {
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
```
Use by saying "**playwright mcp**" in requests for browser automation.
- Body: `{ message, sessionId?, requestId, allowedTools?, workingDirectory? }`
```typescript
// Type extraction
const systemMsg = sdkMessage as Extract<SDKMessage, { type: "system" }>;
const assistantMsg = sdkMessage as Extract<SDKMessage, { type: "assistant" }>;
// Content access
for (const item of assistantMsg.message.content) {
if (item.type === "text") {
const text = (item as { text: string }).text;
}
}
// System message (direct access)
console.log(systemMsg.cwd);
```
**Key Points**: System fields are directly on object, Assistant content nested under `message.content`
1. Create feature branch: `git checkout -b feature/name`
2. Make changes (Lefthook runs `make check` on commit)
3. Push and create PR:
```bash
gh pr create --title "..." --body "..." --label "feature" --label "frontend"
```
4. Include Type of Change checkboxes and description
5. Request review and merge after approval
๐ `bug`, โจ `feature`, ๐ฅ `breaking`, ๐ `documentation`, โก `performance`, ๐จ `refactor`, ๐งช `test`, ๐ง `chore`, ๐ฅ๏ธ `backend`, ๐จ `frontend`
1. Feature PRs merged โ tagpr creates release PR
2. Add version labels if needed (minor/major)
3. Merge release PR โ automatic tag creation
4. GitHub Actions builds binaries automatically
```bash
gh issue create --title "Sub-issue" --label "feature"
SUB_ISSUE_ID=$(gh api repos/sugyan/claude-code-webui/issues/NUM --jq '.id')
gh api repos/sugyan/claude-code-webui/issues/PARENT/sub_issues --method POST --field sub_issue_id=$SUB_ISSUE_ID
```
**Policy**: Use fixed versions (no caret `^`) for consistency
**Update Procedure**:
1. Check versions: `grep "@anthropic-ai/claude-code" frontend/package.json backend/deno.json`
2. Update frontend package.json and `npm install`
3. Update backend deno.json imports and `rm deno.lock && deno cache cli/deno.ts`
4. Update backend package.json and `npm install`
5. Verify: `make check`
```bash
cd backend && deno task build # Local building
```
**Automated**: Push git tags โ GitHub Actions builds for Linux/macOS (x64/ARM64)
```
โโโ backend/ # Server with runtime abstraction
โ โโโ cli/ # Entry points and validation
โ โโโ runtime/ # Runtime abstraction layer
โ โโโ handlers/ # API route handlers
โ โโโ history/ # History processing
โ โโโ middleware/ # Middleware modules
โ โโโ utils/ # Utilities (logger, etc.)
โ โโโ scripts/ # Build and packaging
โโโ frontend/ # React application
โ โโโ src/
โ โ โโโ config/ # API configuration
โ โ โโโ utils/ # Utilities and constants
โ โ โโโ hooks/ # Custom hooks
โ โ โโโ components/ # UI components
โ โ โโโ types/ # Type definitions
โ โ โโโ contexts/ # React contexts
โโโ shared/ # Shared TypeScript types
โโโ CLAUDE.md # This documentation
```
1. **Runtime Abstraction**: Platform-agnostic business logic
2. **Universal CLI Detection**: Tracing-based approach for all package managers
3. **Raw JSON Streaming**: Unmodified Claude responses for frontend flexibility
4. **Modular Architecture**: Specialized hooks and components
5. **TypeScript Throughout**: Type safety across all components
6. **Project Directory Selection**: User-chosen working directories for context
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/claude-code-web-ui-development/raw