| name | h5-lowcode-layout |
| description | Generate, revise, and validate importable JSON page-layout schemas for this repository's 375px H5 low-code editor. Use when a user asks to design or arrange a mobile page with the supported baseLayout, button, text, input, textArea, and image components, convert a page description into editor JSON, or repair a basic-component schema while staying within the editor's supported properties. |
H5 Low-code Layout
Generate the complete import envelope:
{"schema":{"container":[]},"config":{}}
Required workflow
- Read references/schema-reference.md completely before generating or editing a schema.
- Resolve facts from the repository instead of asking the user. Ask only when a missing design decision materially changes the page.
- Plan the page on a 375px canvas. Split major visual sections into sequential top-level
baseLayout containers.
- Use only the six supported basic components and only their documented editable fields:
baseLayout, button, text, input, textArea, and image. Never generate blockLayout.
- Use absolute positioning only. Place leaf components directly in
baseLayout.blocks. Never use flex, relative child positioning, or nonempty flex alignment fields.
- For a new schema, do not hand-author semantic names. Let the validator generate a random, unique six-character ASCII alphanumeric
name for every non-top-level component. For an existing schema, preserve valid unique names and repair only missing, malformed, or duplicate names.
- Use only built-in animation names, and only when the user requests animation. Do not invent events or animation.
- When an image URL is missing, use a relevant HTTPS mock image URL. Never generate Base64 or
data: image placeholders.
- Use
config.additonalCode only when the requirement cannot be expressed with supported schema fields. Explain why it is necessary. Keep it dependency-free and safe.
- From the repository root, validate a new schema with
node h5-lowcode-layout/scripts/validate-schema.mjs <json-file> --fix --regenerate-names. Use --fix without --regenerate-names when revising an existing schema. Then run the validator again without flags. Do not deliver JSON that still has errors.
Output rules
- If the user supplies an output path, write the full import envelope there.
- If no path is supplied, return the full JSON in the response and do not overwrite repository mock data.
- For response-only output, validate an equivalent temporary JSON file first.
- Report assumptions, generated image placeholders, and any
additonalCode briefly after the JSON.
- Do not add unsupported components as a workaround. Ask the user or use narrowly scoped
additonalCode when appropriate.
Validation behavior
Allow --fix to repair only mechanical issues: missing default fields, duplicate or malformed names, empty image sources, safe coordinate clamping, URL wrapping, and insufficient baseLayout height.
Stop and ask or report an error when repair would change design intent: blockLayout, flex layout, unsupported components or properties, oversized children, unsupported animation names, invalid event actions, or unsafe additional JavaScript.