connect-ui
Skill1 starsChanged 36 days agoMITView on GitHub
Wire a use case to a Next.js page through a server action with Zod validation, field errors and pending state. Use when the user wants a form or button in src/app that triggers a use case.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- new-adapterSkill
- new-moduleSkill
- new-use-caseSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Make sure the use case is exposed in src/composition/<module>.ts.
- Very specific: line 20
Run pnpm check, then pnpm build (server actions and Suspense rules are enforced at build time).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Connect UI
src/app is the driving adapter: it translates HTTP/form input into use-case calls and results into UI. It holds no business rules.
Steps
- Make sure the use case is exposed in
src/composition/<module>.ts. The UI imports@/composition/<module>for use cases and@/modules/<module>for types andDomainError. Never import module internals. - In
src/app/<route>/schemas.tswrite the Zod schema for the form. Messages are user-facing. Convert units here (for example dollars to cents), not in the use case. - In
src/app/<route>/actions.ts("use server") follow templates/action.ts.tpl: parse withsafeParse, return{ status: "error", fieldErrors }on failure, call the use case insidetry, mapDomainErrorto its message and everything else to a generic message, thenrevalidatePath. - Shared form state type lives in
form-state.ts(a"use server"file may only export async functions). - Client form:
useActionState(action, initialFormState); submit button usesuseFormStatusfor pending; render each field error next to its input withrole="alert". - Reads: a server component that awaits
connection()(or other runtime data) inside<Suspense>with a loading fallback and an explicit empty state. - Next.js here has breaking changes: check
node_modules/next/dist/docs/for anything you are unsure about (see AGENTS.md). - Run
pnpm check, thenpnpm build(server actions and Suspense rules are enforced at build time).
UI states checklist
loading, empty, error (field and form level), success, pending-disabled button.
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
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.

