The 35 guards
Every convention in Forkit, and the check that holds it.
Forkit is a SaaS starter kit for building with coding agents such as Claude Code and Codex. An agent follows a rule while it's reading it and drops it three files later, so in Forkit no rule lives only in a document. Each one is a check that runs on every push: lint, a test, a type check, a build, or a scenario in a real browser.
A check that never fails proves nothing. So each convention also has a guard. A guard plants
one real violation, runs the check that should catch it, and fails unless that check fails
with the words that name the problem. Then it removes the plant. pnpm check:guards
runs all 35. Below is each one, with the check it proves.
The shape of the code
- a route never touches the database pnpm lint
- core knows nothing of HTTP pnpm lint
- per-request state goes through ctx pnpm lint
- a screen's colours come from the theme pnpm lint
- a webhook is made by hookRoute and no other way pnpm lint
- a screen reaches the API through query.ts pnpm lint
- a screen signs in through session.ts pnpm lint
- only query.ts makes a cache, one for each request pnpm lint
- no password manager is offered an input that is not a credential pnpm lint
- server code never reaches the browser pnpm build
The rules of the data
Workspaces are kept apart by Postgres itself. Every table has forced row level security, and the Worker's database role can't get past a policy. Tests run in Cloudflare's own runtime against a real Postgres, not mocks.
- every table is defined under row level security pnpm lint
- a table without a forced policy fails the sweep db test
- a key to a workspace cascades, so deleting it takes every row db test
- a function that sees past row level security is listed on purpose db test
The API
Every route is documented in OpenAPI, and the typed client is generated from it.
- every route is documented api test
- no input names what the server must decide api test
- sign in is rate limited before the database opens api test
- a workspace answers only its members api check-types
- an invitation shows only to the login that confirmed its address api test
- a visitor reaches only what core wrote for a visitor api check-types
- the generated client matches the routes pnpm check:generated
Webhooks and uploads
- a webhook's delivery is proven before it is acted on api test
- a delivery is acted on once however often it arrives core test
- a picture is what its bytes say, not what the browser claims api test
Email and production
A change that owes an email records it in the same transaction, and a schedule sends whatever was missed. Production is checked against local before a deploy.
- the Worker runs the schedule that delivers owed email web check-types
- production has every binding local has pnpm check:production
- production runs the schedule that delivers owed email pnpm check:production
- a build that does not name its release is not called deployed smoke probe
The screens people use
Every kept flow runs in Chrome, and in WebKit as an iPhone with its keyboard up, against the built Worker, and keeps the screenshots.
- a new person's first minutes work in a browser smoke first-run
- an invited person joins in a browser smoke invitation
- a page for everyone arrives drawn, with its data smoke posts
- a sheet's button stays above a phone's keyboard smoke rename-sheet
The agent's own tools
Forkit bundles pstack, a set of agent workflows by Lauren Tan, for Claude Code and Codex. These guards keep the bundled copy whole and reachable.
- the bundled pstack is the one upstream shipped pnpm check:pstack
- Codex reaches every pstack skill pnpm check:pstack
- an installed pstack never takes the bundled one's place pnpm check:pstack
- check:guards: all 35 guards hold.
Adding your own
A new convention adds its guard in the same change as its check. AGENTS.md tells your agent where each rule lives and which check enforces it, and a new-module skill walks it from table to screens to proof.