Agent Skills › iamcheyan/oc › effect

effect

GitHub

指导在代码库中使用 Effect v4 进行 TypeScript 开发,涵盖 API 引用、编码规范及测试模式。

.opencode/skills/effect/SKILL.md iamcheyan/oc

触发场景

使用 Effect 编写服务或工作流 涉及 Effect Schema 和错误处理 编写 Effect 相关单元测试

安装

npx skills add iamcheyan/oc --skill effect -g -y
更多选项

非标准路径

npx skills add https://github.com/iamcheyan/oc/tree/main/.opencode/skills/effect -g -y

不安装直接使用

npx skills use iamcheyan/oc@effect

指定 Agent (Claude Code)

npx skills add iamcheyan/oc --skill effect -a claude-code -g -y

安装 repo 全部 skill

npx skills add iamcheyan/oc --all -g -y

预览 repo 内 skill

npx skills add iamcheyan/oc --list

SKILL.md

Frontmatter
{
    "name": "effect",
    "description": "Work with Effect v4 TypeScript code in this repo"
}

Effect

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

Source Of Truth

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

  1. If .opencode/references/effect is missing, clone https://github.com/Effect-TS/effect there. Do this in the project, not in the skill folder.
  2. Search .opencode/references/effect 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 or nearby code first.

Testing Patterns

  • Use testEffect(...) from packages/core/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/core; 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.

版本历史

  • d9b4ce8 当前 2026-10-18 23:22

    参考库从 effect-smol 更新为官方 Effect v4 仓库。

  • 4c25fd5 2026-07-05 18:23

同 Skill 集合

.opencode/skills/opencode-dev/SKILL.md
.opencode/skills/rtl-aware-development/SKILL.md
.opencode/skills/sample-skill/SKILL.md
packages/opencode-vim/skills/git-master/SKILL.md
packages/opencode-vim/skills/git-workflow/SKILL.md
packages/plugins/figma/skills/figma-code-connect/SKILL.md
packages/plugins/figma/skills/figma-create-new-file/SKILL.md
packages/plugins/figma/skills/figma-generative-plugins/SKILL.md
packages/plugins/figma/skills/figma-implement-motion/SKILL.md
packages/plugins/figma/skills/figma-shaders/SKILL.md
packages/plugins/figma/skills/figma-use-figjam/SKILL.md
packages/plugins/figma/skills/figma-use-motion/SKILL.md
packages/plugins/figma/skills/figma-use-slides/SKILL.md
.opencode/skills/app-e2e-tests/SKILL.md
.opencode/skills/component-tests/SKILL.md
.opencode/skills/tui-tests/SKILL.md
.opencode/skills/unit-tests/SKILL.md
packages/plugins/figma/skills/figma-design-to-code/SKILL.md
packages/plugins/figma/skills/figma-generate-design/SKILL.md
packages/plugins/figma/skills/figma-generate-diagram/SKILL.md
packages/plugins/figma/skills/figma-generate-library/SKILL.md
packages/plugins/figma/skills/figma-swiftui/SKILL.md
packages/plugins/figma/skills/figma-use/SKILL.md

元信息

文件数
0
版本
e299fa3
Hash
02ea7104
收录时间
2026-07-05 18:23

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-11-03 07:46
浙ICP备14020137号-1