Anthropic Best Practices for Claude: A Working Guide
Anthropic publishes guidance on how to get reliable, cost-effective results from Claude, but it's scattered across docs, cookbooks, and prompt engineering guides. If you're trying to build something real — a support bot, a content pipeline, an internal tool — you need the practical subset: what actually moves the needle in prompt design, request structure, and production reliability.
This article pulls together the best practices that matter most once you move past "hello world" and into shipping something people depend on. It covers prompting technique, system prompts, structured output, tool use, and the operational side (rate limits, retries, cost control) that Anthropic's docs mention but don't always emphasize.
Prompting: be explicit, not clever
Claude follows instructions closely, which means vague prompts produce vague results. The single biggest improvement most people can make is writing prompts that state:
- The exact task, not a paraphrase of it
- The desired output format (JSON, markdown, plain text, a specific schema)
- Constraints (length, tone, what to exclude)
- Examples of correct output when the format is non-trivial
A prompt like "summarize this" gives you an unpredictable summary. "Summarize this in exactly 3 bullet points, each under 20 words, focused on financial risk" gives you something you can build a pipeline around.
Few-shot examples work better than long explanations. If you want a specific output shape, show Claude two or three input/output pairs instead of describing the shape in prose. This is especially true for classification, extraction, and formatting tasks.
Use the system prompt for role and constraints
The system prompt is where persistent instructions belong — role, tone, output rules, things that shouldn't change between turns. Keep user-turn messages focused on the actual request. Mixing role definitions into every user message wastes tokens and makes prompts harder to maintain.
{
"system": "You are a technical support assistant for a SaaS billing API. Answer only questions about billing, invoices, and API keys. If asked anything else, say you can't help with that. Keep answers under 150 words.",
"messages": [
{ "role": "user", "content": "Why was my card declined?" }
]
}
This separation also makes it easier to version and test your instructions independently of user input.
Ask for structured output when you need to parse it
If your application parses Claude's response programmatically, don't rely on the model to "just format it nicely." Be explicit about structure, and validate what comes back:
- Ask for JSON with a defined schema, and describe every field
- Tell Claude what to do when a field has no value (empty string,
null, omit it) - Parse defensively — wrap JSON parsing in try/catch and have a fallback path
For anything beyond simple text generation, structured output plus validation is more reliable than string-matching a natural-language response.
Give Claude room to reason before answering
For tasks involving multi-step logic — math, planning, debugging — asking Claude to think through the problem before giving a final answer generally improves accuracy. This doesn't require special syntax; instructing the model to reason step by step and then state a final answer is often enough. If you don't need the reasoning shown to the end user, ask for it to be wrapped in a section you can strip out before display.
Handle tool use deliberately
If you're using Claude's tool-calling capability, the best practice is to give tools clear, narrow descriptions and let Claude decide when to call them rather than trying to force a specific sequence through prompting alone. Ambiguous tool descriptions are the most common cause of wrong or missed tool calls. Name parameters clearly, describe expected types, and keep the number of available tools per request reasonable — too many similar tools increases the chance Claude picks the wrong one.
Production reliability: retries, rate limits, and cost
Anthropic's guidance (and just general API hygiene) covers a few things worth building into any production integration from day one:
- Retry with backoff on 429 and 5xx responses instead of failing immediately
- Set
max_tokensdeliberately — don't leave it unbounded, or a single request can run longer and cost more than expected - Cache or reuse system prompts where possible to reduce repeated token cost on long, static instructions
- Log usage per request so you can trace cost and behavior back to specific features or customers, not just aggregate totals
This last point matters more as usage scales. If you're running Claude behind a product with multiple features, teams, or paying customers, you need per-key visibility, not just a single account-level bill. That's the specific problem SubToAPI solves — it turns your Claude access into an HTTPS API with separate application keys (sub_live_...) per feature or team, streaming support, tool use, and usage metadata broken down per key, all from one dashboard. See the quickstart to get a key running in a few minutes, or check pricing if you're evaluating it for a team.
Test prompts like you test code
Prompt behavior can shift when you change wording, add examples, or upgrade model versions. Treat your prompts as something to version-control and test against a fixed set of inputs before deploying changes. A small regression suite — a handful of representative inputs with expected output patterns — catches most prompt regressions before they reach users.
Keep instructions current, not accumulated
It's common for system prompts to grow over months as edge cases get patched with "also, don't do X" additions. Periodically review and consolidate — a shorter, well-organized system prompt usually outperforms a long one with contradictory or redundant instructions layered on top of each other.
Questions
What's the single most impactful best practice for using Claude? Being explicit about output format and constraints. Most inconsistent results trace back to ambiguous instructions rather than model limitations.
Should I put instructions in the system prompt or the user message? Persistent rules — role, tone, format, constraints — belong in the system prompt. Task-specific content belongs in the user message. This keeps prompts maintainable and easier to test.
How do I keep Claude API costs predictable in production? Set explicit max_tokens, cache static system prompts where possible, and track usage per feature or per key rather than only at the account level — tools like SubToAPI make this per-key breakdown straightforward.