agentleFS
Cogni-AI-OUCogni-AI-OU/cogni-ai-agent-skills/gdpr-compliant/SKILL.md

gdpr-compliant

Skill4 starsChanged 6 months agoMITView on GitHub

Apply GDPR-compliant engineering practices across your codebase. You MUST load this skill whenever you are designing APIs, writing data models, handling user data, implementing logging, or reviewing pull requests for privacy compliance.

  • Reads credentials

6 other projects use a version of this, 6 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

39 rules. 26 are common, 5 are distinctive, and 8 are very specific to this project.

  • 26

    Common

    Most of the 6 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    When designing the schema for a new user database or authentication system.

    line 25
  2. Distinctive:

    Before merging a Pull Request that introduces new logging telemetry or analytics tracking.

    line 26
  3. Distinctive:

    When reviewing data export, erasure (right to be forgotten), or data retention workflows.

    line 27
  4. Distinctive:

    When styling UI components or fixing simple frontend rendering bugs.

    line 32
  5. Distinctive:

    If the application strictly handles anonymous, machine-generated data with absolutely zero possibility of PII linkage.

    line 33
  6. Very specific:

    Add CreatedAt, RetentionExpiresAt to every table holding personal data at creation time.

    line 58
  7. Common:

    Default all optional data collection to off.

    line 59
  8. Common:

    Update the RoPA with every new feature that introduces a processing activity.

    line 61
  9. Common:

    Use separate DTOs for create, read, and update — never reuse the same object.

    line 75
  10. Common:

    Document the purpose of every processing activity in code comments and in the RoPA.

    line 90
  11. Common:

    Use support ticket content to train ML models without a separate legal basis and user notice.

    line 95
  12. Common:

    Every table holding personal data MUST have a defined retention period.

    line 102
  13. Very specific:

    Add RetentionExpiresAt column — compute at insert time.

    line 118
  14. Very specific:

    Use soft-delete (DeletedAt) with a scheduled hard-delete after the erasure request window (30 days).

    line 119
  15. Common:

    MUST NOT include personal data in URL paths or query parameters.

    line 129
  16. Common:

    Use UUIDs or opaque identifiers — never sequential integers as public resource IDs.

    line 134
  17. Very specific:

    Use Access-Control-Allow-Origin: * on authenticated APIs.

    line 142
  18. Common:

    MUST NOT log: passwords, tokens, session IDs, credentials, card numbers, national IDs, health data.

    line 151
  19. Common:

    MUST NOT log full request/response bodies where PII may be present.

    line 152
  20. Very specific:

    Use structured logging (JSON) with userId as an internal identifier, not the email address.

    line 157
  21. Common:

    Use Problem Details (RFC 7807) for all error responses.

    line 168
  22. Common:

    Use Argon2id (recommended) or bcrypt (cost ≥ 12).

    line 193
  23. Common:

    Use a unique salt per password.

    line 194
  24. Very specific:

    Use pre-commit hooks (gitleaks, detect-secrets) to prevent secret commits.

    line 205
  25. Common:

    Commit secrets to source code.

    line 211
  26. Common:

    When erasing a user, anonymize records that must be retained (financial, audit) rather than deleting them.

    line 219
  27. Common:

    MUST NOT: call data "anonymized" if re-identification is possible through linkage attacks.

    line 222
  28. Common:

    MUST NOT use production personal data in dev, staging, or CI environments.

    line 229
  29. Common:

    MUST NOT restore production DB backups to non-production without scrubbing PII first.

    line 230
  30. Very specific:

    Use synthetic data generators: Bogus (.NET), Faker (JS/Python/Ruby).

    line 231
  31. Very specific:

    Use @example.com for all test email addresses.

    line 232
  32. Common:

    Every new PII column has a documented purpose and retention period.

    line 258
  33. Common:

    No sequential integer PKs as public-facing identifiers.

    line 260
  34. Common:

    No PII in URL paths or query parameters.

    line 263
  35. Common:

    All endpoints returning personal data are authenticated.

    line 264
  36. Common:

    No passwords, tokens, or credentials logged.

    line 269
  37. Common:

    No full request/response bodies logged where PII may be present.

    line 271
  38. Common:

    No public storage buckets or public-IP databases.

    line 274
  39. Common:

    No secrets in source code or committed config files.

    line 280

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GDPR Engineering Skill

<!-- markdownlint-disable MD013 MD022 MD032 MD034 MD036 MD060 -->

Actionable GDPR reference for engineers, architects, DevOps, and tech leads. Inspired by CNIL developer guidance and GDPR Articles 5, 25, 32, 33, 35.

Golden Rule: Collect less. Store less. Expose less. Retain less.

For deep dives, use the guidance below in these areas:

  • Data rights — user rights endpoints, DSR workflow, RoPA
  • Security — encryption, hashing, secrets, anonymization
  • Operations — cloud, CI/CD, incident response, architecture patterns

When to Use

  • When designing the schema for a new user database or authentication system.
  • Before merging a Pull Request that introduces new logging telemetry or analytics tracking.
  • When reviewing data export, erasure (right to be forgotten), or data retention workflows.

When Not to Use

  • For configuring network-level firewalls or pure infrastructure routing that does not touch user data.
  • When styling UI components or fixing simple frontend rendering bugs.
  • If the application strictly handles anonymous, machine-generated data with absolutely zero possibility of PII linkage.

Common Pitfalls

  • Infinite Retention: Creating a new database table for user events without simultaneously defining a TTL (Time To Live) or automated cleanup job.
  • PII in URLs: Passing email addresses, national IDs, or auth tokens as GET query parameters, meaning they get permanently logged in edge CDNs and proxy servers.
  • "Just in Case" Data: Adding optional fields (like birthdate or phone number) to a user profile schema without a strictly documented legal basis or business need.

1. Core GDPR Principles (Article 5)

PrincipleEngineering obligation
Lawfulness, fairness, transparencyDocument legal basis for every processing activity in the RoPA
Purpose limitationData collected for purpose A MUST NOT be reused for purpose B without a new legal basis
Data minimizationCollect only fields with a documented business need today
AccuracyProvide update endpoints; propagate corrections to downstream stores
Storage limitationDefine TTL at schema design time — never after
Integrity & confidentialityEncrypt at rest and in transit; restrict and audit access
AccountabilityMaintain evidence of compliance; RoPA ready for DPA inspection at any time

2. Privacy by Design & by Default

MUST

  • Add CreatedAt, RetentionExpiresAt to every table holding personal data at creation time.
  • Default all optional data collection to off. Users opt in; they never opt out of a default-on setting.
  • Conduct a DPIA before building high-risk processing (biometrics, health data, large-scale profiling, systematic monitoring).
  • Update the RoPA with every new feature that introduces a processing activity.
  • Sign a DPA with every sub-processor before data flows to them.

MUST NOT

  • Ship a new data collection feature without a documented legal basis.
  • Enable analytics, tracking, or telemetry by default without explicit consent.
  • Store personal data in a system not listed in the RoPA.

3. Data Minimization

MUST

  • Map every DTO/model field to a concrete business need. Remove undocumented fields.
  • Use separate DTOs for create, read, and update — never reuse the same object.
  • Return only what the caller is authorized to see — use response projections.
  • Mask sensitive values at the edge: return ****1234 for card numbers, never the full value.
  • Exclude sensitive fields (DOB, national ID, health) from default list/search projections.

MUST NOT

  • Log full request/response bodies if they may contain personal data.
  • Include personal data in URL path segments or query parameters (CDN logs, browser history).
  • Collect dateOfBirth, national ID, or health data without an explicit legal basis.

4. Purpose Limitation

MUST

  • Document the purpose of every processing activity in code comments and in the RoPA.
  • Obtain a new legal basis or perform a compatibility analysis before reusing data for a secondary purpose.

MUST NOT

  • Share personal data collected for service delivery with advertising networks without explicit consent.
  • Use support ticket content to train ML models without a separate legal basis and user notice.

5. Storage Limitation & Retention

MUST

  • Every table holding personal data MUST have a defined retention period.
  • Enforce retention automatically via a scheduled job (Hangfire, cron) — never a manual process.
  • Anonymize or delete data when retention expires — never leave expired data silently in production.

Recommended defaults

Data typeMax retention
Auth / audit logs12–24 months
Session / refresh tokens30–90 days
Email / notification logs6 months
Inactive user accounts12 months after last login → notify → delete
Payment recordsAs required by tax law (7–10 years), minimized
Analytics events13 months

SHOULD

  • Add RetentionExpiresAt column — compute at insert time.
  • Use soft-delete (DeletedAt) with a scheduled hard-delete after the erasure request window (30 days).

MUST NOT

  • Retain personal data indefinitely "in case it becomes useful later."

6. API Design Rules

MUST

  • MUST NOT include personal data in URL paths or query parameters.
    • GET /users/email/alice@example.com
  • Authenticate all endpoints that return or accept personal data.
  • Extract the acting user's identity from the JWT — never from the request body.
  • Validate ownership on every resource: if (resource.OwnerId != currentUserId) return 403.
  • Use UUIDs or opaque identifiers — never sequential integers as public resource IDs.

SHOULD

  • Rate-limit sensitive endpoints (login, data export, password reset).
  • Set Referrer-Policy: no-referrer and an explicit CORS allowlist.

MUST NOT

  • Return stack traces, internal paths, or database errors in API responses.
  • Use Access-Control-Allow-Origin: * on authenticated APIs.

7. Logging Rules

MUST

  • Anonymize IPs in application logs — mask last octet (IPv4) or last 80 bits (IPv6).
    • 192.168.1.xxx
  • MUST NOT log: passwords, tokens, session IDs, credentials, card numbers, national IDs, health data.
  • MUST NOT log full request/response bodies where PII may be present.
  • Enforce log retention — purge automatically after the defined period.

SHOULD

  • Log events not data: "User {UserId} updated email" not "Email changed from a@b.com to c@d.com".
  • Use structured logging (JSON) with userId as an internal identifier, not the email address.
  • Separate audit logs (sensitive access, admin actions) from application logs — different retention and ACLs.

8. Error Handling

MUST

  • Return generic error messages — never expose stack traces, internal paths, or DB errors.
    • Bad: "Column 'email' violates unique constraint on table 'users'"
    • Good: "A user with this email address already exists."
  • Use Problem Details (RFC 7807) for all error responses.
  • Log the full error server-side with a correlation ID; return only the correlation ID to the client.

MUST NOT

  • Include file paths, class names, or line numbers in error responses.
  • Include personal data in error messages (e.g., "User john@example.com not found").

9. Encryption (summary — see references/security.md for full detail)

ScopeMinimum standard
Standard personal dataAES-256 disk/volume encryption
Sensitive data (health, financial, biometric)AES-256 column-level + envelope encryption via KMS
In transitTLS 1.2+ (prefer 1.3); HSTS enforced
KeysHSM-backed KMS; rotate DEKs annually

MUST NOT allow TLS 1.0/1.1, null cipher suites, or hardcoded encryption keys.


10. Password Hashing

MUST

  • Use Argon2id (recommended) or bcrypt (cost ≥ 12). Never MD5, SHA-1, or SHA-256.
  • Use a unique salt per password. Store only the hash.

MUST NOT

  • Log passwords in any form. Transmit passwords in URLs. Store reset tokens in plaintext.

11. Secrets Management

MUST

  • Store all secrets in a KMS: Azure Key Vault, AWS Secrets Manager, GCP Secret Manager, or HashiCorp Vault.
  • Use pre-commit hooks (gitleaks, detect-secrets) to prevent secret commits.
  • Rotate secrets on developer offboarding, annual schedule, or suspected compromise.

.gitignore MUST include: .env, .env.*, *.pem, *.key, *.pfx, *.p12, secrets/

MUST NOT

  • Commit secrets to source code. Store secrets as plain-text environment variable defaults.

12. Anonymization & Pseudonymization (summary — see references/security.md)

  • Anonymization = irreversible → falls outside GDPR scope. Use for retained records after erasure.
  • Pseudonymization = reversible with a key → still personal data, reduced risk.
  • When erasing a user, anonymize records that must be retained (financial, audit) rather than deleting them.
  • Store the pseudonymization key in the KMS — never in the same database as the pseudonymized data.

MUST NOT call data "anonymized" if re-identification is possible through linkage attacks.


13. Testing with Fake Data

MUST

  • MUST NOT use production personal data in dev, staging, or CI environments.
  • MUST NOT restore production DB backups to non-production without scrubbing PII first.
  • Use synthetic data generators: Bogus (.NET), Faker (JS/Python/Ruby).
  • Use @example.com for all test email addresses.

14. Anti-Patterns

Anti-patternCorrect approach
PII in URLsOpaque UUIDs as public identifiers
Logging full request bodiesLog structured event metadata only
"Keep forever" schemaTTL defined at design time
Production data in dev/testSynthetic data + scrubbing pipeline
Shared credentials across teamsIndividual accounts + RBAC
Hardcoded secretsKMS + secret manager
Access-Control-Allow-Origin: * on auth APIsExplicit CORS allowlist
Storing consent with profile dataDedicated consent store
PII in GET query paramsPOST body or authenticated session
Sequential integer IDs in public URLsUUIDs
"Anonymized" data with quasi-identifiersApply k-anonymity, test linkage resistance
Mixing backup regions outside EEAExplicit region lockdown on backup jobs

15. PR Review Checklist

Data model

  • Every new PII column has a documented purpose and retention period.
  • Sensitive fields (health, financial, national ID) use column-level encryption.
  • No sequential integer PKs as public-facing identifiers.

API

  • No PII in URL paths or query parameters.
  • All endpoints returning personal data are authenticated.
  • Ownership checks present — user cannot access another user's resource.
  • Rate limiting applied to sensitive endpoints.

Logging

  • No passwords, tokens, or credentials logged.
  • IPs anonymized (last octet masked).
  • No full request/response bodies logged where PII may be present.

Infrastructure

  • No public storage buckets or public-IP databases.
  • New cloud resources tagged with DataClassification.
  • Encryption at rest enabled for new storage resources.
  • New geographic regions for data storage are EEA-compliant or covered by SCCs.

Secrets & CI/CD

  • No secrets in source code or committed config files.
  • New secrets added to KMS and secrets inventory document.
  • CI/CD secrets masked in pipeline logs.

Retention & erasure

  • Retention enforcement job or policy covers new data store or field.
  • Erasure pipeline updated to cover new data store.

User rights & governance

  • Data export endpoint includes any new personal data field.
  • RoPA updated if a new processing activity is introduced.
  • New sub-processors have a signed DPA and a RoPA entry.
  • DPIA triggered if the change involves high-risk processing.

Golden Rule: Collect less. Store less. Expose less. Retain less.

Every byte of personal data you do not collect is a byte you cannot lose, cannot breach, and cannot be held liable for.


Inspired by CNIL developer GDPR guidance, GDPR Articles 5, 25, 32, 33, 35, ENISA, OWASP, and NIST engineering best practices.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.