--- name: build-case-template description: Create or edit a Penbox case template end to end. Use when the user wants a new type of case, or wants to change the steps, statuses, automations, contacts or data schema of an existing one. --- # Build a case template Read `penbox-getting-started` first if this is the first Penbox action of the conversation. ## Before touching anything 1. `get_skill("case_template")`. Once per conversation. It is the reference for what a case template can contain and the exact shapes. 2. `list_case_templates` to check whether a similar template already exists. Reuse beats duplication. ## Create `create_case_template` with a `title` and an optional `description`. It returns the new template and its `url`. The template is empty at this point. Everything else is added with `update_case_template`. ## Edit 1. `get_case_template` with the `case_template_id`. Work from that document. 2. Load the guide for the structure you are about to write, before writing it: - `case_template_statuses` for statuses. - `case_template_automations` for automations. - `conditions` for conditional steps or automations. - `creation_fields` for what is asked at case creation. - `schema_from_form` to derive the data schema from a form template. - `document_intelligence` for AI document extraction. 3. `update_case_template` with a JSON Patch. Small patches, one concern each. 4. Read the returned document. Continue from it, not from memory. ## Steps that send a form A step that sends a form points at a form template. Find or build it with `build-form-template` first. Then reference it from the case template. ## Finish Call `get_case_template` one last time and check the result against what the user asked. Then hand the user the `url`. ## Do not - Do not write a status, automation or condition from memory. Load the guide. - Do not send a full document. Send a patch. - Do not invent a form template id. List them.