Quick answer: Terminal-native coding agents can ship a working data pipeline themselves—one ?help URL they read for the API contract, one npx @formlm/cli command that builds the assessment behind it.

Claude Code, the Codex CLI and Cursor's agent mode write excellent frontend code and terrible infrastructure. Ask one to "add a contact form" and it will generate a beautiful form, wire up handleSubmit, then shrug: the POST has nowhere to go. A local dev server is not a backend, and an agent that invents api.example.com out of thin air is shipping a dead button.

Agents fail at collection for one reason: they can't read the docs you would have read for them. Fix that and the same agent will do the rest. Here is the two-part handshake—machine-readable documentation, plus a CLI the agent can run.

Handshake one: an endpoint that documents itself

Publish any form or assessment on FormLM and you get a share endpoint. Append ?help to it and the endpoint returns its own API documentation as Markdown—write format, query paging, summary aggregates, rate limits, field creation rules:

# the agent reads its own contract—no docs site, no paste step
curl "https://formlm.me/api/v3/share/YOUR_TOKEN?help"

Drop that URL into the agent's context and it learns the whole surface in seconds. From there the rules are the ones any agent codes against: POST JSON as {"data":{...},"meta":{...}} (flat objects are accepted too), or submit a plain HTML form to /form; read records back from /query, aggregates from /summary. Unknown keys create their own fields, so an agent adding an input to the page never needs a migration.

Handshake two: one npx command builds the assessment itself

Collection is half the job—the other half is what makes a submission worth collecting: scoring logic, a per-respondent report, a published page. formlm-cli is the official MIT-licensed CLI on npm (Node.js ≥ 18), and because a coding agent already owns a terminal, it can drive the whole build:

# three lines the agent runs for you—generate, inspect, publish
npx @formlm/cli smart generate "Digital marketing maturity diagnostic for agency prospects, 5 dimensions, scored PDF report"
npx @formlm/cli snapshot --summary
npx @formlm/cli share url

The first line is the interesting one: smart generate turns a one-sentence brief into a complete assessment app—questions, weighted scales, conditional logic, report layout—cached server-side so the agent can execute it module by module. The second dumps the current state as JSON so the agent knows the field names it must submit against. The third returns the share token and page URL: the exact string that goes into action= or fetch() in the code the agent is writing.

A prompt that actually works

Agents follow contracts better than intentions. This is the shape of a request that ends with live data collection instead of a shrug:

<!-- paste into Claude Code / Codex / Cursor agent mode -->
<p>Before wiring the form, run: npx @formlm/cli smart generate "<your brief"
Then read the API contract at https://formlm.me/api/v3/share/<token>?help
Build the page's submit against that contract: POST {data, meta},
show an inline success state, and add a company honeypot hidden with CSS.
Verify with a curl round-trip before you call it done.</p>

Four things to notice: the agent creates the assessment rather than assuming one exists; it reads the contract rather than guessing field shapes; the honeypot is specified because generated pages never add spam guards on their own; and the curl round-trip gives the agent a test to pass—the same one a human would run.

What stays on you

"The agent's ceiling is whatever it can read. Give it an endpoint that explains itself and a CLI it can run, and 'add a form' stops being a prompt that ends in a TODO comment."

🛠️ Make your agent collection-capable

Everything the handshake needs is free to start—no server anywhere in this picture:

  • Self-documenting endpoints — append ?help to any share URL for its Markdown contract
  • Official CLI on npm — @formlm/cli, MIT licensed, scriptable from any agent terminal
  • Scoring and reports included — generated submissions become graded, branded PDFs automatically
  • MCP as the sibling path — prefer tools over shell? The same capabilities ship as an MCP server: Build an Assessment in Claude Desktop
Create your form endpoint →

✅ Key Takeaways

  • Coding agents ship pages that can't collect because they have no readable backend contract
  • ?help turns any share endpoint into agent-readable Markdown documentation
  • npx @formlm/cli smart generate "<brief>" builds the assessment, snapshot reveals the fields, share url hands over the token
  • Unknown keys auto-create fields—generated pages can add inputs without migrations
  • Ask for a honeypot and a curl round-trip; agents don't add spam guards or verification by instinct
  • Share tokens are public write targets; Access Tokens never go into prompts

Building for respondents rather than repositories? The Consultant and Coaching & Training tracks turn the same scored submissions into client-facing reports.

Frequently Asked Questions

Can an AI coding agent set up a form backend by itself?

Yes, if you give it two things: the share URL of a published form and permission to run npx @formlm/cli in the terminal. The CLI generates the whole assessment app from one instruction, and the agent wires the page it is building to the endpoint. Without a target endpoint, the agent just invents one that does not exist.

How does the agent learn the API without me pasting docs?

Every endpoint answers GET ?help with its own Markdown documentation—write format, query paging, summary aggregates, rate limits, field creation rules. Point the agent at that URL and it reads the contract in seconds; no doc site, no PDF, no copy-paste.

Is it safe to hand a share token to an agent?

A share token authorizes writes to one form, not your account. Treat it like a public POST target—rate limiting and honeypot fields still apply—never paste an Access Token or account credential into an agent prompt.

Does the agent need to keep the form fields in sync?

No. Unknown keys in a submission create their own fields automatically, so an agent that adds an input to the page needs no migration step—the next submissions simply carry the new column.

← Previous: Forms in Next.js, Astro & Hugo Back to Developer Zone →