Skill: backend/integration-adapter
Purpose
Integrate with an external service via a dedicated adapter that enforces:
- timeouts
- retry policy
- idempotency where applicable
- error mapping into shared taxonomy
- observability (logs/metrics/traces) consistent with repo standards
This skill prevents “HTTP calls sprinkled everywhere.”
Inputs
- External API/service name + base URL (or SDK)
- Required operations (list)
- Auth mechanism (token, key, oauth) WITHOUT secrets
- Expected failure cases (timeouts, rate limits, invalid responses)
- Repo profile (preferred):
<repo>/REPO_PROFILE.json
Outputs
- Adapter module with a narrow interface
- Retry/timeout configuration
- Error mapping to shared taxonomy
- Contract tests or mocks (preferred)
- Minimal observability instrumentation
Non-goals
- Implementing domain rules (use
backend/domain-logic-module) - Building orchestration/jobs (use
backend/job-worker-orchestration) - Storing secrets in code
Workflow
- Create adapter boundary:
ExternalServiceClientor module functions
- Implement calls with:
- explicit timeouts
- bounded retries (with backoff) where safe
- idempotency keys when supported/needed
- Normalize errors:
- map external errors to internal taxonomy
- Add contract tests/mocks:
- validate request construction
- validate response parsing and error handling
- Add basic observability:
- correlation id propagation if present
- Run validations per profile.
Checks
-
Adapter is the only place external calls exist for this integration
-
Timeouts are explicit
-
Retry policy is bounded and safe (no infinite loops)
-
If retries, backoff, rate limiting, or multi-step external workflows are introduced,
-
recommend
system/state-machine-mapperto model external interaction states explicitly. -
Errors map to internal taxonomy
-
Tests cover:
- success
- timeout or retry scenario
- bad response parsing
Failure modes
- Retry safety unclear → default to no retry and document why.
- Rate limits encountered → add backoff and respect headers if available.
- External contract unstable → increase mocking/contract tests and tighten parsing.
- Retry/backoff logic added without explicit state modeling →
require
system/state-machine-mapperbefore shipping.
Telemetry
Log:
- skill:
backend/integration-adapter - service:
<name> - retries:
none | bounded - timeout