write-effect-ts
Write Effect TS
Write Effect code that matches the repo's existing style, keeps requirements explicit, and verifies API details against current docs before committing to an implementation.
Read Order
- Read
references/patterns.mdbefore editing Effect code. - Read
references/doc-map.mdwhen you need topic-specific docs, upstream confirmation, or ready-madectx7queries.
Workflow
- Inspect the repo first. Search for
ServiceMap.Service,Effect.Service,Context.Tag,Effect.fn,Effect.gen,Schema.TaggedError,Schema.TaggedErrorClass,Config.schema, andit.effect. - Match the dominant local idiom. Do not mix service styles inside the same feature unless the repo already does.
- If the repo has no strong local style, default to the
effect-solutionshouse style summarized inreferences/patterns.md. - If
effect-solutionsis available, read the relevant topic before coding:
effect-solutions list
effect-solutions show basics services-and-layers data-modeling error-handling config testing
- Verify API details with
ctx7before relying on memory:
ctx7 library effect
ctx7 docs /effect-ts/effect "services layers schema tagged errors testing"
- Implement the smallest complete change.
- Validate with the repo's real feedback loop: typecheck, tests, and any Effect-specific checks.
Default House Style
Unless the repo already established a different style:
- Use
Effect.genfor inline sequential programs. - Use
Effect.fn("Name")for reusable effectful functions and service methods, including nullary methods. - Model domain data with
Schema.Class,Schema.TaggedClass,Schema.Union, and branded primitives. - Model expected errors with
Schema.TaggedErrorClass; useSchema.Defectwhen wrapping unknown external errors. - Prefer
ServiceMap.Servicewith staticlayerandtestLayerexports for service-driven development. - Keep service methods dependency-free (
R = never); resolve dependencies in the layer. - Provide layers once near the application boundary.
- Use
Config.schemaandConfig.redactedinstead of ad hoc parsing. - Use
@effect/vitestwithit.effect,TestClock, and per-test layers.
Style Selection Rules
- If the repo already uses
Context.TagorEffect.Service, stay consistent with it. - If the repo already uses
Schema.TaggedErrorinstead of the class helpers, match that style. - If the repo already wraps third-party clients with a
usepattern orEffect.tryPromise, extend the existing boundary instead of inventing a new abstraction. - If an
effect-solutionsexample conflicts with current upstream docs, prefer repo consistency first, then confirm the API withctx7, then implement the smallest safe adaptation.
Non-Negotiable Rules
- Do not scatter
Effect.providethrough business logic; wire dependencies near the edge. - Do not push service requirements into service method signatures when a layer can resolve them.
- Do not throw raw errors from Effect code when a typed error or defect boundary is appropriate.
- Do not parse untrusted input without
SchemaorConfig. - Do not default to
PromiseAPIs if an Effect or@effect/platformAPI already exists in the repo. - Do not share mutable test state across suites unless the test explicitly needs a shared layer.
Trigger Examples
Add a new Effect service for this API client.Refactor this Promise code to Effect.Fix the layer wiring in this module.Write Effect tests for this service.Model these domain types and errors with Effect Schema.Set up config loading for this Effect app.
Resources
references/patterns.md- effect-solutions-aligned patterns and anti-patternsreferences/doc-map.md- topic map, upstream caveats, andctx7queries
More from khoahyh/skills
jujutsu-colocated
Safe, practical workflows for using Jujutsu (`jj`) in colocated repositories (`.git` + `.jj`) and parallel-agent environments. Use when planning, editing, splitting, recovering, coordinating, isolating parallel agents with workspaces, or publishing changes with `jj`, especially when avoiding destructive history/state operations.
13greptile-address
Run one Greptile review-address pass on a pull request. Trigger or wait for checks once, analyze Greptile comments once, fix actionable feedback once, resolve addressed threads, and report what remains. Use when the user wants to address the latest greptile review comments on their PR.
7sharingan
This skill should be used when the user asks to clone and analyze a repository into a portable context bundle, such as "clone this repo and build reusable context", "package repository context artifacts", or "prepare repo context for another skill or agent workflow".
3deepen-codebase-design
Explore a codebase to find architectural and structural complexity using John Ousterhout's Philosophy of Software Design. Use when the user wants to improve project structure, file structure, module boundaries, patterns, practices, information hiding, testability, or refactoring strategy, especially when the goal is to create or update an RFC artifact under docs/.
3