Skip to main content
Technology & EngineeringAPI Integration97 lines

Ambiguous API Write Recovery

Recover a timed-out or interrupted external API write using exact operation evidence and provider-specific retry guarantees. Use after an uncertain attempt, rather than for general retry-loop design or duplicate-load testing.

Quick Summary5 lines
Produce a defensible outcome for one already-authorized operation: confirmed
applied, confirmed not applied, or unresolved. A timeout, lost response, expired
local lease, or worker restart does not establish which outcome occurred.
skilldb get api-integration-skills/ambiguous-write-recoveryFull skill: 97 lines
Paste into your CLAUDE.md or agent config

Ambiguous API Write Recovery

Produce a defensible outcome for one already-authorized operation: confirmed applied, confirmed not applied, or unresolved. A timeout, lost response, expired local lease, or worker restart does not establish which outcome occurred.

Preserve the attempt

Identify the provider, API version, HTTP method, content type, account or tenant, original request payload, payload digest, client operation ID, original idempotency key if any, remote resource or operation ID, and send/checkpoint times. Keep credentials and private payloads out of shared evidence. A payload hash checks equality; it is not a provider-supported operation identifier.

Keep the uncertain attempt and its original approval intact. Inspect retrying workers and SDK defaults before adding another sender. If code changes are in scope, use the existing durable claim and conditional update mechanism so two recovery workers cannot independently overwrite the result. A local lock alone cannot prevent a remote duplicate after a crash. Before any permitted retry, persist the original operation identity, payload revision and final-send marker durably; do not send if that checkpoint cannot be saved. If the provider succeeds but saving its receipt fails, preserve the uncertain attempt and reconcile it again. A local persistence failure does not reverse the external effect. Never place the external write inside a database transaction callback that may automatically rerun.

Read the applicable provider contract

Verify the actual endpoint and version, key scope, payload comparison, retention window, in-progress behavior, and result lookup method. Do not invent a universal idempotency header or retention duration. HTTP semantics distinguishes a retryable operation from an arbitrary non-idempotent request; the absence of a response is not evidence that a write never happened.

Provider guarantees differ. For example, Stripe's idempotency reference distinguishes API v1's cached result, including an execution-time error, from API v2's completion behavior. Check the applicable version instead of treating every 500 as a fresh attempt. AWS's retry design discussion explains why caller identity, original intent, changed parameters and late requests matter. Neither source grants another provider the same guarantees.

Reconcile before deciding to send

Prefer the provider's documented read-only operation or resource lookup using the original identifiers. Confirm account ownership and operation identity, then compare the relevant immutable request fields. Similar copy, timestamps, or filenames alone do not identify an attempt. A successful HTTP lookup proves only that the lookup completed; inspect the returned operation state.

An empty search, partial page, permission-filtered result, deleted object or eventually consistent 404 is not proof of non-execution. Follow documented pagination and bounded status polling where relevant. If lookup is unavailable or inconclusive, retain that uncertainty rather than converting it to failure.

EvidenceRecovery action
Exact owned operation confirms the intended effectPersist its receipt against the same attempt; do not resend
Authoritative contract and evidence establish that execution never beganRecord that finding; a new attempt may follow the existing authorization and review process
Original attempt is still runningPoll its documented status within a deadline; do not start a competing operation
Outcome unknown, with a documented retry guarantee still valid for this exact attemptAn authorized retry can reuse the original key, original payload, account and endpoint; retain its result under the same attempt
Guarantee absent, expired, or incompatible with the stored requestKeep the attempt unresolved and explain the specific evidence needed; no automatic resend

Never generate a fresh key to escape an uncertain result, clear its receipt to unlock a retry, or edit the payload under the old approval. Reusing a key after its retention window may create a new operation. A parameter mismatch requires investigation, not a replacement key. If a permitted retry is also inconclusive, stop at the documented recovery boundary; do not turn it into an unbounded loop. Changing the destination or intended effect requires the normal new-operation review. Recovery does not authorize deletion, compensation or another account.

Verify the recovery behavior

Use an isolated provider fixture or authorized sandbox with an observable side-effect counter. Exercise a committed write whose response was lost, a valid same-key replay, an expired key, an inconclusive lookup and a mismatched account. Check external effects and request history, not just the client's returned text. The lost-response case should recover the exact receipt without a second write; the supported replay may issue another request but must preserve one effect. Unsafe cases must retain uncertainty without a new mutation. For the negative control, use a separate resettable fixture with explicit authorization to create duplicate effects. Disable deduplication or expire its key, inject a blind retry, and require the duplicate-effect assertion to fail. Do not run that control on the incident being recovered.

Record the tested environment, provider contract/version, original-attempt reference, evidence timestamp, outcome, reason, requests made, and observed effect count. Separate lookup time from original execution time. State which real-provider, concurrency and crash behaviors remain untested. A fixture pass does not prove production delivery or improvement across arbitrary agents.

Install this skill directly: skilldb add api-integration-skills

Get CLI access →

Related Skills

API Documentation

Craft clear, accurate, and user-friendly API documentation that empowers developers to integrate with your services quickly and efficiently. This skill covers structuring content, providing executable examples, and maintaining accuracy. Activate this skill when you are designing or updating documentation for a new or existing API, or when seeking to improve developer experience and adoption.

API Integration•78L

API Gateway Patterns

Architect and implement robust API Gateway patterns to manage, secure, and scale your microservices APIs effectively. This skill guides you through crucial patterns like BFF, API Composition, and Caching, enabling you to optimize client-server interactions and enhance operational resilience. Activate this skill when designing a new API architecture, optimizing an existing microservices gateway, or addressing challenges related to API security, performance, or service orchestration.

API Integration•88L

API Monitoring

Effectively implement and manage robust API monitoring strategies to ensure the availability, performance, and correctness of your API integrations. This skill guides you through proactive detection, deep diagnostics, and actionable alerting across your API ecosystem. Activate this skill when designing new API architectures, troubleshooting existing integrations, or optimizing the reliability and user experience of your services.

API Integration•78L

API Rate Limiting

Master strategies for interacting with external APIs while respecting their rate limits, ensuring your applications remain compliant and robust. This skill teaches you how to prevent `429 Too Many Requests` errors, implement intelligent retry mechanisms, and optimize your API consumption. Activate this skill when you are integrating with third-party APIs, designing resilient data pipelines, or troubleshooting connection stability issues due to excessive requests.

API Integration•101L

API Security

Master the principles and practices for securing your APIs against common threats, ensuring data integrity, confidentiality, and availability. This skill guides you in implementing robust authentication, authorization, and data protection mechanisms. Activate this skill whenever you are designing, developing, or auditing an API, or when assessing potential vulnerabilities in existing integrations.

API Integration•79L

API Testing

Master the comprehensive validation of API functionality, reliability, performance, and security. This skill covers strategic approaches to ensure your APIs consistently meet their contractual obligations and provide a robust integration experience. Activate this skill when developing new APIs, integrating third-party services, diagnosing API issues, or establishing continuous quality assurance for your microservices.

API Integration•73L