首页龙虾技能列表 › Effect-TS — 技能工具

Effect-TS — 技能工具

v0.1.0

Effect-TS (Effect) comprehensive development guide for TypeScript. Use when building, debugging, reviewing, or generating Effect code. Covers typed error mod...

0· 78·0 当前·0 累计
by @tenequm (Misha Kolesnik)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/4
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
An instruction-only developer guide for Effect-TS that is internally consistent with its stated purpose and does not request elevated privileges or hidden installs.
评估建议
This skill is a documentation/authoring guide for Effect-TS and appears coherent and low-risk: it will read project files such as package.json to detect Effect versions and uses many in-repo reference documents and external URLs. Because it is instruction-only (no install, no required env vars), it cannot install code or exfiltrate secrets by itself, but be cautious before asking the agent to run or wire up examples that use external providers (e.g., OpenAI): those examples expect provider API k...
详细分析 ▾
用途与能力
The skill is a comprehensive development/reference guide for Effect-TS and its provided instructions, reference files, and examples align with that purpose. It does not request unrelated binaries, credentials, or install steps that would be disproportionate for a documentation/authoring skill.
指令范围
The runtime instructions ask the agent to detect the project's Effect version by inspecting package.json (e.g., cat package.json | grep '"effect"'), and reference many in-repo reference files and external docs. Reading package.json and project sources is coherent for a tooling/guide skill, but this means the agent will access repository files in the working directory—something to be aware of. The skill also declares broad trigger conditions (e.g., trigger on generating new TypeScript projects), which may cause it to be invoked in more scenarios than strictly necessary.
安装机制
No install spec or code files are present; the skill is instruction-only and therefore does not download or install external code. This is the lowest-risk install profile.
凭证需求
The skill declares no required environment variables or credentials. Some example/reference code (e.g., Effect AI snippets) mentions OPENAI_API_KEY or env variables for provider layers, but these are examples for users and are not requested by the skill itself. If the agent is later asked to run or wire up those examples, appropriate credentials would be needed—nothing in the skill secretly asks for unrelated secrets.
持久化与权限
The skill is not marked always:true and does not request persistent system configuration or modify other skills. Autonomous invocation (default) is allowed but not a new risk here since the skill is instruction-only and lacks installation or credential access that would amplify that privilege.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.1.02026/4/3

Initial publish

● 无害

安装命令 点击复制

官方npx clawhub@latest install effect-ts
镜像加速npx clawhub@latest install effect-ts --registry https://cn.clawhub-mirror.com

技能文档

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+): ServiceMap.Service, Effect.catch, Effect.forkChild, Schema.TaggedErrorClass

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) / ServiceMap.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()("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")ServiceMap.Service(id) or class syntax
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 (ServiceMap.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
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

  • Detect version from package.json before writing any code
  • Clarify boundaries: identify where IO happens, keep core logic as Effect values
  • Choose style: use Effect.gen for sequential logic, pipelines for simple transforms. In v4, prefer Effect.fn("name") for named functions
  • Model errors explicitly: type expected errors in the E channel; treat bugs as defects
  • Model dependencies with services and layers; keep interfaces free of construction logic
  • Manage resources with Scope when opening/closing things (files, connections, etc.)
  • Provide layers and run effects only at program edges (NodeRuntime.runMain or ManagedRuntime)
  • 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

Import Patterns

Always use barrel imports from "effect":

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

For companion packages, import from the package name:

import { NodeRuntime } from "@effect/platform-node"
import { NodeSdk } from "@effect/opentelemetry"

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 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
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务