Agent skill

Postgres Backup Restore

by fmflurry in fmflurry/settings-opencode

PostgreSQL backup & restore playbook for the docker instance: pgdump/pgdumpall recipes, WAL archiving + PITR setup (archivemode, archivecommand, recovery.signal, recoverytargettime, timelines)…

MITAuto-check passedDevOps & Cloud

Install Postgres Backup Restore

skills CLI
$ npx skills add fmflurry/settings-opencode --skill postgres-backup-restore -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install fmflurry/settings-opencode postgres-backup-restore --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/fmflurry/settings-opencode.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/postgres-backup-restore .claude/skills/postgres-backup-restore && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
postgres-backup-restore
GitHub stars
171
Token cost
~2.3k tokens
SKILL.md length
645 words
Files
1
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

PostgreSQL backup & restore playbook for the docker instance: pgdump/pgdumpall recipes, WAL archiving + PITR setup (archivemode, archivecommand, recovery.signal, recoverytargettime, timelines)…

  • Works in 6 steps: Backup strategy map (pick per need) → Logical backup recipes (docker instance) → PITR setup (WAL archiving) — PG16 → …
  • Asked about backup
  • SKILL.md covers 1. Backup strategy map (pick…, 2. Logical backup recipes…, 3. PITR setup (WAL archiving)… and 4. Restore from a logical dump…, plus 2 more sections
  • Calls docker and pg_dump

What it does

Postgres Backup Restore is an agent skill from fmflurry/settings-opencode. PostgreSQL backup & restore playbook for the docker instance: pgdump/pgdumpall recipes, WAL archiving + PITR setup (archivemode, archivecommand, recovery.signal, recoverytargettime, timelines), restore drills, and the PG16 no-incremental-backup constraint. Use when asked about backup, restore, PITR, pgdump, pgbasebackup, WAL archiving, or disaster recovery. Target: postgres:16-alpine (container gc-platform-postgres). Read alongside the postgres-dba agent.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in DevOps & Cloud, covering Backup and disaster recovery and Containers. It works with PostgreSQL and Docker. The repository describes itself as: Custom OpenCode settings. The licence is MIT.

When your agent uses it

  • Asked about backup
  • Disaster recovery

Example prompts

  • “/postgres-backup-restore”

Requirements

  • Docker

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Backup strategy map (pick per need)
  2. Logical backup recipes (docker instance)
  3. PITR setup (WAL archiving) — PG16
  4. Restore from a logical dump (human-executed)
  5. Restore-drill checklist (a backup you cannot restore is not a backup)
  6. Volume persistence audit (read-only)

What it can do on your machine

Read from SKILL.md and the folder at commit 0e6c33c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • docker
    • pg_dump

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • postgresql.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Postgres Backup Restore loads about 2.3k tokens when it runs. Until then it costs about 123 tokens; SKILL.md has 645 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~123
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from fmflurry/settings-opencode at commit 0e6c33c, republished under its MIT licence (© fmflurry). 645 words, ~2,288 tokens.

Download SKILL.mdSave it as .claude/skills/postgres-backup-restore/SKILL.md (or your agent's skills folder).
name
postgres-backup-restore
description
PostgreSQL backup & restore playbook for the docker instance: pg_dump/pg_dumpall recipes, WAL archiving + PITR setup (archive_mode, archive_command, recovery.signal, recovery_target_time, timelines), restore drills, and the PG16 no-incremental-backup constraint. Use when asked about backup, restore, PITR, pg_dump, pg_basebackup, WAL archiving, or disaster recovery. Target: postgres:16-alpine (container gc-platform-postgres). Read alongside the postgres-dba agent.

PostgreSQL Backup & Restore

Target version: postgres:16-alpine — this repository's gc-platform-postgres container (db gcplatform, owner role gcplatform, data on named volume postgres-data).

Contract: auditing is read-only (SHOW, pg_stat_archiver, docker volume inspect). Every backup/restore/ config command below is emitted ONLY as a ⚠️ HUMAN CONFIRMATION REQUIRED block — the postgres-dba agent never executes backups, restores, or server-config changes. Restores are ALWAYS human-executed: a restore overwrites data and is irreversible in the wrong hands.

Connection:

bash
docker exec gc-platform-postgres psql -U gcplatform -d gcplatform -c "<query>"

1. Backup strategy map (pick per need)

MethodCapturesPITR?Notes for this repo
pg_dump -FcOne database, logical (SQL-level)NORestores into any PG version ≥ source; slow on huge DBs; does NOT capture roles/tablespaces
pg_dumpall --globals-onlyCluster globals: roles, tablespacesNONeeded separately — gc_kourou_app_login, gc_kourou_identity_app, gc_kourou_identity_migrator are global objects (though this repo re-provisions them via migrations on boot)
pg_basebackupPhysical whole-cluster copyBase for PITRMust stop/quiet writes for a consistent snapshot unless using WAL archiving; docker volume makes this awkward
WAL archiving + base backupContinuous, point-in-timeYESRequires archive_mode=on + working archive_command (see §3)
PG16 native incremental backup——NOT AVAILABLE: pg_basebackup --incremental is PostgreSQL 17+ only. On PG16, "incremental" = WAL archiving layered on periodic base backups.

pg_dump can never do PITR — it is a logical snapshot at dump time.


2. Logical backup recipes (docker instance)

⚠️ HUMAN CONFIRMATION REQUIRED

bash
# Database dump, custom format (compressed, parallel-restoreable, selective):
docker exec gc-platform-postgres pg_dump -U gcplatform -d gcplatform -Fc -f /tmp/gcplatform_$(date +%F).dump
docker cp gc-platform-postgres:/tmp/gcplatform_$(date +%F).dump ./backups/

# Plain-SQL alternative (readable in git/diff, no parallel restore):
docker exec gc-platform-postgres pg_dump -U gcplatform -d gcplatform -f - > ./backups/gcplatform_$(date +%F).sql

# Cluster globals (roles!) — not included in pg_dump:
docker exec gc-platform-postgres pg_dumpall -U gcplatform --globals-only -f - > ./backups/globals_$(date +%F).sql

Interpretation for audits: a dump in ./backups/ older than the agreed RPO (or no dumps at all) = HIGH. Custom-format dumps are verified with pg_restore -l <file> (lists TOC, does not restore).

⚠️ HUMAN CONFIRMATION REQUIRED

bash
# Verify a dump is structurally readable WITHOUT restoring it:
pg_restore -l ./backups/gcplatform_YYYY-MM-DD.dump | head

3. PITR setup (WAL archiving) — PG16

Source: https://www.postgresql.org/docs/16/continuous-archiving.html

3a. Audit current posture (read-only)
sql
SHOW wal_level;        -- PG16 default 'replica' ✓ (sufficient for archiving)
SHOW archive_mode;     -- 'off' in the stock compose → PITR currently impossible
SHOW archive_command;  -- '(disabled)' when archive_mode=off
SHOW archive_timeout;  -- 0 = WAL segments only archived when full (16MB)
SELECT archived_count, failed_count, last_archived_wal, last_archived_time,
       last_failed_wal, last_failed_time
FROM pg_stat_archiver;

Interpretation: failed_count > 0 with recent last_failed_time = CRITICAL (archives retry forever, pg_wal grows until PANIC shutdown). archive_mode = off + no dump cron = no recovery story = HIGH.

3b. Enable archiving (config change → coder for compose edit + human restart)

⚠️ HUMAN CONFIRMATION REQUIRED

yaml
# docker-compose.yml, postgres service — archive to a path on a dedicated volume:
command: ["postgres", "-c", "archive_mode=on", "-c", "archive_timeout=60",
          "-c", "archive_command=test ! -f /var/lib/postgresql/archive/%f && cp %p /var/lib/postgresql/archive/%f"]
volumes:
  - postgres-data:/var/lib/postgresql/data
  - postgres-archive:/var/lib/postgresql/archive

Hard rules for archive_command (from the PG docs, non-negotiable):

  1. Must return non-zero on failure — a lying success loses WAL and silently breaks PITR.
  2. Must never overwrite an existing archive — hence the test ! -f … && guard; overwriting corrupts the timeline.
  3. archive_timeout = 60 forces a segment switch at least per minute so low-write periods still bound data loss (each forced switch closes a 16MB segment — trade disk for RPO).

wal_level stays at the PG16 default replica — no change needed.

3c. Base backup (the starting point PITR replays from)

⚠️ HUMAN CONFIRMATION REQUIRED

bash
# Physical base backup of the running cluster (needs the superuser role):
docker exec gc-platform-postgres pg_basebackup -U gcplatform -D /tmp/base_$(date +%F) -Ft -z -Xs -P
docker cp gc-platform-postgres:/tmp/base_$(date +%F) ./backups/

-Xs streams WAL during the backup so the base is self-consistent.

Show full SKILL.md (250 more words)Show less
3d. Recovery to a point in time (human-executed, always)

⚠️ HUMAN CONFIRMATION REQUIRED

bash
# 1. Stop the container; preserve the current data dir (rename, never delete):
docker compose stop postgres
docker volume inspect postgres-data   # note the Mountpoint

# 2. Replace the data directory contents with the base backup (as the postgres user).

# 3. Configure recovery in the data dir (postgresql.auto.conf or recovery settings):
restore_command = 'cp /var/lib/postgresql/archive/%f %p'
recovery_target_time = '2026-07-28 14:30:00 UTC'   -- the instant BEFORE the incident
recovery_target_action = 'pause'                  -- inspect before promoting

# 4. Create the signal file that switches the server into recovery:
touch <datadir>/recovery.signal

# 5. Start; watch logs; when paused at the target and satisfied, promote:
docker compose start postgres
docker exec gc-platform-postgres psql -U gcplatform -d gcplatform -c "SELECT pg_wal_replay_resume();"  -- if paused

Timelines: every recovery creates a new timeline (00000002.history etc.). Keep the history files and old WAL — they let you recover to a point on the PRE-recovery timeline if the recovery target was wrong. recovery_target_timeline = 'latest' is the default.


4. Restore from a logical dump (human-executed)

⚠️ HUMAN CONFIRMATION REQUIRED

bash
# Restore into a FRESH database (never over the live one without a plan):
docker exec gc-platform-postgres psql -U gcplatform -d postgres -c "CREATE DATABASE gcplatform_restore OWNER gcplatform;"
docker cp ./backups/gcplatform_YYYY-MM-DD.dump gc-platform-postgres:/tmp/restore.dump
docker exec gc-platform-postgres pg_restore -U gcplatform -d gcplatform_restore -j 4 --no-owner /tmp/restore.dump
# -j 4 = parallel restore (custom format only); --no-owner because the restoring role differs

Repo-specific: roles (gc_kourou_app_login, identity_*) are re-provisioned by EF migrations/IdentitySchemaMigrator on backend boot, so a logical restore of the database plus a backend restart re-creates runtime grants. If restoring globals too, apply globals_*.sql first.


5. Restore-drill checklist (a backup you cannot restore is not a backup)

Run quarterly; every step human-executed:

  • Latest dump/base backup exists and pg_restore -l lists its TOC without errors
  • Restore into a scratch database (gcplatform_restore) succeeds end-to-end
  • Backend boots against the scratch DB and migrations report no pending model changes
  • Row counts on key tables match the source (within RPO)
  • (If PITR) pg_stat_archiver.failed_count has stayed 0 since the last drill; archive destination has free space
  • Documented RTO/RPO and the runbook location are current

Severity for audits: no drill ever recorded = HIGH; drill older than 6 months = MEDIUM.


6. Volume persistence audit (read-only)

bash
docker volume inspect postgres-data
docker inspect --format '{{range .Mounts}}{{.Type}} {{.Name}} -> {{.Destination}}{{println}}{{end}}' gc-platform-postgres

Interpretation: data must sit on the named volume postgres-data at /var/lib/postgresql/data. Anonymous volume or bind-mount into the repo tree = CRITICAL (anonymous volumes vanish with docker compose down; repo-tree mounts corrupt on macOS Docker file-sharing). docker volume rm postgres-data is in the postgres-dba never-execute list — deletion is a human decision with a fresh backup in hand.

© fmflurry, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/postgres-backup-restore of fmflurry/settings-opencode.

Open the folder on GitHubat commit 0e6c33c

Compare with similar skills

Postgres Backup Restore next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Postgres Backup Restore compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Postgres Backup Restore this skillfmflurry/settings-opencode171—~2.3kAutomated safety check: PassMIT
Mg Local DB Restoremodelguide/modelguide108—~645Automated safety check: PassMIT
Supabasemagnus919/agent-skills113—~2.2kAutomated safety check: PassMIT
Cb Build TestBlkLeg/CircuitBreaker201—~1.9kAutomated safety check: PassMIT
Monstermq Broker Configvogler75/monster-mq143—~2.2kAutomated safety check: PassGPL-3.0
Unraiddinglebear-ai/unraid135—~2.8kAutomated safety check: PassMIT

Similar skills

  • Mg Local DB Restore

    modelguide/modelguide

    Trigger phrases - "reset local db", "recreate local postgres", "restore dump to local", "reset local database", "load backup locally"

    108 GitHub stars~645 tokensUpdated 3 mo ago
    DevOps & CloudAuto-check passed
  • Supabase

    magnus919/agent-skills

    A skill your agent uses when developing applications with Supabase, running the Supabase CLI, designing migrations and RLS policies, testing database behavior, generating client types, deploying the…

    113 GitHub stars~2.2k tokensUpdated yesterday
    DevOps & CloudAuto-check passed
  • Cb Build Test

    BlkLeg/CircuitBreaker

    How Circuit Breaker is built, tested, packaged, and kept secret-safe — the make dev/verify/test targets, the PostgreSQL integration test database and its fixtures, the mono Docker image and native…

    201 GitHub stars~1.9k tokensUpdated 2 days ago
    DevOps & CloudAuto-check passed
  • Monstermq Broker Config

    vogler75/monster-mq

    Guide for configuring, deploying, and operating the MonsterMQ broker.

    143 GitHub stars~2.2k tokensUpdated yesterday
    DevOps & CloudAuto-check passed
  • Unraid

    dinglebear-ai/unraid

    Query and monitor an Unraid NAS/homelab server — array health, disk temperatures, Docker containers, virtual machines, system metrics, notifications, alerts, shares, UPS status, log files, network…

    135 GitHub stars~2.8k tokensUpdated 4 days ago
    DevOps & CloudAuto-check passed
  • Infrastructure Setup

    pavel-molyanov/molyanov-ai-dev

    Provides project infrastructure conventions and review criteria for local setup, Docker, Git hooks, CI/CD, service delivery, release artifacts, monitoring, backups, and operations.

    296 GitHub stars~1.9k tokensUpdated 1 mo ago
    DevOps & CloudAuto-check: notes

More from fmflurry/settings-opencode

All 20 skills in this repo
  • Show Your Work

    fmflurry/settings-opencode

    Keep a reviewable decision trail for long-running or unattended work: a TSV log with one row per decision (what, why, evidence, result).

    171 GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Playwright E2E Authoring

    fmflurry/settings-opencode

    Scaffold and extend Playwright E2E tests for the gc.platform suite (tests/playwright), wiring every artifact to the real frontend (localhost:4200) + real .NET backend — never mocks.

    171 GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Why

    fmflurry/settings-opencode

    A skill your agent uses for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds.

    171 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Angular Accessibility

    fmflurry/settings-opencode

    Audit and fix common accessibility issues in Angular templates and Angular Material components.

    171 GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Angular Clean Architecture

    fmflurry/settings-opencode

    Scaffolds and extends Angular standalone feature MODULES under src/app/modules/{name} using Clean Architecture layering (presentation/application/core/infrastructure), a self-registering module…

    171 GitHub stars~3.6k tokensUpdated today
    Auto-check passed
  • Angular Cop

    fmflurry/settings-opencode

    Pre-merge code review for Angular + TypeScript pull requests.

    171 GitHub stars~1.4k tokensUpdated today
    Auto-check passed

Categories

Questions about Postgres Backup Restore

What does Postgres Backup Restore do?

PostgreSQL backup & restore playbook for the docker instance: pgdump/pgdumpall recipes, WAL archiving + PITR setup (archivemode, archivecommand, recovery.signal, recoverytargettime, timelines)…. Postgres Backup Restore is an agent skill from fmflurry/settings-opencode.signal, recoverytargettime, timelines), restore drills, and the PG16 no-incremental-backup constraint.

When should I use Postgres Backup Restore?

Postgres Backup Restore fits situations like: asked about backup; disaster recovery.

How do I install Postgres Backup Restore in Claude Code?

Run `npx skills add fmflurry/settings-opencode --skill postgres-backup-restore -a claude-code`. Or copy the skill folder (skills/postgres-backup-restore in fmflurry/settings-opencode) into .claude/skills/postgres-backup-restore in your project. Claude Code loads it when a task matches its description.

How do I install Postgres Backup Restore in Codex?

Run `npx skills add fmflurry/settings-opencode --skill postgres-backup-restore -a codex`. Or copy the skill folder (skills/postgres-backup-restore in fmflurry/settings-opencode) into .agents/skills/postgres-backup-restore in your project. Codex loads it when a task matches its description.

Can I use Postgres Backup Restore in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add fmflurry/settings-opencode --skill postgres-backup-restore -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/postgres-backup-restore, .gemini/skills/postgres-backup-restore, .github/skills/postgres-backup-restore and .opencode/skills/postgres-backup-restore in your project.

What does Postgres Backup Restore need to run?

Going by SKILL.md and its folder, Postgres Backup Restore needs the command-line tools its instructions call (docker and pg_dump). Our summary lists: Docker.

Does Postgres Backup Restore access the network?

SKILL.md names 1 domain. As links in the text: postgresql.org. This is read from the text; nothing was executed.

Is Postgres Backup Restore safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Postgres Backup Restore use?

Postgres Backup Restore is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Postgres Backup Restore use?

About 2.3k tokens (SKILL.md is roughly 9.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Postgres Backup Restore?

Skills that share tags, products or a category with Postgres Backup Restore: Mg Local DB Restore (modelguide/modelguide, 108 stars), Supabase (magnus919/agent-skills, 113 stars), Cb Build Test (BlkLeg/CircuitBreaker, 201 stars) and Monstermq Broker Config (vogler75/monster-mq, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Postgres Backup Restore?

fmflurry (a GitHub user) maintains it in fmflurry/settings-opencode, which has 171 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 7, 2026.

Source: fmflurry/settings-opencode on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.