[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EMA5SDF48GWRQ4HVFFD875":3,"skill-same:01M7EMA5SDF48GWRQ4HVFFD875":47},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7EMA5SDF48GWRQ4HVFFD875","anthropic-api-pro",null,"Anthropic Claude API guidance — messages API, tool use, prompt caching, extended thinking, and production patterns.","TanNhatCMS\u002Fjarvis","TanNhatCMS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113796420?v=4","01M753MV17KG5CD3152G3WQEQY","KietNT","01M7EKEDYVYQ6PWVJJMZ911VMX",0,"MIT","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-anthropic-api-pro\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: anthropic-api-pro\ndescription: Anthropic Claude API guidance — messages API, tool use, prompt caching, extended thinking, and production patterns.\ncategory: development\n---\n\n## Overview\n\nThe Anthropic API exposes Claude models via the Messages API: a clean messages-in, message-out interface with best-in-class tool use, prompt caching (the cost story for long contexts), and extended thinking for hard reasoning. Claude's strengths — careful instruction-following, long-context handling, and reliable tool calling — shape how you should use it.\n\nThis skill covers the Messages API properly: message construction, tool use patterns, prompt caching for cost control, extended thinking, and production practices.\n\n## When to use\n\n- Calling the Claude Messages API.\n- Implementing tool use (function calling).\n- Reducing costs with prompt caching.\n- Using extended thinking for complex reasoning.\n- Streaming responses with tool use.\n- Choosing between Claude models (Opus\u002FSonnet\u002FHaiku).\n- Migrating from OpenAI-style APIs.\n\n## Core concepts\n\n- **Messages API.** `POST \u002Fv1\u002Fmessages`: `model`, `max_tokens` (required), `system`, `messages` (user\u002Fassistant turns). Stateless — you manage conversation history. Clean and explicit; no legacy baggage.\n- **Model tiers.** Opus (frontier capability), Sonnet (the workhorse — intelligence per dollar), Haiku (fast\u002Fcheap for simple tasks). Sonnet is the default choice; Opus for the hardest problems; Haiku for high-volume simple work.\n- **System prompts.** Separate `system` parameter (not a message) — supports caching and keeps instruction hierarchy clean. Long, detailed system prompts are where Claude shines; invest in them.\n- **Tool use.** `tools` with JSON-schema `input_schema`; the model returns `tool_use` blocks, you return `tool_result` blocks. Claude's tool calling is among the most reliable — but tool design still matters: clear names\u002Fdescriptions, narrow scope, useful errors.\n- **Forced tool choice.** `tool_choice: {\"type\": \"tool\", \"name\": \"...\"}` forces a specific tool; `{\"type\": \"any\"}` requires some tool; `auto` lets the model decide. Force tools when the workflow demands it (extraction, classification).\n- **Prompt caching.** Mark stable prefixes (system prompt, long context, few-shots) with `cache_control: {\"type\": \"ephemeral\"}` — cache writes cost extra once, reads cost ~90% less. The economics of long-context RAG\u002Fagents depend on this. Structure prompts: stable content first, varying query last.\n- **Extended thinking.** `thinking: {\"type\": \"enabled\", \"budget_tokens\": N}` — the model reasons in a separate thinking block before answering; interleaved thinking with tools for agentic reasoning. Budget thinking tokens like any other cost; expose summaries, not raw traces, to users.\n- **Streaming.** SSE streams with `message_start`, `content_block_delta`, `message_stop` events; thinking blocks and tool-use JSON stream as deltas. Assemble carefully — tool input JSON arrives in pieces.\n- **Temperature.** Same semantics as elsewhere; 0-1 range typical. Low for deterministic work; the default 1 is fine for open-ended.\n- **Long context.** 200K+ token windows — Claude handles long contexts well, but \"can\" ≠ \"should\": retrieval + caching usually beats stuffing everything in. Cache the stable corpus, vary the question.\n- **Vision.** Image inputs (base64 or URL) in message content blocks — document understanding, screenshots, diagrams. Downscale huge images; multi-image reasoning works but costs.\n- **Batch API.** 50% discount for async workloads — evaluations, bulk processing. Same pattern as elsewhere: patience pays.\n- **Headers and versioning.** `anthropic-version` header pins the API version; `x-api-key` auth. Pin versions in production; test upgrades deliberately.\n- **Error handling.** 429 (rate limit — backoff), 529 (overloaded — retry), 400 (invalid request — fix the payload), credit balance errors. Distinguish retryable from fatal.\n- **Safety.** Claude's constitutional training helps, but validate outputs for consequential actions; human-in-the-loop for irreversible tool calls; no sensitive data beyond your threat model.\n\n## Practical workflow\n\n1. **Pick the tier.** Sonnet default; Haiku for volume\u002Fsimple; Opus for frontier difficulty. Measure, don't assume.\n2. **Write a strong system prompt.** Detailed, structured, with the stable context up front for caching:\n   ```python\n   response = client.messages.create(\n       model=\"claude-sonnet-4-5\",\n       max_tokens=1024,\n       system=[\n           {\"type\": \"text\", \"text\": SYSTEM_PROMPT,\n            \"cache_control\": {\"type\": \"ephemeral\"}},\n           {\"type\": \"text\", \"text\": long_reference_doc,\n            \"cache_control\": {\"type\": \"ephemeral\"}},\n       ],\n       messages=[{\"role\": \"user\", \"content\": question}],\n       temperature=0,\n   )\n   ```\n3. **Cache aggressively.** System prompt + reference docs + few-shots as cached prefixes; only the final user message varies. Watch the cache hit rate in usage stats.\n4. **Design tools well.** JSON schemas with descriptions; `tool_choice` forced where the workflow requires; handle `tool_use` → execute → `tool_result` loop, with iteration caps.\n5. **Use thinking for hard problems.** Enable with a token budget on reasoning-heavy tasks; stream thinking summaries for UX; keep raw traces internal.\n6. **Stream everything interactive.** SSE with proper delta assembly for text, thinking, and tool JSON.\n7. **Batch offline work.** 50% off for non-urgent bulk jobs.\n8. **Monitor and evaluate.** Token usage by cache status (creation vs hits), latency, tool-call success rates; evals on every prompt change.\n\n## Common pitfalls\n\n- **No prompt caching** — paying full price on repeated long contexts; cache stable prefixes (90% read discount).\n- **Unstable prompt order** — varying content before stable content breaks caching; stable first, query last.\n- **Wrong tier** — Opus for trivial tasks or Haiku for hard reasoning; match tier to difficulty.\n- **Thinking without budget discipline** — unbounded reasoning tokens; budget explicitly.\n- **Exposing raw thinking** — internal reasoning traces to users; summaries instead.\n- **Tool result mishandling** — wrong block structure in multi-turn tool loops; follow the tool_use\u002Ftool_result contract exactly.\n- **Streaming assembly bugs** — partial tool JSON; accumulate deltas correctly.\n- **Ignoring `max_tokens`** — it's required; set deliberately per task (and it caps thinking+output).\n- **No version pinning** — unpinned `anthropic-version`; upgrades breaking production.\n- **Uncapped agentic loops** — tool-use iterations without limits; cap and add circuit breakers.\n- **Long-context stuffing** — 200K tokens when retrieval + caching would do; economics matter.\n- **No evals on prompt changes** — system prompt edits by feel; golden sets.\n- **Secrets in prompts** — beyond your threat model; scope what enters the context.\n","## Overview\n\nThe Anthropic API exposes Claude models via the Messages API: a clean messages-in, message-out interface with best-in-class tool use, prompt caching (the cost story for long contexts), and extended thinking for hard reasoning. Claude's strengths — careful instruction-following, long-context handling, and reliable tool calling — shape how you should use it.\n\nThis skill covers the Messages API properly: message construction, tool use patterns, prompt caching for cost control, extended thinking, and production practices.\n\n## When to use\n\n- Calling the Claude Messages API.\n- Implementing tool use (function calling).\n- Reducing costs with prompt caching.\n- Using extended thinking for complex reasoning.\n- Streaming responses with tool use.\n- Choosing between Claude models (Opus\u002FSonnet\u002FHaiku).\n- Migrating from OpenAI-style APIs.\n\n## Core concepts\n\n- **Messages API.** `POST \u002Fv1\u002Fmessages`: `model`, `max_tokens` (required), `system`, `messages` (user\u002Fassistant turns). Stateless — you manage conversation history. Clean and explicit; no legacy baggage.\n- **Model tiers.** Opus (frontier capability), Sonnet (the workhorse — intelligence per dollar), Haiku (fast\u002Fcheap for simple tasks). Sonnet is the default choice; Opus for the hardest problems; Haiku for high-volume simple work.\n- **System prompts.** Separate `system` parameter (not a message) — supports caching and keeps instruction hierarchy clean. Long, detailed system prompts are where Claude shines; invest in them.\n- **Tool use.** `tools` with JSON-schema `input_schema`; the model returns `tool_use` blocks, you return `tool_result` blocks. Claude's tool calling is among the most reliable — but tool design still matters: clear names\u002Fdescriptions, narrow scope, useful errors.\n- **Forced tool choice.** `tool_choice: {\"type\": \"tool\", \"name\": \"...\"}` forces a specific tool; `{\"type\": \"any\"}` requires some tool; `auto` lets the model decide. Force tools when the workflow demands it (extraction, classification).\n- **Prompt caching.** Mark stable prefixes (system prompt, long context, few-shots) with `cache_control: {\"type\": \"ephemeral\"}` — cache writes cost extra once, reads cost ~90% less. The economics of long-context RAG\u002Fagents depend on this. Structure prompts: stable content first, varying query last.\n- **Extended thinking.** `thinking: {\"type\": \"enabled\", \"budget_tokens\": N}` — the model reasons in a separate thinking block before answering; interleaved thinking with tools for agentic reasoning. Budget thinking tokens like any other cost; expose summaries, not raw traces, to users.\n- **Streaming.** SSE streams with `message_start`, `content_block_delta`, `message_stop` events; thinking blocks and tool-use JSON stream as deltas. Assemble carefully — tool input JSON arrives in pieces.\n- **Temperature.** Same semantics as elsewhere; 0-1 range typical. Low for deterministic work; the default 1 is fine for open-ended.\n- **Long context.** 200K+ token windows — Claude handles long contexts well, but \"can\" ≠ \"should\": retrieval + caching usually beats stuffing everything in. Cache the stable corpus, vary the question.\n- **Vision.** Image inputs (base64 or URL) in message content blocks — document understanding, screenshots, diagrams. Downscale huge images; multi-image reasoning works but costs.\n- **Batch API.** 50% discount for async workloads — evaluations, bulk processing. Same pattern as elsewhere: patience pays.\n- **Headers and versioning.** `anthropic-version` header pins the API version; `x-api-key` auth. Pin versions in production; test upgrades deliberately.\n- **Error handling.** 429 (rate limit — backoff), 529 (overloaded — retry), 400 (invalid request — fix the payload), credit balance errors. Distinguish retryable from fatal.\n- **Safety.** Claude's constitutional training helps, but validate outputs for consequential actions; human-in-the-loop for irreversible tool calls; no sensitive data beyond your threat model.\n\n## Practical workflow\n\n1. **Pick the tier.** Sonnet default; Haiku for volume\u002Fsimple; Opus for frontier difficulty. Measure, don't assume.\n2. **Write a strong system prompt.** Detailed, structured, with the stable context up front for caching:\n   ```python\n   response = client.messages.create(\n       model=\"claude-sonnet-4-5\",\n       max_tokens=1024,\n       system=[\n           {\"type\": \"text\", \"text\": SYSTEM_PROMPT,\n            \"cache_control\": {\"type\": \"ephemeral\"}},\n           {\"type\": \"text\", \"text\": long_reference_doc,\n            \"cache_control\": {\"type\": \"ephemeral\"}},\n       ],\n       messages=[{\"role\": \"user\", \"content\": question}],\n       temperature=0,\n   )\n   ```\n3. **Cache aggressively.** System prompt + reference docs + few-shots as cached prefixes; only the final user message varies. Watch the cache hit rate in usage stats.\n4. **Design tools well.** JSON schemas with descriptions; `tool_choice` forced where the workflow requires; handle `tool_use` → execute → `tool_result` loop, with iteration caps.\n5. **Use thinking for hard problems.** Enable with a token budget on reasoning-heavy tasks; stream thinking summaries for UX; keep raw traces internal.\n6. **Stream everything interactive.** SSE with proper delta assembly for text, thinking, and tool JSON.\n7. **Batch offline work.** 50% off for non-urgent bulk jobs.\n8. **Monitor and evaluate.** Token usage by cache status (creation vs hits), latency, tool-call success rates; evals on every prompt change.\n\n## Common pitfalls\n\n- **No prompt caching** — paying full price on repeated long contexts; cache stable prefixes (90% read discount).\n- **Unstable prompt order** — varying content before stable content breaks caching; stable first, query last.\n- **Wrong tier** — Opus for trivial tasks or Haiku for hard reasoning; match tier to difficulty.\n- **Thinking without budget discipline** — unbounded reasoning tokens; budget explicitly.\n- **Exposing raw thinking** — internal reasoning traces to users; summaries instead.\n- **Tool result mishandling** — wrong block structure in multi-turn tool loops; follow the tool_use\u002Ftool_result contract exactly.\n- **Streaming assembly bugs** — partial tool JSON; accumulate deltas correctly.\n- **Ignoring `max_tokens`** — it's required; set deliberately per task (and it caps thinking+output).\n- **No version pinning** — unpinned `anthropic-version`; upgrades breaking production.\n- **Uncapped agentic loops** — tool-use iterations without limits; cap and add circuit breakers.\n- **Long-context stuffing** — 200K tokens when retrieval + caching would do; economics matter.\n- **No evals on prompt changes** — system prompt edits by feel; golden sets.\n- **Secrets in prompts** — beyond your threat model; scope what enters the context.\n",{"name":5,"category":24,"description":7},"development","main","af388a77c2fe5e0b4fd879cca4300a0ffa9a6579","skills\u002Fams-anthropic-api-pro",1,"https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis","https:\u002F\u002Fgithub.com\u002FTanNhatCMS","https:\u002F\u002Fmrkiet.name.vn","2026-11-07 14:23:08",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add TanNhatCMS\u002Fjarvis --skill anthropic-api-pro",{"tool":39,"command":40},"bunx","bunx skills add TanNhatCMS\u002Fjarvis --skill anthropic-api-pro",{"tool":42,"command":43},"pnpm","pnpm dlx skills add TanNhatCMS\u002Fjarvis --skill anthropic-api-pro","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fams-anthropic-api-pro\u002FSKILL.md",true,[],[48,55,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7EWYJR0J8DARY7E59Z6Y9MV","web-scrape","Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open\u002Ffetch fails on JS-heavy pages, or when you need clean markdown\u002Fstructured extraction from a site. Requires FIRECRAWL_API_KEY.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fweb-scrape\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":59,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7EWYBN5P6F2AJG3FR24T9BP","design-taste-frontend","tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML\u002FCSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, \"AI-made\", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Ftaste-design\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7EWY8FQFNQ2GB7NZZWGSSDX","test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-tdd\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7EWY5SHBFRH1HDHVWM9K7TV","systematic-debugging","Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-debugging\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7EWY3NM0Z0JAKS7HDZ24K66","requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-code-review\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7EWY0WRMWX4M9ZFY0WKC593","brainstorming","You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).","https:\u002F\u002Fgithub.com\u002FTanNhatCMS\u002Fjarvis\u002Fblob\u002Fmain\u002Fskills\u002Fsuperpowers-brainstorming\u002FSKILL.md",[],[]]