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.
npx skills add camilooscargbaptista/cto-toolkit --skill multi-tenancygit clone --depth 1 https://github.com/camilooscargbaptista/cto-toolkitWrote 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.
[](https://agentmods.dev/skills/camilooscargbaptista/cto-toolkit/multi-tenancy)<a href="https://agentmods.dev/skills/camilooscargbaptista/cto-toolkit/multi-tenancy"><img src="https://agentmods.dev/badge/skills/camilooscargbaptista/cto-toolkit/multi-tenancy.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00022 | $0.01057 |
| Opus 5 | $0.00011 | $0.00528 |
| Sonnet 5 | $0.00004 | $0.00211 |
| Haiku 4.5 | $0.00002 | $0.00106 |
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 7d 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.
How it starts
The opening of the file, as written. The whole thing — 145 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Multi-Tenancy Patterns
When to Use
- Building SaaS that serves multiple organizations/clients
- Designing data isolation between tenants (companies, stations, fleets)
- Choosing the right isolation level for your compliance needs
Isolation Models
1. Row-Level (Shared Everything)
┌──────────────────────────────┐
│ Single Database │
│ ┌────────────────────────┐ │
│ │ users table │ │
│ │ tenant_id │ name │ │
│ │ ──────────┼────────── │ │
│ │ company_a │ Alice │ │
│ │ company_b │ Bob │ │
│ └────────────────────────┘ │
└──────────────────────────────┘
Pros: Simple, cheap, easy to maintain
Cons: Risk of data leakage, shared resources
Best for: Small/medium SaaS, cost-sensitive
Implementation — TypeORM Global Scope:
// Middleware injects tenant
@Injectable()
export class TenantMiddleware implements NestMiddleware {
use(req: AuthRequest, res: Response, next: NextFunction) {
req.tenantId = req.user?.companyId;
next();
}
}
// Repository automatically filters by tenant
@Injectable()
export class TenantAwareRepository<T> {
constructor(private repo: Repository<T>) {}
findAll(tenantId: string): Promise<T[]> {
return this.repo.find({ where: { tenant_id: tenantId } as any });
}
// CRITICAL: NEVER allow findAll without tenantId
}
// Global subscriber (safety net)
@EventSubscriber()
export class TenantSubscriber implements EntitySubscriberInterface {
afterLoad(entity: any) {
// Verify tenant match on every load (paranoia mode)
}
beforeInsert(event: InsertEvent<any>) {
// Auto-inject tenant_id
if (event.entity && !event.entity.tenant_id) {
event.entity.tenant_id = getCurrentTenantId();
}
}
}
2. Schema-Level (Shared Database, Separate Schemas)
┌──────────────────────────────┐
│ Single Database │
│ ┌──────────┐ ┌──────────┐ │
│ │ schema_a │ │ schema_b │ │
│ │ users │ │ users │ │
│ │ orders │ │ orders │ │
│ └──────────┘ └──────────┘ │
└──────────────────────────────┘
Pros: Good isolation, shared infra cost
Cons: Schema migration complexity, connection pooling
Best for: Medium SaaS, regulated industries
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.
- 7d ago First seen · 145 lines · 22 tokens per session scan A 373fdbe2e16a
multi-tenancy is a skill published in the GitHub repository camilooscargbaptista/cto-toolkit (7 stars, last pushed 5mo ago), licensed MIT. It adds 22 tokens to every session and 1,057 once invoked, about $0.0001 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-31.
Other skills, from other repositories
architecture-paradigm-cqrs-es
Applies CQRS and Event Sourcing for read/write separation and audit trails. Use when designing systems with complex domain logic or full state-change history.
backend-event-sourcing
Use this skill when the user says 'event sourcing', 'event store', 'event stream', 'event sourced', 'rehydrate from events', 'event replay', 'projection rebuild', 'event log', 'append-only log', 'event history'. This skill enforces: events as the single source of truth, current state derived from event replay…
backend-multi-tenancy
Use this skill when the user says 'multi-tenancy', 'SaaS', 'tenant isolation', 'row-level security', 'DB per tenant', 'schema per tenant', 'tenant provisioning', 'tenant migration', 'multi-tenant database', 'tenant context'. This skill implements tenant isolation strategies: row-level, schema-per-tenant, and…
backend-cqrs-patterns
Use this skill when the user says 'CQRS', 'command query segregation', 'separate read write model', 'command model', 'query model', 'read model', 'write model', 'materialized view', 'command handler', 'query handler'. This skill enforces: strict command/query separation, write model optimized for consistency, read…
migration-evolution
Use when thinking through, reviewing, changing, or verifying data and contract evolution: schema migrations, expand-and-contract, resumable backfills, API or event compatibility, synchronization, CDC, reindexing, traffic cutover, or legacy integration. For outbox and inbox delivery use async-messaging; for transaction…
transactions-consistency
Use when thinking through, reviewing, changing, or verifying transactional or concurrent behavior: isolation, anomalies, locking, state machines, idempotency, sagas, consistency, replication, sharding, consensus, distributed locks, fencing, or ordering. For jobs, queues, and outbox delivery use async-messaging; for…