| name | anth-data-handling |
| description | Implement data privacy, PII handling, and compliance patterns for Claude API.
Use when handling sensitive data, implementing PII redaction,
or configuring data retention for GDPR/CCPA compliance with Claude.
Trigger with phrases like "anthropic data privacy", "claude PII",
"anthropic gdpr", "claude data handling", "redact data claude".
|
| allowed-tools | Read, Write, Edit, Grep |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","ai","anthropic"] |
| compatibility | Designed for Claude Code |
Anthropic Data Handling
Overview
Anthropic's data policies: API inputs/outputs are NOT used for model training (commercial API). Zero-day retention is available. This skill covers PII redaction before sending to Claude and compliance patterns.
Anthropic Data Policies
| Policy | Details |
|---|
| Training data | API data is NOT used for training (commercial API) |
| Data retention | 30-day default; 0-day available via agreement |
| Encryption | TLS 1.2+ in transit, AES-256 at rest |
| SOC 2 Type II | Certified |
| HIPAA BAA | Available for eligible customers |
PII Redaction Before API Calls
import re
import anthropic
def redact_pii(text: str) -> tuple[str, dict]:
"""Redact PII before sending to Claude, return redaction map for restoration."""
redaction_map = {}
patterns = [
(r'\b\d{3}-\d{2}-\d{4}\b', 'SSN', '[SSN-REDACTED-{}]'),
(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', 'EMAIL', '[EMAIL-REDACTED-{}]'),
(r'\b\d{3}[-.]?\d{3}[-.]?\d{4}\b', 'PHONE', '[PHONE-REDACTED-{}]'),
(r'\b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b', 'CARD', '[CARD-REDACTED-{}]'),
]
counter = 0
for pattern, label, replacement in patterns:
for match in re.finditer(pattern, text):
counter += 1
placeholder = replacement.(counter)
redaction_map[placeholder] = .group()
text = text.replace(.group(), placeholder, )
text, redaction_map
() -> :
placeholder, original redaction_map.items():
text = text.replace(placeholder, original)
text
user_input =
safe_input, redactions = redact_pii(user_input)
client = anthropic.Anthropic()
msg = client.messages.create(
model=,
max_tokens=,
messages=[{: , : safe_input}]
)
final_output = restore_pii(msg.content[].text, redactions)