claude-api
Build with Claude Messages API using structured outputs for guaranteed JSON schema validation. Covers prompt caching (90% savings), streaming SSE, tool use, and model deprecations. Prevents 16 documented errors. Use when: building chatbots/agents, troubleshooting rate_limit_error, prompt caching issues, streaming SSE parsing errors, MCP timeout issues, or structured output hallucinations.
npx skills add majiayu000/claude-skill-registry --skill claude-api-brendadeeznuts1111-tier-1380-omega --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Guides using Claude Messages API to enforce structured outputs with guaranteed JSON schema conformance, supports prompt caching, streaming SSE, tool use, and handling model deprecations. Indicates when to use for chatbot/agent building and troubleshooting rate limits, caching, streaming parsing, MCP timeouts, or structured output hallucinations.
How it works
Describes:
- Structured outputs with output_format of type json_schema and optional strict tool use blocks to ensure parameter schemas.
- Pre-warming and caching of large content blocks, with cache_control markers placed on the last content block to enable 90% cost savings.
- Tool use via strict tool definitions, where each tool block includes name, description, input_schema, and strict: true to guarantee schema compliance; tool results must reference the corresponding tool_use block id via tool_use_id and content is JSON stringified results; errors during tool execution are returned as tool_result blocks with is_error when needed.
- Streaming responses via SSE with error listeners and fallback handling, plus guidance that errors may occur after the initial 200 response.
- Semantic validation steps to verify that, while JSON is structurally valid, semantic correctness must be checked (e.g., emails, ages).
- Prompt caching details including token minimums per model, TTL, and cross-content cache sharing rules; caveats about AWS Bedrock limitations.
- Rate limit handling patterns, including exponential backoff respecting retry-after headers, and headers listed for rate limits.
- Error handling mappings for common API errors and specific guidance for streaming and prompts.
When to use it
Use when building chatbots/agents with Claude, when troubleshooting rate_limit_error, prompt caching issues, streaming SSE parsing errors, MCP timeout issues, or structured output hallucinations.
What it can touch
Describes that the skill interacts with the Claude API client (@anthropic-ai/sdk) and uses blocks such as output_format with json_schema, strict tool blocks, and cache_control. It references tool definitions, stream handling, and error event listeners. It includes code patterns for constructing messages, handling tool results, and sanitizing tool results (e.g., Unicode edge cases).
Caveats
Notes limitations: structured outputs guarantee only formatting, not accuracy; several model deprecations and beta features; prompts indicate 24-hour grammar cache; no recursive JSON schemas; limited regex; caching does not work for Claude 4 family on AWS Bedrock; deprecation of direct .parsed access in newer SDKs; several breaking changes in model lineup and beta features.
# Claude API - Structured Outputs & Error Prevention Guide **Package**: @anthropic-ai/sdk@0.71.2 **Breaking Changes**: Oct 2025 - Claude 3.5/3.7 models retired, Nov 2025 - Structured outputs beta **Last Updated**: 2026-01-09 --- ## What's New in v0.69.0+ (Nov 2025) **Major Features:** ### 1. Structured Outputs (v0.69.0, Nov 14, 2025) - CRITICAL ⭐ **Guaranteed JSON schema conformance** - Claude's responses strictly follow your JSON schema with two modes. **⚠️ ACCURACY CAVEAT**: Structured outputs guarantee format compliance, NOT accuracy. Models can still hallucinate—you get "perfectly formatted incorrect answers." Always validate semantic correctness (see below). **JSON Outputs (`output_format`)** - For data extraction and formatting: ```typescript import Anthropic from '@anthropic-ai/sdk'; const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, }); const message = await anthropic.messages.create({ model: 'claude-sonnet-4-5-20250929', max_tokens: 1024, messages: [{ role: 'user', content: 'Extract contact info: John Doe, john@example.com, 555-1234' }], betas: ['structured-outputs-2025-11-13'], output_format: { type: 'json_schema', json_schema: { name: 'Contact', str
- What's New in v0.69.0+ (Nov 2025)
- 1. Structured Outputs (v0.69.0, Nov 14, 2025) - CRITICAL ⭐
- 2. Model Changes (Oct 2025) - BREAKING
- 3. Context Management (Oct 28, 2025)
- 4. Agent Skills API (Oct 16, 2025)
- Streaming Responses (SSE)
- Prompt Caching (⭐ 90% Cost Savings)
- Tool Use (Function Calling)
- Vision (Image Understanding)
- Extended Thinking Mode
- Rate Limits
- Error Handling
- Known Issues Prevention
- Issue #1: Rate Limit 429 Errors Without Backoff
What does the claude-api skill do?
Build with Claude Messages API using structured outputs for guaranteed JSON schema validation. Covers prompt caching (90% savings), streaming SSE, tool use, and model deprecations. Prevents 16 documented errors. Use when: building chatbots/agents, troubleshooting rate_limit_error, prompt caching issues, streaming SSE parsing errors, MCP timeout issues, or structured output hallucinations.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill claude-api-brendadeeznuts1111-tier-1380-omega --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
