clade-security-basics

Featured

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

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 Security Basics ## Overview Securing a Claude integration means protecting your API key, validating inputs, defending against prompt injection, and handling user data responsibly. ## API Key Security ## Instructions ### Step 1: Never Expose Keys Client-Side ```typescript // BAD — key in browser JavaScript const client = new Anthropic({ apiKey: 'sk-ant-...' }); // EXPOSED TO USERS // GOOD — key only on server // api/chat.ts (server-side only) const client = new Anthropic(); // reads from env ``` ### Step 2: Environment Variables ```bash # .env (local dev — never commit) ANTHROPIC_API_KEY=sk-ant-api03-... # .gitignore .env .env.local .env.production ``` ### Step 3: Rotate Keys Regularly - Console → Settings → API Keys → Create New Key - Update all deployments with new key - Delete old key only after all deployments are updated ## Input Validation ```typescript // Validate user input before sending to Claude function validateInput(userMessage: string): string { // Limit length to prevent cost attacks if (userMessage.length > 10_000) { throw new Error('Message too long (max 10,000 characters)'); } // Strip potential PII if not needed // const sanitized = redactEmails(redactPhones(userMessage)); return userMessage; } ``` ## Prompt Injection Defense ```typescript const message = await client.messages.create({ model: 'claude-sonnet-4-20250514', max_tokens: 1024, system: `You are a customer support bot for Acme Corp. IMPORTANT: Only answe...

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-security-basics

Apply Anthropic Claude API security best practices for key management, input validation, and prompt injection defense. Use when securing API keys, validating user inputs before sending to Claude, or implementing content safety guardrails. Trigger with phrases like "anthropic security", "claude api key security", "secure anthropic", "prompt injection defense".

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

anth-install-auth

Install and configure Anthropic Claude SDK authentication for Python and TypeScript. Use when setting up a new Claude API integration, configuring API keys, or initializing the Anthropic SDK in your project. Trigger with phrases like "install anthropic", "setup claude api", "anthropic auth", "configure anthropic API key", "claude sdk setup".

2,266 Updated today
jeremylongshore
AI & Automation Featured

clade-install-auth

Install and configure the Anthropic SDK for Claude API access. Use when setting up Claude integration, configuring API keys, or initializing the Anthropic client in your project. Trigger with phrases like "install anthropic", "setup claude api", "anthropic auth", "configure anthropic API key".

2,266 Updated today
jeremylongshore
AI & Automation Featured

anth-policy-guardrails

Implement content policy guardrails, input/output validation, and usage governance for Claude API integrations. Trigger with phrases like "anthropic guardrails", "claude content policy", "claude input validation", "anthropic safety rules".

2,266 Updated today
jeremylongshore