1---2name: 07-saas-tenant-lifecycle-runbook3description: Use when producing or updating SaaS tenant-lifecycle runbook for provisioning, suspension, reactivation, export, deletion, isolation, and evidence. Use runbook for the neighbouring concern; this skill owns the named document contract and its acceptance evidence.4---567# SaaS Tenant Lifecycle Runbook Skill89<!-- dual-compat-start -->10## Use When1112- Produce or update SaaS tenant-lifecycle runbook from approved project evidence.13- Resolve decisions about provisioning, suspension, reactivation, export, deletion, isolation, and evidence.14- Prepare a reviewable handoff for SaaS operations and support.1516## Do Not Use When1718- The task is primarily owned by runbook; route there and use this skill only for its named output.19- Required project evidence or decision authority is unavailable and the requester expects a pass, release, certification, or production change.2021## Required Inputs2223| Artefact | Source/provider | Required? | Behaviour when absent |24|---|---|---|---|25| Project _context/, approved requirements, and relevant architecture | Project owner and upstream phase skills | Required | Stop at a gap register; do not invent scope, thresholds, integrations, or owners. |26| Existing artefact, implementation, configuration, and evidence named below | Repository, delivery team, or service owner | Required when updating or assessing | Mark inaccessible items `not assessed`; do not treat them as passed. |27| Target audience, environment, risk tolerance, and authority | Requester and accountable owner | Required | Produce a read-only outline with explicit assumptions; do not mutate project or production state. |28## Outputs2930| Artefact | Consumer | Observable acceptance condition |31|---|---|---|32| SaaS Tenant-lifecycle Runbook | SaaS operations and support | Each lifecycle transition has authority, idempotency, tenant-isolation checks, audit evidence, and recovery steps. |33| Decision and gap register | Reviewer and downstream phase owner | Every assumption, rejected option, unresolved dependency, waiver, and owner is explicit. |34| Validation evidence | Release or governance reviewer | Checks identify command or method, date, result, evidence location, and all unassessed items. |3536## Evidence Produced3738| Evidence | Minimum content | Acceptance |39|---|---|---|40| Traceability record | Source artefact, decision, output section, owner | No mandatory decision is source-free. |41| Quality-gate result | Check, expected result, observed result, evidence path | Failures and unavailable checks cannot appear as passes. |42| Review record | Reviewer, date, disposition, open actions | The consumer can reproduce the acceptance decision. |4344## Capability and Permission Boundaries4546- Minimum capabilities: read and search the authorised project sources. Execution is optional and limited to non-destructive validation.47- Inspection is read-only by default. Create or edit the named project document only when explicitly authorised. Production mutation, publishing, destructive action, spending, external communication, or certification claims require separate explicit authority.48- Treat secrets, tenant data, incident evidence, and financial records as least-privilege inputs; expose only the minimum evidence needed for review.4950## Degraded Mode5152If files, execution, network, rendering, environment access, fonts, or current evidence are unavailable, return the narrowest useful draft plus a gap register. Label affected checks `not assessed`, retain the intended acceptance oracle, and state who must supply or verify the missing evidence. Never convert an unavailable check into a pass.5354## Decision Rules5556| Choice | Action | Failure or risk avoided |57|---|---|---|58| Evidence is complete and authority is explicit | Choose lifecycle action from verified tenant state and authority and produce the full artefact. | Cross-tenant or irreversible lifecycle errors. |59| A required source or approval is missing | Stop the affected branch; record the gap, owner, and unblock condition. | Fabricated requirements or unauthorised action. |60| Evidence conflicts across sources | Preserve both claims, identify the controlling owner, and request a recorded decision. | Silent selection of a convenient but wrong source. |61| A check cannot run in the available environment | Keep its oracle and mark it `not assessed`; require later execution evidence. | False assurance from capability limits. |6263## Workflow64651. Confirm the named deliverable, consumer, scope, environment, authority, and neighbouring-skill boundary.662. Inventory required sources and validate provenance, freshness, internal consistency, and missing inputs. Stop the affected branch on a mandatory gap.673. Extract traceable requirements, invariants, risks, and measurable acceptance criteria; record conflicts before choosing a design or procedure.684. Apply the decision rules and the domain workflow below. For a failed branch, preserve evidence, choose the documented recovery path, or escalate to the named owner.695. Draft the artefact, decision register, and evidence record together. Do not defer failure handling, rollback, security, tenancy, accessibility, or operational ownership.706. Run available checks, review every result, repair failures, and hand off only when acceptance is observable. If recovery fails or authority is exceeded, stop and escalate without mutation.7172## Quality Standards7374- Ground every section in a named project source, decision, measured result, or accountable owner.75- Give each requirement or procedure a deterministic oracle that another reviewer can reproduce.76- Keep assumptions, exclusions, degraded checks, residual risks, and waivers visible at handoff.77- Preserve the domain invariants and more specific controls in the existing workflow below; this contract does not replace them.78- Run the repository anti-AI-slop gate: remove filler, verify named standards and dependencies, and retain purposeful domain detail.7980## Anti-Patterns8182- Copying a generic template without mapping it to project sources. Fix: attach each section to an approved requirement, configuration, risk, or owner.83- Choosing a threshold because it is common practice. Fix: derive it from a requirement, measured baseline, risk decision, or current verified source.84- Reporting an inaccessible or unexecuted check as passed. Fix: mark it `not assessed`, preserve the oracle, and name the verifier.85- Mixing the neighbouring runbook concern into this artefact without a boundary. Fix: cross-reference its output and keep ownership explicit.86- Omitting failure, rollback, empty-state, security, tenancy, or escalation behaviour. Fix: specify the trigger, safe action, verification, and owner for each applicable case.87- Mutating a repository, environment, tenant, ledger, or external system while drafting guidance. Fix: remain read-only until the exact mutation and authority are explicit.88- Claiming compliance, certification, readiness, or release from prose alone. Fix: require source-attributed evidence and a named acceptance decision.8990## Worked Example9192Given an approved project source and a conflicting implementation detail, record both with provenance, stop the affected branch, and obtain the accountable owner's decision. Then update the relevant contract, define a reproducible acceptance check, and retain its observed result. The artefact is accepted only when each lifecycle transition has authority, idempotency, tenant-isolation checks, audit evidence, and recovery steps.9394## References9596- [logic.prompt](logic.prompt) - load only when its template, logic, or detail is needed.97- [README.md](README.md) - load only when its template, logic, or detail is needed.98<!-- dual-compat-end -->99## Overview100101Generates the operational runbook covering the SaaS-distinctive tenant lifecycle events. Captures the procedures, automation hooks, manual gates, audit trail, retention obligations, and customer-comms templates that the generic runbook leaves out.102103## When to Use104105- The project is multi-tenant SaaS.106- The generic `Runbook.md` already exists in Phase 06.107- The `Multi_Tenancy_Architecture_Spec.md` from Phase 03 exists.108- GDPR / POPIA / DPPA or similar privacy-regulation constraints apply (almost always).109110## Quick Reference111112| Attribute | Value |113|-----------|-------|114| **Inputs** | `Multi_Tenancy_Architecture_Spec.md`, `Runbook.md`, `Compliance_Docs.md`, billing & metering spec |115| **Output** | `projects/<ProjectName>/<phase>/<document>/Tenant_Lifecycle_Runbook.md` and `playbooks/*.md` |116| **Tone** | Procedural, audit-grade, customer-comms-aware |117| **Standard** | SRE Best Practices; GDPR Art.17 (deletion); POPIA / DPPA equivalents |118119## Output Files120121| File | Description |122|------|-------------|123| Tenant_Lifecycle_Runbook.md | Master runbook indexing each stage |124| playbooks/01-provisioning.md | Provisioning procedure |125| playbooks/02-tier-change.md | Upgrade / downgrade procedure |126| playbooks/03-suspension.md | Suspension procedure (billing / compliance) |127| playbooks/04-reactivation.md | Reactivation procedure |128| playbooks/05-offboarding.md | Self-service offboarding |129| playbooks/06-data-export.md | Customer-requested data export (GDPR portability) |130| playbooks/07-hard-delete.md | Hard delete with verification |131| playbooks/08-retention.md | Retention obligations & destruction schedule |132133## Core Instructions134135### Step 1: Read inputs136137Read the tenancy spec, generic runbook, compliance docs. Identify which lifecycle events the system supports, which control-plane services own each, and what retention obligations apply (per region, per data class).138139### Step 2: Generate the tenant-lifecycle event catalogue140141| Event | Trigger | Source service | Downstream consumers | SLA |142|-------|---------|----------------|----------------------|-----|143| `tenant.created` | Signup or sales-led | Onboarding | App services, billing, comms | < 5 min self-serve / < 1 business day enterprise |144| `tenant.tier_changed` | Admin upgrade/downgrade | Tenant Management | All app services | < 10 min |145| `tenant.suspended` | Billing failure / compliance / admin | Tenant Management | All app services, comms | immediate |146| `tenant.reactivated` | Payment / admin | Tenant Management | All app services, comms | immediate |147| `tenant.offboarded` | Customer cancellation | Tenant Management | All app services, billing, comms | immediate, with grace |148| `tenant.export_requested` | Customer / DSAR | Operations | Data services | per regulation (GDPR: 30 days) |149| `tenant.hard_deleted` | After grace period | Tenant Management | All app services, audit | per retention policy |150151### Step 3: For each stage produce a playbook152153Every playbook MUST contain:1541551. **Trigger** — who or what initiates.1562. **Pre-conditions** — billing status, tier, contractual state, regulatory holds (legal-hold suspends deletion).1573. **Actor** — automated / on-call / customer success / privacy officer.1584. **Automated steps** — control-plane orchestration in order.1595. **Manual gates** — when human approval is required (high-tier offboarding, legal hold).1606. **Per-service propagation** — which app-plane services receive the event, what they MUST do.1617. **Verification** — how success is confirmed (post-conditions, smoke tests, query asserting absence/presence).1628. **Rollback / abort** — if the procedure fails mid-way, what state is the tenant in, who is paged.1639. **Audit-trail entry** — what is logged, where, retention.16410. **Customer-comms message** — template (email subject, body, in-app banner).16511. **Retention-policy reference** — link to the retention/destruction schedule.166167### Step 4: Provisioning playbook specifics168169- Idempotency rule — replay of `tenant.created` MUST NOT create duplicate resources.170- Tier-aware resource fan-out — Bronze pool stack vs Enterprise dedicated VPC.171- Identity bootstrap — initial admin user, password-reset link, MFA enrolment policy.172- Cost-estimate snapshot at provisioning time (feeds FinOps).173- Welcome workflow enqueue (Onboarding Journey Spec).174175### Step 5: Suspension playbook specifics176177- Trigger classes — billing past due (N days), compliance (DPA breach), admin (security incident on tenant side).178- Sequence — feature-flag toggle (read-only), comms sent before suspension, blockings at API gateway, audit entry.179- Tenant-visible UX — what the suspended tenant sees, how they self-recover.180- Reactivation path.181182### Step 6: Offboarding + data-export + hard-delete183184This is the regulated path. GDPR Art.17 / Art.20 obligations:185186- **Soft delete** at offboarding — data preserved for the contractual grace period (e.g. 30 days), tenant locked out.187- **Customer-initiated export** — DSAR within statutory window (30 days GDPR). Document the export format (JSON, CSV, per-table dump), the delivery mechanism (signed URL, expires in 7 days), the authentication required, the audit entry.188- **Hard delete** — at end of grace, run destruction across every data store (primary DB, replicas, backups within retention, search index, cache, object storage, log archives where personally identifiable), assert zero rows remain via a verification query, sign the destruction certificate, retain certificate for required years (typically 5-7).189- **Legal hold** — explicit pre-condition check. If legal hold is set on a tenant, hard delete MUST NOT proceed.190- **Backups** — backup data containing the tenant remains until the backup's own retention expires; document this.191192### Step 7: Write the master runbook193194`Tenant_Lifecycle_Runbook.md` shall index every stage, link each playbook, document the event catalogue, list audit-trail destinations, list retention obligations per region, and list customer-comms templates. Cross-link to `09-governance-compliance/13-saas-dpa-and-privacy-doc-set`.195196## Verification Checklist197198- [ ] Every event in the catalogue has a playbook.199- [ ] Every playbook has trigger, pre-conditions, actor, steps, manual gates, verification, rollback, audit, customer-comms, retention reference.200- [ ] Hard-delete playbook proves destruction across every data store and produces a destruction certificate.201- [ ] Legal-hold pre-condition is enforced on hard-delete.202- [ ] Customer-comms templates exist for every stage that touches the customer.203- [ ] Audit-trail destination is named for every state change.204- [ ] Retention obligations are stated per region and per data class.205206## Integration207208| Direction | Skill | Relationship |209|-----------|-------|-------------|210| Upstream | `03-design-documentation/10-saas-multi-tenancy-architecture-spec` | Provides the event catalogue and pattern context |211| Upstream | `06-deployment-operations/02-runbook` | Generic runbook is the parent |212| Parallel | `09-governance-compliance/13-saas-dpa-and-privacy-doc-set` | Retention and DSAR obligations |213| Parallel | `09-governance-compliance/11-saas-data-isolation-evidence-pack` | Hard-delete verification feeds the evidence pack |214| Downstream | `08-end-user-documentation/05-saas-customer-success-playbook` | Customer-comms templates flow into CS plays |215216## Standards217218- **SRE Best Practices** — Google Site Reliability Engineering.219- **GDPR Art.17 / Art.20** — Right to erasure / Right to portability.220- **POPIA s.14, s.23** — Retention and access rights (South Africa).221- **DPPA 2019** — Uganda Data Protection and Privacy Act.222223## Resources224225- `logic.prompt` — Executable prompt.226- `README.md` — Quick-start.227- `references/saas-tenant-lifecycle-runbook-template.md` — Master template.