@martinffx/atelier 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +285 -0
- package/agents/architect.md +38 -0
- package/agents/oracle.md +40 -0
- package/agents/recon.md +39 -0
- package/dist/atelier.js +33082 -0
- package/package.json +44 -0
- package/skills/code-conventional-commit/SKILL.md +134 -0
- package/skills/code-conventional-commit/evals/evals.json +23 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/commit-message.txt +4 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/validation-result.txt +16 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/commit-message.txt +8 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/report.html +1325 -0
- package/skills/code-debug/SKILL.md +271 -0
- package/skills/code-debug/references/language-tools.md +139 -0
- package/skills/code-debug/references/techniques.md +117 -0
- package/skills/code-docs/SKILL.md +171 -0
- package/skills/code-docs/references/api-docs.md +116 -0
- package/skills/code-docs/references/changelog.md +64 -0
- package/skills/code-docs/references/readme-structure.md +94 -0
- package/skills/code-git-worktrees/SKILL.md +218 -0
- package/skills/code-perf/SKILL.md +163 -0
- package/skills/code-perf/references/common-bottlenecks.md +124 -0
- package/skills/code-perf/references/optimization-patterns.md +167 -0
- package/skills/code-perf/references/profiling-tools.md +126 -0
- package/skills/code-review/SKILL.md +78 -0
- package/skills/code-review/references/output.md +200 -0
- package/skills/code-review/references/reviewers.md +719 -0
- package/skills/code-review/references/rq.md +357 -0
- package/skills/code-review/references/rs.md +30 -0
- package/skills/code-security/SKILL.md +183 -0
- package/skills/code-security/references/owasp-top-10.md +129 -0
- package/skills/code-security/references/security-tools.md +102 -0
- package/skills/code-security/references/vulnerability-patterns.md +129 -0
- package/skills/code-stacked-commit/SKILL.md +155 -0
- package/skills/code-subagents/SKILL.md +184 -0
- package/skills/code-subagents/references/code-quality-reviewer-prompt.md +48 -0
- package/skills/code-subagents/references/implementor-prompt.md +79 -0
- package/skills/code-subagents/references/spec-reviewer-prompt.md +62 -0
- package/skills/oracle-architect/SKILL.md +246 -0
- package/skills/oracle-architect/references/api-design.md +345 -0
- package/skills/oracle-architect/references/data-modeling.md +318 -0
- package/skills/oracle-architect/references/ddd-patterns.md +247 -0
- package/skills/oracle-challenge/SKILL.md +126 -0
- package/skills/oracle-testing/SKILL.md +237 -0
- package/skills/oracle-testing/references/anti-patterns.md +618 -0
- package/skills/oracle-testing/references/boundaries.md +579 -0
- package/skills/oracle-testing/references/core-testing.md +691 -0
- package/skills/oracle-testing/references/edge-testing.md +794 -0
- package/skills/oracle-testing/references/stub-driven-tdd.md +322 -0
- package/skills/oracle-thinkdeep/SKILL.md +164 -0
- package/skills/python-architecture/SKILL.md +148 -0
- package/skills/python-architecture/references/data-modeling.md +558 -0
- package/skills/python-architecture/references/ddd.md +569 -0
- package/skills/python-architecture/references/functional-core.md +337 -0
- package/skills/python-build-tools/SKILL.md +153 -0
- package/skills/python-build-tools/references/basedpyright.md +321 -0
- package/skills/python-build-tools/references/ruff.md +225 -0
- package/skills/python-build-tools/references/uv.md +257 -0
- package/skills/python-fastapi/SKILL.md +184 -0
- package/skills/python-fastapi/references/api-design.md +563 -0
- package/skills/python-fastapi/references/dependencies.md +479 -0
- package/skills/python-fastapi/references/middleware.md +475 -0
- package/skills/python-fastapi/references/validation.md +497 -0
- package/skills/python-modern-python/SKILL.md +201 -0
- package/skills/python-modern-python/references/async.md +76 -0
- package/skills/python-modern-python/references/pattern-matching.md +89 -0
- package/skills/python-modern-python/references/typing.md +96 -0
- package/skills/python-monorepo/SKILL.md +146 -0
- package/skills/python-monorepo/references/docker.md +515 -0
- package/skills/python-monorepo/references/namespace-packages.md +426 -0
- package/skills/python-monorepo/references/workspace-config.md +341 -0
- package/skills/python-sqlalchemy/SKILL.md +119 -0
- package/skills/python-sqlalchemy/references/async.md +51 -0
- package/skills/python-sqlalchemy/references/models.md +67 -0
- package/skills/python-sqlalchemy/references/queries.md +57 -0
- package/skills/python-temporal/SKILL.md +128 -0
- package/skills/python-temporal/references/patterns.md +87 -0
- package/skills/python-temporal/references/testing.md +54 -0
- package/skills/python-testing/SKILL.md +161 -0
- package/skills/python-testing/references/boundaries.md +449 -0
- package/skills/python-testing/references/mocking.md +449 -0
- package/skills/python-testing/references/pytest.md +524 -0
- package/skills/spec-brainstorm/SKILL.md +325 -0
- package/skills/spec-finish/SKILL.md +159 -0
- package/skills/spec-implement/SKILL.md +296 -0
- package/skills/spec-orchestrator/SKILL.md +156 -0
- package/skills/spec-plan/SKILL.md +248 -0
- package/skills/typescript-api-design/SKILL.md +396 -0
- package/skills/typescript-api-design/references/error-responses.md +469 -0
- package/skills/typescript-build-tools/SKILL.md +447 -0
- package/skills/typescript-build-tools/references/biome.md +436 -0
- package/skills/typescript-build-tools/references/bun.md +432 -0
- package/skills/typescript-build-tools/references/turborepo.md +426 -0
- package/skills/typescript-build-tools/references/vitest.md +518 -0
- package/skills/typescript-drizzle-orm/SKILL.md +398 -0
- package/skills/typescript-drizzle-orm/references/cloudflare.md +392 -0
- package/skills/typescript-drizzle-orm/references/entity-pattern.md +412 -0
- package/skills/typescript-drizzle-orm/references/postgresql.md +191 -0
- package/skills/typescript-drizzle-orm/references/repository-pattern.md +479 -0
- package/skills/typescript-drizzle-orm/references/sqlite.md +291 -0
- package/skills/typescript-dynamodb-toolbox/SKILL.md +370 -0
- package/skills/typescript-dynamodb-toolbox/references/entity-layer.md +574 -0
- package/skills/typescript-dynamodb-toolbox/references/error-handling.md +495 -0
- package/skills/typescript-dynamodb-toolbox/references/modeling.md +332 -0
- package/skills/typescript-dynamodb-toolbox/references/repository-layer.md +631 -0
- package/skills/typescript-dynamodb-toolbox/references/testing.md +718 -0
- package/skills/typescript-dynamodb-toolbox/references/transactions.md +423 -0
- package/skills/typescript-effect-ts/SKILL.md +341 -0
- package/skills/typescript-effect-ts/references/core.md +412 -0
- package/skills/typescript-effect-ts/references/error-handling.md +468 -0
- package/skills/typescript-effect-ts/references/resources.md +476 -0
- package/skills/typescript-effect-ts/references/schema.md +536 -0
- package/skills/typescript-effect-ts/references/services.md +461 -0
- package/skills/typescript-fastify/SKILL.md +405 -0
- package/skills/typescript-fastify/references/plugins.md +329 -0
- package/skills/typescript-fastify/references/typeid.md +315 -0
- package/skills/typescript-functional-patterns/SKILL.md +402 -0
- package/skills/typescript-functional-patterns/references/adts.md +497 -0
- package/skills/typescript-functional-patterns/references/branded-types.md +542 -0
- package/skills/typescript-functional-patterns/references/migration-guide.md +695 -0
- package/skills/typescript-functional-patterns/references/option-result.md +585 -0
- package/skills/typescript-testing/SKILL.md +353 -0
- package/skills/typescript-testing/references/mocking.md +675 -0
- package/skills/typescript-testing/references/msw.md +852 -0
- package/skills/typescript-testing/references/snapshot-testing.md +774 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-effect-ts
|
|
3
|
+
description: Type-safe functional effects with Effect-TS. Use when building applications with Effect, using Effect.gen generators, handling typed errors, managing services with Layer and Context.Tag, validating data with Schema, or managing resources with acquireRelease.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Effect-TS
|
|
8
|
+
|
|
9
|
+
Effect is a powerful TypeScript library for building robust, type-safe applications. It provides a functional effect system with typed errors, dependency injection, resource management, and concurrency primitives.
|
|
10
|
+
|
|
11
|
+
## Why Effect?
|
|
12
|
+
|
|
13
|
+
**Type-safe errors**: Unlike Promise which loses error type information, Effect tracks errors in the type system with `Effect<Success, Error, Requirements>`.
|
|
14
|
+
|
|
15
|
+
**Dependency injection**: Services are declared explicitly using `Context.Tag` and provided via `Layer`, making dependencies visible in types.
|
|
16
|
+
|
|
17
|
+
**Resource safety**: `Effect.acquireRelease` ensures resources are always cleaned up, even on failure or interruption.
|
|
18
|
+
|
|
19
|
+
**Composability**: Effects compose naturally with `pipe`, `Effect.gen` generators, and combinators like `Effect.all`, `Effect.flatMap`.
|
|
20
|
+
|
|
21
|
+
## Quick Reference
|
|
22
|
+
|
|
23
|
+
For detailed patterns and examples, see:
|
|
24
|
+
- [Core Concepts](./references/core.md) - Effect type, creating and running effects, generators
|
|
25
|
+
- [Error Handling](./references/error-handling.md) - Typed errors, catchAll, catchTag, Either
|
|
26
|
+
- [Services & Layers](./references/services.md) - Dependency injection with Context.Tag and Layer
|
|
27
|
+
- [Schema](./references/schema.md) - Data validation with encode/decode
|
|
28
|
+
- [Resources](./references/resources.md) - Resource management with acquireRelease and Scope
|
|
29
|
+
|
|
30
|
+
## The Effect Type
|
|
31
|
+
|
|
32
|
+
The core type `Effect<Success, Error, Requirements>` represents a computation that:
|
|
33
|
+
- Produces a value of type `Success` on success
|
|
34
|
+
- May fail with an error of type `Error`
|
|
35
|
+
- Requires a context of type `Requirements` to run
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Effect } from "effect"
|
|
39
|
+
|
|
40
|
+
// Effect<number, never, never> - succeeds with number, cannot fail, no requirements
|
|
41
|
+
const succeed = Effect.succeed(42)
|
|
42
|
+
|
|
43
|
+
// Effect<never, string, never> - always fails with string error
|
|
44
|
+
const fail = Effect.fail("Something went wrong")
|
|
45
|
+
|
|
46
|
+
// Effect<string, Error, never> - may succeed with string or fail with Error
|
|
47
|
+
const parse = (input: string): Effect.Effect<number, Error> =>
|
|
48
|
+
Effect.try({
|
|
49
|
+
try: () => JSON.parse(input),
|
|
50
|
+
catch: (e) => new Error(`Parse failed: ${e}`)
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Creating Effects
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { Effect } from "effect"
|
|
58
|
+
|
|
59
|
+
// From synchronous values
|
|
60
|
+
const fromValue = Effect.succeed(42)
|
|
61
|
+
const fromThunk = Effect.sync(() => Date.now())
|
|
62
|
+
|
|
63
|
+
// From failures
|
|
64
|
+
const fromError = Effect.fail(new Error("Failed"))
|
|
65
|
+
const fromDie = Effect.die("Unexpected error") // Defect, not typed
|
|
66
|
+
|
|
67
|
+
// From async operations
|
|
68
|
+
const fromPromise = Effect.tryPromise({
|
|
69
|
+
try: () => fetch("/api/data").then(r => r.json()),
|
|
70
|
+
catch: (e) => new Error(`Fetch failed: ${e}`)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
// From nullable values
|
|
74
|
+
const fromNullable = Effect.fromNullable(maybeValue)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Running Effects
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { Effect } from "effect"
|
|
81
|
+
|
|
82
|
+
const program = Effect.succeed(42)
|
|
83
|
+
|
|
84
|
+
// Synchronous (throws if effect is async or fails)
|
|
85
|
+
const result = Effect.runSync(program) // 42
|
|
86
|
+
|
|
87
|
+
// Promise-based
|
|
88
|
+
const promise = Effect.runPromise(program) // Promise<42>
|
|
89
|
+
|
|
90
|
+
// With exit status
|
|
91
|
+
const exit = Effect.runSyncExit(program)
|
|
92
|
+
const exitPromise = Effect.runPromiseExit(program)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Effect.gen Generators
|
|
96
|
+
|
|
97
|
+
Write async-looking code with full type safety using generators:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { Effect } from "effect"
|
|
101
|
+
|
|
102
|
+
const program = Effect.gen(function* () {
|
|
103
|
+
const user = yield* fetchUser(userId)
|
|
104
|
+
const posts = yield* fetchPosts(user.id)
|
|
105
|
+
const enriched = yield* enrichPosts(posts)
|
|
106
|
+
return { user, posts: enriched }
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
// Equivalent to:
|
|
110
|
+
const programPipe = fetchUser(userId).pipe(
|
|
111
|
+
Effect.flatMap(user =>
|
|
112
|
+
fetchPosts(user.id).pipe(
|
|
113
|
+
Effect.flatMap(posts =>
|
|
114
|
+
enrichPosts(posts).pipe(
|
|
115
|
+
Effect.map(enriched => ({ user, posts: enriched }))
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Error Handling
|
|
124
|
+
|
|
125
|
+
Effect tracks errors in the type system, making error handling explicit:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import { Effect } from "effect"
|
|
129
|
+
|
|
130
|
+
class UserNotFound extends Error {
|
|
131
|
+
readonly _tag = "UserNotFound"
|
|
132
|
+
constructor(readonly userId: string) {
|
|
133
|
+
super(`User not found: ${userId}`)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
class DatabaseError extends Error {
|
|
138
|
+
readonly _tag = "DatabaseError"
|
|
139
|
+
constructor(readonly cause: unknown) {
|
|
140
|
+
super("Database error")
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Effect<User, UserNotFound | DatabaseError, never>
|
|
145
|
+
const getUser = (id: string) => Effect.gen(function* () {
|
|
146
|
+
const record = yield* queryDatabase(id)
|
|
147
|
+
if (!record) {
|
|
148
|
+
return yield* Effect.fail(new UserNotFound(id))
|
|
149
|
+
}
|
|
150
|
+
return record
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
// Handle specific errors
|
|
154
|
+
const handled = getUser("123").pipe(
|
|
155
|
+
Effect.catchTag("UserNotFound", (e) =>
|
|
156
|
+
Effect.succeed({ id: e.userId, name: "Anonymous" })
|
|
157
|
+
)
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
// Handle all errors
|
|
161
|
+
const recovered = getUser("123").pipe(
|
|
162
|
+
Effect.catchAll((error) =>
|
|
163
|
+
Effect.succeed({ id: "unknown", name: "Fallback" })
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Services and Dependency Injection
|
|
169
|
+
|
|
170
|
+
Define services with `Context.Tag` and provide them with `Layer`:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import { Context, Effect, Layer } from "effect"
|
|
174
|
+
|
|
175
|
+
// Define a service interface and tag
|
|
176
|
+
class Database extends Context.Tag("Database")<
|
|
177
|
+
Database,
|
|
178
|
+
{
|
|
179
|
+
readonly query: (sql: string) => Effect.Effect<unknown[]>
|
|
180
|
+
readonly execute: (sql: string) => Effect.Effect<void>
|
|
181
|
+
}
|
|
182
|
+
>() {}
|
|
183
|
+
|
|
184
|
+
// Use the service in effects
|
|
185
|
+
const getUsers = Effect.gen(function* () {
|
|
186
|
+
const db = yield* Database
|
|
187
|
+
return yield* db.query("SELECT * FROM users")
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
// Create a layer that provides the service
|
|
191
|
+
const DatabaseLive = Layer.succeed(Database, {
|
|
192
|
+
query: (sql) => Effect.sync(() => {
|
|
193
|
+
console.log(`Executing: ${sql}`)
|
|
194
|
+
return []
|
|
195
|
+
}),
|
|
196
|
+
execute: (sql) => Effect.sync(() => {
|
|
197
|
+
console.log(`Executing: ${sql}`)
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
// Provide the layer to run the effect
|
|
202
|
+
const runnable = Effect.provide(getUsers, DatabaseLive)
|
|
203
|
+
Effect.runPromise(runnable)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Schema Validation
|
|
207
|
+
|
|
208
|
+
Use Effect Schema for type-safe data validation:
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
import { Schema } from "effect"
|
|
212
|
+
|
|
213
|
+
// Define a schema
|
|
214
|
+
const User = Schema.Struct({
|
|
215
|
+
id: Schema.String,
|
|
216
|
+
name: Schema.String,
|
|
217
|
+
email: Schema.String,
|
|
218
|
+
age: Schema.Number
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
// Infer types from schema
|
|
222
|
+
type User = Schema.Schema.Type<typeof User>
|
|
223
|
+
|
|
224
|
+
// Decode unknown data
|
|
225
|
+
const decoded = Schema.decodeUnknownSync(User)({
|
|
226
|
+
id: "123",
|
|
227
|
+
name: "Alice",
|
|
228
|
+
email: "alice@example.com",
|
|
229
|
+
age: 30
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
// Decode with Effect (for better error handling)
|
|
233
|
+
const decodeEffect = Schema.decodeUnknown(User)
|
|
234
|
+
const result = decodeEffect({ id: "123", name: "Alice", email: "a@b.com", age: 30 })
|
|
235
|
+
// Effect<User, ParseError, never>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Resource Management
|
|
239
|
+
|
|
240
|
+
Safely manage resources that need cleanup:
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
import { Effect, Scope } from "effect"
|
|
244
|
+
|
|
245
|
+
// Define a resource with acquisition and release
|
|
246
|
+
const withConnection = Effect.acquireRelease(
|
|
247
|
+
// Acquire
|
|
248
|
+
Effect.sync(() => {
|
|
249
|
+
console.log("Opening connection")
|
|
250
|
+
return { query: (sql: string) => sql }
|
|
251
|
+
}),
|
|
252
|
+
// Release
|
|
253
|
+
(conn) => Effect.sync(() => {
|
|
254
|
+
console.log("Closing connection")
|
|
255
|
+
})
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
// Use the resource in a scoped effect
|
|
259
|
+
const program = Effect.scoped(
|
|
260
|
+
Effect.gen(function* () {
|
|
261
|
+
const conn = yield* withConnection
|
|
262
|
+
return conn.query("SELECT * FROM users")
|
|
263
|
+
})
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
// Connection is automatically closed after use
|
|
267
|
+
Effect.runPromise(program)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Common Patterns
|
|
271
|
+
|
|
272
|
+
### Sequential vs Parallel Execution
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
import { Effect } from "effect"
|
|
276
|
+
|
|
277
|
+
const tasks = [task1, task2, task3]
|
|
278
|
+
|
|
279
|
+
// Sequential execution
|
|
280
|
+
const sequential = Effect.all(tasks, { concurrency: 1 })
|
|
281
|
+
|
|
282
|
+
// Parallel execution (all at once)
|
|
283
|
+
const parallel = Effect.all(tasks, { concurrency: "unbounded" })
|
|
284
|
+
|
|
285
|
+
// Parallel with limit
|
|
286
|
+
const limited = Effect.all(tasks, { concurrency: 5 })
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Retry with Backoff
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
import { Effect, Schedule } from "effect"
|
|
293
|
+
|
|
294
|
+
const retried = fetchData.pipe(
|
|
295
|
+
Effect.retry(
|
|
296
|
+
Schedule.exponential("100 millis").pipe(
|
|
297
|
+
Schedule.jittered,
|
|
298
|
+
Schedule.compose(Schedule.recurs(5))
|
|
299
|
+
)
|
|
300
|
+
)
|
|
301
|
+
)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Timeouts
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
import { Effect, Duration } from "effect"
|
|
308
|
+
|
|
309
|
+
const withTimeout = longRunningTask.pipe(
|
|
310
|
+
Effect.timeout(Duration.seconds(30))
|
|
311
|
+
)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Guidelines
|
|
315
|
+
|
|
316
|
+
1. **Use `Effect.gen` for complex flows** - Generators make sequential operations readable
|
|
317
|
+
2. **Tag errors with `_tag`** - Enables `catchTag` for precise error handling
|
|
318
|
+
3. **Define services with `Context.Tag`** - Makes dependencies explicit and testable
|
|
319
|
+
4. **Use `Layer` for service composition** - Layers compose and manage lifecycle
|
|
320
|
+
5. **Prefer `Effect.try` over manual try/catch** - Keeps errors in the Effect channel
|
|
321
|
+
6. **Use Schema for external data** - Validates and transforms API/DB data
|
|
322
|
+
7. **Scope resources with `acquireRelease`** - Guarantees cleanup on success or failure
|
|
323
|
+
8. **Run effects at the edge** - Keep `runPromise`/`runSync` at application boundaries
|
|
324
|
+
|
|
325
|
+
## Integration with Other Skills
|
|
326
|
+
|
|
327
|
+
Effect-TS integrates well with:
|
|
328
|
+
- [Functional Patterns](../functional-patterns/SKILL.md) - Effect builds on Option/Either concepts
|
|
329
|
+
- [Drizzle ORM](../drizzle-orm/SKILL.md) - Wrap Drizzle queries in Effect for typed errors
|
|
330
|
+
- [Fastify](../fastify/SKILL.md) - Use Effect for request handling with typed errors
|
|
331
|
+
|
|
332
|
+
## When This Skill Loads
|
|
333
|
+
|
|
334
|
+
This skill automatically loads when discussing:
|
|
335
|
+
- Effect-TS library usage
|
|
336
|
+
- Typed error handling in TypeScript
|
|
337
|
+
- Dependency injection with Context and Layer
|
|
338
|
+
- Effect.gen generators
|
|
339
|
+
- Schema validation with Effect
|
|
340
|
+
- Resource management and Scope
|
|
341
|
+
- Functional effect systems
|