This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- 常に日本語で会話する
- 原則としてテスト駆動開発(TDD)で進める
- 期待される入出力に基づき、まずテストを作成する
- 実装コードは書かず、テストのみを用意する
- テストを実行し、失敗を確認する
- テストが正しいことを確認できた段階でコミットする
- その後、テストをパスさせる実装を進める
- 実装中はテストを変更せず、コードを修正し続ける
- すべてのテストが通過するまで繰り返す
pnpm dev- Start development server on port 3000pnpm build- Build production applicationpnpm test- Run all tests with Vitestpnpm test:watch- Run tests in watch modepnpm test:coverage- Run tests with coverage reportpnpm test:ui- Open Vitest UIpnpm typecheck- TypeScript type checking
pnpm lint- Run ESLintpnpm lint:fix- Fix ESLint issues and validate Prisma schemapnpm format:fix- Format code with Prettier and format Prisma schemapnpm unused:check- Check for unused code with Knip
pnpm db:seed- Seed database with test datapnpm db:seed:with-actions- Seed database and run all scheduled actionspnpm prisma:dev:migrate- Run Prisma migrations in developmentpnpm prisma:prod:deploy- Deploy Prisma migrations in production
pnpm actions:update-auction-status-to-active- Activate scheduled auctionspnpm actions:update-auction-status-to-completed- Complete ended auctionspnpm actions:return-auction-deposit-points- Return deposit pointspnpm actions:send-scheduled-notifications- Send scheduled notifications
To run a single test file, use: pnpm vitest path/to/test.file.test.ts
This is a Next.js 15 application using the App Router pattern with a comprehensive auction/task management system. The application follows a domain-driven design with clear separation of concerns.
- NextAuth v5 with Google OAuth provider in
src/auth.ts - Custom middleware in
src/middleware.tsprotecting/dashboard/*routes - Session-based authentication with JWT strategy
- Role-based permissions (app owners, group owners, members)
- Prisma ORM with PostgreSQL and Supabase
- Complex schema with auction, task, group, and notification systems
- Database extensions:
pg_bigmfor full-text search capabilities - Optimized indexes for performance-critical queries
- Server Actions Pattern: All data mutations through server actions in
src/lib/actions/ - Cache Layer: Dedicated cache utilities in
src/lib/actions/cache/ - Granular Actions: Domain-specific actions (auction, group, task, notification)
- TanStack Query for server state management
- Comprehensive cache key factory in
src/lib/tanstack-query.ts - IndexedDB persistence for offline capability
- Custom hooks in
src/hooks/for component-specific state logic
- Radix UI primitives for accessible components
- shadcn/ui component system in
src/components/ui/ - Domain-specific components organized by feature (auction, group, task, notification)
- Shared components in
src/components/share/
- Server-Sent Events (SSE) for auction bid updates
- Web Push Notifications with VAPID keys
- Redis integration for real-time data synchronization
- Cloudflare R2 integration for file storage
- Pre-signed URL generation for secure uploads
- Image validation and processing utilities
- User: Authentication, settings, group memberships
- Group: Task containers with member management and point systems
- Task: Work items with auction capabilities and status workflows
- Auction: Bidding system with auto-bid, extensions, and real-time updates
- Notification: Multi-channel notifications (email, push, in-app)
- Users belong to multiple Groups through GroupMembership
- Tasks belong to Groups and can have associated Auctions
- Auctions have BidHistory, AutoBid settings, and AuctionReviews
- Notifications support multiple delivery methods and targeting
- Vitest as test runner with Happy DOM environment
- Testing Library for component testing
- MSW for API mocking
- Comprehensive setup files for different testing scenarios
- 90% line coverage target with specific thresholds
- TypeScript with strict configuration
- Zod schemas for runtime validation in
src/lib/zod-schema.ts - @t3-oss/env-nextjs for type-safe environment variables
- Custom type definitions in
src/types/
- App Router with streaming and suspense
- React Query with infinite cache and persistence
- Optimized database queries with strategic indexing
- Image optimization with Next.js Image component
- Scheduled scripts in
scripts/directory for auction lifecycle management - Notification queue processing
- Point system calculations and deposits
When working on this codebase:
- Follow the established server action pattern for data mutations
- Use the cache utilities for performance-critical operations
- Implement proper error handling in all server actions
- Write comprehensive tests for new functionality
- Utilize the type-safe environment variable system
- Follow the component organization patterns by domain