multi-tenancy

multi-tenancy is a skill for Claude Code from MartinOlivero/saas-builder. It costs 221 tokens per session (1,793 once invoked), scanned A, original, MIT.

A design guide for keeping each customer's, team's, or organization's data separate inside one shared application. It also covers people who belong to more than one organization.

In plain words
What is it for?
Use it when building organization or workspace membership, invitations, roles, active-organization selection, and access checks across an application.
Why use it?
It helps prevent a query, server action, or screen from exposing one organization's data to another. It makes tenant access rules consistent instead of relying on scattered checks.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the saas-builder plugin — 22 skills, 1 hook shipped together

Good fit Use it when building organization or workspace membership, invitations, roles, active-organization selection, and access checks across an application.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/martinolivero/saas-builder/multi-tenancy
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add MartinOlivero/saas-builder --skill multi-tenancy
Clone the repo
git clone --depth 1 https://github.com/MartinOlivero/saas-builder

Made for: Claude Code.

Or install saas-builder, the plugin that ships this one along with the rest of its 22 skills, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for multi-tenancy

README.md
[![agentmods](https://agentmods.dev/badge/skills/martinolivero/saas-builder/multi-tenancy/github.svg)](https://agentmods.dev/skills/martinolivero/saas-builder/multi-tenancy)
Your own site
<a href="https://agentmods.dev/skills/martinolivero/saas-builder/multi-tenancy"><img src="https://agentmods.dev/badge/skills/martinolivero/saas-builder/multi-tenancy/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for multi-tenancy

Your own site · 80×15
<a href="https://agentmods.dev/skills/martinolivero/saas-builder/multi-tenancy"><img src="https://agentmods.dev/badge/skills/martinolivero/saas-builder/multi-tenancy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 221 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,793 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00221 $0.01793
Opus 5.5 $0.00088 $0.00717
Sonnet 5.5 $0.00044 $0.00359
Haiku 4.5 $0.00022 $0.00179

Measured 29d ago against content hash f9ec36ee5f93, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

multi-tenancy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 29d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/multi-tenancy/SKILL.md · 102 lines

How it starts

The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Multi-tenancy

Tenant isolation is one rule — "you only touch what belongs to an organization you are in" — that must hold in every query, every server function and every screen. This skill is about writing that rule once and about the places it is forgotten.

Analogy: an office building with several companies. The lobby is shared, each floor is private. The security model isn't a guard on every desk — it's one badge system that every door consults. The failures are never the front doors; they are the service elevator, the cleaning contractor with a master key, and the show floor left open for visitors.

Discovery (max 3 questions, only if unknown)

  1. Can one person ever belong to two organizations — a freelancer, an agency, a consultant, a founder with two companies?
  2. Who creates an organization — anyone who signs up, or only you?
  3. Is there a shared demo or sample account that strangers can enter?

Step 1 — Decide the membership model now

Model Shape Choose when
Single-org users.org_id The answer to question 1 is a certain, permanent no
Memberships memberships(user_id, org_id, role) + an active-org selection Any doubt at all

Default to memberships. The single-org shortcut saves a table today. Converting later, in one production app, meant touching 39 of 56 policies, 21 functions and 33 files — and exposed the side effects in Step 4.

Step 2 — One choke point

Every policy and query asks one function for the caller's tenant — current_org_id() — instead of reading a column directly.

  • With memberships it returns the active organization, after checking the caller is really a member of it.
  • Because everything goes through it, changing the model later changes one function.
  • The role check lives beside it and filters by the caller's id. Never ask "is there an admin row?" — the first row returned belongs to someone.

Step 3 — "What I can see" is not "who is on the team"

Read the full file on GitHub · 102 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 29d ago First seen · 102 lines · 221 tokens per session scan A f9ec36ee5f93

Subscribe to this mod's changes

multi-tenancy is a skill published in the GitHub repository MartinOlivero/saas-builder (5 stars, last pushed 26d ago), licensed MIT. It adds 221 tokens to every session and 1,793 once invoked, about $0.0009 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-08.

Related

multi-tenancy compared with skills from other repositories

multi-tenancy next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
multi-tenancyMartinOlivero/saas-builderSkill526d agoMITA221Claude Code
architecture-paradigm-microkernelathola/claude-night-marketSkill348yesterdayMITA32Claude Code
plugin-systemellmos-ai/skillsSkill94d agoMITA27Claude Code, Codex
saas-migration-auditparisgroup-ai/imersao-ia-setupSkill11mo agoMITA90Claude Code
multi-tenancycamilooscargbaptista/cto-toolkitSkill87mo agoMITA22Claude Code
moai-ref-api-patternsmodu-ai/moai-adkSkill1.3k4d agoApache-2.0A85Claude Code
flow-next-impl-reviewgmickel/flow-nextSkill717yesterdayMITA34Claude Code, Codex