clade-data-handling

Featured

Handle sensitive data with Claude — PII redaction, conversation management, Use when working with data-handling patterns. context window optimization, and data retention policies. Trigger with "anthropic data privacy", "claude pii", "anthropic context window", "manage claude conversations", "anthropic data retention".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Anthropic Data Handling ## Overview Handle data responsibly when building with Claude — manage the 200K token context window efficiently, implement conversation trimming strategies, redact PII before sending to the API, and configure data retention settings. ## Context Window Management Claude models have a 200K token context window. Managing it efficiently is critical. ```typescript // Count tokens before sending const count = await client.messages.countTokens({ model: 'claude-sonnet-4-20250514', messages, system: systemPrompt, }); // Budget: 200K total - max_tokens (output) = available input const MAX_CONTEXT = 200_000; const MAX_OUTPUT = 4096; const inputBudget = MAX_CONTEXT - MAX_OUTPUT; if (count.input_tokens > inputBudget) { // Trim oldest messages, keep system prompt + recent context messages = trimToFit(messages, inputBudget); } ``` ## Instructions ### Step 1: Conversation Trimming ```typescript function trimConversation(messages: MessageParam[], maxTokens: number): MessageParam[] { // Always keep the first message (often contains key context) // Keep the most recent messages // Drop middle turns first if (messages.length <= 4) return messages; const first = messages[0]; const recent = messages.slice(-6); // Last 3 turns return [first, ...recent]; } ``` ## PII Handling ```typescript // Strip PII before sending to Claude (if not needed for the task) function redactPII(text: string): string { return text .replace(/\b[\w._%+-]+@[...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

anth-data-handling

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".

2,266 Updated today
jeremylongshore
AI & Automation Featured

clade-security-basics

Secure your Anthropic integration — API key management, input validation, Use when working with security-basics patterns. prompt injection defense, and data privacy. Trigger with "anthropic security", "claude api key security", "anthropic prompt injection", "secure claude integration".

2,266 Updated today
jeremylongshore
AI & Automation Featured

clade-policy-guardrails

Implement content safety guardrails for Claude — input filtering, Use when working with policy-guardrails patterns. output validation, usage policies, and prompt injection defense. Trigger with "anthropic content policy", "claude safety", "claude guardrails", "anthropic prompt injection", "claude content filtering".

2,266 Updated today
jeremylongshore
AI & Automation Featured

cohere-data-handling

Implement data privacy for Cohere API calls with PII redaction and compliance. Use when handling sensitive data, implementing PII redaction before API calls, or ensuring GDPR/CCPA compliance with Cohere integrations. Trigger with phrases like "cohere data", "cohere PII", "cohere GDPR", "cohere data retention", "cohere privacy", "cohere redact".

2,266 Updated today
jeremylongshore
AI & Automation Featured

mistral-data-handling

Implement Mistral AI PII handling, data retention, and GDPR/CCPA compliance patterns. Use when handling sensitive data, implementing data redaction, configuring retention policies, or ensuring compliance with privacy regulations for Mistral AI integrations. Trigger with phrases like "mistral data", "mistral PII", "mistral GDPR", "mistral data retention", "mistral privacy".

2,266 Updated today
jeremylongshore