clade-data-handling
БесплатноБез исполняемых скриптовНе проверенHandle sensitive data with Claude \u2014 PII redaction, conversation\ \ management, Use when working with data-handling patterns. context window…
от jeremylongshore★ 2 961 звезда на GitHubОб этом скилле
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.
// 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
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
// Strip PII before sending to Claude (if not needed for the task)
function redactPII(text: string): string {
return text
.replace(/\b[\w._%+-]+@[\w.-]+\.\w{2,}\b/g, '[EMAIL]')
.replace(/\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g, '[PHONE]')
.replace(/\b\d{3}-\d{2}-\d{4}\b/g, '[SSN]')
.replace(/\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g, '[CARD]');
}
Data Retention
- Default: Anthropic does not use API data for training
- Zero retention: Available on Enterprise plans
- Your responsibility: Don't store Claude responses containing user PII longer than needed
Output
- Token counting implemented before sending requests (prevents context overflow errors)
- Conversation trimming preserving first message and recent turns
- PII redaction applied for emails, phone numbers, SSNs, and card numbers
- Data retention policy documented and configured
Error Handling
| Error | Cause | Solution |
|---|---|---|
| API Error | Check error type and status code | See clade-common-errors |
Examples
See Context Window Management (token counting + budget), Conversation Trimming function, and PII Handling regex patterns above.
Resources
- Anthropic Privacy Policy
- Token Counting
- Context Window
Next Steps
See clade-enterprise-rbac for organization and access management.
Prerequisites
- Completed
clade-install-auth - Application handling user conversations or document processing
- Understanding of token counting and context windows
Установить clade-data-handling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditВложенные файлы
FAQ
Что делает скилл clade-data-handling?
Handle sensitive data with Claude \u2014 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".
Как установить скилл clade-data-handling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clade-data-handling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic