# Resilience

> Use when configuring Resilience4j circuit breakers, retries, rate limiters, and fallback strategies for external integrations.

- Skill: `sahilkhan30/resilience` (Agent Skill)
- Install (CLI): `npx skillmds@latest add sahilkhan30/resilience`
- Raw SKILL.md: https://api.skillmd.com/api/skills/sahilkhan30/resilience/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: SahilKhan30 (https://skillmd.com/u/sahilkhan30)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/sahilkhan30/resilience

---


# Platform Resilience & Fallback Handling Skill

## Purpose
Standardize fault tolerance, circuit breaking, retry policies, and ambiguous failure modeling across external payment gateways and integrations.

---

## 1. Rules of Engagement

### MANDATORY
- **MUTATING RETRY SAFETY RULE**: Never blindly retry a financially mutating external operation (e.g. payment initiation, charge, refund).
  - Apply `@Retry` ONLY when:
    1. The downstream endpoint explicitly guarantees idempotency support, OR
    2. The operation is strictly read-only / idempotent by HTTP semantics.
- **FAILURE TRIAGE MODEL**: Financial integrations MUST explicitly distinguish between three outcome states:
  1. **Business Failure**: Downstream explicitly rejected payment (e.g. `INSUFFICIENT_FUNDS`, `CARD_EXPIRED`). Status -> `FAILED`.
  2. **Technical Failure**: Integration call failed before execution (e.g. DNS failure, HTTP 400). Status -> `REJECTED`.
  3. **Unknown Outcome**: Request timed out after transmission (e.g. HTTP 504 Gateway Timeout). Status -> `PENDING_VERIFICATION` / `UNKNOWN`. *(Do NOT immediately fail or retry!)*

---

## 2. Circuit Breaker Configuration Pattern

```yaml
resilience4j.circuitbreaker:
  instances:
    gatewayService:
      slidingWindowSize: 20
      minimumNumberOfCalls: 5
      failureRateThreshold: 50
      waitDurationInOpenState: 10000ms
```

