跳到正文
Skillpedia
API 与服务器(后端)28k · #9874

effect

它能做什么

它指导使用 Effect 库编写 TypeScript 代码,包括服务、模式、类型化错误和多步骤工作流。适合使用 Effect、并希望代码准确且符合当前版本的开发者。

适用场景

  • ✓当你在编写或修改使用 Effect 的 TypeScript 代码时。
  • ✓当你需要用 Effect 构建的类型化错误、模式或服务时。
  • ✓当你希望根据库的源代码检查当前的 Effect v4 模式时。

技能链接

https://github.com/Kilo-Org/kilocode/blob/main/.opencode/skills/effect/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/Kilo-Org/kilocode/blob/main/.opencode/skills/effect/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的 TypeScript 后端需要一个服务,使用 Effect,包含类型化错误,并为请求数据提供一个模式。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体查阅当前 Effect 库的源代码,以获取准确的 API 和示例,遵循项目已有的模式,然后编写代码。它让 HTTP 处理程序保持简洁,并把业务规则放在服务中。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Effect

This codebase uses Effect for typed, composable TypeScript services, schemas, and workflows.

Source Of Truth

Use the current Effect v4 / effect-smol source, not memory or older Effect v2/v3 examples.

  1. If .opencode/references/effect-smol is missing, clone https://github.com/Effect-TS/effect-smol there. Do this in the project, not in the skill folder.
  2. Search .opencode/references/effect-smol for exact APIs, examples, tests, and naming patterns before answering or implementing Effect-specific code.
  3. Also inspect existing repo code for local house style before introducing new patterns.
  4. Prefer answers and implementations backed by specific source files or nearby repo examples.

Guidelines

  • Prefer current Effect v4 APIs and project-local patterns over old blog posts, examples, or package-memory guesses.
  • Use Effect.gen(function* () { ... }) for multi-step workflows.
  • Use Effect.fn("Name") or Effect.fnUntraced(...) for named effects when adding reusable service methods or important workflows.
  • Prefer Effect Schema for API and domain data shapes. Use branded schemas for IDs and Schema.TaggedErrorClass for typed domain errors when modeling new error surfaces.
  • Keep HTTP handlers thin: decode input, read request context, call services, and map transport errors. Put business rules in services.
  • In Effect service code, prefer Effect-aware platform abstractions and dependencies over ad hoc promises where the surrounding code already does so.
  • Keep layer composition explicit. Avoid broad hidden provisioning that makes missing dependencies hard to see.
  • In tests, prefer the repo's existing Effect test helpers and live tests for filesystem, git, child process, locks, or timing behavior.
  • Do not introduce any, non-null assertions, unchecked casts, or older Effect APIs just to satisfy types.
  • Do not answer from memory. Verify against .opencode/references/effect-smol or nearby code first.

Testing Patterns

  • Use testEffect(...) from packages/opencode/test/lib/effect.ts for tests that exercise Effect services, layers, runtime context, scoped resources, or platform integrations.
  • Use it.live(...) for filesystem, git repositories, HTTP servers, sockets, child processes, locks, real time, and other live platform behavior.
  • Run tests from package directories such as packages/opencode; never run package tests from the repo root.
  • Prefer explicit test layers over ad hoc managed runtimes. Keep dependency provisioning visible in the test file.
  • Use scoped fixtures and finalizers for resources that must be cleaned up, including temporary directories, flags, databases, fibers, servers, and global state.
常见问题

它面向哪个 Effect 版本?

它面向 Effect v4,也称为 effect-smol,而不是较旧的 v2 或 v3 示例。

它在哪里查找 API?

它会搜索 effect-smol 源代码的本地副本,如果缺失则会克隆它。

错误如何处理?

领域错误使用带标签的错误类,以便能够通过类型进行处理。

详情

作者的原始描述

Work with Effect v4 / effect-smol TypeScript code in this repo

repo: Kilo-Org/kilocode

热度

GitHub 星标
28k
排名
#9874
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能