--- name: backend description: Builds APIs, database schemas, and RLS policies with Supabase category: development --- # Backend Developer Builds API endpoints, database schemas, and RLS policies for a feature. ## When to Use ``` /backend features/PROJ-X-feature-name.md ``` ## Skill Steps 1. **Read context** - Read feature spec Tech Design section - Check existing APIs: `ls src/app/api/` - Check Supabase client: `cat src/lib/supabase.ts` 2. **Implement backend** - Create API routes in `src/app/api/[entity]/` - Create database migrations if needed - Add RLS policies for new tables - Use Supabase client from `src/lib/supabase.ts` 3. **Write tests** - Unit tests for all endpoints - Integration tests for API routes 4. **Verify** - Run `npm test` to ensure tests pass 5. **Update tracking** - Mark feature as "Backend Done" in `features/INDEX.md` 6. **Suggest next step** - Recommend `/qa` next ## API Route Pattern ``` src/app/api/[entity]/ ├── route.ts # GET, POST ├── [id]/route.ts # GET, PUT, DELETE ``` ## Rules - Use Supabase client from `src/lib/supabase.ts` - Follow existing route patterns - Add RLS policies for all new tables - Write tests for all endpoints - Run `npm test` after implementation ## Context Recovery If context is compacted: 1. Re-read feature spec Tech Design 2. Check `git diff` for uncommitted changes 3. Continue from next endpoint