b2b-saas-architecture

b2b-saas-architecture is a skill for Claude Code, Codex from luanpdd/kit-mcp. It costs 61 tokens per session (3,334 once invoked), scanned A, original, MIT.

A reference architecture for B2B SaaS applications that serve multiple customer organizations from one system. It defines organizations, departments, roles, permissions, tenant routing, and the small set of identity data kept in a JWT.

In plain words
What is it for?
Use it when designing a Supabase multi-tenant application, including its database structure, organization membership, roles, permissions, JWT claims, and row-level security.
Why use it?
It helps prevent customers from seeing one another’s data and avoids common row-level security mistakes. It also gives teams a consistent starting point for access control and onboarding.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when designing a Supabase multi-tenant application, including its database structure, organization membership, roles, permissions, JWT claims, and row-level security.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/luanpdd/kit-mcp/b2b-saas-architecture
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 luanpdd/kit-mcp --skill b2b-saas-architecture
Clone the repo
git clone --depth 1 https://github.com/luanpdd/kit-mcp

Made for: Claude Code, Codex.

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 b2b-saas-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/luanpdd/kit-mcp/b2b-saas-architecture/github.svg)](https://agentmods.dev/skills/luanpdd/kit-mcp/b2b-saas-architecture)
Your own site
<a href="https://agentmods.dev/skills/luanpdd/kit-mcp/b2b-saas-architecture"><img src="https://agentmods.dev/badge/skills/luanpdd/kit-mcp/b2b-saas-architecture/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 b2b-saas-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/luanpdd/kit-mcp/b2b-saas-architecture"><img src="https://agentmods.dev/badge/skills/luanpdd/kit-mcp/b2b-saas-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,334 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.00061 $0.03334
Opus 5 $0.00030 $0.01667
Sonnet 5 $0.00012 $0.00667
Haiku 4.5 $0.00006 $0.00333

Measured 6d ago against content hash f10c2bf7bbec, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

b2b-saas-architecture 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 6d 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.

kit/skills/b2b-saas-architecture/SKILL.md · 302 lines

How it starts

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

B2B SaaS Multi-Tenant — Arquitetura Canônica

Quando usar

LLM carrega esta skill ao desenhar arquitetura de app B2B SaaS multi-tenant em Supabase. Trigger phrases:

  • "B2B SaaS multi-tenant", "arquitetura multi-tenant", "isolation strategy"
  • "single schema vs schema-per-tenant"
  • "schema canônico organizations", "departments table", "members"
  • "JWT claims multi-tenant", "app_metadata orgs"
  • "slug org imutável", "tenant routing"

Esta skill define o schema canônico que multi-tenant-rls-writer (Phase 108), org-onboarding-implementer (Phase 107), super-admin-implementer (Phase 111), audit-log-implementer (Phase 109), e demais agents da suíte v1.21 consomem como entrada.

Regras absolutas

REGRA #1 (estratégia default): Single Schema + org_id + RLS é o caminho canônico para 90% dos B2B SaaS. Schema-per-tenant é justificado apenas em compliance extremo (saúde/jurídico com auditoria isolacional). Database-per-tenant é inviável economicamente fora de contratos enterprise.

REGRA #2 (JWT minimal): APENAS super_admin: bool em app_metadata. Lista de orgs no JWT é anti-pattern — bloat linear no token + stale de 1h após mudança de role. O banco (helper functions PG) é fonte de verdade.

REGRA #3 (slug imutável): organizations.slug é append-only após criação. Mutação requer tabela slug_history + redirect 301 em rotas afetadas. Quebra silenciosa de bookmarks/webhooks/OAuth callbacks é o pior bug que cliente B2B encontra.

REGRA #4 (super_admin via service_role): app_metadata.super_admin = true é setado APENAS via auth.admin.updateUserById() (service role). Cliente NUNCA consegue mutá-lo (≠ user_metadata que é editável).

REGRA #5 (FKs com CASCADE explícito): Todas as FKs têm ON DELETE explícito (CASCADE para entidades dependentes da org, RESTRICT para evitar deleção acidental). Sem default — força decisão consciente.

Patterns canônicos

Estratégia de isolation — tabela comparativa

Estratégia Isolation Custo ops Compliance Quando usar
Single Schema + org_id + RLS Lógico (RLS) Baixo Padrão B2B SaaS DEFAULT 90% dos casos — Stripe, Linear, Vercel, Notion
Schema-per-tenant Físico (PG schemas) Médio (N migrations) Compliance auditável Saúde/jurídico/governo com requisito explícito de isolamento
Database-per-tenant Físico (DB separadas) Alto (N projects Supabase) Compliance extremo Apenas contratos enterprise com SLA de isolamento físico

Read the full file on GitHub · 302 lines

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. 6d ago First seen · 302 lines · 61 tokens per session scan A f10c2bf7bbec

Subscribe to this mod's changes

b2b-saas-architecture is a skill published in the GitHub repository luanpdd/kit-mcp (1 stars, last pushed 3d ago), licensed MIT. It adds 61 tokens to every session and 3,334 once invoked, about $0.0003 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-09-03.

Related

Other skills, from other repositories

azure-postgres-ts

Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg client", "node-postgres", "Azure PostgreSQL…

microsoft/skills · 94 tokens

butterbase

AI-native, open-source backend-as-a-service with a built-in Model Context Protocol server. Postgres, auth, storage, functions, AI gateway.

butterbase-ai/butterbase · 34 tokens

supabase

Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…

supabase/agent-skills · 185 tokens

supabase-cli

This skill should be used when user asks to "use supabase CLI", "supabase init", "supabase start", "run migrations", "deploy edge functions", "manage Supabase project", or works with the supabase command-line tool for local development and project management.

fcakyon/claude-codex-settings · 60 tokens

supabase-js

This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the @supabase/supabase-js JavaScript/TypeScript SDK.

fcakyon/claude-codex-settings · 64 tokens

supabase-node

Express/Hono with Supabase and Drizzle ORM.

alinaqi/maggy · 14 tokens