← 返回 Skills 市场
tenequm

Effect-TS

作者 Misha Kolesnik · GitHub ↗ · v0.2.2 · MIT-0
cross-platform ⚠ suspicious
193
总下载
0
收藏
0
当前安装
4
版本数
在 OpenClaw 中安装
/install effect-ts
功能描述
Effect-TS (Effect) comprehensive development guide for TypeScript. Use when building, debugging, reviewing, or generating Effect code. Covers typed error mod...
使用说明 (SKILL.md)

Effect-TS

Effect is a TypeScript library for building production-grade software with typed errors, structured concurrency, dependency injection, and built-in observability.

Version Detection

Before writing Effect code, detect which version the user is on:

# Check installed version
cat package.json | grep '"effect"'
  • v3.x (stable, most production codebases): Context.Tag, Effect.catchAll, Effect.fork, Data.TaggedError
  • v4.x (beta, Feb 2026+): Context.Service, Effect.catch, Effect.forkChild, Schema.TaggedErrorClass

Note: v4 beta briefly used a ServiceMap module, renamed back to Context on 2026-04-07 (PR #1961). If you see ServiceMap.* in any doc or older beta code, it is the current Context.*. Both v3 and v4 import Context from "effect"; the exports inside differ (Context.Tag in v3 vs Context.Service in v4).

If the version is unclear, ask the user. Default to v3 patterns for existing codebases, v4 for new projects.

Primary Documentation Sources

AI Guardrails: Critical Corrections

LLM outputs frequently contain incorrect Effect APIs. Verify every API against the reference docs before using it.

Common hallucinations (both versions):

Wrong (AI often generates) Correct
Effect.cachedWithTTL(...) Cache.make({ capacity, timeToLive, lookup })
Effect.cachedInvalidateWithTTL(...) cache.invalidate(key) / cache.invalidateAll()
Effect.mapError(effect, fn) Effect.mapError(fn) in pipe, or use Effect.catchTag
import { Schema } from "@effect/schema" import { Schema } from "effect" (v3.10+ and all v4)
import { JSONSchema } from "@effect/schema" import { JSONSchema } from "effect" (v3.10+)
JSON Schema Draft 2020-12 Effect Schema generates Draft-07
"thread-local storage" "fiber-local storage" via FiberRef (v3) / Context.Reference (v4)
fibers are "cancelled" fibers are "interrupted"
all queues have back-pressure only bounded queues; sliding/dropping do not
new MyError("message") new MyError({ message: "..." }) (Schema errors take objects)

v3-specific hallucinations:

Wrong Correct (v3)
Effect.Service (function call) class Foo extends Effect.Service\x3CFoo>()("id", {})
Effect.match(effect, { ... }) Effect.match(effect, { onSuccess, onFailure })
Effect.provide(layer1, layer2) Effect.provide(Layer.merge(layer1, layer2))

v4-specific hallucinations (AI may mix v3/v4):

Wrong (v3 API used in v4 code) Correct (v4)
Context.Tag("X") (v3 shape) Context.Service\x3CX>(id) or class syntax
ServiceMap.Service / ServiceMap.Reference Renamed back to Context.Service / Context.Reference on 2026-04-07
Effect.catchAll(fn) Effect.catch(fn)
Effect.fork(effect) Effect.forkChild(effect)
Effect.forkDaemon(effect) Effect.forkDetach(effect)
Data.TaggedError Schema.TaggedErrorClass
FiberRef.get(ref) yield* References.X (a Context.Reference)
yield* ref (Ref as Effect) yield* Ref.get(ref) (Ref is no longer an Effect)
yield* fiber (Fiber as Effect) yield* Fiber.join(fiber) (Fiber is no longer Effect)
Logger.Default / Logger.Live Logger.layer (v4 naming convention)
Schema.TaggedError Schema.TaggedErrorClass
Schema.makeUnsafe(input) Schema.make(input) (throws SchemaError); also Schema.makeOption, Schema.makeEffect
ParseResult (from "effect") SchemaIssue module + SchemaError class; narrow with Schema.isSchemaError
HttpApiEndpoint.get(n, p).pipe(HttpApiEndpoint.setPath(...), setPayload(...), setSuccess(...)) HttpApiEndpoint.get(n, p, { params, query, payload, success, error }) (object-option form)
Otlp.layer({ url, serviceName }) OtlpTracer.layer({ url, resource: { serviceName } }) + OtlpSerialization.layerJson + FetchHttpClient.layer
import { HttpApi } from "@effect/platform" (v4) import { HttpApi } from "effect/unstable/httpapi"
HttpApi endpoint schema errors are typed errors by default Since PR #2057 (2026-04-20) they default to defects unless transformed

Read references/llm-corrections.md for the exhaustive corrections table.

Progressive Disclosure

Read only the reference files relevant to your task:

  • Error modeling or typed failures → references/error-modeling.md
  • Services, DI, or Layer wiring → references/dependency-injection.md
  • Retries, timeouts, or backoff → references/retry-scheduling.md
  • Fibers, forking, or parallel work → references/concurrency.md
  • Streams, queues, or SSE → references/streams.md
  • Resource lifecycle or cleanup → references/resource-management.md
  • Schema validation or decoding → references/schema.md
  • Logging, metrics, or tracing → references/observability.md
  • HTTP clients or API calls → references/http.md
  • HTTP API servers → references/http.md (covers both client and server)
  • LLM/AI integration → references/effect-ai.md
  • Testing Effect code → references/testing.md
  • Migrating from async/await → references/migration-async.md
  • Migrating from v3 to v4 → references/migration-v4.md
  • Core types, gen, pipe, running → references/core-patterns.md
  • Full wrong-vs-correct API table → references/llm-corrections.md

Core Workflow

  1. Detect version from package.json before writing any code
  2. Clarify boundaries: identify where IO happens, keep core logic as Effect values
  3. Choose style: use Effect.gen for sequential logic, pipelines for simple transforms. In v4, prefer Effect.fn("name") for named functions
  4. Model errors explicitly: type expected errors in the E channel; treat bugs as defects
  5. Model dependencies with services and layers; keep interfaces free of construction logic
  6. Manage resources with Scope when opening/closing things (files, connections, etc.)
  7. Provide layers and run effects only at program edges (NodeRuntime.runMain or ManagedRuntime)
  8. Verify APIs exist before using them - consult https://tim-smart.github.io/effect-io-ai/ or source docs

Starter Function Set

Start with these ~20 functions (the official recommended set):

Creating effects: Effect.succeed, Effect.fail, Effect.sync, Effect.tryPromise

Composition: Effect.gen (+ Effect.fn in v4), Effect.andThen, Effect.map, Effect.tap, Effect.all

Running: Effect.runPromise, NodeRuntime.runMain (preferred for entry points)

Error handling: Effect.catchTag, Effect.catchAll (v3) / Effect.catch (v4), Effect.orDie

Resources: Effect.acquireRelease, Effect.acquireUseRelease, Effect.scoped

Dependencies: Effect.provide, Effect.provideService

Key modules: Effect, Schema, Layer, Option, Either (v3) / Result (v4), Array, Match

DI (v3): Context.Tag, Context.Reference DI (v4): Context.Service, Context.Reference, Layer.effect, Effect.fn("name")

Import Patterns

Always use barrel imports from "effect":

import { Context, Effect, Schema, Layer, Option, Stream } from "effect"

For companion packages, import from the package name. v3 and v4 differ here:

// v3 (stable) companion packages
import { NodeRuntime } from "@effect/platform-node"
import { HttpClient } from "@effect/platform"
import { NodeSdk } from "@effect/opentelemetry"

// v4 (beta) - platform transports still separate, but HttpApi / observability
// moved under effect/unstable/*
import { NodeRuntime } from "@effect/platform-node"
import { FetchHttpClient } from "effect/unstable/http"
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiBuilder, HttpApiScalar } from "effect/unstable/httpapi"
import { OtlpLogger, OtlpSerialization, OtlpTracer } from "effect/unstable/observability"

Avoid deep module imports (effect/Effect) unless your bundler requires it for tree-shaking.

Output Standards

  • Show imports in every code example
  • Prefer Effect.gen (imperative) for multi-step logic; pipelines for transforms
  • In v4, use Effect.fn("name") instead of bare Effect.gen for named functions
  • Never call Effect.runPromise / Effect.runSync inside library code - only at program edges
  • Use NodeRuntime.runMain for CLI/server entry points (handles SIGINT gracefully)
  • Use ManagedRuntime when integrating Effect into non-Effect frameworks (Hono, Express, etc.)
  • Always return yield* when raising an error in a generator (ensures TS understands control flow)
  • Avoid point-free/tacit usage: write Effect.map((x) => fn(x)) not Effect.map(fn) (generics get erased)
  • Keep dependency graphs explicit (services, layers, tags)
  • State the Effect\x3CA, E, R> shape when it helps design decisions

Agent Quality Checklist

Before outputting Effect code, verify:

  • Every API exists (check against tim-smart API list or source docs)
  • Imports are from "effect" (not @effect/schema, @effect/io, etc.)
  • Version matches the user's codebase (v3 vs v4 syntax)
  • Expected errors are typed in E; unexpected failures are defects
  • run* is called only at program edges, not inside library code
  • Resources opened with acquireRelease are wrapped in Effect.scoped
  • Layers are provided before running (no missing R requirements)
  • Generator bodies use yield* (not yield without *)
  • Error raises in generators use return yield* pattern
安全使用建议
This is an instruction-only Effect-TS reference: it will not install software or ask for credentials. If you install it, be aware the agent may (when invoked) read package.json in the project to detect Effect version and may fetch the public docs listed in SKILL.md. If you do not want the agent to access your repository files, restrict its file access; if you are concerned about network access, block or review outgoing requests to the referenced URLs. Also keep in mind the skill is a guide — always validate generated code against your project's dependencies and run tests before deploying.
功能分析
Type: OpenClaw Skill Name: effect-ts Version: 0.2.2 The skill bundle is a comprehensive and well-structured development guide for the Effect-TS library, designed to assist AI agents in generating high-quality TypeScript code. It includes extensive reference documentation, version-specific migration guides, and critical 'hallucination' correction tables (e.g., in SKILL.md and references/llm-corrections.md) to prevent the use of non-existent APIs. No evidence of malicious intent, data exfiltration, or unauthorized execution was found; the included shell command for version detection is a standard, low-risk development practice.
能力标签
cryptocan-make-purchasesrequires-sensitive-credentials
能力评估
Purpose & Capability
The skill's name/description (Effect-TS guide) matches the included SKILL.md and many reference documents. It asks for no environment variables, binaries, or installs — all appropriate for an offline documentation/authoring assistant. The version-detection step (checking package.json) and the listed external documentation links are coherent with the stated purpose.
Instruction Scope
Runtime instructions are focused on writing, migrating, and verifying Effect code. The only filesystem access suggested is checking package.json to detect the library version, which is reasonable for code generation. The skill points to external docs (public URLs) for verification — this may cause network lookups but is explained and relevant. There are no instructions to read unrelated system paths, harvest credentials, or send data to unexpected endpoints.
Install Mechanism
No install spec is provided; this is instruction-only and writes nothing to disk. That is the lowest-risk install model and is proportionate to a documentation/assistant skill.
Credentials
The skill declares no required environment variables, credentials, or config paths. SKILL.md does not instruct access to secrets. Requested capabilities are minimal and appropriate for the stated purpose.
Persistence & Privilege
always is false and model invocation is allowed (the platform default). The skill does not request permanent presence, nor does it instruct modifying other skills or system-wide settings. There are no indications of privileged behavior.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install effect-ts
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /effect-ts 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.2.2
Updated effect-ts from 0.2.1 to 0.2.2. Changes: - modified `SKILL.md` - modified `references/migration-v4.md`
v0.2.1
Updated effect-ts from 0.2.0 to 0.2.1. Changes: - modified `SKILL.md` - modified `references/concurrency.md` - modified `references/dependency-injection.md` - modified `references/effect-ai.md` - modified `references/error-modeling.md` - modified `references/http.md` - modified `references/llm-corrections.md` - modified `references/migration-async.md` - modified `references/migration-v4.md` - modified `references/observability.md` - modified `references/resource-management.md` - modified `references/retry-scheduling.md`
v0.2.0
Updated effect-ts from 0.1.0 to 0.2.0. Changes: - modified `SKILL.md` - modified `evals/evals.json` - modified `references/dependency-injection.md` - modified `references/http.md` - modified `references/llm-corrections.md` - modified `references/migration-async.md` - modified `references/migration-v4.md` - modified `references/observability.md` - modified `references/schema.md`
v0.1.0
Initial publish
元数据
Slug effect-ts
版本 0.2.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 4
常见问题

Effect-TS 是什么?

Effect-TS (Effect) comprehensive development guide for TypeScript. Use when building, debugging, reviewing, or generating Effect code. Covers typed error mod... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 193 次。

如何安装 Effect-TS?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install effect-ts」即可一键安装,无需额外配置。

Effect-TS 是免费的吗?

是的,Effect-TS 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Effect-TS 支持哪些平台?

Effect-TS 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Effect-TS?

由 Misha Kolesnik(@tenequm)开发并维护,当前版本 v0.2.2。

💬 留言讨论