AI code generation works best when the prompt includes the goal, page elements, data collections, user action, and expected result. Code with AI: Write Velo Code can help, but better input usually means better code.
Prompt ingredients
- The feature goal.
- Element IDs or names.
- Collection names and fields.
- What triggers the code.
- What should happen after success.
- What should happen after an error.
Example prompt
Write Velo code for a Wix page where a visitor selects a category from dropdown #categoryDropdown, clicks #filterButton, and repeater #serviceRepeater shows only items from collection Services where category matches the dropdown value.
Common prompt mistakes
- Leaving out element IDs.
- Not saying whether data should be read or written.
- Asking for a complete app when one function is needed.
- Ignoring permissions or member roles.
- Not describing the error state.
Review checklist
- Does the code use the right imports?
- Do element IDs match the Wix editor?
- Are collection names exact?
- Is the code placed in the right file?
- Is there a test path for failure cases?