Building with AI
The Surface MCP server creates the record, hands an agent the binding contract, and statically validates the HTML. Run the loop yourself, or hand it to an agent with a prompt like "build our demo booking form as an SDK form on our landing page".
The authoring loop
Plan (optional)
plan_formwithsdk: truecritiques a blueprint before anything is created.Create the record
create_formwithsdk: true: steps, questions, endings; no styling or routing parameters. Give every question real question text (the responses table reads those labels). Save theformIdandpreviewToken.Get the binding map
get_sdk_binding_mapreturns, per question:questionId,componentType,fieldNames, option keys,answerShape, plusenvironmentId,apiBaseUrl, and a ready-to-pasteinitsnippet. Use the snippet; a wrongapiBaseUrlis the most common failure.Author the page
Write HTML or React against the binding contract, copying IDs and option keys from the binding map.
Validate what ships
validate_form_htmlchecks the markup against the record. Fix every blocker; warnings are silent data loss at runtime.Preview, publish, deploy
Boot with
preview: trueand thepreviewTokento walk the draft with zero writes, thenpublish_formand deploy.Verify end to end
Submit one real test response,
await form.flush(), read it back withget_response, confirm every answer andmeta.surfaceTagStatus: "sdk". Without a browser, run headless in Node.
Validating framework pages
validate_form_html must see the markup the visitor actually receives. Plain HTML: pass the file. Framework page: fetch the rendered HTML (curl http://localhost:3000/your-page) and pass it with containerSelector set to your boot container. Never validate a hand transcription of the source. If navigation or submit is code-driven, declare data-surface-nav="js".
Editing an existing SDK form
Every record edit must be followed through to the HTML:
get_form_structure(withinclude: ["params"]) for the structure and itsrevision.- Edit with
add_step,update_step,add_component,update_component,remove_component, orbatch_edit, passing the revision asifRevisionso concurrent edits fail loudly. - Re-fetch
get_sdk_binding_mapand update the HTML for every difference. validate_form_htmluntil clean, thenpublish_formand deploy together.
If publish and deploy cannot land at the same time, publish first for additions and deploy first for removals and option-key changes. The dashboard's SDK form builder edits the same draft by hand.
Tools that refuse on SDK forms
Styling, marketing, layout, and routing tools reject SDK forms: presentation lives in your HTML, navigation in your code. simulate_response does not apply either. validate_form checks configuration integrity only; a pass says nothing about your page.
Installing the skill
If your agent runner supports skills (Claude Code does):
cp -r node_modules/@surface-labs/forms-sdk/skills/surface-forms-sdk .claude/skills/
The skill includes the workflow, HTML patterns, an editing sync loop, and a debugging runbook.