/data-classification-skills:pii-in-unstructuredfrom data-classification-skills
Detects PII in unstructured data (emails, documents, images, logs) using NER with spaCy and Microsoft Presidio, regex patterns, OCR, and confidence scoring.
Ships in data-classification-skills. 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; scripts run unread.
Unstructured data — emails, documents, images, chat logs, call transcripts, and system logs — accounts for an estimated 80% of enterprise data and presents the greatest challenge for privacy compliance. Unlike structured databases where personal data resides in known columns, unstructured data contains PII embedded in free text, attached files, scanned images, and metadata. This skill covers detection approaches using Named Entity Recognition (NER), pattern matching, OCR, and hybrid pipelines, with focus on Microsoft Presidio and spaCy as implementation frameworks.
| Source | Volume | PII Risk | Detection Challenge |
|---|---|---|---|
| Email (Exchange Online) | 2.1M messages/month | HIGH — names, account numbers, financial data in body and attachments | Mixed text and attachments; forwarded chains contain accumulated PII |
| SharePoint documents | 4.2TB across 1,200 sites | HIGH — contracts, KYC docs, customer correspondence | Multiple formats (docx, pdf, xlsx); embedded images |
| Teams chat | 890K messages/month | MEDIUM — casual references to customers, internal discussions | Short messages, abbreviations, context-dependent PII |
| Application logs | 50GB/day | MEDIUM — IP addresses, user IDs, error messages with PII | High volume, mixed with non-PII technical data |
| Scanned documents | 45K pages/month | HIGH — passport scans, signed contracts, medical certificates | Requires OCR; variable image quality |
| Call transcripts | 8K transcripts/month | HIGH — customers state names, account numbers, personal details | Speech-to-text errors, colloquial language |
| PDF reports | 12K documents/month | MEDIUM — financial reports may contain customer lists | Embedded tables, charts with PII labels |
Presidio is an open-source PII detection and anonymisation SDK developed by Microsoft, designed for integration with enterprise data pipelines.
Input Text/Document
│
▼
┌──────────────────┐
│ Pre-processing │ Format conversion, encoding normalisation,
│ (text extract) │ OCR for images/scanned PDFs
└──────┬───────────┘
│
▼
┌──────────────────┐
│ Presidio │ Multiple recognisers run in parallel:
│ Analyzer │ - NER model (spaCy/transformers)
│ │ - Pattern recognisers (regex)
│ │ - Custom recognisers (org-specific)
│ │ - Context-aware enhancers
└──────┬───────────┘
│
▼
┌──────────────────┐
│ Confidence │ Each detection assigned confidence score
│ Scoring & │ Threshold filtering applied
│ Filtering │ Context enhancement boosts/reduces scores
└──────┬───────────┘
│
▼
┌──────────────────┐
│ Results │ PII locations, types, confidence scores
│ (structured) │ Ready for classification, redaction, or alerting
└──────────────────┘
NER Model (spaCy/Transformers):
en_core_web_trf model (transformer-based) for English NERPattern Recognisers (Regex):
[A-CEGHJ-PR-TW-Z]{2}\d{6}[A-D][a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(?:0|\+44)\d{10,11}[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}([A-Z0-9]?){0,16}\b(?:\d{4}[-\s]?){3}\d{4}\b (with Luhn validation)\b(?:\d{1,3}\.){3}\d{1,3}\b\b\d{2}[/-]\d{2}[/-]\d{4}\bVFS-\d{10}[A-Z]\d{2}\.\d{1,4}Context-Aware Enhancement:
Scanned Document / Image
│
▼
┌──────────────────┐
│ Pre-processing │ Deskew, denoise, contrast enhancement,
│ (image) │ resolution upscaling (if < 300 DPI)
└──────┬───────────┘
│
▼
┌──────────────────┐
│ OCR Engine │ Tesseract OCR (open-source) or
│ │ Azure AI Document Intelligence (cloud)
│ │ Output: extracted text with bounding boxes
└──────┬───────────┘
│
▼
┌──────────────────┐
│ Presidio │ Standard NER + pattern detection
│ Analyzer │ on OCR-extracted text
└──────┬───────────┘
│
▼
┌──────────────────┐
│ Confidence │ Adjust for OCR quality:
│ Adjustment │ OCR confidence < 80% → reduce PII confidence by 20%
│ │ OCR confidence > 95% → no adjustment
└──────────────────┘
| Document Type | OCR Strategy | Expected PII |
|---|---|---|
| Passport scan | Azure AI Document Intelligence (ID document model) | Full name, DOB, nationality, passport number, photo (biometric) |
| Utility bill | General OCR + address pattern recognition | Full name, address, account number |
| Medical certificate | General OCR + health NER model | Name, diagnosis, doctor name, dates |
| Signed contract | General OCR + contract template matching | Names, addresses, financial terms, signatures |
| Cheque image | Banking-specific OCR model | Name, account number, sort code, amount |
| Component | Weight | Description |
|---|---|---|
| Pattern match confidence | 40% | Regex pattern specificity and validation (e.g., Luhn check for credit cards) |
| NER model confidence | 30% | Model probability score for entity classification |
| Context enhancement | 20% | Keyword proximity, section header, document type |
| Source quality | 10% | OCR quality score, document resolution, text extraction confidence |
| Confidence Level | Score Range | Action |
|---|---|---|
| HIGH | 85-100% | Auto-classify and auto-label; include in discovery report |
| MEDIUM | 70-84% | Queue for human review; include in discovery report as pending |
| LOW | 50-69% | Log for audit; do not auto-classify; available for bulk review |
| BELOW THRESHOLD | < 50% | Suppress; do not report unless specifically queried |
# Conceptual pipeline for Exchange Online email scanning
# 1. Microsoft Graph API retrieves email messages
# 2. Extract body text (HTML → plain text conversion)
# 3. Extract attachment text (document parsing)
# 4. Run Presidio analyzer on combined text
# 5. Map findings to email metadata (sender, recipients, date)
# 6. Apply classification labels via Microsoft Purview
For application logs, specific patterns dominate:
Log scanning requires higher false-positive tolerance and volume-optimised processing.
Teams/Slack messages present unique challenges:
Strategy: scan message threads rather than individual messages to capture context.
| Source | Precision Target | Recall Target | Key Challenges |
|---|---|---|---|
| Email body text | > 92% | > 88% | Forwarded chains, signatures, disclaimers |
| SharePoint documents (Office formats) | > 90% | > 85% | Embedded tables, headers/footers |
| Scanned documents (OCR) | > 85% | > 80% | OCR errors, handwriting, poor image quality |
| Application logs | > 88% | > 82% | IP address over-detection, reference number ambiguity |
| Chat messages | > 80% | > 75% | Short context, informal language, abbreviations |
| Call transcripts | > 82% | > 78% | Speech-to-text errors, overlapping speech, accents |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub mukul975/privacy-data-protection-skills --plugin data-classification-skills12 skills in this plugin
/ai-training-data-classClassifies sensitive data in AI/ML training datasets including bias detection for Art. 9 categories, data card documentation, provenance tracking, and consent verification for model training. Keywords: AI training data, ML dataset, bias detection, data card, model training, Art 9, consent, GDPR AI./auto-data-discoveryImplements automated PII discovery and classification using tools like Microsoft Purview, BigID, OneTrust DataDiscovery, and AWS Macie. Covers scanning schedules, accuracy tuning, false positive management, and integration patterns. Keywords: data discovery, PII scanning, Purview, BigID, Macie, OneTrust, automated classification, data cataloging./classification-policyDevelops data classification policies with tiered handling (public, internal, confidential, restricted), labeling requirements, enforcement mechanisms, and procedures per tier. Covers policy governance, exception handling, and compliance monitoring. Keywords: classification policy, data tiers, handling procedures, labeling, enforcement, data governance, information security./criminal-data-handlingHandles GDPR Art. 10 criminal conviction and offence data classification including official authority requirements, national law derogations, and comprehensive register restrictions. Covers controller obligations for criminal background checks and offence records. Keywords: criminal data, Art 10, conviction data, offence records, criminal background, DBS check./cross-jurisdiction-classHarmonises data classification across jurisdictions mapping GDPR special categories vs CCPA sensitive PI (1798.140(ae)) vs HIPAA PHI (160.103) vs LGPD sensitive data (Art. 5-II). Provides cross-regulation mapping matrix for multinational compliance. Keywords: cross-jurisdiction, GDPR, CCPA, HIPAA, LGPD, sensitive data, multinational, classification mapping./data-inventory-mappingBuilds comprehensive data inventory per GDPR Art. 30 Records of Processing Activities. Covers system-by-system discovery, data flow diagramming, third-party identification, and legal basis per category. Keywords: data inventory, data mapping, Art 30, RoPA, data flow, processing activities.2 plugins in one repository ship this exact skill · first indexed Jul 7, 2026
Other plugins' skills for the same job