This is the @effect-app/boilerplate starter — a TypeScript monorepo seed (api/ Effect backend + frontend/ Nuxt + e2e/ Playwright) for projects built on the Effect App ecosystem.
- Package manager:
pnpm(v12, pinned viapackageManager) - Base branch:
main
wiki/architecture/ is the source of truth for patterns:
import rules, resource/controller layout, command pattern, query shapes,
database query guidelines, tagged state machines, error model, vue conventions, etc.
These are synced from effect-app/shared via effa sync — see wiki/shared-sync.md.
When changing a synced doc: edit in place, then effa sync-push --pr to propagate upstream.
For implementation work, start at the index and load only the docs that match the task.
Inspect the existing system first. Before proposing an approach, find the implementations that play the same role — sibling modules, commands, pages, builders — and name them.
Then present two angles, both accounting for the existing system:
- The pragmatic fit — the smallest change that works within the current architecture, constraints, and migration cost, matching how the named peers already do it.
- The greenfield ideal — how this would look if built fresh today, unconstrained. If that shape is better than the peers, the path must include updating those peers, as a stated path (this change or a tracked follow-up).
Keep it brief — a paragraph or a few bullets per angle. Record on every non-trivial PR:
Design angles: <assumed goal> — peers <named> (<pattern>); follow <X> / migrate <Y> via <path> / n/a (trivial).
- In Markdown, when inline code contains a backtick, use a double-backtick
delimiter:
code ` containing a backtick. Do not escape the inner backtick with a slash. - No
as any/as unknown. Fix the real type. - No
@ts-expect-error/@ts-ignore. Fix the underlying type or schema wiring. - No retry/sleep/nudge fixes for flakes. Find the root cause.
withConstructorDefaultis not a decode/migration default: it runs on.make(), not on decode. A new required field on persisted data needs an explicit, preferably versioned migration or a jitM-style backfill at the store boundary..make()/.makeFrom()strip any property the target schema doesn't declare, so build state from a spread instead of hand-copying fields:State.make({ ...state, ...dropTag(event), byUserId }). A later key overrides an earlier spread (order matters).- No local imports from
repos/*; use packages.repos/effectandrepos/effect-appare reference source only. Never webfetch Effect; read the localrepos/effect. effect/effect-app/@effect-app/*resolve from the registry by default, so edits torepos/*source are dormant in the app. To test a repos change locally, runpnpm embedded:effect:linkfirst (links the vendored source into the workspace), thenpnpm install.pnpm embedded:effect:statusshows linked-vs-registry;pnpm embedded:effect:unlinkreverts.- Do not add
pnpmpatches foreffect-app/@effect-app/*. Either link the vendored source (pnpm embedded:effect:link) or upstream the fix and adopt the new published release. - Use one
#<Root>/*alias persrcdir. No per-file aliases, old shims, or unfinished moves. - No manual command→query invalidation. Do not add
Req.Command4th-arginvalidatesQueriescallbacks, page-levelqueryInvalidation, orclientForinvalidation maps. Queries register repository reads; commands publish repository writes; the client invalidates by intersection. See wiki/architecture/command-pattern.md. - Refactors end in a clean state — full replace, no leftovers. When renaming a symbol, class, function, module, or file, update every reference and delete the old name. No back-compat aliases, no re-export shims at the old path, never both names resolvable at once.
- Tests must import production logic. Do not copy business logic into tests.
.vuefiles wire UI to logic; tested logic belongs in.tsmodules or composables.
pre-push (scripts/agent-pre-push.ts) is the agent ship gate. Humans are
not forced through it. Agents are detected via GROK_AGENT / T3_AGENT /
AI_AGENT / Claude / Cursor / Codex env markers.
| Branch PR state | Agent pre-push |
|---|---|
| No open PR | static gate (pnpm validate:changed) |
| Draft | static gate (pnpm validate:changed) |
| Ready for review | full ship gate |
gh / PR lookup failed |
full ship gate (fail closed) |
pnpm validate:changedrunscheck/lint-fix/testonly for the packages you touched (api / frontend / e2e), viascripts/lib/changes.ts. Root-config / lockfile changes fall back to the full gate.pnpm validate:planprints the plan.- Browser E2E attestation — when browser e2e is affected, the full gate asks
whether the relevant Playwright specs have been run. Only an explicit
y/yeswithin five seconds passes;no, empty input, timeout, or no interactive terminal blocks. - Publish path (required):
pnpm pr:ready— runs the same ship gate, then marks the PR ready. Agents must not callgh pr ready(or the ready-for-review API) directly.scripts/install-git-hooks.tsinstalls.tools/bin/gh, a policy shim that blocks those commands unlessAGENT_PR_SHIP=1(set only bypr:ready). Put$REPO/.tools/binfirst onPATHin agent sessions so the shim wins over systemgh. - The gate result is cached per HEAD SHA in
.run/agent-ship-gate.json, so one commit is validated once no matter how many times you push or publish it. Force a re-run only when diagnosing the gate:AGENT_SHIP_GATE_FORCE=1. - Dirty worktrees are rejected: commit before pushing. If the hook rewrites files
(
lint-fix/ dprint), stage those rewrites, commit, and push again. - Never
git push --no-verify/git commit --no-verify. Never setSKIP_AGENT_PREPUSH(human escape hatch only).
Do not run whole-suite checks by hand as routine verification — the gate runs them, once, and CI is the backstop. The exception is narrow, targeted proof while iterating: the one test you are fixing, or typechecking the package you edited.
After making all changes, run from the repository root:
pnpm check && pnpm lint-fixpnpm checktype-checks all packages (tsgo; frontend viavue-tsc). Because packages depend on each other (e.g.frontendande2edepend onapi), always run from the root to catch cross-package type errors.pnpm lint-fixauto-formats and fixes lint issues across all packages.pnpm rbuild(clean+check) is not part of routine validation — reach for it only for unexplained weirdness that survives a normal check.- Note:
pnpm checkforfrontendrunsnuxt prepareautomatically; iflint-fixfails with.nuxt/tsconfig.json not found, runpnpm checkfirst, thenpnpm lint-fix.
Always look at existing code in the repository to learn and follow established patterns before writing new code.
Do not worry about getting code formatting perfect while writing. Use pnpm lint-fix
to automatically format code according to the project's style guidelines.
Instead of writing:
const fn = (param: string) =>
Effect.gen(function*() {
// ...
})Prefer:
const fn = Effect.fnUntraced(function*(param: string) {
// ...
})Prefer the class syntax when working with Context.Service. For example:
import { Context } from "effect-app"
class MyService extends Context.Service<MyService, {
readonly doSomething: (input: string) => number
}>()("MyService") {}Avoid .length > 0 or .length === 0 or !.length or !!.length checks, use Array.isArrayNonEmpty for type narrowing by default.
Resource files (**/resources/*.ts) and controllers (*.Controllers.ts) follow a
fixed declaration order: List, List*, Get, Get*, then commands alphabetically.
Helper classes (S.Opaque, views, errors, inputs) sit immediately before the request
that uses them. See wiki/architecture/resource-and-controller-layout.md.
.vue files have extra constraints (e.g. don't shadow Array). See wiki/architecture/vue-conventions.md.
All .withConstructorDefault extensions exposed by effect-app (S.DateValid.withConstructorDefault, S.Boolean.withConstructorDefault, S.Array(...).withConstructorDefault, S.NullOr(...).withConstructorDefault, StringId.withConstructorDefault, branded ids, etc.) are construction-only:
- Applied when the field is omitted from input to a Schema constructor /
.make(...)call. - NOT applied during
decode(JSON, database rows, RPC payloads). A stored record missing the field will still fail to decode. - Therefore
.withConstructorDefaultMUST NOT be used as a just-in-time migration mechanism for database fields.
Do not reach for withDecodingDefault* as a substitute either. A missing field in persisted data is just as likely to be data corruption as it is an old-shape document; silently substituting a default hides the problem and can poison downstream aggregates.
Prefer an explicit, preferably versioned migration of database data (a schema-version field, a one-shot backfill, or a transform on read gated on an explicit version marker) over decode-time fallbacks. Don't shove missing fields under the rug.
- Work in committable increments — commit each before moving on. Each commit builds and passes its checks; no end-of-task mega-commit.
- On
main, branch first for feature work — unless told "commit and push" onmain. - Commit and push as the natural completion of a task — the user opts out ("don't push"), not in.
- Rebase before publishing or the final ready-PR push. Fetch
originand rebase a PR targetingmainonto the latestorigin/mainbefore the ship gate. Use--force-with-leasewhen updating rebased branches. - Squash-merge repo: new commit per change on a pushed branch, avoid
--amend(reserve it for local/unpushed commits or a deliberate rebase).
The PR description is the shared, portable record any agent resumes from — open early, keep it current.
Use real Markdown H2 headings in exactly this order:
## Why
## What
## How
## RemarksDo not replace these headings with bold labels, inline code, or a flat list. Prefer concise, discursive paragraphs under them. Use bullets only when they materially improve clarity.
- Always open a draft as early as possible: once the first meaningful commit gives reviewers anything useful to inspect, push it and open the draft.
- Publish only when done:
pnpm pr:ready(ship gate, then undraft). Do not use rawgh pr ready. - Keep the PR description in sync at every commit — final description = net
diff to
main, no filler. - PR description must include:
Flow doc updated: ✅ / ❌ (reason)— orn/awhile no flow docs existE2E coverage: added / follow-up tracked / internal-onlyDesign angles: <assumed goal> — peers <named> (<pattern>); follow <X> / migrate <Y> via <path> / n/a (trivial)