Promptles
Errors

Specify Error Handling for APIs

APIs fail: tell Claude what to do when they do.

External APIs fail. Tell Claude what to do when a request times out, returns a 429 (rate limit), or sends back malformed data. Without explicit instructions, Claude writes the happy path and your automation silently breaks at 2 AM. Even a simple 'retry up to 3 times with a 1-second delay, then log the error and skip the record' is enough to make the difference between a robust script and a fragile one.

Where you'll practice this

2 Promptles scenarios teach this principle directly. Each one drops you into a real engineering ticket and asks you to write the prompt you'd send to Claude Code.

  • The API Rate Limiter

    You have a CSV file `companies.csv` with 2,000 company names. You want a Python script called `enrich.py` that calls the Clearbit Company API (`GET https://company.clearbit.com/v2/companies/find?domain={domain}`) for each company to get enrichment data (industry, employee count,…

  • The Bulk Updater

    You need a Python script called `update_prices.py` that reads a CSV file `price_updates.csv` (columns: `product_id`, `new_price`) and updates each product via your REST API at `PATCH /api/products/{product_id}` with a JSON body `{"price": new_price}`. Before updating, the script…

Other principles in Errors