Advises on multi-tenant SaaS architecture decisions including tenancy models, data isolation strategies, tenant routing, and scaling patterns. Use when someone is building a SaaS product, converting single-tenant to multi-tenant, or evaluating isolation strategies. Trigger words: multi-tenant, SaaS architecture, tenant isolation, shared database, per-tenant database, row-level security, tenant routing, SaaS patterns.
This skill helps teams design and implement multi-tenant SaaS architectures by evaluating isolation strategies, generating tenant routing patterns, and recommending the right tradeoffs based on scale, compliance requirements, and budget constraints.
Before recommending anything, establish:
Present trade-offs for these models:
Shared Everything (single DB, shared tables, tenant_id column):
Schema per Tenant (single DB, separate schemas):
Database per Tenant (dedicated DB per tenant):
Hybrid (shared for standard, dedicated for enterprise):
Recommend routing strategy based on the application type:
tenant.app.com — best for B2B SaaSapp.com/tenant/ — simpler SSL, good for internal toolsX-Tenant-ID — API-first productstenant_id in token — serverless/stateless architecturesFor each recommendation, cover:
Produce:
User prompt:
We have 30 tenants and expect 200 in a year. PostgreSQL, no compliance needs yet. What tenancy model?
Agent output:
Recommendation: Shared database with RLS
At 200 tenants with no compliance requirements, a single PostgreSQL database
with row-level security gives you the best simplicity-to-isolation ratio.
Implementation:
1. Add tenant_id UUID column to all tenant-scoped tables
2. Enable RLS: ALTER TABLE <table> ENABLE ROW LEVEL SECURITY;
3. Create policies: USING (tenant_id = current_setting('app.tenant_id')::UUID)
4. Set tenant context per request in middleware via SET LOCAL
Cost: Single db.t3.medium handles this easily at ~$50/month.
Migration path: If you later need dedicated DBs for enterprise clients,
the repository pattern lets you route specific tenants without changing app code.
User prompt:
Building a patient records SaaS. 50 clinic tenants, HIPAA required. Budget: $5k/month infra.
Agent output:
Recommendation: Database per tenant
HIPAA requires demonstrable data isolation. At 50 tenants, per-tenant databases
are operationally feasible and satisfy compliance auditors.
Architecture:
- Tenant registry DB (shared): Stores tenant metadata + routing config
- Per-tenant RDS instances: db.t3.medium ($50/mo each) = $2,500/mo for 50
- Connection routing: Middleware resolves tenant → connection string from registry
- Encryption: RDS encryption at rest + tenant-specific KMS keys
Budget fit: $2,500 for DBs + $1,000 compute + $500 other = $4,000/mo ✅
Key HIPAA controls addressed:
- Physical data isolation (separate DB instances)
- Per-tenant encryption keys (KMS)
- Tenant-scoped audit logs
- Independent backup/restore per tenant
npx skills add TerminalSkills/saas-architecture-advisor下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer