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…
от pedronauck★ 661 звезда на GitHubОб этом скилле
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.
| Reference | Topics |
|---|---|
references/foundations.md |
Setup, imports, TypeScript config |
references/construction-and-style.md |
Effect.gen, pipe, Effect.fn, Effect.fnUntraced |
references/schema-errors-config.md |
Schema modeling, errors, config, retry |
references/pattern-matching.md |
Match.type, Match.value, Match.tag, Match.exhaustive — mandatory for tagged unions |
references/control-flow-and-runtime.md |
Effect.if, Effect.when, loops, runSync, runPromise, ManagedRuntime |
references/data-types.md |
All data types: Option, Either, Data, Exit, Cause, Duration, DateTime, BigDecimal, Chunk, HashSet, Redacted |
references/data-and-testing.md |
Option/Either/Array quick ref, @effect/vitest setup |
references/concurrency-and-resources.md |
Concurrency, Scope, finalizers, resources |
references/streams-deep-dive.md |
Creating, operations, grouping, partitioning, broadcasting, buffering, throttling, error handling |
references/sink.md |
Sink constructors, collecting, folding, operations, concurrency, leftovers, Stream.transduce |
references/batching-and-caching.md |
Request batching (RequestResolver), cachedWithTTL |
references/schema-transforms-and-filters.md |
Schema.transform, Schema.filter, refinements |
references/api-platform-observability.md |
HttpApi, logging, tracing, spans |
references/class-patterns.md |
Context.Tag service pattern, layers, memoization, testing |
references/error-handling-patterns.md |
Data.TaggedError, Schema.TaggedError, error composition, recovery |
references/library-development-patterns.md |
Forbidden patterns, Effect.fn vs Effect.fnUntraced, resource management |
references/testing-patterns.md |
@effect/vitest with assert, TestClock, service mocking |
references/quality-tooling-and-resources.md |
Anti-patterns, validation checklist, packages |
Core Principles
- Effect is not just for async — Use
Effectfor any fallible operation - Immutability — Use Effect's immutable data structures (
Data,Chunk,HashSet) - Type Safety — Track errors in types. No
anyorunknownin error channels - Composition — Build programs by composing small Effects
- Schema-First — Define data models using
Schemawith branded types - Pattern Matching — Use
Matchfor all branching over tagged unions (neverswitch/if-elseon_tag) - Effect Data Types — Use
Option(not null),Either(not ad-hoc),Duration(not raw ms),DateTime(not Date),BigDecimal(not floats),Redacted(for secrets). Seereferences/data-types.md
Quick Reference
Import Convention
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
// 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.
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.
// 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 $
Установить effect-ts в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobВложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл effect-ts?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл effect-ts запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic