Slides for this part are available in English (PDF), and both parts in one Japanese deck (PDF).

Part 1 explained why I built the starter. This part describes the checks that keep the code consistent.

Agents take shortcuts. Sometimes they cheat. They copy the shape of the codebase. They also make the checks pass without solving the problem. A convention in a document does not stop that. The starter puts its conventions in four places: the typechecker, the linter, the test runner, and the dependency graph. Effect gives the code a model. The checks enforce it, so an agent that copies the shape of the codebase also copies the model.

One type instead of many libraries

Most TypeScript projects collect libraries for the same concerns. They use Zod for schemas, p-limit for concurrency, p-retry for retries, dotenv for config, pino for logs, and a dependency injection container for wiring.

Each library is reasonable on its own. Together they require an agent to track many small, slightly different models.

Effect puts those concerns in one type:

Effect<Success, Error, Requirements>

The type has three parameters: success, typed failure, and dependencies. Every combinator tracks those three channels in its type. If a function returns an Effect, its signature shows what it can fail with and what it needs before it can run. That is the main reason I use Effect.

Effect covers several dependencies that usually come as separate packages:

Common choiceEffect
Zod, valibot, io-tsSchema: decode at boundaries, encode for output, tagged errors, branded types, JSON
dotenvConfig and ConfigProvider.fromDotEnv
p-limit, async-semaEffect.forEach(..., { concurrency }), Semaphore
p-retry, async-retryEffect.retry and Schedule
p-queueQueue for in-process work. PersistedQueue for durable work, still unstable
TanStack Query, React QueryEffect atoms, with @effect/atom-react for React
pinoEffect.logInfo and the Logger service
OpenTelemetry integrationEffect.withSpan and the Tracer service, with Otlp layers in effect/observability to export
ts-patternMatch
neverthrowResult for sync values, Effect itself for async work, Exit for run outcomes
tsyringe, InversifyJSContext.Service and Layer: the wiring is checked by the type, not resolved from a runtime container
Hono or Express plus OpenAPI integrationeffect/http and effect/http-api
RxJS for streamsStream

A few of these modules are still marked unstable in Effect v4: the dotenv provider, atoms, the HTTP API, and persisted queues. They work today, but I expect their surface to move.

Reducing the dependency count is one benefit, but it is not the main one. Before Effect, I had to install a schema library, a concurrency limiter, a retry library, a config loader, and a dependency injection container. Then I had to keep them consistent as the project grew. Effect already includes those pieces. I like that. A failure, a retry, a timeout, and a cleanup step all compose in the same place. When an agent adds a workflow, it does not have to choose a retry library or an error convention. It uses the signature.

There are two exceptions. Drizzle still handles the SQL schema and migrations. Playwright still runs the browser tests. Effect does not replace those. Effect v4 is also still changing. I return to Effect v4 at the end.

Schemas at the boundary

If you only need to validate a form, Zod is smaller and a good choice. Schema becomes useful when one shape has more than one purpose.

The starter defines wire shapes only in packages/contracts:

export const User = Schema.Struct({
  id: Schema.String.pipe(Schema.check(Schema.isGUID())),
  name: Schema.NonEmptyString,
  createdAt: Schema.DateTimeUtcFromString,
});

export const UsersResponse = Schema.Array(User);

The API handler returns UsersResponse. The client gets the same type from HttpApiClient. The users atom, built with AtomHttpApi from effect/reactivity, reads through that client and keeps the type. The starter generates the OpenAPI document from the same HttpApi definition. There is no second schema for the client and no z.infer step.

Errors use the same pattern:

export class UsersListError extends Schema.TaggedError<UsersListError>()("UsersListError", {
  message: Schema.String,
}) {}

That class is the error value, the schema, and the tag used by Effect.catchTag. In the HTTP contract, it also maps to a status code. One definition covers several cases.

The rule I care about most here is simple. Parse at the boundary, then pass the parsed type to the rest of the code. The lint rules no-unknown-parameters, no-unknown-returns, and no-unsafe-dictionary-type enforce the second part. They are enabled only in the domain code under apps/api/src/services and packages/contracts. Application code can still take unknown at the boundary, because an HTTP body or a JSON file is unknown.

Concurrency without p-limit

p-limit is a good library. It does one thing well. But it only handles promises, so you must handle everything around the limit:

import pLimit from "p-limit";

const limit = pLimit(4);
const items = await Promise.all(ids.map((id) => limit(() => fetchItem(id))));

If one request fails, Promise.all rejects, but the other requests keep running. A retry needs a wrapper. Cleanup needs try and finally. A span around each item needs another wrapper.

Inside an Effect.gen, the same loop is shorter and structured:

const items = yield* Effect.forEach(ids, (id) => fetchItem(id), { concurrency: 4 });

If one fiber fails, Effect interrupts the other fibers, closes their scopes, and returns the typed error. The concurrency limit is an option on the same combinator that handles failure.

Retries compose the same way:

const items = yield* Effect.forEach(
  ids,
  (id) => fetchItem(id).pipe(Effect.retry(Schedule.recurs(3))),
  { concurrency: 4 },
);

If the limit must be shared across functions, use a Semaphore:

const gate = yield* Semaphore.make(4);
yield* Effect.forEach(ids, (id) => gate.withPermits(1)(fetchItem(id)));

I use Effect.forEach with a concurrency option much more often than a Semaphore. Use a Semaphore when the limit belongs to a resource, such as a database pool, rather than to one loop.

Concurrency is the clearest example of this. Effect has a concurrency limit in the same package, so you do not need a separate library for it. A single Effect<A, E, R> keeps the concurrency, the retry policy, the timeout, and the error type in one value. An agent can move that value, wrap it, or provide its dependencies without losing those properties. With separate libraries, each wrapper has its own rules about what remains after composition. The same argument applies to Queue, Cron, observability, and the other modules in Effect.

Type checking rejects unexecuted Effects

The starter runs TypeScript 7, the native tsgo compiler, through effect-tsgo. At the time of writing, TypeScript 7 is still new, so the starter pins the version in the root package.json:

"typescript": "7.0.2",
"@effect/tsgo": "0.73.2"

effect-tsgo patches TypeScript and Oxlint with the Effect language service. The patch runs in prepare after install. Both tools then see the same Effect rules. The API’s tsconfig.json sets a group of Effect diagnostics to error.

The typechecker enforces the rule. An unexecuted Effect is a type error. In apps/api, these diagnostics are errors, not suggestions:

Effect.log("never executed"); // floatingEffect

export const nested = Effect.succeed(Promise.resolve(1)); // promiseInEffectSuccess

export const untyped = Effect.fail(new Error("oops")); // globalErrorInEffectFailure

export const timers = Effect.gen(function* () {
  setTimeout(() => {}, 1); // globalTimersInEffect
  const now = Date.now(); // globalDateInEffect
  const signal = new AbortController().signal; // abortControllerInEffect
  return { now, signal };
});

Type checking differs from lint. It analyzes the whole program, uses the types, and reports the mistake where the Effect is created. The base config also enables exactOptionalPropertyTypes, noUncheckedIndexedAccess, and erasableSyntaxOnly, which block some common TypeScript workarounds. erasableSyntaxOnly also rejects enums and parameter properties, which agents use out of habit.

Set ignoreEffectWarningsInTscExitCode to true. Set ignoreEffectErrorsInTscExitCode to false. Warnings stay visible without breaking the build. Errors break it. You can adopt the diagnostics gradually without failing every build in the first week.

Lint enforces project policy

The lint config is one file, vite.config.ts. I organized it the way I think about the rules.

  • categories sets correctness and suspicious to error, and perf to warn.
  • typeAware: true lets the type-aware rules use the compiler.
  • plugins adds React, accessibility, TypeScript, import, Vitest, and the Effect rules.
  • jsPlugins loads the starter’s own rules and the adapted anti-slop rules.
  • overrides applies strict rules where domain logic is, and relaxes them at entrypoints, adapters, and tests.

The overrides matter. A rule that applies everywhere adds a warning at every call site. A rule that applies where the decision is made reports the mistake once.

The Effect rules

The starter uses the recommended preset from @effect/tsgo/oxlint-presets, which has 100 rules at this commit. Thirteen are errors. The starter upgrades three more to errors and turns two off.

This article does not list all 100. The preset is the reference. These are the rules that change how I write code:

  • floating-effect reports an Effect that is created and never run or yielded. This is the most common way to write a bug that looks like working code.
  • run-effect-inside-effect reports a nested runtime. If you are already in an Effect, compose instead of running.
  • missing-return-yield-star reports a return effect that should be return yield* effect when the Effect never succeeds.
  • return-effect-in-gen reports a generator that returns an Effect. The result is Effect<Effect<...>>.
  • catch-all-tag-dispatch-to-catch-tag and catch-if-tag-to-catch-tag replace hand-written tag checks with Effect.catchTag.
  • schema-struct-with-tag reports a Schema.Struct with a literal _tag. Schema.TaggedStruct is the correct shape.
  • effect-fn-opportunity suggests Effect.fn for named functions that return an Effect, so each call gets a span and a name in traces.
  • leaking-requirements reports a service implementation that leaks its dependencies into the caller’s requirements channel.

The Oxlint rule names use hyphens. The compiler diagnostic names use camelCase. The two tools often report the same rule.

I turned off two Effect rules. lazy-effect would flag service methods that return an Effect lazily. The starter keeps those methods as functions so each call can have its own Effect.fn span. schema-class-missing-brand would require a brand on every Schema class, which adds work the starter does not need yet.

The pattern is to use the preset, then make a small number of deliberate exceptions and write down why. An agent can read the exceptions in the config.

The starter’s own rules

These rules enforce this project’s structure rather than Effect’s general style. There are eight in tools/oxlint/index.js.

RuleWhat it reportsWhy it exists
runtime-boundaryEffect.run* and ManagedRuntime.make outside an entrypoint or framework adapterKeeps Effects composable. Only entrypoints and adapters run them
test-runtimeEffect.run* and manual runtimes in testsTests use it.effect, which provides TestClock. Layers are provided per test
schema-compile-scopeSchema.decode* and friends called on a static schema inside a functionThe schema is compiled on every call. Hoist it to module scope
workspace-importsRelative imports into another workspace, deep imports into src, imports of private app codeImport contracts through package exports. Keep apps private
no-direct-react-effectuseEffect and useLayoutEffect in apps/web/srcBans the hooks. Use Effect atoms for server data or useSyncExternalStore for external stores
no-wall-clock-in-testsDate.now, new Date(), performance.now, process.hrtime in testsUse TestClock or a fixed date instead of the real clock
no-timer-waits-in-testssetTimeout waits in unit testsUse TestClock, an event signal, or a retry assertion
suppression-reasoneslint-disable, @ts-expect-error, @effect-diagnostics without a reasonAn agent cannot suppress the compiler without a reason

runtime-boundary enforces the architecture. An Effect value is a description. Running it is an operation for an entrypoint or adapter. Keeping Effect.run* at main.ts, http.ts, and the browser client keeps the rest of the code composable. The rule has overrides for those files and for tests, so it does not report those files, where running an Effect is the purpose.

schema-compile-scope is a performance rule, not a style rule. Schema.decodeUnknownSync(User) inside a function recompiles the schema on every call. Hoisting it to a module-level const takes one line and changes the cost on a hot path. It is also the kind of code an agent writes naturally, because the inline version looks simpler.

test-runtime and the timer rules enforce determinism. A test that sleeps for 50ms is slow and flaky, and it shows an agent that waiting is an acceptable way to synchronize. it.effect plus TestClock gives you the same test without the wait. The Vitest plugin also treats it.effect and it.live as test blocks, so it checks expect inside them. Tests that need a socket or a process use the *.integration.test.ts suffix. This keeps the unit suite fast.

suppression-reason matters most. Every suppression needs a -- reason. Oxlint’s reportUnusedDisableDirectives reports a disable comment that no longer suppresses anything as an error. TypeScript does the same for an unused @ts-expect-error. An agent cannot silence the compiler without a reason.

Anti-slop

The anti-slop rules come from Dillon Mulroy’s anti-slop project, adapted to this starter’s Oxlint setup. They report the workarounds an agent uses when the types do not match.

RuleWhat it reports
no-chained-type-assertionsvalue as unknown as User and other chained assertions
no-widen-then-assertA value widened to unknown or object, then asserted back to a narrower type
no-unsafe-dictionary-typeRecord<string, unknown>, { [key: string]: any }, and similar workarounds
no-unknown-parametersunknown parameters, except cause and type-predicate subjects
no-unknown-returnsFunctions that return unknown instead of a parsed domain type
no-module-mockingvi.mock, vi.doMock, and vi.unstable_mockModule
no-reduce-accumulator-copyacc.concat([item]), Object.assign({}, acc), and other growing copies inside reduce. Pairs with oxc/no-accumulating-spread
no-manual-effect-error-tagHand-discriminating _tag inside a broad Effect.catch
no-manual-tagged-constructionWriting { _tag: "Ready", ... } instead of using the tagged constructor

Not all rules apply globally. The starter enables the unknown-parameter, unknown-return, and unsafe-dictionary rules only in domain code. It turns off no-manual-tagged-construction in tests, because tests assert literal wire values. The rest apply everywhere.

The two assertion rules are not my favorites, but they give useful feedback and help keep the codebase in shape. An agent that cannot make the types match has a few options: change the code, ask for help, or assert the type it wants. The last option is the smallest change, and it produces code that compiles but is wrong. no-chained-type-assertions reports value as unknown as User. no-widen-then-assert reports the two-step version, where a value is widened to unknown and narrowed later. Both messages say the same thing. Keep the original type, or parse at the boundary.

The other rule to explain is no-module-mocking. vi.mock replaces a module for the whole test file, so the test stops exercising the interface the application uses. With Effect, that interface is a Layer. Replacing a service in a test is explicit, typed, and scoped to the test’s runtime.

The React rules

The frontend has one project rule that goes further: no-direct-react-effect bans useEffect and useLayoutEffect in apps/web/src. The message points to Effect atoms for server data and useSyncExternalStore for external stores. If an effect really must synchronize with an external system, the rule requires an inline suppression that explains what it synchronizes and why. The rest are the React Compiler’s Rules of React: hooks, purity, refs, and unstable nested components. Agents write a lot of useEffect state syncing, and the ban removes the pattern instead of warning about it. These rules are not specific to agentic coding; they are good rules that are now cheap to run.

Error messages should give the next step

The starter writes its rule messages as instructions. This is the message for runtime-boundary:

Execute Effects only in an entrypoint or framework adapter. Compose Effects and yield services here; tests use it.effect.

An agent that reads that message has a next step. A message that says “invalid” does not.

The starter also tests the rules. tools/effect-policy.test.js has roughly 700 lines of fixtures. They check that the bad pattern reports the rule and that the good pattern passes lint. The tests cover the compiler diagnostics the same way. A rule that stops reporting without an error is worse than no rule. The tests make that failure visible.

Dependencies: catalog, release age, build allowlist

Agents install packages. That is usually useful and occasionally terrifying.

The starter uses a pnpm workspace with a catalog, so every workspace declares the same version of the shared dependencies:

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"

A package writes "effect": "catalog:" instead of a version range. When someone updates Effect, they update it once. If a package uses catalog:, it cannot use a different range.

Two supply-chain settings matter more in agentic coding than they used to:

  • minimumReleaseAge: 1440 does not resolve a package published in the last 24 hours. This blocks recently published packages, including compromised releases. An agent that wants a brand-new version gets an older one instead, or an error if no version qualifies.
  • allowBuilds lists the only packages allowed to run install scripts: @parcel/watcher, esbuild, and msgpackr-extract. Postinstall scripts run code. The allowlist prevents a new dependency from running install scripts without review.

There are also overrides to pin one Vite version and one Vitest version across the workspace, and a peerDependencyRules entry for the Vite+ core alias. pnpm-generated projects include a lockfile, so a fresh install uses the versions I tested, not a new resolution.

None of this is unique to Effect. It is easier to keep consistent when the dependency list is small and the versions come from one place.

One toolchain

The starter uses Vite+ for lint, format, test, pack, and task running. Vite+ provides one vp CLI and one root config for Vite, Vitest, Oxlint, and Oxfmt:

"lint": "vp lint .",
"format:check": "vp fmt . --check",
"typecheck": "vp run --cache --concurrency-limit 4 --filter \"@effect-starter/*\" typecheck"

The task runner caches and parallelizes the workspace checks. typecheck runs each workspace’s typecheck script (effect-tsgo tsc --noEmit in the API and contracts) with a concurrency limit, so checks finish quickly even as the workspace grows. Each package runs its own vp test. The root script also runs the rule-policy tests and the generated-project checks.

An agent also has fewer setup steps that can fail. The same vp command runs the same scripts in every package. The API build runs effect-tsgo tsc --noEmit && vp pack, so a build cannot skip the typecheck. The generated projects and the starter use the same task names.

The starter supports pnpm or Bun as the package manager, and Node.js or Bun for the API runtime. The Vite+ checks always run on Node, even when Bun is the package manager or the runtime.

Plain vp lint does not run the prepare patch first, so it can miss the Effect rules. The patch runs during install. Use the package script afterwards, not a bare vp lint. Put this detail in the README, because an agent will run the shorter command.

What this costs

Speed is not the cost. Lint and typecheck finish in seconds, even on one of my projects. The unit tests use TestClock, so they do not wait on real time.

A rule that reports a valid pattern can cause an agent to write a more complex workaround. The error messages make the fix clear, but they do not eliminate the work.

Rules cannot check the design. You can write code that passes lint and solves the wrong problem. The starter makes the mechanical parts consistent. It does not make product decisions.

Effect v4 is still changing. Some APIs are unstable, and the starter lists the ones it allows. I expect some of these rules and examples to look different in six months. I use a commit URL in the links instead of main for that reason.

Closing

The goal is not to add constraints without a reason. It is to give the codebase a shape that an agent can copy. A person should not need to review every line for style. Type checking reports language and type errors. The linter reports violations of this project’s conventions. Tests report timing, concurrency, and boundary errors. The catalog aligns dependency versions.

When those checks work, review can focus on product decisions. That is the result.