# Guidelines for Claude Code This document contains guidelines for Claude Code (or other AI assistants) when working on this project. ## Documentation Style ### What to AVOID in Documentation Files **❌ ASCII Art / Directory Tree Diagrams** Do NOT create directory tree structures like this: ``` client/ ├── src/ │ ├── main.ts │ └── components/ │ └── video-player.ts ``` **✅ Use Bullet Points Instead** Instead, use simple bullet point lists with file paths: - `client/src/main.ts` - Description of what this file does - `client/src/components/video-player.ts` - Description of component ### What to INCLUDE in Documentation **✅ Inline Code Examples** - Code snippets showing implementation patterns are good - Keep them focused and relevant **✅ Clear Explanations** - Explain the "why" behind decisions - Provide context and rationale **✅ Simple Lists** - Bullet points for enumerating items - Numbered lists for sequential steps ## Architecture Decision Process When making architectural decisions: 1. **Document in DECISION_LOG.md** - Use the established format: - Date - Decision - Context - Options Considered - Rationale - Consequences - Status 2. **Update ARCHITECTURE.md** - Keep the main architecture doc in sync with decisions 3. **Prefer Simplicity** - This project values: - Type safety (Rust, TypeScript) - Simple deployment (single binary, minimal dependencies) - Modern standards over frameworks - Self-contained solutions over external services ## Code Style Preferences ### Backend (Rust) - Use `sqlx` for explicit SQL with compile-time checking - Prefer newtype pattern for critical domain types - Use `#[instrument]` for tracing - Leverage Rust's type system to prevent invalid states ### Frontend (TypeScript) - Use Web Components for component abstraction - Modern browser APIs over libraries when possible - Keep bundle size small - TypeScript types should mirror Rust backend types ### General - Explicit over implicit - Simple over clever - Type-safe over runtime validation where possible - Document decisions, not just implementation ## Version Control with Jujutsu (jj) This project uses **Jujutsu (jj)** for version control, which is Git-compatible but has a different workflow. **Key Concepts:** - Working copy is a real commit (not a staging area) - All changes are automatically tracked when you edit files - Use `jj new` to create a new working commit on top of the current one - Use `jj describe` to set/edit the commit message - Use `jj file untrack $FILE` to untrack files (e.g., when adding to .gitignore) **Common Commands:** - `jj status` or `jj st` - Show working copy changes - `jj log` - Show commit history - `jj describe` - Set commit message for current change - `jj new` - Create new working commit (finalizes current commit) - `jj file untrack $FILE` - Remove file from tracking **Claude's Workflow:** 1. After completing each task, remind user to commit 2. Suggest conventional commit messages for `jj describe` 3. User runs `jj describe -m "message"` to set the commit message 4. User runs `jj new` to finalize and create new working commit 5. Claude waits for confirmation before starting next task ## Commit Messages This project uses **Conventional Commits** validated by **convco**. **Format:** ``` (): [optional body] [optional footer] ``` **Types:** `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `ci` **Common Scopes:** `auth`, `video`, `api`, `db`, `frontend`, `backend`, `config`, `storage`, `upload`, `stream` **Examples:** ``` feat(auth): add JWT token generation fix(upload): handle large file validation docs: update implementation plan chore: initialize Rust backend ``` **Tools:** - `.gitmessage` - Commit template (for reference) - `.convco` - convco configuration - Run `convco check` to validate commit messages - Run `convco changelog` to generate CHANGELOG.md ## When Working on This Project 1. **Check existing decisions** in `docs/DECISION_LOG.md` before suggesting alternatives 2. **Keep scope focused** - This is a small-scale self-hosted app, not enterprise software 3. **Prefer pragmatic solutions** - Balance type safety with development speed 4. **Document trade-offs** - Explain why simpler solutions were chosen over complex ones 5. **Suggest conventional commit messages** after each task completion ## Specific to This Project **Target Audience:** Small groups (5-20 friends) self-hosting a video sharing app **Not Our Target:** - Enterprise scale - Complex distributed systems - Framework-heavy solutions - Services requiring extensive configuration **Our Values:** - Works out-of-box with good defaults - Single binary deployment - Type safety catches bugs at compile time - Minimal external dependencies - Self-contained (no cloud services required)