multi-tenancy

multi-tenancy is a skill for Claude Code, Codex from rrezartprebreza/spring-boot-skills. It costs 38 tokens per session (442 once invoked), scanned A, original, MIT.

Guidelines for keeping one application’s data separate from another customer’s data in a Spring Boot 3 system. A tenant is usually one customer, organization, or account sharing the application.

In plain words
What is it for?
Use it when implementing tenant-aware databases or schemas, JPA repositories, reactive request context, caching, jobs, migrations, and authorization. It covers database-per-tenant, schema-per-tenant, and shared-schema designs.
Why use it?
It reduces the risk of exposing one customer’s records to another through databases, caches, background jobs, or authorization checks. It also sets rules for identifying tenants and handling migrations safely.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Part of the spring-boot-3-skills plugin — 33 skills shipped together

Good fit Use it when implementing tenant-aware databases or schemas, JPA repositories, reactive request context, caching, jobs, migrations, and authorization. It covers database-per-tenant, schema-per-tenant, and shared-schema designs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rrezartprebreza/spring-boot-skills/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 rrezartprebreza/spring-boot-skills --skill multi-tenancy
Clone the repo
git clone --depth 1 https://github.com/rrezartprebreza/spring-boot-skills

Made for: Claude Code, Codex.

Or install spring-boot-3-skills, the plugin that ships this one along with the rest of its 33 skills.

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/rrezartprebreza/spring-boot-skills/multi-tenancy/github.svg)](https://agentmods.dev/skills/rrezartprebreza/spring-boot-skills/multi-tenancy)
Your own site
<a href="https://agentmods.dev/skills/rrezartprebreza/spring-boot-skills/multi-tenancy"><img src="https://agentmods.dev/badge/skills/rrezartprebreza/spring-boot-skills/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/rrezartprebreza/spring-boot-skills/multi-tenancy"><img src="https://agentmods.dev/badge/skills/rrezartprebreza/spring-boot-skills/multi-tenancy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 442 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00038 $0.00442
Opus 5 $0.00019 $0.00221
Sonnet 5 $0.00008 $0.00088
Haiku 4.5 $0.00004 $0.00044

Measured 10d ago against content hash 66d3a9858000, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 10d 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/spring-boot-3/multi-tenancy/SKILL.md · 51 lines

How it starts

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

Multi-Tenancy

Treat tenant identity as an authorization boundary, not a query convenience.

Choose an isolation model

  • Database per tenant: strongest isolation and highest operational cost.
  • Schema per tenant: strong logical isolation with shared infrastructure.
  • Shared schema with tenant_id: simplest operations, but every access path must enforce scope.
  • Document the selected model and prohibit repositories from bypassing it.

Resolve tenant identity

  • Derive the tenant from a verified token claim, trusted host mapping, or authenticated API key.
  • Reject missing, unknown, disabled, or conflicting tenant identifiers.
  • Never trust a public X-Tenant-Id header by itself.
  • Clear servlet thread-local context in finally; use Reactor Context for reactive flows.

Enforce isolation

  • Apply tenant selection before opening the persistence session or transaction.
  • Include tenant identity in unique constraints, cache keys, idempotency keys, and object storage paths.
  • Prevent cross-tenant joins and unrestricted administrative repositories.
  • Authorize support impersonation explicitly and audit every use.

Operations

  • Run migrations per database/schema with resumable progress and version reporting.
  • Propagate tenant identity into scheduled jobs, messages, and async tasks explicitly.
  • Limit noisy tenants with quotas and per-tenant observability using bounded identifiers.
  • Test negative cross-tenant access, not only successful tenant queries.

Examples

  • See examples/good-tenant-filter.java and examples/bad-tenant-filter.java.

Gotchas

  • Agent trusts a tenant header supplied by the caller - derive tenant from authenticated context.
  • Agent forgets to clear a servlet ThreadLocal - pooled threads can leak one tenant into another request.
  • Agent scopes database queries but not cache keys - cached data can cross tenants.
  • Agent starts a transaction before selecting the tenant - routing may choose the wrong database.
  • Agent runs background jobs without tenant context - make tenant an explicit job parameter.

Read the full file on GitHub · 51 lines

Files

What ships with it

3 files 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. 10d ago First seen · 51 lines · 38 tokens per session scan A 66d3a9858000

Subscribe to this mod's changes

multi-tenancy is a skill published in the GitHub repository rrezartprebreza/spring-boot-skills (260 stars, last pushed 2d ago), licensed MIT. It adds 38 tokens to every session and 442 once invoked, about $0.0002 per session on Opus 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-08-30.