What problem does it solve?
AI coding agents frequently generate flawed multi-tenant Rails implementations that expose critical security risks, including cross-tenant data leaks, use of deprecated or fragile patterns like the unmaintained apartment gem, and broken background job tenancy that fails to isolate customer data.
Core Features & Use Cases
- Pattern trade-off guidance: Clear recommendations for row-scoped, schema-per-tenant, and database-per-tenant multi-tenancy, with explicit guidance on when to use each pattern for different compliance and operational needs.
- Production-ready implementation steps: Step-by-step instructions for setting up acts_as_tenant, resolving tenants via subdomain, path, or API header, scoping background jobs, isolating sessions and file storage, and implementing plan-based feature gating.
- Critical bug prevention: Explicit guardrails and test patterns to avoid the most common multi-tenant mistakes, including unscoped queries, missing tenant_id indexes, and cross-tenant data access.
Use case: For B2B SaaS Rails applications where each customer account requires isolated data, this skill ensures AI agents implement compliant, secure multi-tenancy that aligns with senior Rails developer best practices.
Quick Start
Use the multi-tenancy skill to implement row-scoped tenant isolation with acts_as_tenant for your Rails SaaS app, including subdomain-based tenant resolution and background job tenancy.