senrecep/tsentials/tsentials-resilience
Claude Code and agent skill by senrecep/tsentials
- community
Checking that the SKILL.md file is still in the repository.
Use when an operation returning Result<T> needs retry, circuit breaker, timeout or fallback — immutable ResiliencePolicy built with withRetry/withCircuitBreaker/withTimeout/withFallback and run via execute(signal => ...), plus retryIfFailed for one-off retries; failures never throw, only the caller's abort rejects.
Install
npx vskill@latest install senrecep/tsentials/tsentials-resilienceSKILL.md
tsentials/resilience
Composable, immutable resilience pipeline for operations that return Result<T>. Subpath-only: not exported from the root tsentials entry.
Installation
Import
ResiliencePolicy
- Each
with…call returns a new policy; the strategy is appended inside the previous ones (first added = outermost).withFallbackis always outermost. execute(action, { signal })— the action receives anAbortSignal(aborted by the caller and by the timeout); pass it to the underlying I/O.executeValue(fn)wraps a plain value as success.- Result is awaitable directly (
ResultAsync) and never rejects except with the caller's abort reason.
Options
| Method | Options | |||
|---|---|---|---|---|
withRetry({ maxAttempts, delay, exponentialBackoff, backoff, shouldRetry, maxRetryAfterMs }) | backoff: `'constant' \ | 'linear' \ | 'exponential'; shouldRetry(error) replaces the retryable check (a throw stops retrying); a failure with retryAfterMs metadata waits at least that long, capped at maxRetryAfterMs` (default 30 s) | |
| `withTimeout(ms \ | { timeout })` | default 30 000 ms, min 10 ms | ||
withCircuitBreaker({ minimumThroughput, samplingDuration, breakDuration, failureRatio }) | durations >= 500 ms | |||
withFallback(signal => value) / withFallbackResult(action) | value or Result used when everything else failed |
Invalid option values throw RangeError.
Fallback
Error codes
| Code | When | |
|---|---|---|
Resilience.Timeout | the timeout strategy cancelled an attempt (type Failure) | |
Resilience.CircuitBroken | the circuit is open and rejected the call (type Failure) |
Compare against ResilienceErrorCode.Timeout / .CircuitBroken.
retryIfFailed
What is retryable
A failure is retryable unless its first error is Validation, NotFound, Unauthorized or Forbidden. Thrown values are retryable too (except the caller's abort). isRetryable(result) exposes this rule.
Patterns and pitfalls
- Import from
tsentials/resilience— never from the roottsentialsentry. maxAttemptscounts retries: the action runs at mostmaxAttempts + 1times.- AbortSignal convention: the caller's abort rejects with
signal.reasonand is never retried; any other error (including a timeout) becomes a failure. - Order matters:
.withRetry().withTimeout()times out each attempt;.withTimeout().withRetry()times out the whole retry sequence. - Do not call
new ResiliencePolicy(); useResiliencePolicy.create(options?).
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.well-known/agent-skills/tsentials-resilience/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/senrecep/tsentials/tsentials-resilience)