Use these prompts to turn a schema proposal into a change record that an approver and on-call engineer can use during a production release. They are for backend engineers, database owners and reviewers dealing with changes that must coexist with live application traffic.
Start with the primary plan. Then test its ordering, turn the agreed gates into checks, set stop points, and record an approval decision. Do not skip the dependency review because the migration file looks small.
Key point
Build for coexistence
Most production schema changes have a period where old and new application behaviour must both work. Make that period explicit before approving the change.
1. Build the plan from the actual change record
Use Build the primary migration plan when the design is still a mixture of migration files, tickets and service notes. Paste the current schema as well as the target change. A diff alone does not show existing indexes, constraints, partitioning or table size, all of which can change the operational risk.
The prompt separates supplied facts from inferences. Keep that distinction in the resulting document. For example, “the new column is nullable” may be a fact from the migration. “the backfill will not affect replicas” is an inference unless you have evidence.
Fill in operational constraints before running it. Include the release window, whether replicas serve reads, any write-heavy jobs, and the recovery process that is actually available. If those details are missing, leave the placeholder in place or write unknown. The prompt should block approval rather than paper over the gap.
Watch out
Do not call a change reversible by default
A column drop, semantic rewrite, overwritten value or completed backfill may make return to the prior state unsafe, even if the deployment system can redeploy older application code.
2. Test the order against every consumer
Run Find dependency and ordering failures after you have a first plan. This is the prompt for catching a service that starts writing a new field before another worker understands it, or a reader that fails when an old field disappears.
Build the dependency inventory from named components, not team memory. Include:
- API services and their deployment groups.
- Scheduled jobs, queue consumers and retry workers.
- Admin scripts, bulk importers and repair tools.
- Reporting, exports and downstream data consumers.
- Read replicas, caches and any clients that inspect schema metadata.
The compatibility matrix is the useful output here. Review every row where Safe during transition? is not a clear yes. A component marked unknown is a release risk, not a harmless omission. Assign someone to establish whether it reads or writes the affected data.
3. Make each release gate observable
Use Write rollout validation checks once the order is credible. It converts vague statements such as “monitor errors” into checks with an expected result, an owner and an immediate action.
Paste normal error rates, latency ranges and relevant data counts where you have them. The prompt deliberately does not invent thresholds. A count mismatch may be a stop condition, but only if you define the source population, target population and treatment of late writes.
For a data move, require both technical and business-facing invariants where applicable. A successful job count does not prove that every source row was transformed correctly. Define the comparison key and the acceptable outcome before starting the backfill.
Check
A usable check has a decision attached
If the check fails, the document must say whether to stop, contain the issue, roll back, or continue under monitoring. A dashboard name without that decision is not a gate.
4. Record where to stop and who decides
Use Set rollback conditions and stop points before the production window. This matters most for destructive changes and data transformations. It gives the on-call engineer a bounded instruction instead of asking them to interpret a design document during an incident.
Read the Latest safe point column closely. The safest rollback is usually available before a destructive operation, not after it. If recovery relies on a backup or restore, require evidence that it is available and relevant to this data set. Do not label an untested recovery path as a rollback plan.
The exact database features, query methods and operational controls available to you depend on your environment and configuration. If you are integrating these checks into an automated workflow, confirm the current options in the xAI documentation.
5. Make the approval decision evidence-based
Run Review the plan for production approval last. Give it the actual plan, the validation checklist, the rollback record and evidence from a dry run or staging. Do not paste only a summary written by the change author.
An Approved with conditions result should still be actionable. Each condition needs an owner and a piece of evidence, such as a completed compatibility test, a confirmed dependency owner, or a reconciliation result. If there is no evidence for lock behaviour, recovery capability or old-version compatibility, the review should say so plainly.
How to tell the output is wrong
Look for false certainty. The most common failure is a polished plan that silently assumes deployment order, database behaviour or consumer ownership. Search the output for words such as “safe”, “minimal”, “no impact” and “rollback”. For each one, ask what supplied fact supports it.
| If you see this | Treat it as | What to do |
|---|---|---|
| A precise threshold with no baseline | An invented limit | Replace it with the actual normal range or mark it unknown. |
| A rollback step after data destruction | A likely unsafe promise | Add the last safe point and recovery consequences. |
| “All consumers” with no inventory | An untested claim | Name each service, job and external reader. |
| A validation check with no action | Monitoring, not a gate | Add a blocker, owner and immediate containment action. |
Stop
Do not use generated SQL without review
Treat query templates as review material. A database owner must check them against the real engine, schema, permissions and production load.
When the plan does not work
If the first prompt returns too many unknowns, do not ask it to be more confident. Collect the missing schema details, dependency owners and recovery evidence, then run it again. If the sequence cannot support old and new application behaviour together, split the change into expansion, application adoption, backfill and later contract work. When a risk remains unresolved, keep the release blocked or obtain an explicit decision from the accountable production owner.