scratch-foundation

Construct a multi-tenant Supabase backend with database schema and RLS policies.

1|Updated Jun 7, 2026
One-click install
npx skills add https://github.com/MikeyMiami/lovable-web-design --skill scratch-foundation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scratch-foundation
Source: https://github.com/MikeyMiami/lovable-web-design/tree/main/skills/scratch-foundation
Command: npx skills add https://github.com/MikeyMiami/lovable-web-design --skill scratch-foundation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the complexity of bootstrapping a secure, multi-tenant Supabase backend from scratch, ensuring all architectural invariants, RLS policies, and database schemas are correctly initialized in the required order.

Core Features & Use Cases

  • Deterministic Infrastructure: Automates the creation of core tables, SECURITY DEFINER helpers, and RLS policies to ensure consistent tenant isolation.
  • Security Guardrails: Implements strict RLS audit gates and server-side write validation to prevent cross-tenant data leaks.
  • Use Case: Use this when initializing a new golden master environment to ensure the database schema, auth roles, and server-function skeletons are perfectly aligned with the platform specification.

Quick Start

Use the scratch-foundation skill to initialize the database schema and security policies for a new multi-tenant backend environment.

Frequently Asked Questions about scratch-foundation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bootstrap a multi-tenant Supabase backend with RLS policies?

To bootstrap a multi-tenant Supabase backend, you need to initialize core tables, SECURITY DEFINER helpers, and Row Level Security policies in a specific order. This ensures strict tenant isolation and role-based access control from the start.

What is the best way to enforce strict tenant isolation in a PostgreSQL database?

Enforcing strict tenant isolation in PostgreSQL requires applying Row Level Security policies alongside server-side write validation. Implementing RLS audit gates prevents cross-tenant data leaks by restricting data access based on tenant identifiers.

How do I set up a deterministic build order for multi-tenant database schemas?

Setting up a deterministic build order for multi-tenant database schemas involves sequentially creating core tables, auth roles, and server-function skeletons. This structured provisioning ensures architectural invariants are correctly initialized without dependency conflicts.

Can I use this approach to initialize a golden master environment for SaaS platforms?

Yes, you can use this approach to initialize a golden master environment for SaaS platforms. It provisions the required database schema, auth roles, and server-function skeletons to align perfectly with platform specifications for multi-tenant infrastructure.

Why do I need SECURITY DEFINER helper functions in a multi-tenant PostgreSQL architecture?

You need SECURITY DEFINER helper functions in a multi-tenant PostgreSQL architecture to execute privileged operations safely while maintaining Row Level Security boundaries. They provide server-side write validation to ensure data integrity across isolated tenants.

What are the limitations of provisioning multi-tenant infrastructure from scratch?

Provisioning multi-tenant infrastructure from scratch is limited to initial environment setup and does not handle ongoing schema migrations. It strictly satisfies initial tenant isolation and role-based access requirements rather than continuous platform maintenance.