Implement Supabase reference architecture with best-practice project layout. Use when designing new Supabase integrations, reviewing project structure, or establishing architecture standards for Supabase applications. Trigger with phrases like "supabase architecture", "supabase best practices", "supabase project structure", "how to organize supabase", "supabase layout".
From supabase-packnpx claudepluginhub nickloveinvesting/nick-love-plugins --plugin supabase-packThis skill is limited to using the following tools:
references/errors.mdreferences/examples.mdreferences/key-components.mdreferences/project-structure.mdGuides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
A well-structured Supabase project separates concerns across distinct layers: the client initialization layer (singleton instance, environment configuration), the data access layer (typed query functions that encapsulate Supabase calls), the business logic layer (services that orchestrate data access), and the presentation or API layer (controllers or route handlers). This separation makes the codebase testable, maintainable, and easier to migrate if you ever need to swap out the underlying data provider.
Set up the project layout following the reference structure above. Place all Supabase client initialization in a single lib/supabase.ts module that the rest of the codebase imports, rather than allowing each file to create its own client instance. Centralizing client creation simplifies configuration changes and prevents connection pool fragmentation.
Create the singleton client with caching and monitoring. The wrapper should expose typed query functions that return domain objects rather than raw Supabase response types, decoupling your business logic from the specifics of the Supabase API surface.
Implement custom error classes that translate Supabase error codes into domain-specific exceptions. This makes error handling in higher layers cleaner and avoids leaking Supabase implementation details into your API error responses.
Add a health check endpoint that performs a lightweight Supabase connectivity test — a simple count query against a small table is sufficient. This allows your infrastructure orchestration layer to detect connectivity issues and route traffic away from affected instances.
See ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error handling.
See ${CLAUDE_SKILL_DIR}/references/examples.md for detailed examples.
Implement Supabase reference architecture with best-practice project layout.