peterbamuhigire/skills-web-dev/saas-tenant-data-portability-and-erasure
Claude Code and agent skill by peterbamuhigire/skills-web-dev
- community
Checking that the SKILL.md file is still in the repository.
Use when designing verified tenant data export, retention, erasure, backup handling, audit evidence, or privacy-law portability workflows.
Install
npx vskill@latest install peterbamuhigire/skills-web-dev/saas-tenant-data-portability-and-erasureSKILL.md
SaaS Tenant Data Portability and Erasure
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
Required Inputs
| Input | Required | Use | |
|---|---|---|---|
| Tenant, product, and lifecycle scope | yes | Bound the SaaS decision | |
| Current architecture, plans, policies, and constraints | yes | Preserve enforceable behaviour | |
| Production data or verified evidence | conditional | Validate thresholds and migrations |
Skill-specific inputs:
- Tenant lifecycle states (
saas-architecture-strategy). - Map of every data store the SaaS uses (primary DBs, search, object storage, warehouse, CRM, ESP, analytics, third-party processors).
- Regulatory profile (GDPR? POPIA? Uganda DPPA? CCPA? sector-specific HIPAA?).
- Retention obligations (audit log 7 years; financial 10 years in most jurisdictions; backups 30 days).
Capability and permission contract
Default to read-only analysis. Change configuration, billing, identity, tenant data, infrastructure, or customer communications only with explicit authority, least-privilege credentials, tenant scope, rollback, and auditable approval. Never expose secrets or cross tenant boundaries.
Degraded mode
If production access, policy, telemetry, or authoritative records are unavailable, produce a labelled design or dry-run plan. Do not claim deployment, reconciliation, deletion, delivery, or measured outcomes; list missing evidence and verification.
Decision rules
| Condition | Action | Stop condition | |
|---|---|---|---|
| Tenant isolation, money, identity, or deletion is affected | Require approval and rollback evidence | Scope or authority is ambiguous | |
| Evidence supports a reversible change | Stage, test, and record it | Acceptance checks fail | |
| Only partial context is available | Return assumptions and validation | A production claim cannot be verified |
Domain Anti-Patterns
- Applying one tenant's policy or data to another. Fix: enforce tenant scope at every boundary.
- Mutating production from an advisory request. Fix: remain read-only until authority is explicit.
- Inventing limits, prices, metrics, or compliance claims. Fix: use authoritative records or mark them unresolved.
- Shipping without rollback and audit evidence. Fix: stage and retain before/after proof.
- Treating a missing dependency as successful. Fix: name the blocked verification.
<!-- dual-compat-start -->
Use When
- Implementing the data-portability (export) and erasure (delete) workflows mandated by GDPR Article 20 / 17, POPIA, CCPA, Uganda DPPA, Kenya DPA.
- Designing the cascade that purges a tenant's data through every store the SaaS uses — primary DB, search index, file storage, warehouse, caches, backups, ESP suppression list, CRM, analytics, third-party processors.
- Handling user-level vs tenant-level erasure (a user leaving a tenant vs a tenant leaving the platform).
- Designing requester verification so an attacker can't erase a competitor's tenant.
- Designing the retention policy and the documented backup window (what survives erasure and for how long).
Do Not Use When
- The task is general data classification — use compliance audit work in
vibe-security-skill/web-app-security-audit. - The task is tenant lifecycle state machine — use
saas-architecture-strategy. - The task is region-specific compliance content — use
dpia-generatorfor Ugandan specifics.
Workflow
- Read this
SKILL.md. - Inventory every data store (§2).
- Map every store to user-level + tenant-level erasure capability (§3).
- Design the export workflow (§4).
- Design the erasure workflow (§5).
- Design requester verification (§6) — protect against malicious erasure.
- Document retention exceptions (§7) — what survives, why, for how long.
- Wire into the back-office (§8).
- Apply anti-patterns (§9).
Quality Standards
- Export delivered within 30 days (GDPR ceiling); aim for hours-to-days.
- Erasure cascades through every store; documented retention exceptions only.
- Backups handled honestly — document the retention window after which erased data is also purged from backups; don't claim instant deletion of backups when it's not true.
- Every export and erasure logged in the audit log with actor, target, verification trail.
- Requester verification appropriate to risk — primary-admin email confirmation + MFA for tenant-level erasure.
Anti-Patterns
- "Delete" implemented as
SET deleted_at = NOW()(soft delete) — fails the regulatory test. - Forgetting the warehouse — analytics data still contains PII years later.
- Forgetting the ESP suppression list — email still goes out to "deleted" addresses.
- Forgetting backups — claim "deleted" while the customer's PII sits in S3 for 90 days.
- One-click tenant erasure with no verification — competitor / disgruntled user destroys the tenant.
- No audit trail of the erasure itself — cannot prove compliance.
Outputs
- Data store inventory + erasure capability matrix.
- Export workflow + format spec.
- Erasure workflow + cascade order.
- Requester verification policy.
- Retention exceptions document.
- Customer-facing data-processing addendum (DPA) annex.
Evidence Produced
| Category | Artifact | Format | Example | |
|---|---|---|---|---|
| Data safety | Data store + erasure capability matrix | Markdown table | docs/compliance/data-store-erasure-matrix.md | |
| Release evidence | Export workflow spec | Markdown doc + sample export | docs/compliance/export-workflow.md | |
| Release evidence | Erasure workflow spec | Markdown doc | docs/compliance/erasure-workflow.md | |
| Data safety | Retention exceptions document | Markdown doc | docs/compliance/retention-exceptions.md |
References
references/erasure-cascade.md— the per-store cascade including backups + warehouse.references/export-format-spec.md— JSON-LD / CSV export package contents.references/requester-verification.md— verification strength per request type.- Companion:
saas-architecture-strategy,saas-admin-backoffice-tooling,multi-tenant-saas-architecture,dpia-generator,vibe-security-skill.
<!-- dual-compat-end -->
§1 The Two Request Types
| Request type | Initiator | Scope | |
|---|---|---|---|
| User export / erasure | Individual user | That user's personal data across tenants where they appear | |
| Tenant export / erasure | Tenant primary admin | All data for that tenant (organisation-wide) |
A user-level request inside a tenant context (a tenant admin asks for a specific user's data) is a third variant: scope is one user within one tenant.
§2 Data Store Inventory
For every SaaS, enumerate stores:
| Store | Examples | Erasure mechanic | |
|---|---|---|---|
| Primary OLTP DB | MySQL/Postgres tenant data | DELETE with cascade or per-tenant TRUNCATE / drop schema | |
| Search index | Elasticsearch / Meilisearch / Algolia | Delete by tenant prefix or index | |
| Object storage | S3 / R2 / GCS / Azure Blob | Delete by per-tenant prefix | |
| Caches | Redis / Memcached | Flush by tenant key namespace | |
| Message queues | SQS / Kafka / RabbitMQ | Drain + per-tenant filter; usually short retention | |
| Warehouse | BigQuery / Snowflake / Redshift | Per-tenant partition delete or pseudonymise | |
| Analytics | Mixpanel / Amplitude / PostHog / Heap | Vendor delete API; per-distinct-id or per-tenant property | |
| CRM | Salesforce / HubSpot | API-driven delete; verify cascade | |
| ESP / suppression | Postmark / SendGrid / Customer.io | API + central suppression-list update | |
| Logs | CloudWatch / Datadog / Loki | Time-based purge; redact PII; document window | |
| Backups | RDS snapshots / S3 backups | Retention window; redaction policy on rotation | |
| Audit log | Internal | Kept (regulatory) but PII fields redacted | |
| Third-party processors | Stripe / Twilio / OpenAI / etc. | Per-vendor delete API; document each |
Every store gets a column: "Per-user delete?" "Per-tenant delete?" "Retention window after request?"
§3 The Erasure Capability Matrix
Example:
| Store | Per-user delete | Per-tenant delete | Backup retention | |
|---|---|---|---|---|
| MySQL primary | Yes (cascade by user_id) | Yes (cascade by tenant_id) | 30 days | |
| Elasticsearch | Yes (delete-by-query) | Yes (drop tenant index) | 7 days | |
| S3 documents | Yes (per-key) | Yes (per-tenant prefix) | 30 days (S3 versioning) | |
| Redis | Yes (per-user key namespace) | Yes (per-tenant namespace) | None (TTL) | |
| Snowflake warehouse | Yes (DELETE on event tables) | Yes (per-tenant partition) | 7 days (Time Travel) | |
| Postmark suppression | Yes (per-email API) | n/a | Permanent | |
| Stripe Customer | Yes (delete API; PII redacted in retained financial records) | n/a | 7 years (financial) | |
| Audit log | PII pseudonymise (email → hash) | n/a | 7 years |
§4 Export Workflow
Trigger: Customer initiates via in-product "Export my data" or tenant admin's "Export tenant data".
Steps:
- Verify requester (§6).
- Create export job (
exportstable; statusqueued). - Worker dumps data:
- Primary DB tables relevant to the user/tenant → CSV or JSON-Lines.
- Object storage files → keep folder structure.
- Settings / preferences → JSON.
- Audit log subset (the customer's own actions) → JSON.
- Package as ZIP / TAR.GZ.
- Upload to a private bucket; generate a signed URL with 7-day expiry.
- Email the requester (to the verified email on file) with the link.
- Update job
status = ready; audit-log the event.
Format guidance:
- Use JSON-LD or plain JSON with schemas; CSV for tabular tables; manifest file at the root listing contents.
- Document field meanings in a
README.mdinside the bundle. - Include a manifest of what is not included and why (retained for legal reasons, etc.).
Time: GDPR allows 30 days. Aim for hours-to-days; queue for big tenants.
§5 Erasure Workflow
Trigger: customer-initiated OR admin-initiated GDPR erasure request.
Pre-conditions:
- Outstanding obligations resolved (paid up, no pending refund, no legal hold).
- Final export offered to the customer (last chance to retrieve data).
- Cool-down window (e.g., 7 days) to prevent rage-deletion regret.
Cascade order (top to bottom; failures retried):
- Mark tenant `pending_erasure` — no new data accepted; UI blocks; sessions invalidated.
- External processors first (irreversible, slowest): Stripe Customer marked deleted (PII redacted, financial retained); Twilio/SendGrid/Customer.io contacts deleted; analytics vendor delete API.
- Search indexes — delete-by-tenant.
- Caches — flush per-tenant namespace.
- Object storage — delete per-tenant prefix.
- Primary OLTP — per-tenant DELETE cascade or schema drop.
- Warehouse — DELETE / pseudonymise; rebuild materialised views.
- Audit log — pseudonymise PII fields (email → hash); keep the records for regulatory retention; document this in the retention exceptions.
- Backups — flag for redaction at the next rotation; do not delete the running backup retention window (operational risk).
- Tenant record —
status = deleted,deleted_at = NOW(), identifiers retained as opaque hashes only. - Audit log entry —
TENANT_ERASURE_COMPLETEDwith the cascade outcome JSON. - Email requester confirming completion + summary of retention exceptions.
Failure handling:
- Each step is idempotent and retriable.
- Per-step status persisted (
erasure_runs.step_status). - On unrecoverable failure (e.g., Stripe API down), pause; alert ops; resume.
§6 Requester Verification
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/saas/saas-tenant-data-portability-and-erasure/SKILL.md
Popularity
- Repository stars
- 18
- Repository forks
- 4
- 7-day trend score
- 15
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/peterbamuhigire/skills-web-dev/saas-tenant-data-portability-and-erasure)