Markdown Output Prompt — Lock the Document Structure
The contract that stops AI documents from restructuring themselves: a pinned section skeleton, forced tables, and strict consistency rules.
Ship a schema change without downtime or data loss — an expand-migrate-contract migration plan with backward compatibility, ordering, and a reversal path.
A schema change deployed naively locks tables, breaks the running version, or loses data on rollback. This prompt plans a safe migration using the expand/contract pattern: the backward-compatible expand step, the data backfill, the cutover, and the later contract — each ordered so the old and new code can both run during deploy, with a reversal path at every stage.
Describe the schema change
Note the change you are making, the tables and data it touches, and the versions that must keep running during deploy. The plan orders it so old and new code coexist.
Open this resource in Markdown Output Builder
Load the prompt into Markdown Output Builder and fill in the change. It returns the expand-migrate-contract plan as clean Markdown you can drop into your runbook.
Walk through the migration stages
Read the backward-compatible expand step, the backfill, the cutover, and the later contract, confirming each carries a reversal path.
Fill the gaps before you migrate
Resolve any stage without a clean reversal and confirm the ordering keeps both versions working, then run the migration behind it.
Splitting it lets old and new code both run during the deploy window. The EXPAND step is additive only — new nullable columns and tables, no drops — so the old version keeps working. BACKFILL and CUTOVER move data and reads over, and the destructive CONTRACT (dropping old columns) is deferred to a separate later deploy once nothing uses the old shape.
The prompt has a dedicated LOCK & PERFORMANCE section that flags any step that could lock a large table and describes how to avoid it, and the BACKFILL step is specified as batched, resumable, and non-locking rather than a single ALTER. The Markdown Output Builder writes these into your runbook; you still run the actual migration wherever your database lives.
The REVERSIBILITY section tags every step as reversible or not and states the reversal action for the ones that are. For irreversible steps it specifies a safeguard instead — a backup or a dual-write window — and the RULES push destructive drops into a separate last deploy, so a failed cutover reverses without having already dropped data.
The contract that stops AI documents from restructuring themselves: a pinned section skeleton, forced tables, and strict consistency rules.
Overview, Installation, Usage, Examples, Configuration — the README skeleton with required, runnable code examples.
Overview, Authentication, Endpoints, Error Handling, Rate Limits — endpoint docs in an identical structure, with parameter tables and runnable examples forced.
Summary, Why It Matters, What Happens Next — the executive summary contract for readers who will never open the source.
Stop getting 'Sure, here is the JSON…' — the output-contract pattern that forces models to return only parseable JSON: schema, example, and a strict rule block.
The JSON won't parse and you can't see why. Deterministic cause-sniffing — trailing commas, single quotes, unclosed brackets — and the repair prompt that fixes it.
Build prompts that produce documents in a fixed structure — headings, sections, and tables.
The ALTER is one line. The migration is everything around it — because for a while, two versions of your code share one database. Here's how to turn a schema change on a live table into phases that stand alone, a backfill that can resume, and one step you can never take back.
"We do rolling deploys, so we have zero downtime" is true about the mechanism and often false about the change. Here is how to plan a zero-downtime deployment with AI: work out whether the old and new versions can actually run at once, across the database, the queue, and the traffic switch, before you ship.