Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    LLM Dataset Anonymization & PII Masking Architect

    1

    Designs defensible PII masking and anonymization architectures for LLM training and RAG datasets.

    $25

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    LLM Dataset Anonymization & PII Masking Architect

    LLM Dataset Anonymization & PII Masking Architect

    Example session with this skill installed

    We have 50GB of Zendesk support tickets in JSONL. We need to use them for SFT but must remove customer PII while keeping the conversation flow coherent. We use Python and spaCy.

    • Read your context and instructions
    • Compiled the llm dataset anonymization

    I have designed a PII masking architecture for your Zendesk SFT pipeline. This design prioritizes conversation fluency (utility) while implementing multi-layered detection for high-risk identifiers.

    Anonymization Architecture: Zendesk SFT Pipeline

    ComponentStrategyImplementation Detail
    Direct IdentifiersIndexed PlaceholderReplace names with <PERSON_1>, <PERSON_2> to maintain dialogue flow.
    Contact InfoTyped PlaceholderReplace emails with <EMAIL> and phone numbers with <PHONE>.
    Secrets/KeysIrreversible RedactionImmediate removal of API keys, JWTs, and passwords found in logs.
    Quasi-IdentifiersGeneralizationShift exact timestamps to date-only; truncate IP addresses to /24 blocks.
    ConsistencyDocument-levelUse a consistent mapping within a single ticket ID so "John" is always <PERSON_1>.

    Layered Detection Stack

    Deterministic Layer: Use scripts/pii_scan.py for regex-based detection of emails, IPs, and Luhn-validated credit card numbers.
    2. Statistical NER: Deploy en_core_web_trf (spaCy) to identify PERSON, ORG, and GPE entities.
    3.

    Context Rules: High-weight triggers for "My name is", "Attached is my ID", and Zendesk-specific metadata headers.
    4.

    Residual Gate: A final pass using a transformer-based model (e.g., PII-masking-large) on a 5% random sample to calculate leakage rates.

    Training Utility Controls

    Placeholder Vocabulary: Use a fixed set of tokens added to the tokenizer to prevent sub-word splitting of tags like <PERSON_1>.

    Deduplication: Run minhash LSH deduplication after masking to catch records that become near-duplicates once PII is removed.

    Assumptions

    • Data is primarily English language.
    • Internal use for model training, not for public dataset release.
    • Infrastructure supports GPU inference for the NER layer at 50GB scale.

    Residual risks

    • Low-frequency quasi-identifiers (e.g., unique product issues) may still allow re-identification.
    • Statistical NER may miss names that function as common nouns.

    Next steps

    1. Run the scripts/pii_scan.py self-test on a 1000-row sample to establish a baseline recall.
    2. Define the cross-record consistency requirements if you need to track the same user across multiple tickets.
    3. Review the templates/anonymization-policy.yaml to formalize the detection thresholds.

    Next steps

    1. Run the included scanner on a 1000-row sample to establish a baseline.
    2. Define if you need cross-ticket consistency for the same user.
    3. Configure the anonymization-policy.yaml with your spaCy model path.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    LLM training requires massive datasets, but piping raw production data into a model creates catastrophic privacy risks and legal liabilities. This skill provides the engineering architecture needed to identify, mask, and audit PII within text, code, and conversation logs before they reach your training pipeline.

    What it does

    • Classifies data risks by mapping direct identifiers, quasi-identifiers, sensitive categories, and secrets across structured and unstructured fields.
    • Designs layered detection using a multi-tier approach including schema drops, regex with checksums, gazetteers, and statistical NER.
    • Defines masking strategies tailored to the data type, ranging from simple redaction and placeholders to keyed pseudonyms and format-preserving surrogates.
    • Protects training utility by implementing intra-record consistency and fixed placeholder vocabularies to maintain model performance.
    • Validates privacy gates via gold-set labeling, canary injection, and residual-risk scanning to measure detection recall and precision.

    How it works

    1. Intake where you provide the data modality, jurisdiction, and downstream use case (e.g., SFT, RAG, or external release).
    2. Architecture design where the agent produces a tiered detection and masking policy tailored to your specific risk tolerance.
    3. Pipeline specification providing a stage-by-stage implementation plan, from ingestion and normalization to dedup and export.
    4. Audit and reporting resulting in a governance pack including a data inventory and residual-risk assessment for compliance review.

    Frameworks & tools

    The skill assumes a stack involving Python, Spark, or SQL for data processing. It integrates with tools like Microsoft Presidio, spaCy, Hugging Face token-classification models, and custom regex-based scanners for secrets and checksum-validated IDs (Luhn, IBAN, SSN).

    Why this beats prompting it yourself

    Generic prompts often miss "quasi-identifiers" that can re-identify users when combined, or they destroy training utility by over-masking. This skill applies a formal data-privacy engineering framework that accounts for checksum validation, cross-record consistency, and measurable residual risk.

    Use cases

    • Cleaning customer support chat logs for fine-tuning a brand-specific LLM.
    • Redacting secrets, API keys, and author PII from internal codebases for a code-assistant model.
    • Anonymizing healthcare or financial datasets for RAG applications while maintaining medical timelines.
    • Preparing evaluation datasets for external red-teaming without leaking internal hostnames or employee names.

    Known limitations

    Detection is probabilistic and cannot guarantee 100% PII removal. It does not provide legal conclusions and requires an external NER model for free-text entity detection like names or addresses.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.

    Detection is probabilistic, not absolute. NER for names/addresses requires external models. Not a substitute for legal counsel. Re-identification risk exists for quasi-identifiers.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 22 days ago

    Software
    Python

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Listed22 days ago

    What's inside

    Frequently Asked Questions

    This skill provides the comprehensive engineering blueprint and governance framework required to build a PII masking pipeline that balances data privacy with model performance. It solves the risk of 'data leakage' where models inadvertently memorize and output sensitive user information found in training sets.

    You receive a complete architecture design, including a tiered detection strategy, specific masking policies for different data types, and a validation framework for auditing residual risk. It includes the logic for maintaining 'intra-record consistency' so your data remains useful for training.

    Yes, the architecture is designed to integrate with standard data processing stacks like Python, Spark, or SQL, and works alongside NER tools like Microsoft Presidio or Hugging Face models. It is agnostic to your specific LLM provider, whether you use OpenAI, Anthropic, or local open-source models.

    Standard prompting often 'over-masks,' which breaks the logical flow of training data; this skill uses fixed placeholder vocabularies and format-preserving surrogates to ensure the LLM still learns language patterns and entity relationships without seeing the raw PII.

    While this skill uses advanced techniques like checksum validation and quasi-identifier mapping, detection is probabilistic. It is designed to be one layer of a defense-in-depth strategy and includes an audit reporting phase to help your team assess any remaining residual risk.

    New in LLM Ops