/qa-compliance:gdpr-test-patternsfrom qa-compliance
Provides test patterns for GDPR and CCPA/CPRA compliance, covering data subject rights, consent, breach notification, and data minimization. Use when auditing or building features that handle EU or California personal data.
Ships in qa-compliance. 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.
Per gdpr.eu (community-maintained reference; canonical text at eur-lex.europa.eu Regulation 2016/679):
GDPR (General Data Protection Regulation, in force 2018-05-25) applies to any processing of EU personal data regardless of the processor's location. Failure to demonstrate compliance carries fines up to €20M or 4% of global annual turnover (whichever higher).
This is a reference skill - defines the test-pattern catalog by Article. Tests use the team's existing test framework; this skill is the per-Article test recipe.
For products also processing California consumer data, the CCPA/CPRA catalog by Cal. Civ. Code section - GPC opt-out (§1798.135), right-to-know, deletion, right-to-correct, sensitive-PI limits - is in references/ccpa.md.
synthetic-pii-generator - never real customer PII.def test_consent_recorded_at_collection_time():
response = client.post('/signup', json={
'email': '[email protected]',
'consent_marketing': True,
'consent_timestamp': '2026-05-06T12:00:00Z',
})
user = User.objects.get(email='[email protected]')
consent = ConsentRecord.objects.get(user=user, scope='marketing')
assert consent.granted is True
assert consent.granted_at is not None
assert consent.granted_via == 'signup-form' # auditable evidence
def test_consent_revocable():
revoke_consent(user, scope='marketing')
consent = ConsentRecord.objects.get(user=user, scope='marketing')
assert consent.granted is False
assert consent.revoked_at is not None
# Subsequent marketing emails must not be sent:
assert not user.is_eligible_for(EmailType.MARKETING)
def test_subject_access_request_returns_all_personal_data():
response = authenticated_client.post('/sar', json={'subject_email': '[email protected]'})
assert response.status_code == 200
data = response.json()
# Must include data from EVERY system that holds PII for this subject:
assert 'profile' in data
assert 'billing' in data
assert 'support_tickets' in data
assert 'analytics' in data # often forgotten; tests catch it
assert 'third_party_sharing' in data
# Response must arrive within 1 month per Art. 12(3):
assert response.headers['X-Processing-Time'] < timedelta(days=30)
def test_erasure_removes_all_personal_data():
erase_subject('[email protected]')
# Across ALL systems:
assert User.objects.filter(email='[email protected]').count() == 0
assert BillingRecord.objects.filter(user_email='[email protected]').count() == 0
assert AnalyticsEvent.objects.filter(user_email='[email protected]').count() == 0
# Backup retention: erasure marker recorded; backup expires within retention window
assert ErasureMarker.objects.filter(subject='[email protected]').exists()
def test_data_portability_export_machine_readable():
response = client.post('/data-export', json={'subject': '[email protected]'})
export = response.json()
# Must be in "structured, commonly used and machine-readable format"
assert response.headers['Content-Type'] in ['application/json', 'text/csv', 'application/xml']
# Format must be self-describing (keys not random IDs):
assert 'profile' in export
assert 'orders' in export
def test_breach_notification_workflow_within_72h():
# Simulate a breach detection event
breach = BreachIncident.create(detected_at=timezone.now())
# Workflow MUST notify supervisory authority within 72 hours:
deadline = breach.detected_at + timedelta(hours=72)
notification = BreachNotification.objects.filter(incident=breach).first()
assert notification is not None
assert notification.sent_at <= deadline
assert notification.recipient == '[email protected]'
def test_eu_user_data_stored_in_eu_region():
user = User.objects.create(email='[email protected]', region='EU')
# Storage assertions vary by infra (AWS region, GCP region, etc.):
assert user.storage_region in ['eu-west-1', 'eu-central-1', 'eu-north-1']
# Cross-region replication MUST stay in EU:
backups = Backup.objects.filter(user=user)
for b in backups:
assert b.region in EU_REGIONS
def test_signup_fixtures_contain_only_required_pii():
fixture = load_fixture('user_signup.json')
required = {'email', 'consent_terms', 'consent_marketing'}
optional = {'phone', 'city', 'date_of_birth'}
for k in fixture.keys():
assert k in required | optional, f"Unrecognized field: {k}"
# No SSN, no passport number, no genetic / biometric data unless explicitly justified:
forbidden = {'ssn', 'passport', 'genetic_data', 'biometric_data'}
for k in forbidden:
assert k not in fixture, f"Forbidden PII type: {k}"
A support agent triggers an Art. 17 erasure for [email protected]. The team already has test_erasure_removes_all_personal_data (above), which asserted the app User table was empty and passed. Running the multi-system version reveals AnalyticsEvent still holds rows keyed by user_email, because analytics writes were never wired into the erasure job. The test fails on AnalyticsEvent.objects.filter(...).count() == 0. The team adds analytics to the erasure fan-out, re-runs, and the test goes green with an ErasureMarker recorded so the nightly backup expiry honors the request within the retention window.
| Gap | Detection |
|---|---|
| Marketing emails sent to revoked-consent users | Step Art. 7 + email-flow tests |
| SAR returns incomplete dataset (missing analytics/CRM) | Step Art. 15 multi-system assertion |
| Erasure leaves data in unindexed backup tables | Step Art. 17 multi-system assertion |
| EU user data quietly replicated to US region | Step Art. 44 - 50 region assertion |
| Breach detected but DPO not notified within 72h | Step Art. 33 timing test |
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Test only main-app data store on SAR/erasure | Misses analytics, CRM, support, backups | Multi-system assertion (Steps Art. 15 + 17) |
| Hardcode 30-day SAR window assumption | GDPR allows extension to 3 months in complex cases | Test timeline against actual policy doc |
| Test consent recording without revocation | Half the workflow uncovered | Both grant + revoke tests (Step Art. 7) |
| Fixture data uses real customer PII | GDPR violation in tests themselves | Use synthetic-pii-generator |
| Skip data-minimization assertions | New PII types creep in via schema changes | Step Art. 5(1)(c) field-allowlist test |
synthetic-pii-generator - cross-plugin: safe test fixture generationaudit-trail-test-author - companion: GDPR audit logsevals/audit-finding-says-unsubscribe-is-unevidenced/criteria.json (opens in a new tab)evals/audit-finding-says-unsubscribe-is-unevidenced/task.md (opens in a new tab)evals/dashboard-flags-requests-the-dpo-says-were-fine/criteria.json (opens in a new tab)evals/dashboard-flags-requests-the-dpo-says-were-fine/task.md (opens in a new tab)evals/erasure-ticket-closed-but-the-rows-are-still-there/criteria.json (opens in a new tab)evals/erasure-ticket-closed-but-the-rows-are-still-there/task.md (opens in a new tab)evals/researcher-says-we-shared-her-data-anyway/criteria.json (opens in a new tab)evals/researcher-says-we-shared-her-data-anyway/task.md (opens in a new tab)evals/signup-payload-grew-twice-this-quarter/criteria.json (opens in a new tab)evals/signup-payload-grew-twice-this-quarter/task.md (opens in a new tab)references/ccpa.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
gdpr, ccpa, data-privacy, compliance-testing, data-subject-rights
6 skills in this plugin
/audit-trail-test-authorUse when audit logs need tests for HIPAA, PCI DSS, SOC 2, GDPR or another framework: the required events (logins, privilege changes, data access, admin actions, exports), structured log format, tamper-evident hash chains, immutability and retention, and replaying logs for forensics./compliance-coverage-scoringUse when a named framework (GDPR, CCPA, SOC 2, HIPAA, PCI DSS, ISO 27001) and existing evidence need a per-criterion readiness score before an audit, assessor visit or regulator inquiry. Marks each criterion met, partial or not met, records approved exclusions and never claims ready with a gap./hipaa-test-patternsUse when a product handling protected health information (PHI) needs HIPAA Security Rule readiness tests: administrative, physical and technical safeguards (access control, audit logs, integrity, transmission security), PHI in fixtures, minimum-necessary access and BAA scope./pci-dss-control-test-authorUse whenever tests must prove payment card handling meets PCI DSS v4.0: no stored or logged CVV, full card number (PAN), track data or PIN, card data only over strong TLS, cardholder data environment boundaries and segmentation, key management, SAQ level, scope reduction with hosted fields./soc2-evidence-collectorUse when preparing for a SOC 2 Type II audit or any audit that needs evidence packages from automated tests: per-criterion artifacts (CC1-CC9 and optional categories), collection from CI, audit and access logs and change records, Vanta, Drata or Secureframe formats, and observation-period sampling.npx claudepluginhub testland/qa --plugin qa-complianceOther plugins' skills for the same job