# Effect Service Architect

> Expertly scaffold and refactor Effect-based services and layers following v3 standards. Use when creating new backend logic or migrating from Promise-based code. Use when this capability is needed.

- Skill: `tomevault-io/effect-service-architect` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/effect-service-architect`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/effect-service-architect/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/effect-service-architect

---


# Effect Service Architect (v3)

## Instructions

1.  **Service Tag**: Define the service using `Effect.Tag`.
    ```typescript
    export class MyService extends Effect.Tag("MyService")<MyService, {
      readonly getData: () => Effect.Effect<Data, MyError>
    }>() {}
    ```
2.  **Implementation**: Create the `Live` layer using `Layer.effect` or `Layer.succeed`.
    ```typescript
    export const MyServiceLive = Layer.effect(
      MyService,
      Effect.gen(function* () {
        // Implementation logic
        return {
          getData: () => Effect.succeed({ ... })
        }
      })
    )
    ```
3.  **Error Handling**: Use `Data.TaggedError` for all domain-specific errors.
    ```typescript
    export class MyError extends Data.TaggedError("MyError")<{
      readonly message: string
    }> {}
    ```
4.  **Composition**: Use `pipe` for simple flows and `Effect.gen` with `yield*` for complex sequential logic.
5.  **Verification**:
    *   Run `tsc --noEmit` to verify type inference.
    *   Ensure all `Effect.tryPromise` calls include a `catch` block for typed errors.

## Patterns to Enforce
- NO explicit return type annotations unless necessary (let inference work).
- NO `try/catch` blocks inside `Effect.gen` (use `Effect.catchAll` etc.).
- ALWAYS use `yield*` when calling an Effect inside `Effect.gen`.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/samuelho-dev) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

