resilience-patterns
Skill1 starsChanged 12 days agoMITView on GitHub
Make a service behave predictably when its dependencies are slow, failing, or duplicating work. Covers timeouts and deadline propagation, retry with exponential backoff, jitter and retry budgets, circuit breakers, bulkheads, rate limiting and load shedding, fallbacks and graceful degradation, idempotent consumers, the transactional outbox and inbox, saga compensation, and health probes. Use when writing or reviewing any call that leaves the process, when handling a message, or when the user says 'resilience', 'circuit breaker', 'retry', 'timeout', 'cascading failure', 'outbox', 'saga', or 'graceful degradation'. This skill governs runtime failure behaviour — not layering (see clean-architecture), not test design (see test-strategy).
5 other projects use a version of this.
Adopted by
Most recently taken up by
- swadhinbiswas/SKILLStheir own version, first seen Nov 22, 2026
- reddygopalkrishna/developer-agent-skillstheir own version, first seen Nov 8, 2026
- abhisheksharma2411/distributed-systems-skillstheir own version, first seen Aug 27, 2026
- dbtinoy-/lexigram-framework-skillstheir own version, first seen Aug 24, 2026
- tygwan/skillstheir own version, first seen Nov 12, 2025
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- reddygopalkrishna/developer-agent-skills★ 8same name
- abhisheksharma2411/distributed-systems-skills★ 2same name
- dbtinoy-/lexigram-framework-skills★ 1same name
- swadhinbiswas/SKILLS★ 1same name
- tygwan/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-contractsSkill
- api-protocolsSkill
- clean-architectureSkill
- collaborative-judgmentSkill
- config-and-dependenciesSkill
- contract-testingSkill
- cqrs-and-consistencySkill
- data-accessSkill
- design-firstSkill
- design-serviceSkill
- domain-modellingSkill
- idempotency-and-immutabilitySkill
- implement-serviceSkill
- infrastructure-adaptersSkill
- refactor-safelySkill
- review-serviceSkill
- secure-serviceSkill
- service-boundariesSkill
- stack-profileSkill
- test-strategySkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Read .msskills/config.yaml in the repo root.
- Very specific: line 25
No config file or no paths.resilience key → use defaults.
- Distinctive: line 55
FALLBACK DEFINED: When this fails after all protection, what does the caller see — cached data, a partial response, a degraded feature, or …
- Distinctive: line 69
All checks pass → state "Passes resilience: timeout <x>, retry <policy>, breaker <yes/no>, fallback <behaviour>."
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Resilience Patterns
In a single process, a slow function is a performance problem. Across a network, a slow dependency is an outage: threads pile up on the caller, its own callers time out, and the failure walks upstream faster than anyone can page. Most microservice incidents are this, not a crash.
Two rules carry most of the weight: every remote call has a timeout, and every retry has a budget. Retries without a budget are a self-inflicted denial of service on a service that was already struggling.
Config Resolution
- Read
.msskills/config.yamlin the repo root; look uppaths.resilience. - A custom document exists at that path → read its frontmatter
mode:override→ use it alone; ignore the defaults below.overlay(default, or nomodekey) → read defaults first, then apply the custom document's sections on top, matched by exact heading; new sections append.
- A path is configured but no file exists there → say which path is missing, then use the defaults.
- No config file or no
paths.resiliencekey → use defaults. .msskills/stack.mdexists → name that stack's actual library and idiom rather than the generic pattern: the platform's circuit breaker, its retry policy type, its client deadline mechanism, its outbox tooling. Never invent a library; if the profile does not name one, describe the behaviour and say the library choice is open.
Self-Validation Checklist
STOP after writing or reviewing any code that crosses a process boundary — HTTP, gRPC, database, cache, broker, filesystem. Verify every check. Fix failures before presenting.
- TIMEOUT: Does this call have an explicit timeout, shorter than the caller's own deadline? A default of "none" or "60s inherited from the client library" → set one derived from the latency budget.
- DEADLINE PROPAGATION: Is the remaining time budget passed downstream, so work nobody is waiting for is abandoned? If the framework supports it and it is unused → use it.
- RETRY SAFETY: Is the operation idempotent before it is retried? Retrying a non-idempotent write → add an idempotency key first, or do not retry.
- RETRY SHAPE: Does every retry use exponential backoff with jitter, a bounded attempt count, and a budget capping retries as a fraction of total traffic? Fixed-interval or unbounded retries → fix; synchronised retries → add jitter.
- RETRY CLASSIFICATION: Are only retryable failures retried — timeouts, connection errors, 429, 502/503/504? Retrying a 400 or 422 wastes the budget and never succeeds.
- NO NESTED RETRIES: Does more than one layer retry the same logical call? Retries multiply; pick exactly one layer, usually the outermost that still knows the operation is idempotent.
- CIRCUIT BREAKER: Does a call to a dependency that can fail persistently sit behind a breaker with a defined failure threshold, open duration, and half-open probe? If not → add one, or record why this dependency does not need it.
- ISOLATION: Can one slow dependency exhaust the resource pool the whole service shares? If yes → bulkhead it with a separate pool or concurrency limit.
- FALLBACK DEFINED: When this fails after all protection, what does the caller see — cached data, a partial response, a degraded feature, or a clean error? "It throws" is only acceptable if that is the deliberate choice.
- IDEMPOTENT CONSUMER: For a message handler, does redelivery of the same message produce the same result? At-least-once delivery is the norm → deduplicate on message ID or make the effect naturally idempotent.
- NO DUAL WRITE: Does anything write to the database and publish to a broker as two separate operations? → transactional outbox.
- COMPENSATION: For a multi-service workflow, is every step's compensating action defined, and is it itself idempotent and retryable?
- PROBES CORRECT: Does readiness reflect the ability to serve traffic, and liveness only unrecoverable state? A readiness probe that checks a downstream dependency will take the whole fleet out when that dependency blips.
All checks pass → state "Passes resilience: timeout <x>, retry <policy>, breaker <yes/no>,
fallback <behaviour>."
Active Anti-Pattern Scan
Any box you can check is a defect. Fix it before presenting.
- Infinite Timeout: any remote call using the library default → set an explicit one.
- Retry Storm: retries at client, gateway, and service layers compounding → one layer only.
- Synchronised Retry: fixed backoff with no jitter, so every caller returns together → full jitter.
- Unbounded Retry Budget: retries allowed regardless of overall failure rate → cap them as a fraction of traffic and shed when exceeded.
- Retrying the Unretryable: 4xx responses, validation failures, or non-idempotent writes retried → classify before retrying.
- Dual Write: database commit and event publish as separate steps → outbox.
- Fire and Forget: an async publish whose failure is logged and dropped → outbox, or an explicit dead-letter path.
- Missing Dead Letter: a consumer that retries forever on a poison message, blocking the partition → bounded retries, then dead-letter with enough context to replay.
- Cascading Readiness: readiness checking downstream dependencies, so one outage empties every load balancer → readiness reflects this instance only.
- Shared Pool Exhaustion: one connection or thread pool for every dependency → bulkhead the risky ones.
- Silent Fallback: degraded data served as if it were fresh, with no signal to the caller or the dashboards → make degradation visible.
- Compensation Assumed: a saga whose rollback path was never written or never tested → it does not exist.
- Unbounded Queue or Buffer: in-memory work queues with no limit → bound them and shed; an unbounded queue converts a latency problem into an out-of-memory crash.
Ambiguity Signals
Route these through collaborative-judgment. Each has two defensible answers.
- Fail closed or degrade. Serving stale or partial data protects availability; refusing protects correctness. Which one is right is a product decision — ask, do not assume.
- Timeout values. Too short sheds load that would have succeeded; too long ties up resources. Without latency percentiles this is a guess; say so, propose a starting point, and make it configurable.
- Circuit breaker thresholds. Sensitive breakers trip on noise; tolerant ones let cascades build. Depends on traffic volume and the cost of a false trip.
- Orchestration or choreography for a multi-step workflow. An orchestrator makes the flow
visible and debuggable in one place; choreography avoids the central component and scatters the
flow across services (see
service-boundaries). - Where the outbox relay lives. Change-data-capture is robust and adds infrastructure; a polling publisher is simple and adds latency and load.
- Whether this dependency needs a breaker at all. For a rarely used, non-critical call, the breaker may be more machinery than the risk justifies.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

