Effect Ts logo

Effect Ts

Community
pedronauck
effect-ts

Expert guide for writing Effect-TS code, including project setup, core principles, data modeling with Schema, error handling, and the Context.Tag service pattern. Use when writing, refactoring, or analyzing TypeScript code using the Effect library.

Overview

Publisherpedronauck
Repositoryskills
Skill nameeffect-ts
Stars
635
Forks
89
Bundled files
19
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 19 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by pedronauck on GitHub. Read the source before you install it.

Installation

Install the Effect Ts AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/pedronauck/skills/tree/main/skills/curated/effect-ts
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/pedronauck/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/curated/effect-ts .claude/skills/effect-ts
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Effect Ts in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Effect Ts on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Effect Ts is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Effect-TS Developer Guide

Guidelines, patterns, and best practices for Effect-TS in this project.

Reference Documents

Read the relevant reference before writing code. references/core-patterns.md is the master index.

ReferenceTopics
references/foundations.mdSetup, imports, TypeScript config
references/construction-and-style.mdEffect.gen, pipe, Effect.fn, Effect.fnUntraced
references/schema-errors-config.mdSchema modeling, errors, config, retry
references/pattern-matching.mdMatch.type, Match.value, Match.tag, Match.exhaustive — mandatory for tagged unions
references/control-flow-and-runtime.mdEffect.if, Effect.when, loops, runSync, runPromise, ManagedRuntime
references/data-types.mdAll data types: Option, Either, Data, Exit, Cause, Duration, DateTime, BigDecimal, Chunk, HashSet, Redacted
references/data-and-testing.mdOption/Either/Array quick ref, @effect/vitest setup
references/concurrency-and-resources.mdConcurrency, Scope, finalizers, resources
references/streams-deep-dive.mdCreating, operations, grouping, partitioning, broadcasting, buffering, throttling, error handling
references/sink.mdSink constructors, collecting, folding, operations, concurrency, leftovers, Stream.transduce
references/batching-and-caching.mdRequest batching (RequestResolver), cachedWithTTL
references/schema-transforms-and-filters.mdSchema.transform, Schema.filter, refinements
references/api-platform-observability.mdHttpApi, logging, tracing, spans
references/class-patterns.mdContext.Tag service pattern, layers, memoization, testing
references/error-handling-patterns.mdData.TaggedError, Schema.TaggedError, error composition, recovery
references/library-development-patterns.mdForbidden patterns, Effect.fn vs Effect.fnUntraced, resource management
references/testing-patterns.md@effect/vitest with assert, TestClock, service mocking
references/quality-tooling-and-resources.mdAnti-patterns, validation checklist, packages

Core Principles

  1. Effect is not just for async — Use Effect for any fallible operation
  2. Immutability — Use Effect's immutable data structures (Data, Chunk, HashSet)
  3. Type Safety — Track errors in types. No any or unknown in error channels
  4. Composition — Build programs by composing small Effects
  5. Schema-First — Define data models using Schema with branded types
  6. Pattern Matching — Use Match for all branching over tagged unions (never switch/if-else on _tag)
  7. Effect Data Types — Use Option (not null), Either (not ad-hoc), Duration (not raw ms), DateTime (not Date), BigDecimal (not floats), Redacted (for secrets). See references/data-types.md

Quick Reference

Import Convention

typescript
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Schema from "effect/Schema";
import * as Match from "effect/Match";
import * as Option from "effect/Option";
import * as Either from "effect/Either";
import * as Data from "effect/Data";
import * as Duration from "effect/Duration";
import { pipe } from "effect/Function";
// Also: DateTime, BigDecimal, Chunk, HashSet, Exit, Cause, Redacted

Effect.gen vs pipe vs Effect.fn

typescript
// Effect.gen — complex logic with branching
Effect.gen(function* () {
  const user = yield* fetchUser(id);
  if (user.isAdmin) yield* logAdminAccess(user);
  return user;
});

// pipe — linear transformations
pipe(fetchData(), Effect.map(transform), Effect.flatMap(save));

// Effect.fn — traced reusable functions (public API)
const processUser = Effect.fn("processUser")(function* (userId: string) {
  const user = yield* getUser(userId);
  return yield* processData(user);
});

Error Handling

Data.TaggedError for in-process discrimination, Schema.TaggedError for serializable errors. See references/error-handling-patterns.md.

typescript
export class NotFoundError extends Data.TaggedError("NotFoundError")<{
  id: string;
}> {}

// Recovery
pipe(riskyOp, Effect.catchTag("NotFoundError", (e) => Effect.succeed(null)));

Pattern Matching (Mandatory for Tagged Unions)

Always use Match — Match.exhaustive catches missing cases at compile time. See references/pattern-matching.md.

typescript
// Match.type — reusable matcher function
const handle = Match.type<Status>().pipe(
  Match.tag("Pending", (s) => `Pending since ${s.requestedAt}`),
  Match.tag("Approved", (s) => `Approved by ${s.approvedBy}`),
  Match.exhaustive // Compile error if any variant is missing
);

// Match.valueTags — shorthand for immediate matching
Match.valueTags(status, {
  Pending: (s) => `Pending since ${s.requestedAt}`,
  Approved: (s) => `Approved by ${s.approvedBy}`,
});

Service Pattern (Context.Tag)

See references/class-patterns.md for full pattern with factory methods and layers.

typescript
export class MyService extends Context.Tag("@myapp/MyService")<
  MyService,
  { readonly find: (id: string) => Effect.Effect<Result, NotFoundError> }
>() {
  static readonly layer = Layer.effect(MyService, Effect.gen(function* () {
    const db = yield* Database;
    return MyService.of({ find: MyService.createFind(db) });
  }));
}

Testing

CRITICAL: Use assert from @effect/vitest for it.effect. Never expect with it.effect. See references/testing-patterns.md.

typescript
import { assert, describe, it } from "@effect/vitest";

it.effect("processes data", () =>
  Effect.gen(function* () {
    const result = yield* processData("input");
    assert.strictEqual(result, "expected");
  }).pipe(Effect.provide(MyService.testLayer))
);

Forbidden Patterns

typescript
// NEVER: try-catch in Effect.gen — use Effect.exit instead
Effect.gen(function* () {
  try { yield* someEffect } catch (e) { } // WRONG — will never catch
});

// NEVER: Type assertions
const value = something as any;   // FORBIDDEN
const value = something as never; // FORBIDDEN

// NEVER: Missing return on terminal yield
Effect.gen(function* () {
  if (bad) { yield* Effect.fail("err") } // Missing return!
});

// NEVER: switch/if-else on _tag — use Match instead
switch (status._tag) { /* no exhaustiveness checking! */ }

// NEVER: Effect.runSync inside Effects
Effect.gen(function* () { Effect.runSync(sideEffect) }); // Loses error tracking

// NEVER: Native JS where Effect data types exist
const x: string | null = null;              // Use Option<string>
const delay = 5000;                         // Use Duration.seconds(5)
const now = new Date();                     // Use DateTime.now or DateTime.unsafeNow()
const price = 0.1 + 0.2;                   // Use BigDecimal for precision
const secret = "sk-1234";                   // Use Redacted.make("sk-1234")

// NEVER: expect with it.effect
it.effect("test", () => Effect.gen(function* () {
  expect(result).toBe(value) // WRONG — use assert.strictEqual
}));

// NEVER: Inline layers (breaks memoization)
Layer.provide(Postgres.layer({ url })) // Store in constant instead

Validation Checklist

  • Imports use import * as Module from "effect/Module"
  • Effect.gen for complex logic, pipe for linear, Effect.fn for public API
  • Match for all _tag branching with Match.exhaustive
  • Branded types for domain primitives (IDs, Emails)
  • Errors: Data.TaggedError (discrimination) or Schema.TaggedError (serializable)
  • No any/unknown in error channels, no type assertions
  • No try-catch in Effect.gen — use Effect.exit
  • return yield* for terminal effects (Effect.fail, Effect.interrupt)
  • Services: Context.Tag with static factory methods and Effect.fn tracing
  • Layers: Layer.merge/Layer.provide, parameterized layers in constants
  • Resources: Effect.acquireRelease or Effect.scoped
  • Option for nullable values, Either for sync success/failure
  • Duration for time values, DateTime for dates (not Date)
  • BigDecimal for financial/precise math, Redacted for secrets
  • Data.struct/Data.Class for structural equality, HashSet for sets
  • Clock.currentTimeMillis instead of Date.now()
  • Tests: assert from @effect/vitest (not expect) with it.effect
  • Run pnpm run typecheck and pnpm run test

Reference Implementation

See /packages/looper/src/data/api-client/api-client.ts for Context.Tag service pattern.

Effect Solutions CLI

bash
pnpm exec effect-solutions list              # List all topics
pnpm exec effect-solutions show <slug...>    # Read topics
pnpm exec effect-solutions search <term>     # Search by keyword

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Effect Ts AI skill do?

Expert guide for writing Effect-TS code, including project setup, core principles, data modeling with Schema, error handling, and the Context.Tag service pattern. Use when writing, refactoring, or analyzing TypeScript code using the Effect library.

Why use Effect Ts on TypingMind?

Because you install it once and use it with any model. Effect Ts is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Effect Ts in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/pedronauck/skills/tree/main/skills/curated/effect-ts. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Effect Ts?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Effect Ts?

As many as you like. As long as a model supports skills, you can use Effect Ts with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Effect Ts AI skill free?

It is published on GitHub by pedronauck. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇