--- name: build-form-template description: Create or edit a Penbox form template end to end. Use when the user wants a new form, or wants to add, change or remove questions, elements, signatures, translations, loops or document generation in an existing one. --- # Build a form template Read `penbox-getting-started` first if this is the first Penbox action of the conversation. ## Before touching anything 1. `get_skill("form_template")`. Once per conversation. It is the reference for what a form can contain and the exact element shapes. 2. `list_form_templates` to check whether a similar template already exists. ## Create `create_form_template` with a `name` and a `locale` (`fr`, `nl`, `en`). The locale is the language of the content. It returns the template and its `url`. The template is created published. You cannot unpublish it later. Build it right, one patch at a time. ## Edit 1. `get_form_template` with the `form_template_id`. Work from that document. 2. Load the guide for the feature you are about to use, before writing it: - `form_template_automations` for what happens on completion. - `signatures` for electronic signature. - `looping` for repeated sections. - `translations` for multilingual forms. - `options` for choice lists. - `invitations` for how the form is sent. - `access_security` for who can open it. - `document_generation` for generated documents. - `ai_extract` for AI extraction from uploaded files. - `advanced_operations` for the rare operations. 3. `update_form_template` with a JSON Patch. Small patches, one concern each. 4. Read the returned document and its validation errors. Fix them before moving on. ## Finish Call `get_form_template` one last time and walk through the elements in order. Check them against what the user asked. Then hand the user the `url`. ## Do not - Do not write an element from memory. Load the guide. - Do not guess the id. Use the id or slug that `list_form_templates` returned. - Do not bisect a patch that failed. Read the validation errors, they say what is wrong.