[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F86EVCP3ETSSVYRQ59Z922":3,"skill-same:01M6F86EVCP3ETSSVYRQ59Z922":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":56,"ownerHtmlUrl":57,"ownerBlogUrl":6,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6F86EVCP3ETSSVYRQ59Z922","clade-known-pitfalls",null,"Common mistakes when building with the Anthropic API and how to avoid them.\nUse when working with known-pitfalls patterns.\nTrigger with \"anthropic mistakes\", \"claude pitfalls\", \"anthropic gotchas\",\n\"common claude errors\", \"anthropic anti-patterns\".","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fjeremylongshore\u002Fclaude-code-plugins-plus-skills\u002Fclade-known-pitfalls\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"clade known pitfalls","best-practices","pitfalls","errors","with","how to","trigger","io","claude-code","patterns","code","anti-patterns","use","edit","write","read","common","how","api","saas","2026-11-10 10:12:30",false,"---\nname: clade-known-pitfalls\ndescription: |\n  Common mistakes when building with the Anthropic API and how to avoid them.\n  Use when working with known-pitfalls patterns.\n  Trigger with \"anthropic mistakes\", \"claude pitfalls\", \"anthropic gotchas\",\n  \"common claude errors\", \"anthropic anti-patterns\".\nallowed-tools: Read, Write, Edit\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ncompatible-with: claude-code\ntags: [saas, anthropic, claude, pitfalls, best-practices]\n---\n\n# Anthropic Known Pitfalls\n\n## Overview\nTen common mistakes when building with the Anthropic API and how to avoid them: forgetting `max_tokens` (required), system prompt in messages array (wrong), non-alternating messages, unchecked `stop_reason`, creating client per request, no 529 handling, hardcoded model IDs, expensive output tokens, no streaming, and unnecessary PII.\n\n\n## 1. Forgetting `max_tokens`\nUnlike OpenAI, `max_tokens` is **required**. Omitting it returns a 400 error.\n```typescript\n\u002F\u002F BAD\nawait client.messages.create({ model: 'claude-sonnet-4-20250514', messages });\n\n\u002F\u002F GOOD\nawait client.messages.create({ model: 'claude-sonnet-4-20250514', max_tokens: 1024, messages });\n```\n\n## 2. System Prompt in Messages Array\nClaude uses a top-level `system` parameter, not a system message in the array.\n```typescript\n\u002F\u002F BAD — this sends \"system\" as a user message role, which will error\nmessages: [{ role: 'system', content: '...' }, { role: 'user', content: '...' }]\n\n\u002F\u002F GOOD\nsystem: 'You are helpful.',\nmessages: [{ role: 'user', content: '...' }]\n```\n\n## 3. Non-Alternating Messages\nMessages must strictly alternate between user and assistant.\n```typescript\n\u002F\u002F BAD — two user messages in a row\nmessages: [\n  { role: 'user', content: 'Hello' },\n  { role: 'user', content: 'How are you?' }, \u002F\u002F ERROR\n]\n\n\u002F\u002F GOOD — combine into one or add assistant between\nmessages: [\n  { role: 'user', content: 'Hello. How are you?' },\n]\n```\n\n## 4. Not Checking `stop_reason`\nIf `stop_reason === 'max_tokens'`, the response was truncated.\n```typescript\nif (message.stop_reason === 'max_tokens') {\n  \u002F\u002F Response is incomplete — increase max_tokens or handle truncation\n}\n```\n\n## 5. Creating Client Per Request\nEach `new Anthropic()` creates a new connection pool. In serverless, this adds latency.\n```typescript\n\u002F\u002F BAD — new client every request\napp.post('\u002Fchat', async (req, res) => {\n  const client = new Anthropic(); \u002F\u002F Cold connection every time\n});\n\n\u002F\u002F GOOD — reuse across requests\nconst client = new Anthropic();\napp.post('\u002Fchat', async (req, res) => {\n  await client.messages.create({ ... });\n});\n```\n\n## 6. No Error Handling for 529\n529 (overloaded) is common during peak hours. The SDK retries automatically, but you should handle it for critical paths.\n\n## 7. Hardcoding Model IDs\nModel IDs change with new versions. Use environment variables.\n```typescript\nconst MODEL = process.env.CLAUDE_MODEL || 'claude-sonnet-4-20250514';\n```\n\n## 8. Ignoring Token Costs\nOutput tokens cost 5x more than input tokens. A 4096 max_tokens response on Opus costs ~$0.30. Use the smallest max_tokens that works.\n\n## 9. No Streaming for User-Facing Apps\nWithout streaming, users stare at a blank screen for 5-30 seconds. Always stream for interactive use.\n\n## 10. Sending PII Unnecessarily\nDon't include user PII in prompts unless the task requires it. Redact before sending.\n\n## Quick Reference\n| Pitfall | Fix |\n|---------|-----|\n| Missing `max_tokens` | Always include it |\n| System in messages | Use top-level `system` param |\n| Non-alternating messages | Combine or interleave |\n| Unchecked `stop_reason` | Check for `max_tokens` truncation |\n| Client per request | Module-level singleton |\n| No 529 handling | SDK retries + fallback model |\n| Hardcoded model IDs | Environment variable |\n| Expensive output | Minimize `max_tokens` |\n| No streaming | Always stream for UI |\n| Unnecessary PII | Redact before sending |\n\n## Output\n- All ten pitfalls checked against your codebase\n- `max_tokens` present on every `messages.create` call\n- System prompt using top-level `system` parameter\n- Messages strictly alternating user\u002Fassistant\n- `stop_reason` checked for truncation\n- Client instance reused across requests\n\n## Error Handling\n| Error | Cause | Solution |\n|-------|-------|----------|\n| API Error | Check error type and status code | See `clade-common-errors` |\n\n## Examples\nSee ten numbered pitfall sections above, each with BAD\u002FGOOD code comparisons. Quick Reference table at the end summarizes all fixes.\n\n## Resources\n- [API Reference](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fapi\u002Fmessages)\n- [Best Practices](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fbuild-with-claude)\n\n## Prerequisites\n- Familiarity with the Anthropic Messages API\n- Active Claude integration to audit\n- Access to codebase for pattern review\n\n## Instructions\n\n### Step 1: Review the patterns below\nEach section contains production-ready code examples. Copy and adapt them to your use case.\n\n### Step 2: Apply to your codebase\nIntegrate the patterns that match your requirements. Test each change individually.\n\n### Step 3: Verify\nRun your test suite to confirm the integration works correctly.\n\n","# Anthropic Known Pitfalls\n\n## Overview\nTen common mistakes when building with the Anthropic API and how to avoid them: forgetting `max_tokens` (required), system prompt in messages array (wrong), non-alternating messages, unchecked `stop_reason`, creating client per request, no 529 handling, hardcoded model IDs, expensive output tokens, no streaming, and unnecessary PII.\n\n\n## 1. Forgetting `max_tokens`\nUnlike OpenAI, `max_tokens` is **required**. Omitting it returns a 400 error.\n```typescript\n\u002F\u002F BAD\nawait client.messages.create({ model: 'claude-sonnet-4-20250514', messages });\n\n\u002F\u002F GOOD\nawait client.messages.create({ model: 'claude-sonnet-4-20250514', max_tokens: 1024, messages });\n```\n\n## 2. System Prompt in Messages Array\nClaude uses a top-level `system` parameter, not a system message in the array.\n```typescript\n\u002F\u002F BAD — this sends \"system\" as a user message role, which will error\nmessages: [{ role: 'system', content: '...' }, { role: 'user', content: '...' }]\n\n\u002F\u002F GOOD\nsystem: 'You are helpful.',\nmessages: [{ role: 'user', content: '...' }]\n```\n\n## 3. Non-Alternating Messages\nMessages must strictly alternate between user and assistant.\n```typescript\n\u002F\u002F BAD — two user messages in a row\nmessages: [\n  { role: 'user', content: 'Hello' },\n  { role: 'user', content: 'How are you?' }, \u002F\u002F ERROR\n]\n\n\u002F\u002F GOOD — combine into one or add assistant between\nmessages: [\n  { role: 'user', content: 'Hello. How are you?' },\n]\n```\n\n## 4. Not Checking `stop_reason`\nIf `stop_reason === 'max_tokens'`, the response was truncated.\n```typescript\nif (message.stop_reason === 'max_tokens') {\n  \u002F\u002F Response is incomplete — increase max_tokens or handle truncation\n}\n```\n\n## 5. Creating Client Per Request\nEach `new Anthropic()` creates a new connection pool. In serverless, this adds latency.\n```typescript\n\u002F\u002F BAD — new client every request\napp.post('\u002Fchat', async (req, res) => {\n  const client = new Anthropic(); \u002F\u002F Cold connection every time\n});\n\n\u002F\u002F GOOD — reuse across requests\nconst client = new Anthropic();\napp.post('\u002Fchat', async (req, res) => {\n  await client.messages.create({ ... });\n});\n```\n\n## 6. No Error Handling for 529\n529 (overloaded) is common during peak hours. The SDK retries automatically, but you should handle it for critical paths.\n\n## 7. Hardcoding Model IDs\nModel IDs change with new versions. Use environment variables.\n```typescript\nconst MODEL = process.env.CLAUDE_MODEL || 'claude-sonnet-4-20250514';\n```\n\n## 8. Ignoring Token Costs\nOutput tokens cost 5x more than input tokens. A 4096 max_tokens response on Opus costs ~$0.30. Use the smallest max_tokens that works.\n\n## 9. No Streaming for User-Facing Apps\nWithout streaming, users stare at a blank screen for 5-30 seconds. Always stream for interactive use.\n\n## 10. Sending PII Unnecessarily\nDon't include user PII in prompts unless the task requires it. Redact before sending.\n\n## Quick Reference\n| Pitfall | Fix |\n|---------|-----|\n| Missing `max_tokens` | Always include it |\n| System in messages | Use top-level `system` param |\n| Non-alternating messages | Combine or interleave |\n| Unchecked `stop_reason` | Check for `max_tokens` truncation |\n| Client per request | Module-level singleton |\n| No 529 handling | SDK retries + fallback model |\n| Hardcoded model IDs | Environment variable |\n| Expensive output | Minimize `max_tokens` |\n| No streaming | Always stream for UI |\n| Unnecessary PII | Redact before sending |\n\n## Output\n- All ten pitfalls checked against your codebase\n- `max_tokens` present on every `messages.create` call\n- System prompt using top-level `system` parameter\n- Messages strictly alternating user\u002Fassistant\n- `stop_reason` checked for truncation\n- Client instance reused across requests\n\n## Error Handling\n| Error | Cause | Solution |\n|-------|-------|----------|\n| API Error | Check error type and status code | See `clade-common-errors` |\n\n## Examples\nSee ten numbered pitfall sections above, each with BAD\u002FGOOD code comparisons. Quick Reference table at the end summarizes all fixes.\n\n## Resources\n- [API Reference](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fapi\u002Fmessages)\n- [Best Practices](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fbuild-with-claude)\n\n## Prerequisites\n- Familiarity with the Anthropic Messages API\n- Active Claude integration to audit\n- Access to codebase for pattern review\n\n## Instructions\n\n### Step 1: Review the patterns below\nEach section contains production-ready code examples. Copy and adapt them to your use case.\n\n### Step 2: Apply to your codebase\nIntegrate the patterns that match your requirements. Test each change individually.\n\n### Step 3: Verify\nRun your test suite to confirm the integration works correctly.\n\n",{"name":5,"tags":44,"author":47,"license":15,"version":48,"description":49,"allowed-tools":50,"compatible-with":27},[38,45,46,21,20],"anthropic","claude","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Common mistakes when building with the Anthropic API and how to avoid them.\nUse when working with known-pitfalls patterns.\nTrigger with \"anthropic mistakes\", \"claude pitfalls\", \"anthropic gotchas\",\n\"common claude errors\", \"anthropic anti-patterns\".\n","Read, Write, Edit","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fjeremylongshore\u002Fclaude-code-plugins-plus-skills\u002Fclade-known-pitfalls",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill clade-known-pitfalls",{"tool":66,"command":67},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill clade-known-pitfalls",{"tool":69,"command":70},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill clade-known-pitfalls","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fjeremylongshore\u002Fclaude-code-plugins-plus-skills\u002Fclade-known-pitfalls\u002FSKILL.md",true,[],[75,84,93,102,108,114],{"skillNo":76,"name":77,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[81,82,83],"model","model hierarchy","model hierarchy skill",{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[90,91,92],"MCP","zoom","zoom mcp",{"skillNo":94,"name":95,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[99,100,101,91],"sdk","zoom apps sdk","apps",{"skillNo":103,"name":104,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[104],{"skillNo":109,"name":110,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[110],{"skillNo":115,"name":116,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[116]]