integrate-external-serviceslisted
Install: claude install-skill kennguyen887/agent-foundation
# Integrate external services
Integrating systems you don't own — calling vendor APIs, receiving their webhooks, and exposing a
partner/public edge. Examples NestJS/TS, neutral domain; vendors are "Provider A/B", "the payment
gateway", "the identity provider". principle → **▸ Example** → **▸ Other stacks**. For calls between
your own services (RPC, fan-out, cross-service reads), see `integrate-internal-services`.
## Core principle
**An external system is untrusted and unreliable.** Wrap it behind an interface you own (so it's
swappable and your domain never speaks vendor-ese), make every outbound call resilient (timeout +
retry + circuit breaker), and treat every inbound call (webhook, partner request) as hostile until
verified. Never let a vendor's schema, downtime, or duplicate delivery leak into your core.
## 1. Anti-corruption adapter — one interface, many providers
- **Wrap each external system behind a domain interface your code owns.** Each vendor gets an impl
that translates vendor schema ↔ your DTOs and vendor errors → your errors. A **factory/registry**
selects the impl by provider type; callers depend on the interface, never on a vendor SDK.
```ts
export interface PaymentGateway {
getProvider(): ProviderType;
createPayment(input: CreatePaymentInput): Promise<PaymentResult>; // your DTOs, not the vendor's
refund(input: RefundInput): Promise<RefundResult>;
}
// providers/index.ts barrels StripeGateway, RapydGateway, CyberSourceGateway, Uo