/sdlc-documentation:10-saas-multi-tenancy-architecture-specfrom sdlc-documentation
Guides the creation of a multi-tenant SaaS architecture specification covering control/application planes, per-service tenancy patterns, context propagation, isolation, noisy-neighbour controls, and cost attribution.
Ships in sdlc-documentation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Artefact | Source or provider | Required? | Missing behaviour |
|---|---|---|---|
| Approved HLD, SRS and business model | Phase 01-03 artefacts | Required | Stop if tenant identity or service inventory is incomplete. |
| Residency, isolation, scale and cost constraints | Security, compliance, platform and finance owners | Required | Make unknown constraints explicit ADR blockers. |
| Artefact | Consumer | Observable acceptance condition |
|---|---|---|
| Multi-Tenancy Architecture Specification and ADR seeds | Service, data, security, platform and billing teams | Every tenant-touching service has a pattern, context rule, enforcement, failure behaviour, noisy-neighbour control, observability and cost attribution. |
| Evidence | Consumer | Acceptance condition |
|---|---|---|
| Source and decision trace | Reviewer and downstream owner | Each material statement cites an approved input, named decision or qualified open issue. |
| Completed verification record | Release or phase gate owner | Every applicable check records pass/fail; unavailable checks remain not assessed. |
Read-only is the default for analysis, review, evaluation and planning. Read and search access to authorised project artefacts are required. Editing is limited to an explicitly requested project deliverable. Execution may run document, syntax or validation checks. Network access is used only for facts that require current verification. Do not publish, spend, change production, approve policy, or claim certification without explicit authority.
If any required capability is unavailable, return the narrowest useful qualified Multi-Tenancy Architecture Specification and ADR seeds draft plus a gap register showing the missing item, affected sections, risk and owner. Never convert an unassessed check into a pass.
| Choice | Action | Failure or risk avoided |
|---|---|---|
| Isolation/regulation outweighs pooling economy | Choose silo, pod or dedicated pattern | Blast radius and residency are bounded |
| Workload is homogeneous with enforceable row isolation | Choose pool with defence in depth | Unnecessary unit cost is avoided |
multi-tenant without a service matrix. Fix: decide per service and store.This skill produces the SaaS-distinctive architecture artefact that no generic HLD captures: the explicit two-plane decomposition, the per-microservice tenancy-pattern matrix, tenant-context propagation, isolation strategy, noisy-neighbor controls, per-tenant cost-attribution method, and the ADR seeds. It is the canonical Phase 03 SaaS skill.
The skill is anchored in Tod Golding, Building Multi-Tenant SaaS Architectures (O'Reilly, 2024). It assumes a generic HLD.md already exists (from 01-high-level-design) and that the present skill augments it with the SaaS-specific viewpoints.
vision.md or PRD.md describes a multi-tenant SaaS (B2B, B2C, vertical, horizontal).HLD.md already exists or will be created in the same Phase 03 run.| Attribute | Value |
|---|---|
| Inputs | projects/<ProjectName>/<phase>/<document>/SRS_Draft.md, HLD.md, projects/<ProjectName>/_context/tech_stack.md, PRD.md |
| Output | projects/<ProjectName>/<phase>/<document>/Multi_Tenancy_Architecture_Spec.md plus ADR seeds |
| Tone | Architectural, decision-driven, evidence-bearing |
| Standard | IEEE 1016-2009 Sec 5 (Design Viewpoints); ISO/IEC 25010 (Quality Model) |
| Source | Golding, Building Multi-Tenant SaaS Architectures (2024) |
| File | Location | Required | Purpose |
|---|---|---|---|
| SRS_Draft.md | Phase-02 output dir | Yes | Functional and NFR requirements |
| HLD.md | Phase-03 output dir | Yes | Generic architecture being augmented |
| tech_stack.md | _context/ | Yes | Cloud / framework constraints |
| PRD.md | Phase-01 output dir | Recommended | Tiering, ICP, business model |
| vision.md | _context/ | Recommended | Strategic context |
| File | Location | Description |
|---|---|---|
| Multi_Tenancy_Architecture_Spec.md | Phase-03 output dir | Full SaaS multi-tenancy spec |
adr-seeds/0001-tenancy-pattern-<service>.md | Phase-03 output dir | One ADR seed per microservice |
adr-seeds/0002-control-plane-boundary.md | Phase-03 output dir | Boundary between control plane and application plane |
Follow these nine steps in order. Halt if any required input is missing.
Read SRS_Draft.md, HLD.md, tech_stack.md, PRD.md, vision.md. Identify regulatory constraints, data-residency requirements, target ICP segments, expected tier mix, and any "enterprise must have dedicated infra" obligations. Log all source citations.
Per Golding Ch.2, every SaaS architecture has a control plane (onboarding, identity, tenant management, metering, billing, deployment automation, operations, analytics) and an application plane (the domain microservices that carry tenant context).
Produce a Mermaid diagram showing the two planes, the services in each, and the events/APIs crossing the boundary. Every service in scope shall be classified as control-plane or application-plane.
flowchart LR
subgraph CP[Control Plane]
Onb[Onboarding]
Idn[Identity]
TMg[Tenant Management]
Met[Metering]
Bil[Billing]
Dep[Deployment Automation]
Ops[Operations Console]
end
subgraph AP[Application Plane]
Svc1[Domain Service 1]
Svc2[Domain Service 2]
SvcN[Domain Service N]
end
CP -- "tenant lifecycle events" --> AP
AP -- "metering events" --> CP
For every microservice in the application plane, fill the following table:
| Service | Compute | Storage | Pattern | Drivers | Trade-offs accepted | ADR ref |
|---|---|---|---|---|---|---|
| Service A | pooled / siloed / pod | pooled / siloed / pod | Full-Stack Pool / Full-Stack Silo / Mixed-Mode / Pod / VPC-per-tenant | regulatory / blast-radius / cost / perf / noisy-neighbor / migration | what was traded away | 0001-tenancy-pattern-service-a.md |
Patterns are drawn from Golding Ch.3:
Every row shall name at least one driver from the regulated list. Drivers without measurable thresholds are not drivers — replace with a measurable threshold (e.g. "P95 cross-tenant latency interference < 10 ms" not "low interference").
Document the token format, claims (tenant_id, tier, region, roles), how the token is issued (control-plane → application-plane), how it is propagated across services (HTTP header, gRPC metadata, async-event envelope), how it is validated at each service boundary, and the fail-safe behaviour when the context is missing or invalid (reject request, audit log, alarm).
Cite SRS-section identifiers for each rule and write a Verification Procedure table — how each rule is tested in CI.
For each tenancy pattern in use, document the isolation enforcement at each layer:
Cross-link to 09-governance-compliance/11-saas-data-isolation-evidence-pack which produces the evidence artefact.
For every pooled service, document:
Cross-link to 06-deployment-operations/08-saas-slo-and-error-budget-doc.
For every pooled service, state the method by which infrastructure cost is attributed back to the tenant: metered usage events (API calls, storage GB-month, compute seconds), allocation of shared costs (per-tenant share of base infrastructure), reporting cadence (daily / monthly), and the destination (FinOps dashboard, finance ERP). This feeds the Pricing & Packaging Spec and the Billing & Metering SRS.
For each microservice, emit one ADR file at adr-seeds/0001-tenancy-pattern-<service>.md using the template at references/saas-tenancy-decision-template.md. Each ADR contains: context, decision, status, consequences, drivers, alternatives considered, evidence references, sign-off owners.
Also emit one ADR for the control-plane / application-plane boundary: where API calls cross the boundary, what events propagate, what isolation exists.
Write Multi_Tenancy_Architecture_Spec.md with the following sections in order:
Log the section count and ADR-seed count.
Strict heading order as above. Mermaid for all diagrams. LaTeX for any quota / cost formulas. Tables for the tenancy-pattern matrix and SLOs. No vague adjectives — every NFR has a measurable threshold per 02-requirements-engineering/references/saas-nfr-catalog.md.
| Pitfall | Remedy |
|---|---|
| Treating the whole system as one tenancy pattern | Fill the matrix per microservice; mixed-mode is the norm |
| Naming a pattern without drivers | Every row must cite at least one driver from {regulatory, isolation, blast-radius, cost, performance, noisy-neighbor} |
| "Isolation is logical" without enforcement evidence | Cross-link to the Data Isolation Evidence Pack and the test artefacts |
| No noisy-neighbor controls in a pool service | Throttle, quota, back-off, per-tier SLO are mandatory |
| No tenant-context fail-safe | Every service must define the reject + audit behaviour when context is missing |
| Cost attribution missing for pool services | Pool means you cannot tell who is expensive — fix that with metering, not later |
| Direction | Skill | Relationship |
|---|---|---|
| Upstream | 01-high-level-design | Consumes the generic HLD as the architectural baseline |
| Upstream | Phase 02 SRS | Consumes NFRs, regulatory constraints |
| Downstream | 02-low-level-design | Tenancy patterns drive module-level helpers (tenant-aware repos, scoped logging) |
| Downstream | 04-database-design | Storage tenancy pattern drives schema strategy (separate-DB / separate-schema / shared-schema-RLS) |
| Downstream | 06-deployment-operations/07-saas-tenant-lifecycle-runbook | Lifecycle events defined here are operationalised in the runbook |
| Downstream | 06-deployment-operations/08-saas-slo-and-error-budget-doc | Per-tier SLOs declared here feed the SLO doc |
| Downstream | 09-governance-compliance/11-saas-data-isolation-evidence-pack | Isolation strategy here is the design; the evidence pack is the proof |
| Downstream | 09-governance-compliance/05-architecture-decision-records | ADR seeds graduate to the ADR catalog |
logic.prompt — Executable prompt.README.md — Quick-start.references/saas-tenancy-decision-template.md — ADR template per service.references/saas-control-plane-services.md — Canonical control-plane service catalogue.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub peterbamuhigire/chwezi-sdlc-documentation --plugin sdlc-documentation160 skills in this plugin
/01-deployment-guideUse when producing or updating deployment guide for release prerequisites, migration choreography, verification, rollback, and ownership. Use runbook for the neighbouring concern; this skill owns the named document contract and its acceptance evidence./01-high-level-designUse when approved requirements need a system-level architecture with boundaries, components, critical flows, deployment topology and ADRs, or an as-built design must be recovered from existing code; use system-overview for orientation, low-level-design for module internals, and infrastructure-design for infrastructure depth./01-initialize-srsUse when writing a new SRS (software requirements specification) for a business system or module: create the Waterfall SRS workspace, IEEE structure, identifiers and source context; use context-engineering next for boundaries and actors.Other plugins' skills for the same job