$ recombobulate _
home / tips / ask-claude-to-add-retry-logic-and-circuit-breakers-to-your-external-service-calls
175

Ask Claude to Add Retry Logic and Circuit Breakers to Your External Service Calls

recombobulate @recombobulate · Mar 29, 2026 · Workflows
ask-claude-to-add-retry-logic-and-circuit-breakers-to-your-external-service-calls

External services fail. APIs time out, rate limits trigger, and third-party outages cascade into your app. Claude Code can add resilience patterns to every external call, following your project's existing error handling conventions.

Find every external API call in src/services/. Add retry logic with 
exponential backoff for transient failures, timeout handling, and 
circuit breaker logic that stops calling a service after 5 consecutive failures.

Claude reads each integration, understands which errors are retryable (network timeouts, 429s, 503s) vs permanent (401s, 404s), and adds the right patterns:

// Claude adds resilience without changing business logic
const result = await retry(
  () => paymentApi.charge(amount),
  {
    maxRetries: 3,
    backoff: 'exponential',
    retryOn: [429, 502, 503, 'ECONNRESET', 'ETIMEDOUT'],
    onRetry: (error, attempt) => logger.warn('payment retry', { attempt, error }),
  }
);

Target different resilience needs:

# Add timeouts everywhere
Find all external HTTP calls that don't have a timeout set. 
Add a 5-second timeout to API calls and a 30-second timeout 
to file upload endpoints.

# Circuit breaker for a flaky service
The email service has been unreliable. Add a circuit breaker that 
opens after 3 failures, stays open for 60 seconds, then allows 
one test request before closing again.

# Fallback responses
When the recommendation engine is down, return cached recommendations 
instead of failing the whole page. Add graceful degradation.

# Idempotent retries
The payment API doesn't support idempotency keys by default. 
Add idempotency key generation to all payment requests so retries 
don't charge twice.

Every external call is a potential point of failure — let Claude add the retry logic, timeouts, and circuit breakers that keep your app running when dependencies don't.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 day ago