privacy-and-data-lineage-gate
Skill4 starsChanged 31 days agoMITView on GitHub
Enforces Apple Privacy and Meta Data Infrastructure engineering discipline to protect user data from the system itself. Use when designing user data pipelines, processing PII/sensitive customer data, defining database schemas storing personal information, implementing GDPR/CCPA deletion lifecycles, or instrumenting analytics and telemetry sinks — even if they don't explicitly say "privacy gate". Do NOT use for external network DDoS mitigation, routine UI cosmetic styling, or non-user operational infrastructure.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- anti-slop-engineeringSkill
- anti-slop-engineeringSkill
- api-ergonomics-and-contract-governorSkill
- apple-craft-and-frame-budgetSkill
- apple-craft-and-interaction-physicsSkill
- asset-provenance-guardSkill
- backprop-guardSkill
- chaos-and-degradation-choreographerSkill
- chromatic-drift-guardSkill
- cognitive-load-and-attention-governorSkill
- comment-budget-guardSkill
- context-window-and-token-economics-architectSkill
- cryptographic-agility-and-secret-lifecycle-gateSkill
- decision-guardSkill
- demock-guardSkill
- design-system-drift-guardSkill
- deterministic-simulation-and-property-testingSkill
- distributed-consensus-and-concurrency-gateSkill
- finops-and-unit-economics-governorSkill
- future-scale-gateSkill
- grumpy-senior-staff-engineerSkill
- honeypot-trap-guardSkill
- house-tell-guardSkill
- install-anti-slopSkill
- llm-eval-and-prompt-injection-fortressSkill
- mandela-guardSkill
- mechanical-sympathy-and-perf-gateSkill
- mechanical-sympathy-profilerSkill
- motion-runtime-guardSkill
- observability-and-slo-architectSkill
- observability-and-slo-gateSkill
- paranoid-principal-architectSkill
- pr-boundary-guardSkill
- re0-handoff-guardSkill
- reduction-guardSkill
- repo-memory-and-invariant-stewardSkill
- root-fix-gateSkill
- safe-evolution-and-rollout-choreographerSkill
- scientific-fault-isolationSkill
- styleseed-guardSkill
- supply-chain-and-sbom-sentinelSkill
- tagore-guardSkill
- type-level-and-ast-slop-gateSkill
- ui-and-copy-disciplineSkill
- verification-oracle-architectSkill
- zero-downtime-migration-gateSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 56
Mandatory retention TTL: Every database table, collection, and cache key storing user data must declare retention_ttl_days ($\le 90$ days …
- Very specific: line 57
Explicit purpose binding: Every schema and pipeline must declare its business purpose (AUTHENTICATION, BILLING, LEGAL_AUDIT, …
- Very specific: line 60
Zero PII in URL query strings: Never place user emails, names, or tokens in query parameters where they leak into access logs, browser …
- Distinctive: line 78
Before creating or approving code handling customer data, subject the design to this matrix:
- Very specific: line 80
Distrust of System Logging: If an unhandled exception fires on this route, will logger.error or APM agents dump raw request payloads or …
- Distinctive: line 81
Distrust of Immutable Storage: If this user requests account deletion tomorrow, how do we erase this record from Kafka topic partitions, …
- Distinctive: line 107
When a durable architectural record is warranted, save a JSON assessment following the Privacy Record Contract and audit it with:
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: The Privacy & Data Lineage Gate (Apple Privacy & Meta Data Infra)
While external security shields the system from outside adversaries, this gate protects user data from the system itself: zero internal leaks, cryptographic erasure across immutable ledgers, mandatory retention TTLs, and provenance flow control.
Why This Skill Is Needed & Target State
Modern security teams focus on external attackers: firewalls, rate limiters, token-bucket WAFs, and injection guards. Yet over 90% of privacy violations and regulatory fines stem from internal systemic design defects:
- Accidental PII logging when developers pass full
userobjects or unhandledreq.bodyto logging transports (Datadog, CloudWatch, Sentry). - Telemetry leakage where third-party analytics SDKs (Mixpanel, Google Analytics, Facebook Pixel) receive raw emails, phone numbers, or hardware IDs.
- The "Soft-Delete Fallacy" where systems set
is_deleted = true, leaving user personal data permanently exposed across immutable Kafka partitions, database WALs, Parquet lakehouses, and disaster recovery backups. - Indefinite data retention where tables accumulate high-precision GPS coordinates, raw IPs, and browsing activity for years without an automated retention TTL or business purpose justification.
The target state is Apple Privacy & Meta Data Infrastructure Rigor: all personal identifiers are encapsulated in compiler-enforced tainted types (Redacted<T>), account deletion guarantees instantaneous $O(1)$ cryptographic erasure (crypto-shredding via KMS key-per-subject), every schema mandates an automated retention TTL with explicit purpose binding, and all data flows are mapped within an audited lineage DAG with strictly fenced telemetry egress.
Activation and Boundaries
| Situation | Behavior |
| Designing user data storage, database schemas, or caching layers | Enforce purpose binding, data minimization, and mandatory retention_ttl_days with automated GC |
| Building event-driven architectures, Kafka pipelines, or lakehouse tables | Enforce Key-per-Subject Cryptographic Erasure (Crypto-Shredding) for $O(1)$ GDPR Article 17 erasure |
| Authoring or refactoring code handling PII (emails, phones, IPs, addresses) | Wrap sensitive fields in Redacted<T> branded types; ban unredacted toString(), toJSON(), and log calls |
| Instrumenting analytics, telemetry, crash reporting, or external third-party SDKs | Route all telemetry through a first-party Egress Gateway with differential privacy and strict allowlists |
| Reviewing PRs that add user data fields or modify deletion lifecycles | Audit data lineage DAG and reject naive soft-delete patterns or unbounded retention tables |
| External network DDoS mitigation, token buckets, or firewall configurations | Do not activate; delegate to paranoid-principal-architect and security-review |
| Routine styling tweaks, documentation formatting, or local non-user scripts | Do not activate; use Anti-Slop Engineering BUILD/FIX gates |
The Four Absolute Laws
- The Internal Threat Axiom (System as Adversary): Code is treated as an active threat to user data. Never rely on developer vigilance, code review vigilance, or central regex log scrubbers. Personal data must be physically impossible to print, serialize, or transmit without an audited unwrap operation.
- The Crypto-Shredding Invariant ($O(1)$ Erasure over Immutable Stores): In distributed append-only architectures (Kafka, Redpanda, Iceberg, WALs, S3 snapshots), physical row deletion is an architectural anti-pattern. Every user must have an isolated Data Encryption Key (DEK). User erasure is executed by destroying the DEK from the KMS, instantly rendering all distributed ciphertext unrecoverable in $O(1)$ time.
- The Data Minimization & Retention Mandate: If an operation does not require personal data, it must not be collected. If an operation requires age verification, collect boolean
is_over_21, never date of birth. Any table, cache, or message queue storing user data without an explicit purpose binding and automated retention TTL is rejected at the CI gate. - The Provenance & Fenced Egress Law: Every byte of personal data must be traceable across a Directed Acyclic Graph (DAG) from ingestion to cold storage. Direct outbound connections from clients or microservices to third-party analytics are strictly prohibited; all telemetry traverses an egress gateway that strips PII and applies local differential privacy ($\epsilon \le 1.0$).
Invariant Rules
- Tainted PII Types everywhere. Wrap emails, phone numbers, IP addresses, physical locations, and national IDs in nominal branded types and
Redacted<T>containers. - Ban unredacted serialization. Override
toString(),toJSON(), and runtime inspection hooks ([util.inspect.custom]) to output[REDACTED]by default. - Audited unwrapping only. The underlying sensitive value can only be accessed via an explicit
.reveal(auditContext)method requiring an actor ID, correlation ID, and authorized business reason. - Crypto-shredding for immutable ledgers. Store user data in event streams and lakehouses encrypted with a user-specific DEK (
AES-256-GCMorXChaCha20-Poly1305). User deletion shreds the key in KMS within $\le 5,000\text{ ms}$. - No naive soft-deletes. Setting
is_deleted = truewithout cryptographic shredding or physical storage purging is a blocker defect under GDPR Article 17. - Mandatory retention TTL. Every database table, collection, and cache key storing user data must declare
retention_ttl_days($\le 90$ days default, $\le 730$ days maximum) backed by an automated partition drop cron or TTL index. - Explicit purpose binding. Every schema and pipeline must declare its business purpose (
AUTHENTICATION,BILLING,LEGAL_AUDIT,SECURITY_FRAUD_PREVENTION,ANALYTICS_OPT_IN). Cross-purpose joins are rejected at the query admission gate. - Differential privacy on telemetry. Numeric metrics derived from user behavior must inject Laplace/Gaussian perturbation noise with privacy budget $\epsilon \le 1.0$.
- Coarse attribute truncation. Truncate IPv4 to
/24, IPv6 to/48, and GPS coordinates to coarse geohash ($\ge 20\text{ km}$ precision) before persistence or analytics logging. - Zero PII in URL query strings. Never place user emails, names, or tokens in query parameters where they leak into access logs, browser history, and
Refererheaders.
Execution Router
| Task Shape | Primary Workflow | Reference Contract |
| Designing a new user data pipeline, database schema, or lakehouse | Architect Privacy System | Data Minimization & TTL |
| Implementing domain entities, DTOs, or models handling sensitive PII | Implement Tainted Types | Tainted PII Types |
| Implementing GDPR Right-to-be-Forgotten or account deletion lifecycles | Verify Cryptographic Erasure | Cryptographic Erasure |
| Auditing data flows, event topics, or third-party telemetry integrations | Audit Data Lineage | Lineage & Flow Graphs |
| Auditing an architectural compliance record | Record Contract | scripts/privacy_guard.py |
Mandatory Pre-Execution Privacy Matrix
Before creating or approving code handling customer data, subject the design to this matrix:
- Distrust of System Logging: If an unhandled exception fires on this route, will
logger.erroror APM agents dump raw request payloads or personal attributes into Datadog, Sentry, or CloudWatch? - Distrust of Immutable Storage: If this user requests account deletion tomorrow, how do we erase this record from Kafka topic partitions, database WAL logs, Parquet files, and S3 glacier backups without rewriting petabytes of storage?
- Distrust of Retention: Why does this table need to keep this data indefinitely? What automated cron or TTL mechanism purges records once their business purpose expires?
- Distrust of Third-Party Sinks: Are third-party analytics libraries (Mixpanel, Google, AppsFlyer) receiving raw emails, device UDIDs, or unmasked IPs? Is telemetry routed through an authorized egress gateway?
- Distrust of Granularity: Did we collect an exact birthdate when a boolean
is_over_21suffices? Did we store 6-decimal GPS coordinates when a city or coarse geohash is enough?
Prohibited Anti-Patterns (Instant Rejection List)
- The Soft-Delete Fallacy: Marking database rows with
is_deleted = trueordeleted_at = NOW()and claiming GDPR erasure compliance while PII remains plaintext in backups and data lakes. - Logging
req.bodyor Unredacted Error Objects: Passing full request payloads or entities containing personal information directly intoconsole.logor logging libraries. - The SHA-256 Telemetry Hash Illusion: Passing SHA-256 hashed emails to third-party ad or tracking networks without per-user secret salting (easily inverted via rainbow tables).
- Indefinite Table Retention: Creating database schemas or cache stores holding user identifiers without an explicit
retention_ttl_daysand automated GC pipeline. - URL Query Parameter PII: Transmitting user emails, telephone numbers, or authentication tokens inside URL query strings (
?email=...). - Centralized Regex Scrubber Reliance: Depending solely on centralized regex scrubbing at the log forwarder (Fluentd/Logstash) rather than enforcing type-level redaction at the domain boundary.
Required Output & Review Workflow
Structure all architectural designs, code reviews, and implementations through this 3-phase discipline:
- Privacy & Lineage Pre-Mortem: Bullet out the top 3 internal leak vectors, unencrypted immutable stores, and unneeded data attributes.
- Hardened Privacy Implementation: Emit production-grade code with tainted types,
Redacted<T>wrappers, purpose bindings, automated TTLs, and crypto-shredding interfaces. - Adversarial Erasure & Leak Verification: Provide tests verifying that logging prints
[REDACTED], telemetry egress strips PII, and KMS key destruction renders historical ciphertext permanently undecryptable.
When a durable architectural record is warranted, save a JSON assessment following the Privacy Record Contract and audit it with:
npx anti-slop-engineering privacy audit <record.json> --json
# Or scan source code directly for privacy hazards:
npx anti-slop-engineering privacy audit <record.json> --source <source_file> --jsonDoes 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
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.

