# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview This is a Svelte 5 + TypeScript + Vite single-page application for a discovery-based creature collection game called "Pictuary". It uses the latest Svelte 5 with runes syntax (`$state()`, `$derived()`, etc.). ### Main Features - **Monster Discovery**: Upload images → AI identifies objects and generates/retrieves canonical "Piclets" - **Canonical System**: Each real-world object has ONE canonical Piclet, with variations tracked - **Collection Management**: Track discovered Piclets with metadata (discoverer, rarity, variations) - **Activity Feed**: Leaderboard showing top discoverers and recent finds - **Server Integration**: Connects to `../piclets-server/` for canonical Piclet database ## Essential Commands ```bash # Install dependencies npm install # Development server with HMR npm run dev # Type checking npm run check # Production build (outputs to dist/) npm run build # Preview production build npm run preview # Run tests npm test # Run tests with UI npm run test:ui ``` ## Architecture ### Component Structure - Components use `.svelte` files with TypeScript support via `lang="ts"` in script tags - Main entry: `src/main.ts` → mounts `src/App.svelte` - Reusable components go in `src/lib/` - Uses Svelte 5 runes syntax (not Svelte 4 syntax) ### Key Components - **Pages**: `Scanner.svelte` (discovery), `Pictuary.svelte` (collection), `Activity.svelte` (leaderboard/feed) - **Monster Discovery**: `PicletGenerator.svelte`, `PicletResult.svelte` with canonical/variation detection - **Server Integration**: Services for canonical Piclet lookup and creation - **Piclet Management**: `PicletCard.svelte`, `PicletDetail.svelte` with discovery metadata - **Database**: IndexedDB with `schema.ts` for local caching + server sync for canonical data ### Key Patterns 1. **State Management**: Use `$state()` rune for reactive state 2. **TypeScript**: All components should use `