Always research before implementing. Use this two-step process for optimal results
1
Research Phase with Codex/Sonnet
Copy
I need to implement [FEATURE] with these requirements:- [Requirement from discovery]- Scale: [Expected load from discovery]- Real-time: [Yes/No from discovery]Current stack: [Your chosen stack]Please suggest:1. Database schema design2. API structure3. Caching strategy4. Security considerations5. Performance optimizations6. Edge cases to handle
2
Implementation with Claude Code
Copy
Based on this architecture review from [Codex/Sonnet]:[Paste research findings]And these discovery requirements:- [Specific requirement]- [Performance target]- [Security requirement]Now implement:1. Database migrations2. RLS policies (if Supabase)3. API endpoints with validation4. Error handling5. Client-side hooks6. TestsFollow our established patterns from [reference files]
Ideal for most SaaS applications with real-time needs
1
Database Design
Copy
-- From discovery data requirements-- Users and profilesCREATE TABLE profiles ( id UUID PRIMARY KEY REFERENCES auth.users(id), email TEXT UNIQUE NOT NULL, full_name TEXT, avatar_url TEXT, role user_role NOT NULL DEFAULT 'user', metadata JSONB DEFAULT '{}', created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW());-- Enable RLSALTER TABLE profiles ENABLE ROW LEVEL SECURITY;-- Policies based on discovery requirementsCREATE POLICY "Users can view own profile" ON profiles FOR SELECT USING (auth.uid() = id);CREATE POLICY "Users can update own profile" ON profiles FOR UPDATE USING (auth.uid() = id);-- Indexes for performanceCREATE INDEX idx_profiles_email ON profiles(email);CREATE INDEX idx_profiles_role ON profiles(role);