Compliance & Privacy Engineering
Turn regulatory obligations into engineering requirements — before an auditor,
a regulator, or a deletion request does it for you. This skill covers the
engineering of compliance (what to build and how); it is not legal advice, and
material decisions (lawful basis, DPAs, breach notification) need counsel —
flag them explicitly rather than silently deciding. Boundary with its siblings:
security-audit finds technical vulnerabilities, threat-modeling analyzes
attacker paths in a design; this skill handles what regulations oblige you to
do with data regardless of attackers.
Workflow
Step 1: Map the Data — You Can't Comply with What You Can't Find
Build the data inventory first; every obligation hangs off it:
- What personal data exists — direct identifiers (name, email, phone),
indirect (IP, device IDs, location), sensitive categories (health, biometrics,
children's data — these carry stricter rules).
- Where it lives — every store, including the ones people forget: logs,
analytics, backups, data warehouses, third-party processors, caches, error
trackers.
- Where it flows — which services touch it, which vendors receive it
(each is a processor needing a DPA), and whether it crosses borders.
Grep the codebase and schemas for it; the inventory that only reflects the
architecture diagram misses the PII in logs and analytics events.
Step 2: Determine What Applies
Which regimes govern you follows from the data and the users, not the company's
location: EU/UK users → GDPR/UK-GDPR; California residents → CCPA/CPRA; health
data in the US → HIPAA; card data → PCI-DSS; enterprise customers asking for
audits → SOC 2. Verify specifics against current official sources — regulations
and thresholds change; don't answer from memory. Then extract the engineering
obligations (see references/obligations-map.md
for the regulation → engineering-requirement mapping).
Step 3: Design for Minimization and Purpose
The cheapest data to protect is data you don't have:
- Collect less: challenge every field — what breaks if we don't collect it?
- Retain less: every data class gets a retention period and an automated
deletion path; "keep forever by default" is a finding, not a policy.
- Expose less: pseudonymize/tokenize where full identity isn't needed
(analytics, testing — see
test-data-strategy for GDPR-safe test data);
scope access per purpose.
- Log less: PII in logs inherits none of your database's controls and all
of its obligations — scrub at the logging layer, not in post-processing.
Step 4: Build the Rights Machinery
Data-subject rights are engineering features with deadlines (typically ~30
days), not support tickets to improvise:
- Access/export: produce all of a person's data across every Step-1 store.
- Deletion: erase or anonymize across primary stores, caches, search
indexes, analytics, and a documented stance on backups (usually: excluded
from immediate erasure, purged on backup expiry — state it in the policy).
Deletion that misses a store the inventory forgot is the classic failure.
- Consent: record what was consented to, when, and which version; make
withdrawal as easy as granting; gate the relevant processing on it.
Test the deletion path like a feature — run it against a seeded user and verify
every store — because the first real request is a terrible time to discover it
doesn't work.
Step 5: Implement the Control Layer (SOC 2 lens)
The controls auditors verify are mostly good engineering hygiene made
demonstrable: least-privilege access with a review cadence, change management
(PRs + reviews + CI — which you likely have; the gap is usually evidence),
append-only audit logging of sensitive-data access and admin actions
(overlaps threat-modeling's repudiation counters), encryption in transit and
at rest, offboarding that provably revokes access, and vendor review for every
processor in the Step-1 flow map. Wire evidence collection into the systems
themselves — screenshots gathered the week before an audit don't scale.
Step 6: Make It Continuous
Compliance decays with every feature that adds a data flow. Add a lightweight
privacy check to the definition of done for features touching personal data
(new data collected? new vendor? retention set? deletion path covers it?), keep
the data inventory in version control next to the code, and re-run the Step-1
mapping when architecture changes — same living-document discipline as a threat
model.
Principles Applied
- Minimization is the master control: every other obligation scales with
how much data you hold.
- Rights are features: access, deletion, and consent need designs, tests,
and deadlines — not runbooks of manual SQL.
- Evidence or it didn't happen: an undocumented control fails the audit
even when it works.
Cross-Skill References
security-audit — technical vulnerability review (confidentiality controls overlap)
threat-modeling — design-time attack analysis; shares the data-classification step
data-modeling — schema-level retention, soft-delete vs erasure, PII isolation
test-data-strategy — GDPR-safe test data, anonymization
configuration-strategy — secrets and access to production data
observability-design — keeping PII out of logs, traces, and metrics
1---2name: compliance-privacy3description: Engineer for regulatory and privacy obligations — GDPR/CCPA privacy-by-design, PII data mapping and minimization, retention and deletion (right to erasure), data subject requests, consent, SOC 2 controls (access, change management, audit logging). Triggers: GDPR, CCPA, SOC 2, HIPAA, compliance, privacy review, PII, personal data, data retention, right to be forgotten, DSR, audit requirements, are we compliant. Vulnerabilities in code → security-audit; attack analysis of a design → threat-modeling.4---56# Compliance & Privacy Engineering78Turn regulatory obligations into engineering requirements — before an auditor,9a regulator, or a deletion request does it for you. This skill covers the10*engineering* of compliance (what to build and how); it is not legal advice, and11material decisions (lawful basis, DPAs, breach notification) need counsel —12flag them explicitly rather than silently deciding. Boundary with its siblings:13`security-audit` finds technical vulnerabilities, `threat-modeling` analyzes14attacker paths in a design; this skill handles what regulations *oblige* you to15do with data regardless of attackers.1617## Workflow1819### Step 1: Map the Data — You Can't Comply with What You Can't Find2021Build the data inventory first; every obligation hangs off it:2223- **What personal data exists** — direct identifiers (name, email, phone),24 indirect (IP, device IDs, location), sensitive categories (health, biometrics,25 children's data — these carry stricter rules).26- **Where it lives** — every store, including the ones people forget: logs,27 analytics, backups, data warehouses, third-party processors, caches, error28 trackers.29- **Where it flows** — which services touch it, which vendors receive it30 (each is a processor needing a DPA), and whether it crosses borders.3132Grep the codebase and schemas for it; the inventory that only reflects the33architecture diagram misses the PII in logs and analytics events.3435### Step 2: Determine What Applies3637Which regimes govern you follows from the data and the users, not the company's38location: EU/UK users → GDPR/UK-GDPR; California residents → CCPA/CPRA; health39data in the US → HIPAA; card data → PCI-DSS; enterprise customers asking for40audits → SOC 2. Verify specifics against current official sources — regulations41and thresholds change; don't answer from memory. Then extract the engineering42obligations (see [references/obligations-map.md](references/obligations-map.md)43for the regulation → engineering-requirement mapping).4445### Step 3: Design for Minimization and Purpose4647The cheapest data to protect is data you don't have:4849- **Collect less**: challenge every field — what breaks if we don't collect it?50- **Retain less**: every data class gets a retention period and an *automated*51 deletion path; "keep forever by default" is a finding, not a policy.52- **Expose less**: pseudonymize/tokenize where full identity isn't needed53 (analytics, testing — see `test-data-strategy` for GDPR-safe test data);54 scope access per purpose.55- **Log less**: PII in logs inherits none of your database's controls and all56 of its obligations — scrub at the logging layer, not in post-processing.5758### Step 4: Build the Rights Machinery5960Data-subject rights are engineering features with deadlines (typically ~3061days), not support tickets to improvise:6263- **Access/export**: produce all of a person's data across every Step-1 store.64- **Deletion**: erase or anonymize across primary stores, caches, search65 indexes, analytics, and a documented stance on backups (usually: excluded66 from immediate erasure, purged on backup expiry — state it in the policy).67 Deletion that misses a store the inventory forgot is the classic failure.68- **Consent**: record what was consented to, when, and which version; make69 withdrawal as easy as granting; gate the relevant processing on it.7071Test the deletion path like a feature — run it against a seeded user and verify72every store — because the first real request is a terrible time to discover it73doesn't work.7475### Step 5: Implement the Control Layer (SOC 2 lens)7677The controls auditors verify are mostly good engineering hygiene made78demonstrable: least-privilege access with a review cadence, change management79(PRs + reviews + CI — which you likely have; the gap is usually *evidence*),80append-only audit logging of sensitive-data access and admin actions81(overlaps `threat-modeling`'s repudiation counters), encryption in transit and82at rest, offboarding that provably revokes access, and vendor review for every83processor in the Step-1 flow map. Wire evidence collection into the systems84themselves — screenshots gathered the week before an audit don't scale.8586### Step 6: Make It Continuous8788Compliance decays with every feature that adds a data flow. Add a lightweight89privacy check to the definition of done for features touching personal data90(new data collected? new vendor? retention set? deletion path covers it?), keep91the data inventory in version control next to the code, and re-run the Step-192mapping when architecture changes — same living-document discipline as a threat93model.9495## Principles Applied9697- **Minimization is the master control**: every other obligation scales with98 how much data you hold.99- **Rights are features**: access, deletion, and consent need designs, tests,100 and deadlines — not runbooks of manual SQL.101- **Evidence or it didn't happen**: an undocumented control fails the audit102 even when it works.103104## Cross-Skill References105106- `security-audit` — technical vulnerability review (confidentiality controls overlap)107- `threat-modeling` — design-time attack analysis; shares the data-classification step108- `data-modeling` — schema-level retention, soft-delete vs erasure, PII isolation109- `test-data-strategy` — GDPR-safe test data, anonymization110- `configuration-strategy` — secrets and access to production data111- `observability-design` — keeping PII out of logs, traces, and metrics