25 slides
Agents copy the codebase.
Strict by design.
Effect starter, part 2
Typecheck. Lint. Tests. Dependencies.
Agents take shortcuts
They copy the shape of the codebase.
They make the checks pass without solving the problem.
A convention in a document does not stop that.
Effect gives the code a model. The checks enforce it.
An agent that copies the shape also copies the model.
Starter at a glance
| Location | Role |
|---|---|
apps/api | Effect HTTP API, Drizzle, PostgreSQL |
apps/web | React or TanStack Start with Effect Atom, or no frontend |
packages/contracts | Schemas and the HTTP contract |
One workspace. One contract.
One type instead of many libraries
Zod, p-limit, p-retry, dotenv, a DI container → Effect<A, E, R>
Success, typed failure, dependencies. Every combinator tracks those three channels in its type.
One model. Not a complete list.
What Effect replaces
| Common choice | Effect |
|---|---|
| Zod, valibot, io-ts | Schema |
| dotenv | Config |
| p-limit, async-sema | Effect.forEach, Semaphore |
| p-retry, async-retry | Effect.retry, Schedule |
| TanStack Query, React Query | Effect atoms (@effect/atom-react for React) |
| p-queue | Queue, PersistedQueue |
| pino, OpenTelemetry | logs, metrics, traces |
| tsyringe, InversifyJS | Layer, Context.Service |
| Hono, Express | effect/http, effect/http-api |
| RxJS | Stream |
The list is long. The point is one model.
Schemas at the boundary
packages/contracts → API / client / OpenAPI
One definition. Several jobs.
One schema, several jobs
const User = Schema.Struct({
id: Schema.String.pipe(Schema.check(Schema.isGUID())),
name: Schema.NonEmptyString,
createdAt: Schema.DateTimeUtcFromString,
});
class UsersListError extends Schema.TaggedError<UsersListError>()(
"UsersListError",
{ message: Schema.String },
) {}
One definition types the API, the client, and the OpenAPI document.
Example: concurrency
p-limit: the limit is yours to manage
const limit = pLimit(4);
const items = await Promise.all(
ids.map((id) => limit(() => fetchItem(id))),
);
Retry, cleanup, and spans need more wrappers.
Example: concurrency
Effect: the limit is one option
const items = yield* Effect.forEach(
ids,
(id) => fetchItem(id).pipe(Effect.retry(Schedule.recurs(3))),
{ concurrency: 4 },
);
Same limit. Structured failure, cleanup, and retries.
Beyond concurrency
| Area | Effect |
|---|---|
| Queues | Queue / PersistedQueue |
| Recurring work | Cron / Schedule |
| Observability | logs, metrics, traces |
| Config | Config |
| HTTP / SQL | effect/http, effect/sql |
| Streams | Stream |
p-limit is one example. The same argument applies to the rest of the toolbox.
Type checking rejects unexecuted Effects
Effect.log("never executed"); // floatingEffect
Effect.succeed(Promise.resolve(1)); // promiseInEffectSuccess
Effect.fail(new Error("oops")); // globalErrorInEffectFailure
An unexecuted Effect is a type error.
Type checking: the details
| Promoted to error | Strict TypeScript flags |
|---|---|
floatingEffect | exactOptionalPropertyTypes |
runEffectInsideEffect | noUncheckedIndexedAccess |
promiseInEffectSuccess | erasableSyntaxOnly |
leakingRequirements | verbatimModuleSyntax |
unknownInEffectCatch | |
globalTimersInEffect | |
abortControllerInEffect |
TypeScript 7 + effect-tsgo. Warnings stay visible; errors fail the build.
Lint is project policy
categories:correctnessandsuspiciousare errors,perfis a warningtypeAware: true: the type-aware rules use the compilerplugins: React, a11y, TypeScript, import, Vitest, EffectjsPlugins: the starter’s rules and anti-slopoverrides: strict in domain code, relaxed at the edges
A rule that applies everywhere is noise. A rule that applies where the decision is made is a guardrail.
The Effect preset
| 100 | 13 | 3 | 2 |
|---|---|---|---|
| recommended rules | already errors | upgraded to error | turned off |
Upgraded catch-all-tag-dispatch-to-catch-tag, catch-if-tag-to-catch-tag, schema-struct-with-tag
Off lazy-effect (keep service methods as functions), schema-class-missing-brand (not needed yet)
The starter’s rules
| Rule | What it reports |
|---|---|
runtime-boundary | Effect.run* outside an entrypoint or adapter |
test-runtime | Manual runtimes in tests; use it.effect |
schema-compile-scope | Schema compilers inside a function |
workspace-imports | Private app code or deep src imports |
no-direct-react-effect | useEffect / useLayoutEffect in apps/web/src |
no-wall-clock-in-tests | Date.now, new Date() in tests |
no-timer-waits-in-tests | setTimeout waits in unit tests |
suppression-reason | Disables and ignores without a reason |
The code is in tools/oxlint/index.js.
Anti-slop
| Rule | What it reports |
|---|---|
no-chained-type-assertions | value as unknown as User |
no-widen-then-assert | Widen to unknown, then assert back |
no-unsafe-dictionary-type | Record<string, unknown> and similar |
no-unknown-parameters | unknown parameters outside cause |
no-unknown-returns | Functions returning unknown |
no-module-mocking | vi.mock, vi.doMock |
no-reduce-accumulator-copy | Growing copies inside reduce |
no-manual-effect-error-tag | Hand-discriminating _tag in catch |
no-manual-tagged-construction | Literal { _tag: "Ready" } |
Adapted from Dillon Mulroy’s anti-slop project.
The React rules
| Rules of React | no-direct-react-effect | no-unstable-nested-components |
|---|---|---|
| Hooks, purity, refs, immutability | Ban useEffect and useLayoutEffect. Use Effect atoms or useSyncExternalStore | Keep component identity stable |
Not agent-specific. Good rules that are now cheap to run.
Error messages should give the next step
Execute Effects only in an entrypoint or framework adapter. Compose Effects and yield services here; tests use it.effect.
The rules are tested. Roughly 700 lines of fixtures.
Tests: no real time
it.effect("retries", () => Effect.gen(function* () {
yield* TestClock.adjust("1 second");
// ...
}));
Use TestClock. Put real sockets and processes in *.integration.test.ts.
Dependencies: one catalog
catalog:
"@effect/platform-node": "^4.1.4"
"@effect/sql-pg": "^4.1.4"
"@effect/vitest": "4.1.4"
effect: "^4.1.4"
vite-plus: "1.7.0"
One version per shared dependency.
Dependencies: the supply chain
minimumReleaseAge | allowBuilds | lockfile |
|---|---|---|
1440 minutes. No package published in the last 24 hours | Only three packages may run install scripts | A fresh install uses the versions I tested |
Agents install packages. The graph needs guardrails.
One toolchain
vp lint .
vp fmt . --check
vp test
vp pack
vp run --cache --concurrency-limit 4 typecheck
One CLI. One root config.
What this costs
Speed is not the cost.
Lint and typecheck finish in seconds. Tests use TestClock.
| False positives | Workarounds | Design |
|---|---|---|
| A valid pattern can still get a warning | An agent may write a stranger fix to satisfy a rule | Lint cannot tell you the design is wrong |
Give the codebase a shape an agent can copy.
Typecheck. Lint. Tests. Dependencies.
The English deck for part 2 of the series, in the same Cobalt Grid design as the Japanese one. 25 slides.
It covers the checks in the order they run: typecheck, lint, tests, and the dependency graph. The written version is Effect starter, part 2: checks agents can run.
Both parts together are also available as one Japanese deck.