Claude Code Plugins

Community-maintained marketplace

Feedback

effect-resilience

@aitchwhy/dotfiles
3
0

Effect-TS patterns for retry, timeout, polling, and XState integration.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name effect-resilience
description Effect-TS patterns for retry, timeout, polling, and XState integration.
allowed-tools Read, Write, Edit, Grep, Glob
token-budget 400
version 1.0.0

Effect Resilience Patterns

Retry, timeout, and polling using Effect primitives.

Effect.retry + Schedule

import { Effect, Schedule } from 'effect';

// Exponential backoff with jitter
const policy = Schedule.exponential('100 millis').pipe(
  Schedule.jittered,
  Schedule.compose(Schedule.recurs(5))
);

const resilient = Effect.retry(fetchData, policy);

Effect.timeout

// Timeout with typed error
const withTimeout = Effect.timeout(fetchData, '30 seconds');
// Returns Effect<A, E | TimeoutException, R>

Effect.repeat (Polling)

// Poll every 5 seconds until condition
const poll = Effect.repeat(
  checkStatus,
  Schedule.spaced('5 seconds').pipe(
    Schedule.whileOutput((status) => status !== 'complete')
  )
);

XState v5 Integration

Use fromPromise to wrap Effect programs:

import { fromPromise } from 'xstate';
import { Effect } from 'effect';

const fetchActor = fromPromise(async ({ input }: { input: { id: string } }) => {
  return Effect.runPromise(
    fetchUser(input.id).pipe(
      Effect.retry(Schedule.exponential('100 millis').pipe(Schedule.recurs(3))),
      Effect.timeout('30 seconds'),
      Effect.provide(HttpClientLive)
    )
  );
});

Anti-patterns

// BAD - manual retry loop
let retries = 3;
while (retries > 0) { ... }

// BAD - setTimeout polling
setInterval(() => checkStatus(), 5000);

// GOOD - Effect primitives
Effect.retry(op, Schedule.exponential('100 millis'));
Effect.repeat(op, Schedule.spaced('5 seconds'));