// 60 tips tagged "api"
Instead of describing what code should do, show Claude what it should produce — paste the expected JSON response, HTML output, CLI table, or email template and Claude works backwards to write the code that generates it. The output IS the spec, and there's no room for misinterpretation.
When API docs give you a working cURL example, paste it into Claude and it converts it into proper code for your language — a typed HTTP request with headers, authentication, request body, response parsing, and error handling, ready to drop into your codebase instead of shelling out to curl.
Hand-maintained API docs always drift from reality. Tell Claude to read your routes, controllers, validation rules, and response shapes, then generate an OpenAPI specification that matches what the code actually does — accurate paths, parameters, request bodies, response schemas, and status codes.
MCP servers aren't just for third-party integrations — you can build your own to give Claude direct access to your internal tools, databases, APIs, and workflows. A custom MCP server turns any system your team uses into a tool Claude can call natively from your session.
Tell Claude to add /health and /ready endpoints that check your app's vital signs at runtime — database connectivity, Redis availability, queue worker status, disk space, and external service reachability — so load balancers and monitoring tools know when something breaks.
When you're integrating with a third-party API — Stripe, Twilio, SendGrid, or any REST service — tell Claude to build a clean client wrapper with typed methods, error handling, retries, and response mapping, so the rest of your code never touches raw HTTP calls.
When Claude needs to implement something from a library or API it might not know well, paste the documentation URL — Claude fetches and reads the page, then writes code that follows the actual docs instead of guessing from training data that might be outdated.
Tell Claude to read your routes, controllers, request validation, and response structures, then generate a complete OpenAPI (Swagger) specification — every endpoint, parameter, request body, response shape, and auth requirement, derived from the code itself.
Tell Claude which webhook provider you're integrating — Stripe, GitHub, Twilio, or any other — and it reads the docs, builds the handler with signature verification, idempotent event processing, and proper retry handling so you never miss or double-process an event.
Tell Claude to read your API response classes, TypeScript interfaces, or actual response data and generate JSON Schema definitions — for API documentation, contract testing, runtime validation, and keeping frontend and backend types in sync.
Tell Claude to find every external API call in your code and add resilience — exponential backoff for retries, circuit breakers that stop calling a failing service, timeout handling, and fallback responses so a third-party outage doesn't take your app down with it.
If your app uses AI — classification, summarization, extraction, or generation — use Claude Code to draft the system prompts, write few-shot examples, test edge cases, and iterate until the output is reliable, all before you wire it into your production code.