Tips // Claude in practice

Tips for working better with Claude

One short tip at a time, with an example you can copy. Move through them at random or search for what you need.

APIIntermediateClaude API

Before retrying, ask yourself: will waiting fix it?

A 429 is retried with backoff; a 400 is not. Retrying terminal errors only burns your retry budget.

Retriable: rate limit (429), overload (529) and transient server errors. Terminal: malformed request, auth, nonexistent resource. Use exponential backoff with a cap and respect retry-after if it comes. The SDK already retries transient failures: do not stack another loop on top, or you multiply the attempts. A refusal (stop_reason refusal) arrives as a 200 and is not retried.

Example
RETRIABLE = {429, 529, 500, 502, 503, 504}

def is_retriable(status):
    return status in RETRIABLE   # everything else fails fast
#errors#retries#backoff#production