mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-28 12:39:43 +00:00
2 KiB
2 KiB
| name | description |
|---|---|
| effect | Work with Effect v4 / effect-smol 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 / effect-smol source, not memory or older Effect v2/v3 examples.
- If
.opencode/references/effect-smolis missing, clonehttps://github.com/Effect-TS/effect-smolthere. Do this in the project, not in the skill folder. - Search
.opencode/references/effect-smolfor exact APIs, examples, tests, and naming patterns before answering or implementing Effect-specific code. - Also inspect existing repo code for local house style before introducing new patterns.
- 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")orEffect.fnUntraced(...)for named effects when adding reusable service methods or important workflows. - Prefer Effect
Schemafor API and domain data shapes. Use branded schemas for IDs andSchema.TaggedErrorClassfor 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-smolor nearby code first.