Command Palette

Search for a command to run...

Назад к скиллам
скилл № 32927

presidio-pii-detection

Use when existing data (datasets, logs, free text) must be scanned for personal data or redacted: Microsoft Presidio analyzer and anonymizer, built-in…

БесплатноБез исполняемых скриптов
testlandот testland★ 18 звёзд на GitHub

Установить presidio-pii-detection в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

presidio-pii-detection

Overview

Microsoft Presidio is an open-source SDK for PII detection and anonymisation. Two engines compose:

  • presidio-analyzer - detects PII entities in free text using per-entity recognisers (regex + NER + checksum validation).
  • presidio-anonymizer - applies operators to the detected spans (replace, redact, mask, hash, encrypt, custom).

This skill wraps both. For the categories of PII that Presidio detects across regulatory regimes see the pii-categories catalog in pii-masking-pipeline-builder references/; for the operator chosen per field see the masking-techniques catalog there.

When to use

  • Scanning a database dump, log stream, or document corpus before promoting to a non-production environment.
  • Building a masking pipeline (pii-masking-pipeline-builder) that needs entity detection upstream of operator application.
  • CI gating that fails the build when test fixtures contain unexpected PII patterns (e.g., real emails leaked into a JSON fixture).

For generating fake PII fixtures, use synthetic-pii-generator (in the qa-test-data plugin). Presidio detects; this is the orthogonal axis.

Authoring

Install

Per presidio.dataprivacystack.org/analyzer:

pip install presidio-analyzer presidio-anonymizer
python -m spacy download en_core_web_lg

The spaCy model powers the PERSON / LOCATION NER recognisers. For non-English text use en_core_web_md (smaller) or language-specific spaCy models.

Basic detection

from presidio_analyzer import AnalyzerEngine

analyzer = AnalyzerEngine()
results = analyzer.analyze(
    text="Contact John Doe at [email protected] or +1 555-123-4567",
    language="en",
)
for r in results:
    print(r.entity_type, r.start, r.end, r.score)
# PERSON 8 16 0.85
# EMAIL_ADDRESS 20 36 1.0
# PHONE_NUMBER 40 54 0.75

AnalyzerEngine() loads the default NLP model and all built-in recognisers. Per presidio.dataprivacystack.org/analyzer, analyze() returns a list of RecognizerResult with fields start, end, score (0 - 1 confidence), and entity_type.

Restricting entity types

results = analyzer.analyze(
    text=text,
    language="en",
    entities=["US_SSN", "CREDIT_CARD", "EMAIL_ADDRESS"],
    score_threshold=0.5,
)

entities whitelists which recognisers run. score_threshold (0 - 1) drops low-confidence hits. Default threshold is 0; raise to 0.4 - 0.6 for noisy text (logs) where partial matches inflate false positives.

Built-in entity catalog

Presidio ships global recognisers (CREDIT_CARD, EMAIL_ADDRESS, IP_ADDRESS, PERSON, PHONE_NUMBER, IBAN_CODE, URL, and more) plus country-specific IDs across the US, UK, Spain, Italy, Poland, Singapore, Australia, India, Finland, Korea, Nigeria, and Thailand (US_SSN, UK_NHS, ES_NIF, PL_PESEL, SG_NRIC_FIN, IN_AADHAAR, and so on). Pass the ones you need to entities=[...]. The full global and country-specific tables are in references/entity-catalog.md; for the authoritative list and descriptions see presidio.dataprivacystack.org/supported_entities.

Custom PatternRecognizer

For entities Presidio doesn't ship - internal employee IDs, custom account-number formats, vendor-specific IDs - extend the analyzer:

from presidio_analyzer import PatternRecognizer, Pattern

employee_id_pattern = Pattern(
    name="employee_id_pattern",
    regex=r"\bEMP-\d{6}\b",
    score=0.9,
)

employee_id_recognizer = PatternRecognizer(
    supported_entity="EMPLOYEE_ID",
    patterns=[employee_id_pattern],
    context=["employee", "staff", "personnel"],  # boosts score when nearby
)

analyzer.registry.add_recognizer(employee_id_recognizer)

Per Presidio docs the Pattern (regex + score) and PatternRecognizer (supported_entity + patterns + context words + optional validation function) compose the standard custom-recogniser pattern.

For non-regex detection (ML-based custom NER) extend EntityRecognizer directly.

Running

Anonymise after detect

from presidio_anonymizer import AnonymizerEngine
from presidio_anonymizer.entities import OperatorConfig

anonymizer = AnonymizerEngine()
anonymized = anonymizer.anonymize(
    text=text,
    analyzer_results=results,
    operators={
        "PERSON": OperatorConfig("replace", {"new_value": "<PERSON>"}),
        "EMAIL_ADDRESS": OperatorConfig("mask",
            {"chars_to_mask": 8, "masking_char": "*", "from_end": False}),
        "CREDIT_CARD": OperatorConfig("hash",
            {"hash_type": "sha256", "salt": "secret-per-tenant"}),
        "US_SSN": OperatorConfig("redact"),
    },
)
print(anonymized.text)

Per presidio.dataprivacystack.org/anonymizer, `OperatorConfig(o

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • .tessl-plugin/plugin.json
  • references/entity-catalog.md

FAQ

Что делает скилл presidio-pii-detection?

Use when existing data (datasets, logs, free text) must be scanned for personal data or redacted: Microsoft Presidio analyzer and anonymizer, built-in recognizers for names, emails, cards, SSNs, IBANs and national IDs, custom pattern recognizers, score thresholds and CI gates.

Как установить скилл presidio-pii-detection?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл presidio-pii-detection запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить presidio-pii-detection с