# Copy-Paste Prompt Pack (Google Gemini & Anthropic Claude)

Use these prompts in order if you are running the migration manually step-by-step (or let the installed `rust-deframework-migration` skill drive them automatically). Replace `<PLACEHOLDERS>` before running.

---

## Prompt 0 — Full Codebase & Live Dependency Audit
**Recommended Model:** **Claude Opus** or **Gemini Pro (High reasoning)**

```text
We are going to de-framework this application and rebuild it in Rust (Axum + Askama SSR + Vanilla ES Modules + SQLx/SQLite, or pure static HTML/CSS/JS if no backend is needed) on an isolated staging subdomain (`staging.<YOUR_DOMAIN>`) before cutting over production.

DO NOT WRITE ANY IMPLEMENTATION CODE YET. Perform a thorough, read-only audit of the entire repository and write `MIGRATION_AUDIT.md` containing:
1. Complete Page Route Inventory: every static/dynamic route, error page, redirect, rewrite, canonical URL, `robots.txt`, `sitemap.xml`, OG/meta tags, and JSON-LD.
2. Complete API Inventory: every `(HTTP_METHOD, PATH)`, request/response JSON contract, auth/RBAC rule, and rate limit.
3. Database & Storage Audit: every table, schema/migration, JSONB column, raw SQL query, index, sequence, cache layer, and file upload/object storage path.
4. Auth, Security & External Integrations: password hash algorithm, session/cookie/JWT format (and what is required to keep existing users logged in), OAuth, CSRF, CSP, payments/webhooks, email, and cron jobs.
5. CSS, Fonts, Icons & Static Assets Audit: every stylesheet, Tailwind/PostCSS config & custom tokens, theme classes (`dark`/CSS vars), font loading (`next/font`, Google Fonts, local WOFF2), icon libraries, `public/` files, and image optimization routes (`/_next/image`).
6. Sibling Clients & Sidecars: any mobile apps, extensions, or external workers that talk to this backend, plus any pre-existing live bugs you discover.

Be exhaustive—cite exact file paths for every finding.
```

---

## Prompt 1 — Architecture Blueprint & Spec (Owner Sign-Off Gate)
**Recommended Model:** **Claude Opus** or **Gemini Pro (High reasoning)**

```text
Using `MIGRATION_AUDIT.md`, author a comprehensive, single-source-of-truth `MIGRATION_BLUEPRINT.md` to rebuild this application in Rust + Vanilla Web (zero runtime Node/React/Next.js/Vue/Prisma/Tailwind/Python frameworks) with 100% 1:1 visual, CSS, UX, API, and functional parity.

Your blueprint MUST cover:
1. Executive Pushbacks: explicitly call out anything that should NOT be rewritten (e.g., sibling mobile/extension clients, or specialized media sidecars) and any open owner decisions needed before coding.
2. Target Architecture & Workspace Layout: Rust crate layout living alongside the untouched legacy app (`rust/`), exact crates (`axum`, `askama`, `sqlx`/`rusqlite`, `tower-http`, etc.), and whether any purely static routes can be served directly by the reverse proxy.
3. Day-1 CSS, Font, Icon & Asset Parity Pipeline: exact strategy so CSS cannot regress (e.g., build-time standalone `@tailwindcss/cli` scanning Askama templates + Vanilla JS into content-hashed CSS with zero runtime Node, OR exact token/preflight extraction; self-hosted WOFF2 fonts; build-time SVG icon macros matching existing icons pixel-for-pixel; exact `/public` URL parity; CSP/MIME checks).
4. Vanilla ES Modules DOM Architecture: route-scoped `<script type="module">` modules, safe DOM construction (no unsafe `innerHTML`), and how every interactive UI component (modals, drawers, forms, filters, dark mode) will work.
5. Auth, Security & Data Compatibility: session/cookie compatibility, CSRF, nonce/strict CSP, RBAC, SSRF protection, and DB migration/compatibility plan.
6. Strict Staging Isolation (`STAGING_SAFE_MODE`): how `staging.<YOUR_DOMAIN>` runs completely isolated from production (separate cloned DB with zero prod credentials, trapped emails via Mailpit, sandboxed webhooks/billing, quarantined crons, `robots.txt: Disallow: /`, Basic Auth/Access gate).
7. Single-Touch Vertical Slice Plan: ordered vertical slices where each vertical is built to 100% completion (zero placeholder UI) and verified with Playwright before advancing.
8. 100% Parity Verification Matrix, Controlled Cutover Runbook (with <5s rollback), and Owner-Gated Decommissioning Checklist.

End by listing the exact decisions you need me to approve before Stage 2 begins. Do not start coding until I sign off.
```

---

## Prompt 2 — Isolated Staging Spine + CSS/Asset Verification (Vertical 0)
**Recommended Model:** **Claude Sonnet** or **Gemini Pro (Standard)** *(use Opus / Pro High if auth/crypto migration is complex)*

```text
`MIGRATION_BLUEPRINT.md` is approved with these decisions:
<PASTE YOUR ANSWERS TO OPEN QUESTIONS HERE>

Execute Vertical 0 (Staging Spine & Visual Foundation) cleanly alongside the untouched legacy app:
1. Scaffold the Rust workspace (`rust/`), DB pool/migrations, auth/session/CSRF/CSP middleware, `/healthz`, and the build-time CSS + self-hosted fonts + SVG icon + static asset pipeline from `MIGRATION_BLUEPRINT.md`.
2. Set up the isolated staging deployment config (`staging.<YOUR_DOMAIN>`) with `STAGING_SAFE_MODE=1` so production is 100% untouched.
3. Build the first complete page (base layout + header + navigation + footer + homepage) with full styling.
4. Run unit/integration tests AND a Playwright verification script comparing `https://<YOUR_DOMAIN>/` vs `https://staging.<YOUR_DOMAIN>/` across desktop (`1440x900`) and mobile (`390x844`).
5. Confirm: 0 console errors, 0 `pageerror`s, 0 HTTP >=400 assets, all stylesheets & fonts loaded, and matching computed styles on `html`, `body`, `header`, `nav`, `h1`, and `footer`. Fix any CSS/asset mismatch before reporting back.
```

---

## Prompt 3 — Vertical Slice Implementation (Repeat Per Vertical)
**Recommended Model:** **Claude Sonnet** or **Gemini Pro (Standard)**

```text
Implement Vertical <N> (<NAME OF VERTICAL>) from `MIGRATION_BLUEPRINT.md` to 100% completion—no stubs, no placeholder CSS, no skipped states.

Requirements:
1. Implement all Rust handlers, DB queries, Askama templates, CSS styles, and Vanilla ES Modules for this vertical.
2. Preserve 100% of existing UX details: responsive mobile & desktop layouts, hover/focus states, dark/light themes, modals/drawers, loading/empty/error states, form validation, and SEO meta tags.
3. Add Rust unit & integration tests (happy paths + edge cases + auth/CSRF/RBAC negative tests).
4. Add all routes and interactive flows from this vertical to our Playwright parity suite (`scripts/parity_check.mjs` + E2E tests) and run it against `https://<YOUR_DOMAIN>` vs `https://staging.<YOUR_DOMAIN>` on desktop (`1440x900`) and mobile (`390x844`).
5. Inspect the Playwright screenshots and diff report. Fix EVERY CSS, layout, asset, console, or behavioral discrepancy until Playwright exits 0 with 100% parity.
```

---

## Prompt 4 — Full 100% 1:1 Staging Parity Audit (Pre-Cutover Gate)
**Recommended Model:** **Claude Opus** or **Gemini Pro (High reasoning + Vision)**

```text
All verticals are deployed on `https://staging.<YOUR_DOMAIN>`. Run a ruthless, 100% 1:1 parity audit comparing production (`https://<YOUR_DOMAIN>`) against staging (`https://staging.<YOUR_DOMAIN>`):

1. Run the full Playwright parity suite across EVERY route in `MIGRATION_AUDIT.md` on desktop (`1440x900`) and mobile (`390x844`):
   - Verify 0 `pageerror`s, 0 `console.error`s, 0 failed/404 asset requests, 0 broken images, 0 unloaded stylesheets, and 0 unintended horizontal overflow.
   - Compare computed CSS styles and visually inspect side-by-side screenshots (including modals, menus, forms, dark/light themes, and error states).
2. Run full Playwright E2E user journeys: auth (login/signup/logout/OAuth/password reset), every CRUD flow, search/filters/pagination, file uploads, test-mode payments/webhooks, email capture (Mailpit), and admin dashboards.
3. Run automated API contract, redirect, SEO (`<title>`, meta, canonical, JSON-LD, `robots.txt`, `sitemap.xml`), and security negative tests (CSRF `403`, auth `401`, RBAC `403`, XSS escaping, rate limits).
4. Benchmark RAM usage, Docker image size, cold start, and p50/p99 TTFB vs production.
5. Write `PARITY_REPORT.md`. If ANY discrepancy exists—even a minor CSS spacing, font weight, or border mismatch—fix it and re-verify with Playwright until the report is 100% green.

DO NOT CUT OVER PRODUCTION YET. Present `PARITY_REPORT.md` for my sign-off.
```

---

## Prompt 5 — Controlled Production Cutover (Keep Instant Rollback Ready)
**Recommended Model:** **Claude Opus** or **Gemini Pro (High reasoning)**

```text
I have reviewed `PARITY_REPORT.md` and approve production cutover for `<YOUR_DOMAIN>`.

Execute the Controlled Cutover Runbook from `MIGRATION_BLUEPRINT.md`:
1. Confirm zero unverified commits, warm up the production Rust container on its internal port (`STAGING_SAFE_MODE` unset), and verify `/healthz`.
2. Quiesce crons/background writers, perform the brief read-only write freeze + final atomic DB sync, and run automated table row-count, sequence, and FK integrity verification across EVERY table. Abort and revert immediately if any count disagrees.
3. Perform the atomic reverse-proxy switch (Caddy/Nginx graceful reload), point crons to the Rust service, and STOP (do NOT delete!) the legacy app container and legacy DB volume so <5-second rollback stays available during the soak period.
4. Immediately run the Playwright live smoke suite (zero console/asset/CSS errors, auth, core routes, SEO, `/healthz`) and capture live `docker stats` / RAM usage.

DO NOT DECOMMISSION OR DELETE LEGACY FILES/CONTAINERS YET. Report the cutover result and rollback command.
```

---

## Prompt 6 — Gated Decommissioning (Run ONLY After Clean Soak Period)
**Recommended Model:** **Claude Opus** or **Gemini Pro (High reasoning)**

```text
The production soak period on `<YOUR_DOMAIN>` is clean and I explicitly approve decommissioning the legacy stack now.

Execute the Decommissioning Runbook:
1. Verify final production health, recent backups, and zero error spikes in logs.
2. Create an archived snapshot of the legacy DB/config and tag git with `pre-decommission-legacy`.
3. Retire and remove legacy app containers, unused BaaS/runtime sidecars, and temporary `staging.<YOUR_DOMAIN>` containers/volumes/proxy blocks/DNS entries (confirm with me first if we should keep staging alive).
4. Remove legacy framework directories and unused dependencies from the repo in a clean commit, and update `README.md` / `Makefile` / CI / deploy docs.
5. Run the full automated test suite, live Playwright smoke check, and report final production server RAM, CPU, and disk savings.
```
