Nano Banana Pro
Agent skill for nano-banana-pro
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MigrainLog is a comprehensive migraine tracking application built with React 19, TypeScript, Vite, and Supabase. Users can track detailed migraine episodes including symptoms, triggers, medications, and contributing factors.
npm run dev # Start development server (http://localhost:5173) npm run build # Build for production (includes TypeScript compilation) npm run preview # Preview production build locally
npm run lint # Run ESLint npx tsc -b # Type-check without building
npm run test # Run tests in watch mode npm run test:run # Run tests once npm run test:ui # Run tests with UI npm run test:coverage # Run tests with coverage report
npm run test:e2e # Run E2E tests headless npm run test:e2e:ui # Run with interactive UI npm run test:e2e:headed # Run with visible browser npm run test:e2e:debug # Run with debugger npm run test:e2e:chromium # Run in Chromium only npm run test:e2e:firefox # Run in Firefox only npm run test:e2e:webkit # Run in WebKit only npm run test:e2e:report # View test report
Important: E2E tests require the dev server to be running. The Playwright config will automatically start it, but if you encounter issues, manually start the dev server first.
The project uses TypeScript path aliases configured in
vite.config.ts:
@/ maps to src/ directoryimport { supabase } from '@/lib/supabase'src/contexts/AuthContext.tsx) provides global auth statesrc/routes/_authenticated/ require authentication_authenticated.tsx layout file uses a beforeLoad hook to check session and redirect to /about if not authenticatedepisodes table with Row Level Security (RLS)src/types/database.tssrc/types/episode.tsuseEpisodesQuery, useCreateEpisodeMutation, etc.)src/lib/supabase.tsThe application uses file-based routing with TanStack Router:
src/routes/ ├── __root.tsx # Root layout with AuthProvider ├── _authenticated.tsx # Auth layout (requires login) ├── _authenticated/ │ ├── index.tsx # Dashboard (/) │ ├── episodes.tsx # Episode list │ ├── episodes/$episodeId.tsx # Episode detail/edit │ └── analysis.tsx # Data visualization ├── about.tsx # Public about page ├── login.tsx # Login page └── signup.tsx # Signup page
Important: The route tree is auto-generated by the TanStack Router plugin into
src/routeTree.gen.ts. Never edit this file manually.
Forms use TanStack Form with Zod validation:
src/utils/validation.tsuseForm hook from @tanstack/react-formzodFieldValidator from src/utils/zodValidator.ts for validationFormFieldContextExample pattern from
EpisodeForm.tsx:
const form = useForm({ defaultValues: initialData, onSubmit: async ({ value }) => { await createMutation.mutateAsync(value); }, validators: { onChange: episodeSchema, }, });
Episodes track comprehensive migraine data:
The database schema includes:
updated_at triggerepisode_stats view for analyticsCopy
.env.example to .env and fill in:
VITE_SUPABASE_URL=your_supabase_project_url VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
Get these from Supabase Dashboard → Settings → API
Run
supabase/migrations/001_create_episodes.sql via:
supabase db pushThe migration creates:
episodes table with RLS policiesepisode_stats viewupdated_at triggerAll episode data is user-scoped via RLS policies:
user_id = auth.uid() checkssrc/components/ui/npx shadcn@latest add <component>components.jsoncn() utility from @/lib/utils for conditional classessrc/lib/queryClient.tssrc/hooks/useEpisodesQuery.tsinvalidateQueries after mutations to refresh dataTIMESTAMPTZdate-fns library for formatting (installed)Reusable helpers in
tests/utils/:
auth-helpers.ts: Login/signup helperstest-data.ts: Shared test dataassertions.ts: Custom assertionstests/auth.spec.tstests/episodes.spec.tsDatabase type from @/types/database@/types/episode separate from DB typesany type - use unknown or proper typing{ data, error } - always check erroronError callbacksrc/components/ ├── ui/ # shadcn/ui primitives (Button, Input, etc.) ├── episodes/ # Episode-specific components ├── layout/ # Layout components (Header, Footer) └── ... # Feature-specific directories
VITE_ are exposed to client codeimport.meta.env.VITE_*.env file - use .env.example as template@tailwindcss/vite plugin instead of PostCSSsupabase/ directory for migrationsThe application is configured for deployment to Vercel with automatic Supabase database migrations.
main triggers production deploymentvercel.json - Vercel project configuration.github/workflows/vercel-deploy.yml - Deployment workflowscripts/run-migrations.js - Migration runner scriptVERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_IDSUPABASE_ACCESS_TOKEN, SUPABASE_PROJECT_REF, SUPABASE_DB_PASSWORDVITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEYVITE_SUPABASE_URL - Supabase project URLVITE_SUPABASE_ANON_KEY - Supabase anonymous keySee
CI_CD.md for detailed setup instructions.