S
SkillsMD 发现、学习和掌握最新的 AI 技术 Skills。基于真实社区数据,为开发者提供最权威的 AI 工具导航。
关于 聚焦 AI 技术 Skills 每周数据更新 中英双语文档 © 2026 SkillsMD. All rights reserved.
Effect-TS 中文指南:TypeScript 函数式编程、错误处理与依赖管理最佳实践 | SkillsMD
首页 / Skills / effect-ts Effect-TS 中文指南:TypeScript 函数式编程、错误处理与依赖管理最佳实践 effect-ts by teeverc/effect-ts-skills
npx skills add https://github.com/teeverc/effect-ts-skills --skill effect-ts🇨🇳 中文介绍 Effect-TS
概述
为构建基于 Effect 的 TypeScript 程序提供工作流、模式和最佳实践,并针对错误处理、依赖管理、资源管理、运行时执行、生成器、模式验证、测试、平台模块、Sink/Stream 处理以及 Effect AI 提供重点参考。
主要文档和 API 来源:
对于内部查询,可以使用 effect-docs MCP 来搜索和获取 API 参考:https://github.com/tim-smart/effect-mcp 。
渐进式披露
从 references/docs-index.md 开始,用于主题导航。
为当前任务阅读一篇主要指南。
仅在需要时阅读一篇相邻指南(针对诸如测试、运行时或可观测性等横切关注点)。
避免加载不相关的参考资料。
快速分类
如果需要核心 Effect 数据类型或组合器,打开 。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
联系我们 references/core-usage.md
如果需要更广泛的数据类型选择(DateTime、BigDecimal、HashSet、Redacted),打开 references/data-types-advanced.md。
如果需要相等性/排序/哈希语义,打开 references/behavior-traits.md。
如果任务涉及错误建模或类型化失败,打开 references/error-management.md。
如果需要错误处理工具(沙盒化、Cause、错误通道转换),打开 references/error-tooling.md。
如果涉及服务/依赖项,打开 references/dependency-management.md。
如果涉及层构造或测试布线,打开 references/layer-patterns.md。
如果涉及资源生命周期,打开 references/resource-management.md。
如果涉及运行效果或运行时选择,打开 references/runtime-execution.md。
如果涉及纤程或并发原语,打开 references/concurrency.md。
如果涉及中断、监督或纤程引用,打开 references/concurrency-advanced.md。
如果涉及调度或重复执行,打开 references/scheduling.md。
如果涉及重试/退避或调度组合,打开 references/scheduling-retry.md。
如果涉及流、队列、发布订阅或 STM,打开 references/streams-queues-stm.md。
如果涉及 HTTP 客户端或外部 API,打开 references/http-client.md。
如果涉及 HTTP 服务器或 API 定义,打开 references/http-server.md。
如果涉及请求批处理或数据加载器,打开 references/request-resolver.md。
如果涉及缓存或记忆化,打开 references/caching.md。
如果涉及配置或配置提供者,打开 references/configuration.md。
如果涉及高级配置或数据脱敏,打开 references/configuration-advanced.md。
如果涉及日志、指标或追踪,打开 references/observability.md。
如果需要具体的日志记录器/指标/追踪设置或导出器,打开 references/observability-examples.md。
如果需要日志/指标/追踪层的布线,打开 references/observability-wiring.md。
如果需要顺序/分支逻辑的可读性,打开 references/generators.md。
如果需要运行时验证/解码,打开 references/schema.md。
如果涉及使用归约器的流消费模式,打开 references/sink.md。
如果需要在测试中使用确定性时间,打开 references/testing.md。
如果需要更广泛的测试服务,打开 references/testing-stack.md。
如果涉及命令/文件/路径/终端/键值模块,打开 references/platform-primitives.md。
如果涉及 LLM 工作流、规划或通过 Effect AI 使用工具,打开 references/ai.md。
如果涉及受包大小限制的运行时,打开 references/micro.md。
如果涉及从 Promise/async 迁移,打开 references/migration-async.md。
如果需要版本控制或签名更改,打开 references/versioning.md。
如果遇到常见陷阱或运行时错误,打开 references/troubleshooting.md。
如果需要结果检查或调试,打开 references/exit-cause.md。
如果需要来自 llms.txt 的文档到指南映射,打开 references/docs-index.md。
核心工作流
明确边界和 IO;将核心逻辑保持为 Effect 值。
选择风格:简单组合使用管道;顺序逻辑使用 Effect.gen。
显式建模错误:对预期错误进行类型化;将缺陷视为意外故障。
使用服务、标签和层来建模依赖项;保持接口不涉及构造细节。
在打开/关闭资源时使用 Scope 管理资源生命周期。
通过层提供环境,并仅在程序边界运行效果。
对于平台/基础设施代码,将副作用保留在专用的适配器中,并向领域代码暴露类型化服务。
对于代理任务,包含关于错误处理、并发和运行时选择的简明理由。
输出标准
展示导入和最小的可运行示例。
优先使用桶导入 (from "effect" / from "@effect/platform") 而非深层模块路径。
当函数式组合更清晰时,使用 effect 中的 pipe。
保持依赖图显式化(服务、层、上下文标签)。
包含错误通道类型,并明确指出预期错误与缺陷错误。
避免在库内部运行效果;在入口点或测试中展示运行时用法。
优先选择在当前 Effect 主版本下可编译的示例。
代理质量检查清单
在有助于设计决策时,将目标形态声明为 Effect<A, E, R>。
明确区分预期错误 (E) 和缺陷。
指出在何处提供层以及在何处调用 run*。
对于并发代码,说明有界/无界行为以及关闭策略。
对于边界解码,展示 Schema 的用法以及故障处理的位置。
对于测试,注明提供了哪些测试服务 (TestContext、TestClock、实时覆盖)。
对于文档不确定的情况,在最终确定 API 之前查阅 references/docs-index.md 和源文档。
参考资料
从 references/docs-index.md 开始,以便快速选择相关指南。
对于大多数编码任务,使用 references/core-usage.md、references/error-management.md 和 references/dependency-management.md 作为默认参考。
对于边界和集成工作,使用平台/运行时参考资料 (references/platform-primitives.md、references/runtime-execution.md)。
对于验证和调试,使用测试/诊断参考资料 (references/testing.md、references/testing-stack.md、references/troubleshooting.md)。
🇺🇸 English Effect-TS
Overview
Provide workflows, patterns, and best practices for building Effect-based TypeScript programs, with focused references for errors, dependencies, resources, runtime execution, generators, schema, testing, platform modules, sink/stream processing, and Effect AI.
Primary docs and API sources:
For internal lookups, the effect-docs MCP can be used to search and fetch API references: https://github.com/tim-smart/effect-mcp .
Progressive Disclosure
Start with references/docs-index.md for topic routing.
Read one primary guide for the task.
Read one adjacent guide only if needed (for cross-cutting concerns like testing, runtime, or observability).
Avoid loading unrelated references.
Quick Triage
If it needs core Effect data types or combinators, open references/core-usage.md.
If it needs broader data-type choices (DateTime, BigDecimal, HashSet, Redacted), open references/data-types-advanced.md.
If it needs equality/order/hash semantics, open references/behavior-traits.md.
If the task is about error modeling or typed failures, open references/error-management.md.
If it needs error tooling (sandboxing, Cause, error-channel transforms), open references/error-tooling.md.
If it involves services/dependencies, open references/dependency-management.md.
If it involves layer construction or test wiring, open references/layer-patterns.md.
If it involves resource lifecycles, open references/resource-management.md.
Core Workflow
Clarify boundaries and IO; keep core logic as Effect values.
Choose style: use pipelines for simple composition; use Effect.gen for sequential logic.
Model errors explicitly: type expected errors; treat defects as unexpected failures.
Model dependencies with services, tags, and layers; keep interfaces clean of construction concerns.
Manage resource lifecycles with Scope when opening/closing resources.
Provide the environment via layers and run effects only at the program edge.
For platform/infra code, keep side effects in dedicated adapters and expose typed services to domain code.
For agent tasks, include a concise rationale for error, concurrency, and runtime choices.
Output Standards
Show imports and minimal runnable examples.
Prefer barrel imports (from "effect" / from "@effect/platform") over deep module paths.
When function-style composition is clearer, use pipe from effect.
Keep dependency graphs explicit (services, layers, context tags).
Include error channel types and call out expected vs defect errors.
Avoid running effects inside libraries; show runtime usage in entrypoints or tests.
Prefer examples that compile under current Effect major versions.
Agent Quality Checklist
State the target shape as Effect<A, E, R> when it helps design decisions.
Explicitly separate expected errors (E) from defects.
Identify where layers are provided and where run* is called.
For concurrent code, state bounded/unbounded behavior and shutdown strategy.
For boundary decoding, show Schema usage and where failures are handled.
For tests, note which test services are provided (TestContext, TestClock, live overrides).
For docs uncertainty, consult references/docs-index.md and source docs before finalizing APIs.
References
Start at references/docs-index.md to choose relevant guides quickly.
Use references/core-usage.md, references/error-management.md, and references/dependency-management.md as defaults for most code tasks.
Use platform/runtime references (references/platform-primitives.md, references/runtime-execution.md) for boundary and integration work.
Use testing/diagnostic references (references/testing.md, references/testing-stack.md, references/troubleshooting.md) for verification and debugging.
Weekly Installs
101
Repository
teeverc/effect-ts-skills
GitHub Stars
4
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPass SocketPass SnykWarn
Installed on
opencode92
codex89
gemini-cli87
github-copilot87
amp81
kimi-cli80
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
116,600 周安装
If it involves running effects or runtime choice, open references/runtime-execution.md.
If it involves fibers or concurrency primitives, open references/concurrency.md.
If it involves interruption, supervision, or fiber refs, open references/concurrency-advanced.md.
If it involves schedules or repetition, open references/scheduling.md.
If it involves retries/backoff or schedule composition, open references/scheduling-retry.md.
If it involves streams, queues, pubsub, or STM, open references/streams-queues-stm.md.
If it involves HTTP clients or external APIs, open references/http-client.md.
If it involves HTTP servers or API definitions, open references/http-server.md.
If it involves request batching or data loaders, open references/request-resolver.md.
If it involves caching or memoization, open references/caching.md.
If it involves configuration or config providers, open references/configuration.md.
If it involves advanced config or redaction, open references/configuration-advanced.md.
If it involves logs, metrics, or tracing, open references/observability.md.
If it needs concrete logger/metrics/tracing setups or exporters, open references/observability-examples.md.
If it needs wiring of log/metric/trace layers, open references/observability-wiring.md.
If it needs sequential/branching readability, open references/generators.md.
If it needs runtime validation/decoding, open references/schema.md.
If it involves stream consumption patterns with reducers, open references/sink.md.
If it needs deterministic time in tests, open references/testing.md.
If it needs broader testing services, open references/testing-stack.md.
If it involves command/file/path/terminal/key-value modules, open references/platform-primitives.md.
If it involves LLM workflows, planning, or tool use via Effect AI, open references/ai.md.
If it involves bundle-size constrained runtimes, open references/micro.md.
If it involves migrating from Promise/async, open references/migration-async.md.
If it needs versioning or signature changes, open references/versioning.md.
If it hits common pitfalls or runtime errors, open references/troubleshooting.md.
If it needs result inspection or debugging, open references/exit-cause.md.
If it needs a docs-to-guide map from llms.txt, open references/docs-index.md.