Define services, provide layers, compose dependencies, and switch live/test. Use for DI boundaries and app composition.
class UserRepo extends Effect.Service<UserRepo>()("UserRepo", {
sync: () => ({ find: (id: string) => Effect.succeed({ id }) })
}) {}
const program = Effect.gen(function* () {
const repo = yield* UserRepo
return yield* repo.find("123")
}).pipe(Effect.provide(UserRepo.Default))
const AppLayer = Layer.merge(UserRepo.Default, Logger.Default)
const layer = process.env.NODE_ENV === "test" ? UserRepoTest : UserRepo.Default
.Default for quick live/test setup; add custom layers as neededR and provisioningCRITICAL: Search local Effect source before implementing
The full Effect source code is available at docs/effect-source/. Always search the actual implementation before writing Effect code.
docs/effect-source/effect/src/Layer.tsdocs/effect-source/effect/src/Effect.tsdocs/effect-source/effect/src/Context.ts# Find Layer composition patterns
grep -F "Layer.merge" docs/effect-source/effect/src/Layer.ts
grep -F "Layer.provide" docs/effect-source/effect/src/Layer.ts
# Study Effect.Service patterns
grep -F "Effect.Service" docs/effect-source/effect/src/Effect.ts
# Find Context usage
grep -F "Tag" docs/effect-source/effect/src/Context.ts
grep -F "make" docs/effect-source/effect/src/Context.ts
# Look at Layer test examples
grep -F "Layer." docs/effect-source/effect/test/Layer.test.ts
docs/effect-source/effect/src/Layer.ts for the implementationReal source code > documentation > assumptions
npx skills add mepuka/effect-layers-services下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer