server-function-boundary
Where a server function lives, and what one file of it holds.
The rule
Agents read this text as written when they write and review code.
Put every createServerFn in a server/ folder, one per file, named for what it does. A server function that takes input declares its validator. Server-only code only that function uses sits beside it in server/, and nothing outside server/ imports a server-only dependency.
server/ is the one place code runs on the server, so the client/server line is read from the tree, and a server dependency reaching the client shows as a wrong import path.
Examples
The check flags the incorrect code and passes the correct code; the agent judges what the check cannot see. Each example is a small repo, because this rule looks across files. It opens on the file that matters; the other files are the repo around it.
Incorrect
import { createServerFn } from '@tanstack/react-start';import type { Issue } from '../types/Issue.ts';// Incorrect: a server function in utils/, so nothing in the tree says// where the client stops and the server begins.export const findIssues = createServerFn({ method: 'GET' }).handler(async (): Promise<Issue[]> => [{ id: 1, title: 'Login fails' }]);
Correct
import { createServerFn } from '@tanstack/react-start';import type { Issue } from '../types/Issue.ts';// Correct: one server function, in server/, named for what it does.export const findIssues = createServerFn({ method: 'GET' }).handler(async (): Promise<Issue[]> => [{ id: 1, title: 'Login fails' }]);
Configure
- Block
"blocking"Stops a run when a file the run changed breaks the rule. - AdviseDefault
"advisory"Reports it and hands it to the refactor agent. Never stops a run. - Off
"off"Not checked. Use it when your own linter already enforces the rule.
Add this to your lightsout.config.json, then change the value.
{"standards-rule-settings": {"server-function-boundary": "advisory"}}