This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Director's Palette is a professional-grade AI creative platform for generating production-ready shot lists for stories, music videos, and commercials. It integrates multiple AI models and provides director-specific styling capabilities.
📖 Platform Documentation: See DIRECTORS-PALETTE-PRODUCTION-AUDIT-REPORT.md for comprehensive technical audit and component grades.
- Framework: Next.js 15.2.4 with App Router
- Language: TypeScript 5 with strict typing
- UI: React 19 + Tailwind CSS 4 + shadcn/ui components
- State Management: Zustand stores with persistence (
stores/directory) - Database: IndexedDB for browser storage + Supabase for authentication
- AI Integration: OpenAI via AI SDK, Replicate for image generation
- Testing: Vitest for unit/integration tests, Playwright for E2E
# Install and run
npm install
npm run dev # Development server on port 3000
# Testing - MANDATORY before commits
npm run test # Run Vitest unit tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests
npx playwright test # E2E browser tests (port 3009)
# Build and quality checks
npm run build # Production build
npm run lint # ESLint checksThe application uses Zustand stores for centralized state management:
stores/app-store.ts- Main application state and mode switchingstores/story-store.ts- Story mode state and shot managementstores/music-video-store.ts- Music video workflow statestores/post-production-store.ts- Image generation and gallerystores/unified-gallery-store.ts- Cross-mode gallery management
All AI operations use Next.js server actions in app/actions.ts:
generateBreakdown- Story/commercial breakdowngenerateFullMusicVideoBreakdown- Music video structuregenerateDirectorStyleDetails- Custom director stylesgenerateAdditionalChapterShots- Additional shots generation
MANDATORY: Maximum 200 lines per component file
When refactoring large components:
- Extract types to
*Types.tsfiles - Extract hooks to
*Hooks.tsfiles - Break UI into focused sub-components
- Create thin orchestrator components
Example pattern:
ComplexComponent.tsx (800 lines) becomes:
├── ComplexComponentTypes.ts (50 lines)
├── ComplexComponentHooks.ts (100 lines)
├── ComplexComponentHeader.tsx (150 lines)
├── ComplexComponentContent.tsx (150 lines)
└── ComplexComponent.tsx (100 lines - orchestrator)
🚨 MANDATORY: TEST THAT SHIT BEFORE MARKING DONE! 🚨
NEVER deploy or mark tasks complete without testing:
- Unit Tests: Run
npm run testafter changes - Browser Testing: Always test with Playwright (
npx playwright test) - Manual Testing: Verify functionality in development server - ACTUALLY TEST THE FEATURE WORKS
- Build Verification: Ensure
npm run buildsucceeds - Feature Testing: Test the actual feature in the browser before considering it done
- Error Checking: Check browser console for errors
- Regression Testing: Verify existing features still work
IMPORTANT: If you don't test it, it's not done. Period.
- Location:
components/post-production/ - Models: Supports 5 AI models with dynamic parameter controls
- Gallery: 8 images per page with search functionality
- Wild Cards: Dynamic prompt expansion system (
_location_→ "mystical forest")
- Component:
components/GenreCommandMulti.tsx - Data:
lib/music_genres.json- Complete taxonomy - Architecture: 3-tier hierarchy (Primary → Subgenres → Microgenres)
- Story Mode: Text → Character extraction → Director styling → Shot list
- Music Video Mode: Lyrics + Artist → Video concept → Section breakdown
- Commercial Mode: Brief → Template selection → Shot generation
- Children's Book Mode: Story → Page-by-page illustrations
- Always run tests before committing:
npm run test - Test in Playwright for UI changes:
npx playwright test - Verify functionality manually in browser
- Run
npm run buildto ensure production readiness - Fix all issues before committing
- Build Config: TypeScript errors currently ignored (
next.config.mjs) - No Rate Limiting: AI calls need rate limiting implementation
- Browser Storage: Heavy reliance on IndexedDB/localStorage
- Component Size: Some components exceed 200 lines (need refactoring)
- Never commit API keys or secrets
- Use environment variables for all sensitive data
- Validate all user inputs before AI processing
- Sanitize outputs from AI before display
Required environment variables in .env.local:
# AI Generation
OPENAI_API_KEY=sk-...
# Image Generation (optional)
REPLICATE_API_TOKEN=r8_...
# Authentication
NEXT_PUBLIC_SUPABASE_URL=...
NEXT_PUBLIC_SUPABASE_ANON_KEY=...- Server Actions:
app/actions.ts - Zustand Stores:
stores/*.ts - UI Components:
components/ui/ - Feature Components:
components/ - Database Operations:
lib/*-db.ts - Type Definitions:
lib/*-types.ts - AI Prompts:
lib/prompts-*.ts
# Test story workflow
npm run test __tests__/functionality/story-workflow.test.ts
# Test music video generation
npm run test __tests__/integration/music-video-generation.test.ts
# Test export system
npm run test __tests__/functionality/export-system.test.ts
# Run E2E tests with UI
npx playwright test --ui- Use
useMemoanduseCallbackfor expensive operations - Implement virtual scrolling for large lists
- Lazy load heavy components with dynamic imports
- Monitor bundle size with
npm run build
Import Task Master's development workflow commands and guidelines, treat as if import is in the main CLAUDE.md file. @./.taskmaster/CLAUDE.md