This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run check:all # Comprehensive check: build + lint + tests. Run in root (your default working directory) for client+server checks, or in `client` or `server` directory for more targeted checks.
npm run lint # ESLint + TypeScript on all source files
npm run test:all # Tests + test lintingSee /.context/testing.md for detailed testing commands and patterns.
Don't use npm run dev. The site is already available on localhost:5173, and the server is already running on :3000.
After implementing any front-end change, perform visual checks until the task is achieved:
- Identify what changed - Review the modified components/pages
- Navigate to affected pages - Use
mcp__playwright__browser_navigateto visit each changed view - Verify design compliance - Compare against
/.context/design-principles.mdand/.context/style-guide.md - Validate feature implementation - Ensure the change fulfills the user's specific request
- Check acceptance criteria - Review any provided context files or requirements
- Capture evidence - Take full page screenshot at desktop and mobile viewports of each changed view
- Check for errors - Run
mcp__playwright__browser_console_messages
The site is available at http://localhost:5173/. To login, use username 'claude@localdevelopment.com' and password 'asdF!234'.
Invoke the design-reviewer subagent for thorough design validation when:
- Completing significant UI/UX features
- Before finalizing PRs/tasks with visual changes
- Needing comprehensive accessibility and responsiveness testing
After making code changes (and only when the visual checks are done), run a quick validation:
- Run checks - Check for ESLint / TS / test issues. When in doubt, use check:all in the
clientorserverdirectory, or in root to check both. - Verify functionality - Test the specific feature/fix you implemented
- Check for obvious issues - Review your changes for common problems
Having to remind you about lint issues is one of the most common interruptions in our workflow. Always identify and fix lint issues yourself before you treat a task as completed.
Invoke the code-reviewer subagent for thorough code validation when:
- Completing significant features or refactoring
- Before finalizing PRs/tasks with substantial code changes
- Needing systematic review of architecture, security, and maintainability
Take project-specific requirements into account: .context/testing.md.
- Lecture pages must stay synchronized with
/client/public/sitemap.xml - Update
/client/src/page/static/Privacy.tsxwhenever any tools or practices change that need to be disclosed to users
- Important functions and classes must have corresponding unit tests
- Integration tests should be added for complex workflows involving multiple components
This is a monorepo containing an AI-powered multiplayer interactive fiction game with three workspaces:
Shared TypeScript library containing:
- Types: Complete type definitions for stories, players, beats, outcomes, etc.
- Models: Domain models (
Story.ts,PlayerManager.ts,ThreadManager.ts, etc.) - Utils: Shared utilities for date handling, difficulty calculation, template processing
Express.js backend with:
- WebSocket: Real-time game orchestration via Socket.IO
- HTTP API: REST endpoints for CRUD operations
- AI Integration: LangChain with OpenAI/Anthropic/Google providers
- Storage: PostgreSQL for users/metadata, JSON files for stories/templates
- Authentication: JWT with role-based access (user/admin)
React SPA with:
- Game Interface: Real-time multiplayer gameplay UI
- Page System: Public pages, library browser, template configurator
- User System: Authentication, account management, story archives
- Admin Interface: Story/template/user management
- Frontend: React 18, TypeScript, Vite, Tailwind CSS, React Router
- Backend: Express.js, Socket.IO, PostgreSQL, JWT authentication
- AI: LangChain, OpenAI API, image generation via AI providers
- Validation: Zod schemas shared between client/server
- Build: Workspace-based monorepo with TypeScript compilation
- Client Contexts:
/admin/,/game/,/page/,/users/with directory aliases - Resources: Cross-context features in
/client/src/resources/RESOURCE - Shared: Common utilities in
/client/src/shared/and/server/src/shared/ - Core: Types and utilities shared between client/server in
/core/
- Client: Use Vite aliases (
game/*,core/*,shared/*, etc.) instead of relative paths (configured invite.config.ts) - Server: Use TypeScript path mapping (
core/*,server/*,shared/*, etc.) instead of relative paths (configured intsconfig.json) - Tests: Use relative paths in test files (e.g.,
'../../../../src/game/utils/module') - Source Files: Can use path aliases in source files - Jest automatically resolves them
/server/.env- Server environment variables (OPENAI_API_KEY, database config)/client/.env- Client environment variables (VITE_WS_PORT)/core/config.ts- Shared configuration constants
/core/models/Story.ts- Central story domain model/server/src/game/GameHandler.ts- Game orchestration service/client/src/game/GameService.ts- Client-side game state management/core/models/PlayerManager.ts- Multiplayer session management
/core/types/- Complete TypeScript definitions/server/src/shared/db.ts- Database connection and queries/data/templates/- Template JSON files and images/data/stories/- Story save files and generated images
/.context/folder-structure.md- More details about the folder structure of the repo/.context/deployment.md- Deployment, Workspace Dependencies, Install commands/.context/api.md- Current endpoints/.context/api-dev.md- How to create new API flows between client and server/.context/storage.md- Database schemas and file storage system/.context/testing.md- Unit and integration tests, commands for checking for ESLint and TypeScript issues/.context/design-principles.md- Design principles for frontend/.context/ui.md- Style guide/.context/story.md- Story state and Story model classes/.context/image-generation.md- Image generation flows/.context/pregenerations.md- Flows for pregenerating possible future story states (to reduce wait times for users)/.context/security.md- Security layers and components/.context/template-hiding-ids.md- Automated story element ID generation and deferred image file operations