Works with the AI Agents you already use
Laravel Multi-Tenancy (Single Database): Tenant Scoping, Queues, Cache and Leak Tests
Build or audit tenant isolation in a shared-database Laravel 12/13 SaaS so no customer can see another customer's data.
$3
Laravel Multi-Tenancy (Single Database): Tenant Scoping, Queues, Cache and Leak Tests
Example session with this skill installed
Our Laravel 13 app has teams; users switch the current team. Audit it for cross-tenant leaks and add proper tenant scoping.
- Read your context and instructions
- Compiled the laravel multi-tenancy single
Decision note (single database, team_id, current-team switcher) → findings table (e.g. Critical: InvoiceController uses DB::table('invoices') without team_id; High: SendReminder job loses the team) → CurrentTenant, ResolveTenant middleware, fail-closed TenantScope, BelongsToTenant trait, RequiresTenant job middleware → Pest isolation tests → completed leak checklist.
Connects securely to your tools. The creator never sees your data.
About this skill
Most Laravel SaaS products keep every customer in one database, with a tenant_id (or team_id) on each row. It is simple and cheap, but it fails silently: one missing where clause, one queued job that lost its tenant, or one unprefixed cache key shows one customer's data to another.
This skill gives your agent a repeatable procedure to:
- Choose between a shared database and database-per-tenant, with a decision table.
- Resolve and authorise the tenant in one middleware (subdomain, custom domain, path, API token or team switcher), ordered before route model binding.
- Keep the current tenant in Laravel's
Contextas hidden data, so it follows queued jobs automatically. - Apply a fail-closed global scope and a
BelongsToTenanttrait that blocks writes for the wrong tenant. - Close the side doors: raw
DB::queries,unique/existsvalidation, cache, file storage, broadcast channels, scheduled tasks and unique jobs. - Prove isolation with two-tenant Pest tests and a read-only Python scan that flags models missing the trait.
Output is either a full implementation (complete files plus a completed leak checklist) or an audit findings table ranked Critical to Low. Targets Laravel 12 and 13.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Focuses on single-database (shared table, tenant_id column) tenancy. For database-per-tenant or schema-per-tenant setups it only helps with the decision and points to dedicated packages. The scan script is a heuristic static check, not a proof of isolation.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 14 days ago
- Software
- Laravel 12or13 project
- Optional
Python 3.8+
Python runs the read-only scan script.
Permissions
File Scopes
The scan script is read-only and uses only the Python standard library.