Editing a Sandcastle

After a sandcastle is scaffolded, you can keep refining it — add views, change layouts, tweak styling, add new data fields. Every edit creates a new version, so nothing is lost.

Before you begin

  • You need edit or admin access to the sandcastle.
  • The sandcastle must already exist. See Creating a sandcastle.

Two ways to edit

From chat

Open the AI chat and describe the change you want. Reference the sandcastle by name:

"In the Purchase Approvals sandcastle, add a bar chart to the dashboard that shows total spend by department for the current month."

The AI edits the code, creates a new version, and you can preview the result.

This is the fastest path for most changes. The AI knows the app's structure and collections, so it can make targeted edits without you needing to understand the code.

From the editor

Go to Sandcastles, click the sandcastle, then click Edit. This opens a split-pane view:

  • Left pane — the app's code. You can read and modify it directly.
  • Right pane — a live preview that updates as you save.
  • Chat sidebar — an AI chat scoped to this sandcastle, so you can ask for changes without leaving the editor.

Use the editor when you want to see exactly what the AI changed, make a small manual tweak, or understand how the app is structured.

Best practices for editing

One change per edit. Ask for one feature or one view at a time. This keeps each version clean and makes rollbacks precise. "Add a filter bar" is a good edit. "Add a filter bar, change the color scheme, and add a new collection" is three edits.

Describe what you see, not what to code. You don't need to know React. "Make the overdue items red" works. "Move the summary cards above the table" works. The AI handles the implementation.

Preview after each edit. The preview page shows the live app. Check that the change looks right before moving on. Catching a problem early is much cheaper than fixing it three edits later.

Use version history to roll back. On the sandcastle's detail page, you can see every version with its commit message. If an edit broke something, roll back to the previous version and try a different approach.

Adding new collections

If the app needs a new type of data that doesn't fit an existing collection, ask the AI:

"Add a new collection called 'comments' to the Purchase Approvals sandcastle. Each document should have requisition_id, author, text, and created_at."

The AI creates the collection and updates the app code to read from it.

Rebuilding the preview

If the preview looks stale or broken, you can trigger a rebuild from the sandcastle's detail page. Click Rebuild next to the current version. The preview recompiles and refreshes.

Next steps