factory-forms

factory-forms is a skill for Claude Code, Codex from nonlinear-xyz/factory-kit. It costs 118 tokens per session (3,103 once invoked), scanned A, original, MIT.

A set of conventions for building web forms with react-hook-form, a React form library, and Zod, a data-validation library. It defines separate schemas for strict server data, flexible browser input, and partial updates, plus patterns for drawers, multi-step forms, conditional fields, and delayed validation.

In plain words
What is it for?
Use it for create/edit forms, drawer forms, multi-step wizards, and forms with dependent fields. It helps define validation, organize sections, register fields, hide and clean up conditional values, and submit changes through server actions or tRPC mutations.
Why use it?
It prevents browser-friendly empty values from weakening server validation and keeps update requests limited to the fields that changed. It also provides structure for forms that would otherwise grow difficult to maintain.

Skill for Claude CodeCodex

Part of the factory-kit plugin — 37 skills, 8 commands, 12 agents, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nonlinear-xyz/factory-kit/factory-forms
Any agent
npx skills add nonlinear-xyz/factory-kit --skill factory-forms
Clone the repo
git clone --depth 1 https://github.com/nonlinear-xyz/factory-kit

Made for: Claude Code, Codex.

Or install factory-kit, the plugin that ships this one along with the rest of its 37 skills, 8 commands, 12 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for factory-forms

README.md
[![agentmods](https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-forms.svg)](https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-forms)
Your own site
<a href="https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-forms"><img src="https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-forms.svg" alt="Measured on agentmods" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,103 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00118 $0.03103
Opus 5 $0.00059 $0.01551
Sonnet 5 $0.00024 $0.00621
Haiku 4.5 $0.00012 $0.00310

Measured 3d ago against content hash d602774081d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

factory-forms scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

await fetch(uploadUrl, { method: 'PUT', body: file, headers: { 'Content-Type': contentType } });
skills/factory-forms/SKILL.md · 300 lines

How it starts

The opening of the file, as written. The whole thing — 300 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Factory forms

Each section leads with Principle (one sentence, stack-agnostic), then Why (constraint → option → tradeoff), then Recipe (the react-hook-form / Zod / Mantine or shadcn shape), and Failure mode when there's one to name. Sections that are pure style with no deeper truth are marked Recipe only.

Stack

Recipe only.

  • react-hook-form — form state, validation, submission
  • Zod — schemas
  • Resolvermantine-form-zod-resolver (Mantine) or @hookform/resolvers/zod (shadcn)
  • Server submission — server action or tRPC mutation (see factory-api.md)

Three Zod schema variants — server strict, client lenient, patch partial

Principle. Maintain three schema variants per entity: server strict, client lenient, patch partial. Don't try to unify them.

Why. HTML inputs in controlled React forms initialize to ''; the server expects null or a valid value. A unified schema accommodates both by sprinkling .or(z.literal('')) everywhere, which leaves the server schema enforcing nothing. Three schemas keeps each contract sharp: the server enforces real shape, the client tolerates the input flux, the patch shape is structurally partial (only-what-changed). Cost: more schema. Benefit: each layer's invariants stay enforceable.

Recipe.

// features/customers/schema.ts

// Server input — strict types, server enforces these
export const customerInputSchema = z.object({
  orgId: z.string().uuid(),
  name: z.string().min(1),
  email: z.string().email(),
  phone: z.string().regex(/^\+?[0-9-]+$/),
  industry: z.enum(['retail', 'wholesale', 'manufacturing']),
});

// Client form — lenient, accepts empty strings (controlled-input compat)
export const customerFormSchema = z.object({
  orgId: z.string().uuid(),
  name: z.string().min(1, 'Required'),
  email: z.string().email().or(z.literal('')).optional(),
  phone: z.string().or(z.literal('')).optional(),
  industry: z.enum(['retail', 'wholesale', 'manufacturing']).or(z.literal('')).optional(),
});

// Patch — partial updates
export const customerPatchSchema = customerInputSchema.partial();

Read the full file on GitHub · 300 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 300 lines · 118 tokens per session scan A d602774081d5

Subscribe to this mod's changes

factory-forms is a skill published in the GitHub repository nonlinear-xyz/factory-kit (9 stars, last pushed 1mo ago), licensed MIT. It adds 118 tokens to every session and 3,103 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

educational-presentation

Crea presentazioni interattive per lezioni scolastiche ITIS usando React via CDN, dark theme, simulatori interattivi, e quiz. Due approcci consolidati: CDN-based (zero build, HTML puri) e Build-based (Vite+TS+Tailwind). Deploy su GitHub Pages. Progetto di riferimento: presentazione-vpn (Mar 2026).

thomascasali/claude-kb-workflow · 86 tokens

design-to-code

Lanhu to Code workflow for Claude Code. Convert Lanhu design URLs into Vue/React frontend code with component reuse, design token mapping, TODO-safe business logic, and optional code review.

ursazoo/lanhu-to-code · 42 tokens

component-doc-gen

Scan frontend src directories and generate docs/components.md so Claude Code can reuse existing Vue/React components during design-to-code generation.

ursazoo/lanhu-to-code · 29 tokens

vercel-react-view-transitions

Guide for implementing smooth, native-feeling animations using React's View Transition API ( component, addTransitionType, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components…

zhukunpenglinyutong/desktop-cc-gui · 127 tokens

ask-sonner

Sonner, the React toast library: mounting Toaster once, toast() calls, promise and loading toasts, updating, dismissing, styling, theming, dark mode, positioning. Use when toasts do not appear, appear twice, sit behind a modal, ignore Tailwind classes, or do nothing from a server action.

ericrisco/rsc-harness · 71 tokens

univer-integrate

Integrate Univer Sheets, Docs, or Slides into React, Vue 3, HTML, or Node.js projects. Use when embedding Univer, choosing preset or plugin mode, initializing instances, configuring themes/locales/workers, or manipulating workbooks, worksheets, ranges, formulas, permissions, and events through the Facade API.

dream-num/skills · 70 tokens