heymegabyte/agent-skills / 08-deploy-and-runtime-verification
deploy-and-runtime-verification
UnverifiedMANDATORY deploy after every code change. Typecheck → deploy → purge CDN → E2E on production → visual verify → fix-forward loop. Workers Builds native CI/CD, D1 Time Travel PIT recovery, D1→R2 long-term backups, wrangler rollback, wrangler secrets management, structured observability, cross-browser smoke tests, rollback procedures, and GitHub auto-configuration.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.6 KB |
| backup-and-disaster-recovery.md | markdown | 2.7 KB |
| changelog-and-releases.md | markdown | 5.3 KB |
| ci-cd-pipeline.md | markdown | 7.1 KB |
| critical-css.md | markdown | 4.7 KB |
| font-subsetting.md | markdown | 4.5 KB |
| gh-fix-ci.md | markdown | 3.5 KB |
| launch-day-sequence.md | markdown | 5.2 KB |
| pipeline-health-check.md | markdown | 4.5 KB |
| r2-lifecycle.md | markdown | 5.6 KB |
| service-worker.md | markdown | 9.7 KB |
| uptime-and-health.md | markdown | 6.5 KB |
backup-and-disaster-recovery.md
View on GitHub---
name: "Backup and Disaster Recovery"
version: "1.2.0"
updated: "2026-04-23"
description: "Single-zip restore plan: D1 Time Travel (30-day) + D1→R2 export, KV dump, wrangler.toml + secrets list. Cron-based automated backups. Recovery runbook."
---
# Backup and Disaster Recovery
## Single-Zip Restore Plan
```
backup-domain-YYYY-MM-DD.zip
├── db/database.sql # D1 export
├── kv/kv-dump.json # KV pairs
├── r2/manifest.json # R2 object list
├── config/wrangler.toml, secrets.txt (NAMES only), dns-records.json
├── src/ # Full source
├── restore.sh # One-command restore
└── README.md # Recovery instructions
```
## Backup Commands
```bash
npx wrangler d1 export DB --output=backup/db/database.sql
npx wrangler r2 object list BUCKET --json > backup/r2/manifest.json
curl "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/dns_records" -H "Authorization: Bearer $CF_API_TOKEN" | jq '.result' > backup/config/dns-records.json
```
## Restore Script
```bash
#!/bin/bash
set -e
npm install && npx wrangler deploy # 1. Deploy Worker
npx wrangler d1 execute DB --file=backup/db/database.sql # 2. Restore D1
# 3. Restore KV (iterate kv-dump.json)
# 4. Manual: re-enter secrets from password manager
# 5. Purge cache
```
## Automated Backups (Worker Cron)
```toml
[triggers] crons = ["0 3 * * *"] # Daily 3AM UTC
```
Export D1 tables + KV dump to R2 at `backups/daily/{date}/`.
## Retention Policy
- **Daily** — 7 days
- **Weekly (Sunday)** — 12 weeks
- **Monthly (1st)** — 12 months
Cleanup: delete daily backups older than 7 days after each run.
## Recovery Runbook
- **Worker deleted** — `npx wrangler deploy`
- **D1 corrupted** — restore from R2 backup
- **KV lost** — restore from R2 backup
- **DNS lost** — re-create from `dns-records.json`
- **Secrets lost** — re-enter from password manager
- **Total loss** — run `restore.sh`
## MCP Tools for Backups
- `mcp__coolify__database_backups` — trigger Coolify DB backups
- `mcp__coolify__diagnose_server` — check disk space
- `mcp__claude_ai_Cloudflare_Developer_Platform__d1_database_query` — export D1
- `mcp__claude_ai_Cloudflare_Developer_Platform__kv_namespace_get` — read KV
- `mcp__claude_ai_Cloudflare_Developer_Platform__r2_buckets_list` — list R2
## R2 Storage Structure
```
r2://backups/{daily|weekly|monthly}/{date}/{db|kv|coolify|config}/
```
## Acceptance Criteria
- Daily backup runs automatically
- D1 row count matches
- KV key count matches
- Coolify DBs triggered
- Retention enforced
- `restore.sh` works end-to-end
- Size <100MB (alert on 10x spike)
- Secrets list has names only
- DNS records valid
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |