You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+43-32Lines changed: 43 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,25 +208,28 @@ Without both changes, Electric sync requests for the new table will be rejected
208
208
209
209
## Effect-TS Best Practices
210
210
211
-
> **Skill Available**: Run `/effect-best-practices` for comprehensive Effect-TS patterns. The skill auto-activates when writing Effect.Service, Schema.TaggedError, Layer composition, or effect-atom code.
211
+
> **Skill Available**: Run `/effect-best-practices` for comprehensive Effect-TS patterns. The skill auto-activates when writing ServiceMap.Service, Schema.TaggedError, Layer composition, or effect-atom code.
212
212
213
-
### Always Use `Effect.Service` Instead of `Context.Tag`
213
+
### Always Use `ServiceMap.Service` Instead of `Context.Tag`
214
214
215
-
**ALWAYS** prefer `Effect.Service` over `Context.Tag` for defining services. Effect.Service provides built-in `Default` layer, automatic accessors, and proper dependency declaration.
215
+
**ALWAYS** prefer `ServiceMap.Service`(from `effect`) over `Context.Tag` for defining services. `ServiceMap.Service` with a `make` option stores the constructor effect on the class. You must define the layer explicitly using `Layer.effect`.
- Factory patterns where the resource is provided externally at runtime
253
266
254
-
### Use `dependencies` Array in Effect.Service
267
+
### Wire Dependencies with `Layer.provide`
255
268
256
-
**ALWAYS** declare service dependencies in the `dependencies` array when using `Effect.Service`. This ensures proper layer composition and avoids "leaked dependencies" that require manual `Layer.provide` calls at the usage site.
269
+
Wire service dependencies using `Layer.provide` on the layer. The v3 `dependencies` array no longer exists.
257
270
258
271
```typescript
259
-
// ✅ CORRECT - Dependencies declared in the service
0 commit comments