agentsclimarketplace

Effect platform

Skill ComeOnOliver/skillshub/skills/TerminalSkills/skills/effect-platform

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.From the repository description

Install
npx -y skills add ComeOnOliver/skillshub --skill effect-platform

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

5.2 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Effect Platform β€” Production TypeScript Framework

You are an expert in Effect (Effect-TS), the production-grade TypeScript framework for building reliable, composable applications. You help developers write type-safe code with structured error handling (typed errors in the type signature), dependency injection, concurrency, retries, scheduling, streaming, schema validation, and built-in observability β€” replacing scattered libraries (zod, retry, pino, awilix) with a single coherent platform.

Core Capabilities

Typed Errors and Effects

import { Effect, pipe } from "effect";
import { Schema } from "@effect/schema";

// Typed errors β€” compiler knows exactly what can fail
class UserNotFound extends Schema.TaggedError<UserNotFound>()("UserNotFound", {
  userId: Schema.String,
}) {}

class DatabaseError extends Schema.TaggedError<DatabaseError>()("DatabaseError", {
  message: Schema.String,
}) {}

class ValidationError extends Schema.TaggedError<ValidationError>()("ValidationError", {
  field: Schema.String,
  reason: Schema.String,
}) {}

// Function signature tells you: returns User, can fail with UserNotFound | DatabaseError
function getUser(id: string): Effect.Effect<User, UserNotFound | DatabaseError> {
  return pipe(
    Effect.tryPromise({
      try: () => db.users.findUnique({ where: { id } }),
      catch: (e) => new DatabaseError({ message: String(e) }),
    }),
    Effect.flatMap((user) =>
      user ? Effect.succeed(user) : Effect.fail(new UserNotFound({ userId: id })),
    ),
  );
}

// Compose effects β€” errors propagate and accumulate in the type
function getUserProfile(id: string): Effect.Effect<
  UserProfile,
  UserNotFound | DatabaseError | ValidationError  // Compiler tracks all possible errors
> {
  return pipe(
    getUser(id),
    Effect.flatMap((user) => getPreferences(user.id)),
    Effect.map((prefs) => ({ ...user, preferences: prefs })),
  );
}

// Handle errors exhaustively
const program = pipe(
  getUserProfile("user-42"),
  Effect.catchTags({
    UserNotFound: (e) => Effect.succeed({ error: "User not found", userId: e.userId }),
    DatabaseError: (e) => Effect.die(e),   // Unrecoverable β€” crash
    ValidationError: (e) => Effect.succeed({ error: `Invalid ${e.field}: ${e.reason}` }),
  }),
);

// Run
const result = await Effect.runPromise(program);

Dependency Injection (Layers)

import { Effect, Context, Layer } from "effect";

// Define service interfaces
class Database extends Context.Tag("Database")<Database, {
  readonly query: (sql: string) => Effect.Effect<any[], DatabaseError>;
}>() {}

class EmailService extends Context.Tag("EmailService")<EmailService, {
  readonly send: (to: string, subject: string, body: string) => Effect.Effect<void>;
}>() {}

// Use services in your effects
function createUser(data: CreateUserInput) {
  return Effect.gen(function* () {
    const db = yield* Database;
    const email = yield* EmailService;

    const [user] = yield* db.query("INSERT INTO users ...");
    yield* email.send(data.email, "Welcome!", "Thanks for signing up");

    return user;
  });
}

// Provide implementations via Layers
const DatabaseLive = Layer.succeed(Database, {
  query: (sql) => Effect.tryPromise({ try: () => pool.query(sql), catch: (e) => new DatabaseError({ message: String(e) }) }),
});

const EmailLive = Layer.succeed(EmailService, {
  send: (to, subject, body) => Effect.promise(() => resend.emails.send({ to, subject, html: body })),
});

// Compose and run
const AppLayer = Layer.merge(DatabaseLive, EmailLive);
await Effect.runPromise(pipe(createUser(input), Effect.provide(AppLayer)));

Concurrency and Retries

import { Effect, Schedule } from "effect";

// Retry with exponential backoff
const reliableCall = pipe(
  callExternalApi(),
  Effect.retry(
    Schedule.exponential("100 millis").pipe(
      Schedule.compose(Schedule.recurs(5)),   // Max 5 retries
      Schedule.jittered,                      // Add randomness
    ),
  ),
);

// Concurrent execution with limits
const results = yield* Effect.forEach(
  userIds,
  (id) => fetchUserData(id),
  { concurrency: 10 },                       // Max 10 concurrent
);

// Race β€” first to complete wins
const fastest = yield* Effect.race(
  fetchFromPrimary(query),
  fetchFromReplica(query),
);

// Timeout
const withTimeout = pipe(
  longRunningTask(),
  Effect.timeout("5 seconds"),
);

Installation

npm install effect @effect/schema @effect/platform

Best Practices

  1. Typed errors β€” Errors in the type signature; compiler enforces exhaustive handling; no forgotten catch blocks
  2. Effect.gen β€” Use generator syntax for readable async-like code; yield* instead of await
  3. Layers for DI β€” Define services with Context.Tag; swap implementations for testing without mocks
  4. Schema validation β€” Use @effect/schema instead of Zod; integrates with Effect error channel
  5. Retry policies β€” Use Schedule for retry, backoff, jitter; declarative, composable
  6. Concurrency β€” Use Effect.forEach with concurrency option; bounded parallelism built-in
  7. Streaming β€” Use Stream for processing large datasets; backpressure, transformation, batching
  8. Observability β€” Built-in tracing and metrics via OpenTelemetry; no additional instrumentation code

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.