# CLAUDE.md — RateRight v2 Build Instructions

## What You're Building
An AI-first construction hiring marketplace. Read PRODUCT-SPEC.md for the full spec.

## Tech Stack
- **Frontend:** Next.js 14+ with App Router, Tailwind CSS, shadcn/ui
- **Backend:** Supabase (Postgres, Auth, Realtime, Edge Functions, Storage)
- **AI Layer:** OpenAI/Anthropic for LLM features, Whisper for voice transcription
- **Payments:** Stripe ($50 flat fee per hire)
- **Deployment:** Vercel

## Supabase Connection
- URL: https://memscjotxrzqnhrvnnkc.supabase.co
- Anon Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im1lbXNjam90eHJ6cW5ocnZubmtjIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg0MjIwNTAsImV4cCI6MjA4Mzk5ODA1MH0.wDb6WAANxQJZDBB9ZSHv6rVIJFZjKmb9DFy5jRmWYjs
- **Service Role Key:** Available in `.env` as `SUPABASE_SERVICE_ROLE_KEY`. Use this for admin operations that bypass RLS (migrations, direct DB updates, bulk operations). You have full DB access — don't say you can't update the database.

## MVP Priority (Build in this order)
1. Project scaffolding (Next.js + Supabase + Tailwind + shadcn/ui)
2. Database schema (see PRODUCT-SPEC.md section 7)
3. Auth flow (Supabase Auth — email/phone signup)
4. Contractor signup with AI company research
5. Worker signup (simple form, 5 questions)
6. Job posting with AI suggestions
7. Smart matching + worker browsing
8. One-tap hire flow
9. Stripe payment ($50)
10. Ratings system
11. Push notifications

## Design Principles
- **Mobile-first** — designed for construction workers on phones
- **One-tap everything** — minimize clicks/taps
- **AI does the work** — pre-fill, suggest, auto-complete
- **Ultra simple** — if a screen has more than 3 actions, simplify it
- **Fast** — every page loads in <1 second
- **Australian** — use AUD, Australian English, local references

## Code Style
- TypeScript everywhere
- Server components by default, client components only when needed
- Supabase client via @supabase/ssr
- Environment variables in .env.local
- Keep components small and focused
- Use shadcn/ui for all UI components

## Database Operations — You Have Full Access
- **Supabase CLI:** `npx supabase` available for migrations
- **Direct SQL:** Use service role key to run SQL against the database directly via curl or supabase-js admin client
- **Migrations:** Create in `supabase/migrations/`, run via Supabase dashboard SQL Editor or CLI
- **RLS policies:** You can create, modify, delete RLS policies
- **Triggers/Functions:** You can create/update database triggers and functions
- **Schema changes:** You can add columns, tables, indexes — just document what you changed
- **DO NOT** drop tables or delete data without confirmation
- **DO** fix broken triggers, add missing policies, update functions
- When you find a DB issue, fix it directly — don't just document it

## Git — Push Your Work
- `git add`, `git commit`, `git push` — you have full permissions
- Commit messages: descriptive, prefixed (fix:, feat:, audit:, chore:)
- Push to main branch directly

## Agent Teams
- You can spawn sub-agents for parallel work
- Use agent teams for: security review + code fixes + build verification simultaneously
- Each agent gets its own context — assign clear, scoped tasks

## Important
- This is a REAL business with REAL users coming
- Quality matters — no shortcuts on auth, payments, or data handling
- Mobile experience is MORE important than desktop
- Every AI feature should have a manual fallback
