agentleFS
vantionlabsvantionlabs/saas-starter/.agents/skills/effect-form-e2e/SKILL.md

effect-form-e2e

Skill9 starsChanged 42 days agoMITView on GitHub

Use when adding or changing a form, a field's validation rules, or a Playwright test in this repository. Covers why a form is effect-form and lives in the app rather than the design system, declaring field rules once in the contract, telling a validation failure apart from a refusal, and the e2e harness's rules — a user per test, waiting on a condition rather than sleeping.

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every check carries a message, because that is what a person reads.

    line 29
  2. Very specific:

    Read it out of the Cause with AsyncResult.error, not off the result.

    line 49
  3. Very specific:

    Never sleep. interactUntil retries the action against the condition it was meant to cause — a click on a server-rendered button before …

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

A write is a form, and a form is effect-form

FormReact.make over a FormBuilder, living in the app rather than in @vantion/ui. The library binds the submit into the form definition, so a shared presentational component taking onCreate as a prop cannot be one. apps/design renders plain inputs for the layout, because validation and submit state are the part of a form that has nothing to do with how it looks.

That also removes a problem rather than managing it: effect-form does not render its fields during SSR, so there is no window in which somebody can type into a control that is not listening.

A field's rules are declared once, in the contract

ContactFields in ContactRpc.ts is what the CreateContact payload is built from and what the form validates with, so the form refuses exactly what the server would.

export const ContactFields = {
  fullName: Schema.String.check(Schema.isNonEmpty({ message: "Enter a name." })),
};

Every check carries a message, because that is what a person reads. They were two declarations of one rule once — the procedure checked isNonEmpty with no message while the screen kept a readable copy — and the server's was the version nobody could read.

For a rule a regex cannot express, Schema.makeFilter returns a sentence or undefined. EndpointFields.url is the worked example, and the rule it enforces is the difference between a webhook form and server-side request forgery.

A failed submit is two different things

submitMessage in apps/web/src/lib/form/result.ts tells them apart: a SchemaError is the form failing to decode, anything else came back from a server. Saying "check the fields above" to somebody whose permission was denied sends them looking in the wrong place.

The validation case is named rather than inferred from everything that is not one particular request error. Written the other way round, every error added later inherits the wrong message.

A refusal worth acting on gets its own sentence. LimitReached carries the number, so the screen says "this plan includes two API keys" rather than "could not create that key". Read it out of the Cause with AsyncResult.error, not off the result.

Browser tests

pnpm e2e needs nothing set up: its own Postgres container on a free port, migrated with the same runner bun run dev uses, both servers on 3100 and 5273.

Two properties keep it parallel and deterministic:

  • Every test signs up its own user, so none truncates a table and none shares a tenant.
  • Every test presents its own x-forwarded-for, because the credential endpoints are rate-limited per caller and a parallel suite from one address exhausts the bucket.

Never sleep. interactUntil retries the action against the condition it was meant to cause — a click on a server-rendered button before React attaches succeeds and does nothing, and the next assertion is what fails fifteen seconds later.

Three refusals an integration hits first, all worth knowing before debugging one: 415 for no Content-Type, 403 MISSING_OR_NULL_ORIGIN for no Origin, and a hydration race that looks like a broken feature.

Where to look

  • apps/web/src/components/contact/contact-form.tsx — the worked form
  • apps/web/src/lib/form/result.ts — the two sentences
  • e2e/fixtures.ts — signedIn, interactUntil, completeOnboarding
  • repos/effect-form/packages/form*/src/ — the only reference; there are no published docs for the v4 API

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.