---
name: "postgres-wal-g-backup-restore"
description: "Perform streaming compressed physical backups and Point-In-Time Recovery to S3/GCS."
metadata:
  author: "WAL-G"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "backup postgres to s3 wal-g"
  - "restore pitr postgresql"
  - "archive wal with wal-g"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# WAL-G Fast PostgreSQL Physical Backup & PITR

Automates PostgreSQL disaster recovery with WAL-G: delta backups, multi-threaded LZ4/ZSTD compression, continuous WAL archiving, S3 storage integration, and sub-minute PITR restorations.

## When to Invoke
Invoke this skill whenever you need to:
- backup postgres to s3 wal-g
- restore pitr postgresql
- archive wal with wal-g

## Execution SOP & Rules
1. Set archive_command = 'wal-g wal-push %p' and archive_mode = on in postgresql.conf.
2. Run wal-g backup-push /var/lib/postgresql/data to trigger parallel compressed backup creation.
3. List existing recovery snapshots using wal-g backup-list --pretty.
4. Restore cluster state by running wal-g backup-fetch /var/lib/postgresql/data LATEST and setting restore_command.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
