peterbamuhigire/skills-web-dev/saas-tenant-data-portability-and-erasure

Claude Code and agent skill by peterbamuhigire/skills-web-dev

Trust tier 2
  • community
LLM review pending
Source check pending

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-erasure

SKILL.md

SaaS Tenant Data Portability and Erasure

Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.

Required Inputs

InputRequiredUse
Tenant, product, and lifecycle scopeyesBound the SaaS decision
Current architecture, plans, policies, and constraintsyesPreserve enforceable behaviour
Production data or verified evidenceconditionalValidate 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

ConditionActionStop condition
Tenant isolation, money, identity, or deletion is affectedRequire approval and rollback evidenceScope or authority is ambiguous
Evidence supports a reversible changeStage, test, and record itAcceptance checks fail
Only partial context is availableReturn assumptions and validationA 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-generator for Ugandan specifics.

Workflow

  1. Read this SKILL.md.
  2. Inventory every data store (§2).
  3. Map every store to user-level + tenant-level erasure capability (§3).
  4. Design the export workflow (§4).
  5. Design the erasure workflow (§5).
  6. Design requester verification (§6) — protect against malicious erasure.
  7. Document retention exceptions (§7) — what survives, why, for how long.
  8. Wire into the back-office (§8).
  9. 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

CategoryArtifactFormatExample
Data safetyData store + erasure capability matrixMarkdown tabledocs/compliance/data-store-erasure-matrix.md
Release evidenceExport workflow specMarkdown doc + sample exportdocs/compliance/export-workflow.md
Release evidenceErasure workflow specMarkdown docdocs/compliance/erasure-workflow.md
Data safetyRetention exceptions documentMarkdown docdocs/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 typeInitiatorScope
User export / erasureIndividual userThat user's personal data across tenants where they appear
Tenant export / erasureTenant primary adminAll 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:

StoreExamplesErasure mechanic
Primary OLTP DBMySQL/Postgres tenant dataDELETE with cascade or per-tenant TRUNCATE / drop schema
Search indexElasticsearch / Meilisearch / AlgoliaDelete by tenant prefix or index
Object storageS3 / R2 / GCS / Azure BlobDelete by per-tenant prefix
CachesRedis / MemcachedFlush by tenant key namespace
Message queuesSQS / Kafka / RabbitMQDrain + per-tenant filter; usually short retention
WarehouseBigQuery / Snowflake / RedshiftPer-tenant partition delete or pseudonymise
AnalyticsMixpanel / Amplitude / PostHog / HeapVendor delete API; per-distinct-id or per-tenant property
CRMSalesforce / HubSpotAPI-driven delete; verify cascade
ESP / suppressionPostmark / SendGrid / Customer.ioAPI + central suppression-list update
LogsCloudWatch / Datadog / LokiTime-based purge; redact PII; document window
BackupsRDS snapshots / S3 backupsRetention window; redaction policy on rotation
Audit logInternalKept (regulatory) but PII fields redacted
Third-party processorsStripe / 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:

StorePer-user deletePer-tenant deleteBackup retention
MySQL primaryYes (cascade by user_id)Yes (cascade by tenant_id)30 days
ElasticsearchYes (delete-by-query)Yes (drop tenant index)7 days
S3 documentsYes (per-key)Yes (per-tenant prefix)30 days (S3 versioning)
RedisYes (per-user key namespace)Yes (per-tenant namespace)None (TTL)
Snowflake warehouseYes (DELETE on event tables)Yes (per-tenant partition)7 days (Time Travel)
Postmark suppressionYes (per-email API)n/aPermanent
Stripe CustomerYes (delete API; PII redacted in retained financial records)n/a7 years (financial)
Audit logPII pseudonymise (email → hash)n/a7 years

§4 Export Workflow

Trigger: Customer initiates via in-product "Export my data" or tenant admin's "Export tenant data".

Steps:

  1. Verify requester (§6).
  2. Create export job (exports table; status queued).
  3. 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.
  1. Package as ZIP / TAR.GZ.
  2. Upload to a private bucket; generate a signed URL with 7-day expiry.
  3. Email the requester (to the verified email on file) with the link.
  4. 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.md inside 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):

  1. Mark tenant `pending_erasure` — no new data accepted; UI blocks; sessions invalidated.
  2. External processors first (irreversible, slowest): Stripe Customer marked deleted (PII redacted, financial retained); Twilio/SendGrid/Customer.io contacts deleted; analytics vendor delete API.
  3. Search indexes — delete-by-tenant.
  4. Caches — flush per-tenant namespace.
  5. Object storage — delete per-tenant prefix.
  6. Primary OLTP — per-tenant DELETE cascade or schema drop.
  7. Warehouse — DELETE / pseudonymise; rebuild materialised views.
  8. Audit log — pseudonymise PII fields (email → hash); keep the records for regulatory retention; document this in the retention exceptions.
  9. Backups — flag for redaction at the next rotation; do not delete the running backup retention window (operational risk).
  10. Tenant record — status = deleted, deleted_at = NOW(), identifiers retained as opaque hashes only.
  11. Audit log entry — TENANT_ERASURE_COMPLETED with the cascade outcome JSON.
  12. 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/peterbamuhigire/skills-web-dev/saas-tenant-data-portability-and-erasure/badge)](https://verified-skill.com/skills/peterbamuhigire/skills-web-dev/saas-tenant-data-portability-and-erasure)

Something wrong with this skill or its page? Tell us.