Skip to content
Back to skills

Multi Tenancy

ASecurity

Architect B2B SaaS multi-tenancy safely using strict tenant scoping, database RLS, cache isolation, and noisy-neighbor limits

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentrustsqlapidatabasebackendsecurity

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill multi-tenancy --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Multi Tenancy?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Multi Tenancy
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-multi-tenancy/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-multi-tenancy)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Architect B2B SaaS multi-tenancy safely using strict tenant scoping, database RLS, cache isolation, and noisy-neighbor limits
profile: standard
tags: architecture, database, security, backend
---

# Multi-tenancy

Use when building multi-tenant B2B APIs, storage schemas, background queues, or caches.

## Tenant isolation
- Derive the active `tenantId` solely from verified auth credentials/tokens—never trust client-supplied body fields or query parameters alone.
- Enforce isolation at the database boundary (for example PostgreSQL Row-Level Security policies with transaction-scoped `SET LOCAL` + composite `(tenant_id, id)` indexes) as defense in depth behind app filters.
- Prefix all Redis cache keys, object storage paths, and search index queries with `tenantId`.

## Fair usage and background jobs
- Carry explicit `tenantId` context inside every queued job payload and verify object ownership before executing mutations.
- Apply per-tenant rate limits and concurrency/queue fairness so one heavy tenant does not starve others.

## Verify
Write cross-tenant integration tests attempting reads, updates, deletes, and cache lookups across Tenant A and Tenant B records and assert `403`/`404`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.