pii-detector
Detects Personally Identifiable Information (PII) in code, logs, databases, and files for GDPR/CCPA compliance. Use when user asks to "detect PII", "find sensitive data", "scan for personal information", "check GDPR compliance", or "find SSN/credit cards".
What this skill does
# PII Detector
Scans code, logs, databases, and configuration files for Personally Identifiable Information (PII) to ensure GDPR, CCPA, and privacy compliance.
## When to Use
- "Scan for PII in my codebase"
- "Find sensitive data"
- "Check for exposed personal information"
- "Detect SSN, credit cards, emails"
- "GDPR compliance check"
- "Find PII in logs"
## Instructions
### 1. Detect Project Type
```bash
# Check project structure
ls -la
# Detect language
[ -f "package.json" ] && echo "JavaScript/TypeScript"
[ -f "requirements.txt" ] && echo "Python"
[ -f "pom.xml" ] && echo "Java"
[ -f "Gemfile" ] && echo "Ruby"
# Check for logs
find . -name "*.log" -type f | head -5
```
### 2. Define PII Patterns
**Common PII Types:**
1. **Social Security Numbers (SSN)**
- Pattern: `\b\d{3}-\d{2}-\d{4}\b`
- Example: 123-45-6789
2. **Credit Card Numbers**
- Visa: `\b4\d{3}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b`
- MasterCard: `\b5[1-5]\d{2}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b`
- Amex: `\b3[47]\d{2}[\s-]?\d{6}[\s-]?\d{5}\b`
- Discover: `\b6011[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b`
3. **Email Addresses**
- Pattern: `\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b`
4. **Phone Numbers**
- US: `\b\d{3}[-.]?\d{3}[-.]?\d{4}\b`
- International: `\+\d{1,3}[\s-]?\d{1,14}`
5. **IP Addresses**
- IPv4: `\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b`
- IPv6: `([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}`
6. **Dates of Birth**
- Pattern: `\b\d{2}/\d{2}/\d{4}\b` or `\b\d{4}-\d{2}-\d{2}\b`
7. **Passport Numbers**
- US: `\b[A-Z]{1,2}\d{6,9}\b`
8. **Driver's License**
- Varies by state/country
9. **Bank Account Numbers**
- Pattern: `\b\d{8,17}\b`
10. **API Keys / Tokens**
- AWS: `AKIA[0-9A-Z]{16}`
- Slack: `xox[baprs]-[0-9a-zA-Z-]{10,}`
- GitHub: `ghp_[0-9a-zA-Z]{36}`
### 3. Scan Codebase
**Using grep:**
```bash
# Scan for SSN
grep -rn '\b\d{3}-\d{2}-\d{4}\b' . --include="*.js" --include="*.py" --include="*.java"
# Scan for credit cards
grep -rn '\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b' . --exclude-dir=node_modules
# Scan for emails
grep -rn '\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b' . --include="*.log"
# Scan for phone numbers
grep -rn '\b\d{3}[-.]?\d{3}[-.]?\d{4}\b' .
# Scan for API keys
grep -rn 'AKIA[0-9A-Z]{16}' . --include="*.env*" --include="*.config*"
```
**Exclude common false positives:**
```bash
# Exclude test files, build directories
grep -rn <pattern> . \
--exclude-dir=node_modules \
--exclude-dir=.git \
--exclude-dir=dist \
--exclude-dir=build \
--exclude-dir=vendor \
--exclude-dir=__pycache__ \
--exclude="*.test.js" \
--exclude="*.spec.ts" \
--exclude="*.min.js"
```
### 4. Create PII Detection Script
**Python Script:**
```python
#!/usr/bin/env python3
import re
import os
import sys
from pathlib import Path
from typing import List, Dict, Tuple
class PIIDetector:
def __init__(self):
self.patterns = {
'SSN': r'\b\d{3}-\d{2}-\d{4}\b',
'Credit Card': r'\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b',
'Email': r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b',
'Phone (US)': r'\b\d{3}[-.]?\d{3}[-.]?\d{4}\b',
'IPv4': r'\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b',
'AWS Key': r'AKIA[0-9A-Z]{16}',
'GitHub Token': r'ghp_[0-9a-zA-Z]{36}',
'Slack Token': r'xox[baprs]-[0-9a-zA-Z-]{10,}',
'Date of Birth': r'\b(?:0[1-9]|1[0-2])/(?:0[1-9]|[12][0-9]|3[01])/(?:19|20)\d{2}\b',
}
self.exclude_dirs = {
'node_modules', '.git', 'dist', 'build', 'vendor',
'__pycache__', '.next', 'out', 'coverage', '.venv'
}
self.exclude_extensions = {
'.min.js', '.map', '.lock', '.jpg', '.png', '.gif',
'.pdf', '.zip', '.tar', '.gz'
}
def should_scan_file(self, filepath: Path) -> bool:
"""Check if file should be scanned."""
# Check excluded directories
if any(excluded in filepath.parts for excluded in self.exclude_dirs):
return False
# Check excluded extensions
if filepath.suffix in self.exclude_extensions:
return False
# Check file size (skip files > 10MB)
try:
if filepath.stat().st_size > 10 * 1024 * 1024:
return False
except OSError:
return False
return True
def scan_file(self, filepath: Path) -> List[Dict]:
"""Scan a single file for PII."""
findings = []
try:
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
for line_num, line in enumerate(f, 1):
for pii_type, pattern in self.patterns.items():
matches = re.finditer(pattern, line)
for match in matches:
# Check for common false positives
if self.is_false_positive(pii_type, match.group(), line):
continue
findings.append({
'file': str(filepath),
'line': line_num,
'type': pii_type,
'value': self.mask_pii(match.group()),
'context': line.strip()[:100]
})
except Exception as e:
print(f"Error scanning {filepath}: {e}", file=sys.stderr)
return findings
def is_false_positive(self, pii_type: str, value: str, context: str) -> bool:
"""Check for common false positives."""
# Common test data
test_patterns = [
'000-00-0000',
'111-11-1111',
'123-45-6789',
'4111111111111111', # Test credit card
'[email protected]',
'user@localhost',
'127.0.0.1',
'0.0.0.0',
'192.168.',
]
for pattern in test_patterns:
if pattern in value:
return True
# Check if in comment
if any(comment in context for comment in ['//', '#', '/*', '*', '<!--']):
if 'example' in context.lower() or 'test' in context.lower():
return True
return False
def mask_pii(self, value: str) -> str:
"""Mask PII value for reporting."""
if len(value) <= 4:
return '*' * len(value)
return value[:2] + '*' * (len(value) - 4) + value[-2:]
def scan_directory(self, directory: Path) -> List[Dict]:
"""Recursively scan directory for PII."""
all_findings = []
for filepath in directory.rglob('*'):
if filepath.is_file() and self.should_scan_file(filepath):
findings = self.scan_file(filepath)
all_findings.extend(findings)
return all_findings
def generate_report(self, findings: List[Dict]) -> str:
"""Generate human-readable report."""
if not findings:
return "✅ No PII detected!"
report = f"⚠️ Found {len(findings)} potential PII instances:\n\n"
# Group by type
by_type = {}
for finding in findings:
pii_type = finding['type']
if pii_type not in by_type:
by_type[pii_type] = []
by_type[pii_type].append(finding)
for pii_type, items in sorted(by_type.items()):
report += f"## {pii_type} ({len(items)} found)\n\n"
for item in items[:10]: # Limit to 10 per type
report += f"- {item['file']}:{item['line']}\n"
report += f" Value: {item['value']}\n"
report += f" Context: {item['context']}\n\n"
if len(items) > 10:
report += f" ... and {len(items) - 10} more\n\n"
return report
def main():
import argparse
parser = argparse.ArgumentParser(descripRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.