Token导航 LogoToken导航TokenDH.com
开发external-serviceclawhub未标认证来源可访问clear审计提醒

effect-ts效果 ts

Agent Skill

effect-ts 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 OpenClaw 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

5,645

周安装

240

GitHub Stars

公开资料未说明

下载量

1,978
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:effect-ts(效果 ts)
来源仓库:https://github.com/tenequm/effect-ts
安装命令:
openclaw skills install effect-ts
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install effect-ts

简介

Effect-TS函数式编程开发指南,管理异步操作与错误处理流程。

  • 提供键入错误模式识别与资源安全管理最佳实践参考。
  • 适用于高可靠性系统构建,减少回调地狱与竞态条件发生概率。
  • 需熟悉TypeScript高级类型系统,才能充分发挥Effect的类型安全保障。
  • 复杂业务逻辑建议拆分为纯函数组合,提升代码可测性与复用性。

SKILL.md

name
effect-ts
description
Effect-TS (Effect) comprehensive development guide for TypeScript. Use when building, debugging, reviewing, or generating Effect code. Covers typed error modeling (expected errors vs defects), structured concurrency (fibers), dependency injection (Context + Layers), resource management (Scope), retry/scheduling (Schedule), streams, Schema validation, observability (OpenTelemetry), HTTP client/server, Effect AI (LLM integration), and MCP servers. Critical for AI code generation: includes exhaustive wrong-vs-correct API tables preventing hallucinated Effect code. Supports both Effect v3 (stable) and v4 (beta). Use this skill whenever code imports from 'effect', '@effect/platform', '@effect/ai', or the user mentions Effect-TS, typed errors with Effect, functional TypeScript with Effect, Context, ServiceMap, Layer, or Schema from Effect. Also trigger when generating new TypeScript projects that could benefit from Effect patterns, even if the user doesn't explicitly name the library.
metadata
version
0.3.3
upstream
effect@4.0.0-beta.58
openclaw
homepage
https://github.com/tenequm/skills/tree/main/skills/effect-ts
emoji
🌀
envVars
required
false
description
OpenAI API key for Effect AI examples using the OpenAI provider.
required
false
description
Anthropic API key for Effect AI examples using the Anthropic provider.

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

  • https://effect.website/docs (v3 stable docs)
  • https://effect.website/llms.txt (LLM topic index)
  • https://effect.website/llms-full.txt (full docs for large context)
  • https://tim-smart.github.io/effect-io-ai/ (concise API list)
  • https://github.com/Effect-TS/effect-smol (v4 source + migration guides)
  • https://github.com/Effect-TS/effect-smol/blob/main/LLMS.md (v4 LLM guide)

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-12Effect 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-pressureonly bounded queues; sliding/dropping do not
new MyError("message")new MyError({ message: "..." }) (Schema errors take objects)

v3-specific hallucinations:

WrongCorrect (v3)
Effect.Service (function call)class Foo extends Effect.Service<Foo>()("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<X>(id) or class syntax
ServiceMap.Service / ServiceMap.ReferenceRenamed 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.TaggedErrorSchema.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.LiveLogger.layer (v4 naming convention)
Schema.TaggedErrorSchema.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 defaultSince 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<A, 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

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

70.22%
按下载量换算1,389

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills