saas-architecture-advisor

为多租户 SaaS 架构决策提供建议,包括租户模型、数据隔离策略、租户路由和扩展模式。适用于构建 SaaS 产品、将单租户系统转换为多租户系统或评估隔离策略的场景。触发词示例:多租户、SaaS 架构、租户隔离、共享数据库、按租户独立数据库、行级安全、租户路由、SaaS 模式。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "saas-architecture-advisor":https://skillpi.com/zh/skills/deepskill-f8b81a4b9b25cddd5023b831dc574b0033c5088017bad5ae4798f7b8454ebaf2。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为多租户 SaaS 架构决策提供建议,包括租户模型、数据隔离策略、租户路由和扩展模式。适用于构建 SaaS 产品、将单租户系统转换为多租户系统或评估隔离策略的场景。触发词示例:多租户、SaaS 架构、租户隔离、共享数据库、按租户独立数据库、行级安全、租户路由、SaaS 模式。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: saas-architecture-advisor
description: >-
  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.
license: Apache-2.0
compatibility: "Language and database agnostic; examples default to PostgreSQL and Node.js"
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: development
  tags: ["saas", "multi-tenant", "architecture", "database-design"]

SaaS Architecture Advisor

Overview

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.

Instructions

Step 1: Gather Context

Before recommending anything, establish:

  • Scale: Expected tenant count (year 1 and year 3)
  • Tenant size: Users per tenant (range and distribution)
  • Compliance: SOC2, HIPAA, GDPR, or contractual isolation requirements
  • Stack: Database, language, framework, hosting
  • Budget: Monthly infrastructure budget
  • Data sensitivity: What kind of data tenants store
  • Customization needs: Do tenants need custom fields, workflows, or branding?

Step 2: Evaluate Tenancy Models

Present trade-offs for these models:

Shared Everything (single DB, shared tables, tenant_id column):

  • Best for: <1,000 tenants, uniform data model, no strict isolation requirements
  • Cost: Lowest ($1 DB serves all tenants)
  • Risk: Query bugs can leak data; noisy neighbor issues
  • Mitigation: Row-level security (PostgreSQL RLS), application-layer checks

Schema per Tenant (single DB, separate schemas):

  • Best for: 50-500 tenants, moderate isolation needs
  • Cost: Low (single DB instance, logical separation)
  • Risk: Migration complexity scales with tenant count; catalog bloat
  • Mitigation: Automated migration tooling, connection pooling with schema switching

Database per Tenant (dedicated DB per tenant):

  • Best for: <100 tenants, strict compliance, large enterprise clients
  • Cost: Highest ($274+/mo per tenant on RDS)
  • Risk: Operational overhead managing N databases
  • Mitigation: Infrastructure-as-code templates, centralized monitoring

Hybrid (shared for standard, dedicated for enterprise):

  • Best for: Mixed tenant base with some requiring isolation
  • Cost: Moderate (shared DB + N dedicated for premium)
  • Trade-off: Two code paths, but repository pattern abstracts them

Step 3: Design Tenant Routing

Recommend routing strategy based on the application type:

  • Subdomain routing: tenant.app.com — best for B2B SaaS
  • Path routing: app.com/tenant/ — simpler SSL, good for internal tools
  • Header routing: X-Tenant-ID — API-first products
  • JWT claim: tenant_id in token — serverless/stateless architectures

Step 4: Address Cross-Cutting Concerns

For each recommendation, cover:

  • Rate limiting: Per-tenant to prevent noisy neighbors
  • Billing metering: How to track usage per tenant
  • Background jobs: Tenant context propagation to workers/queues
  • Caching: Tenant-namespaced cache keys
  • Search: Filtered indices or per-tenant indices
  • Audit logging: Tenant-scoped audit trails

Step 5: Generate Implementation Artifacts

Produce:

  • Database schema with tenant isolation mechanisms
  • Middleware/interceptor code for tenant context
  • Repository pattern that abstracts tenancy
  • Tenant provisioning/deprovisioning scripts
  • Migration strategy for existing single-tenant apps

Examples

Example 1: Early-Stage SaaS

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.

Example 2: Healthcare SaaS Requiring HIPAA

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

Guidelines

  • No one-size-fits-all — always evaluate against the specific context before recommending
  • Start simple, migrate up — recommend the simplest model that meets requirements; overengineering multi-tenancy is expensive
  • RLS is not optional for shared databases — application-layer filtering alone is insufficient; one missed WHERE clause = data breach
  • Test tenant isolation — always recommend integration tests that verify queries cannot access other tenants' data
  • Plan for the migration path — even if starting with shared DB, design the data access layer so switching to dedicated DBs later is feasible
  • Background jobs are the blind spot — tenant context often gets lost in async flows; always address this explicitly

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值88/100

亮点

  • 针对多租户 SaaS 架构设计,解决企业构建 SaaS 产品的核心痛点
  • 覆盖租户隔离、路由、扩展等关键决策点,具有广泛实用价值
触发精准92/100

亮点

  • 触发词完整且精准,覆盖多租户、SaaS 架构、租户隔离等核心概念
  • 边界清晰,不易与其他 Skill 混淆
结构规范95/100

待提升项

  • 缺少独立 When to Use 章节 原报告严重程度:轻微

    未设置独立的 When to Use 章节,但使用场景已在 description 和 Step 1 中充分说明

    改进建议:可考虑增加独立 When to Use 章节以提升可读性,但当前结构已足够清晰

亮点

  • Phase 划分清晰(Step 1-5),逻辑连贯
  • 提供端到端示例,增强可操作性
执行可靠90/100

亮点

  • 工具来源明确(PostgreSQL RLS、RDS、KMS),参数合理
  • 覆盖主要风险点(数据泄露、合规、成本),并提供缓解措施
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。