src/**/*.sql.ts.<entity>_id; indexes are <table>*<column>\_idx.drizzle.config.ts (schema: ./src/**/*.sql.ts, output: ./migration).bun run db generate --name <slug>.migration/<timestamp>_<slug>/migration.sql and snapshot.json._journal.json).Use these rules when writing or migrating Effect code.
See specs/effect-migration.md for the compact pattern reference and examples.
Effect.gen(function* () { ... }) for composition.Effect.fn("Domain.method") for named/traced effects and Effect.fnUntraced for internal helpers.Effect.fn / Effect.fnUntraced accept pipeable operators as extra arguments, so avoid unnecessary outer .pipe() wrappers.Effect.callback for callback-based APIs.DateTime.nowAsDate over new Date(yield* Clock.currentTimeMillis) when you need a Date.Schema.Class for multi-field data.Schema.brand) for single-value types.Schema.TaggedErrorClass for typed errors.Schema.Defect instead of unknown for defect-like causes.Effect.gen / Effect.fn, prefer yield* new MyError(...) over yield* Effect.fail(new MyError(...)) for direct early-failure branches.makeRuntime (from src/effect/run-service.ts) for all services. It returns { runPromise, runFork, runCallback } backed by a shared memoMap that deduplicates layers.InstanceState (from src/effect/instance-state.ts) for per-directory or per-project state that needs per-instance cleanup. It uses ScopedCache keyed by directory — each open project gets its own state, automatically cleaned up on disposal.InstanceState.InstanceState.make closure — ScopedCache handles run-once semantics. Don't add fibers, ensure() callbacks, or started flags on top.Effect.addFinalizer or Effect.acquireRelease inside the InstanceState.make closure for cleanup (subscriptions, process teardown, etc.).Effect.forkScoped inside the closure for background stream consumers — the fiber is interrupted when the instance is disposed.FileSystem.FileSystem instead of raw fs/promises for effectful file I/O.ChildProcessSpawner.ChildProcessSpawner with ChildProcess.make(...) instead of custom process wrappers.HttpClient.HttpClient instead of raw fetch.Path.Path, Config, Clock, and DateTime when those concerns are already inside Effect code.Effect.repeat or Effect.schedule with Effect.forkScoped in the layer definition.Instance.bind(fn) captures the current Instance AsyncLocalStorage context and restores it synchronously when called.
Use it for native addon callbacks (@parcel/watcher, node-pty, native fs.watch, etc.) that need to call Bus.publish or anything that reads Instance.directory.
You do not need it for setTimeout, Promise.then, EventEmitter.on, or Effect fibers.
const cb = Instance.bind((err, evts) => {
Bus.publish(MyEvent, { ... })
})
nativeAddon.subscribe(dir, cb)