db-backup

Database backup specialist: set up automated backup, restore, and disaster recovery workflows for PostgreSQL, MySQL, MongoDB, and Redis. Suitable for implementing backup schedules, point-in-time recovery, cross-region replication, backup verification, or disaster recovery runbooks. Trigger terms include: database backup, pg_dump, mysqldump, mongodump, disaster recovery, point-in-time recovery, WAL archive, backup rotation, restore database, RTO, RPO, backup verification.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "db-backup" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-ce5604917d1c2409fb0132418cb73d03e8fc75e02238040d2a7ed0aa3d786ef0. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Database backup specialist: set up automated backup, restore, and disaster recovery workflows for PostgreSQL, MySQL, MongoDB, and Redis. Suitable for implementing backup schedules, point-in-time recovery, cross-region replication, backup verification, or disaster recovery runbooks. Trigger terms include: database backup, pg_dump, mysqldump, mongodump, disaster recovery, point-in-time recovery, WAL archive, backup rotation, restore database, RTO, RPO, backup verification.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Software, accounts and paid services
Determine the backup strategy based on: **RPO** (Recovery Point Objective): How much data loss is acceptable? (minutes → WAL/binlog streaming, hours → periodic dumps) **RTO** (Recovery Time Objective): How fast must recovery complete? (minutes → hot standby, hours → restore from backup) **Database size**: Small (<10GB) → full dumps; Large (>100GB) → incremental/WAL archiving **Compliance**: Retention requirements (30 days, 1 year, 7 years for financial data)
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: db-backup
description: >-
  Set up automated database backup, restore, and disaster recovery procedures
  for PostgreSQL, MySQL, MongoDB, and Redis. Use when you need to implement backup
  schedules, point-in-time recovery, cross-region replication, backup verification,
  or disaster recovery runbooks. Trigger words: database backup, pg_dump, mysqldump,
  mongodump, disaster recovery, point-in-time recovery, WAL archiving, backup rotation,
  restore database, RTO, RPO, backup verification.
license: Apache-2.0
compatibility: "Linux/macOS; target database CLI tools must be installed"
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: devops
  tags: ["database", "backup", "disaster-recovery", "postgresql", "mysql"]

Database Backup

Overview

This skill helps you implement comprehensive database backup and disaster recovery strategies. It covers automated backup scheduling, storage management, backup verification, point-in-time recovery, and disaster recovery runbooks for PostgreSQL, MySQL, MongoDB, and Redis.

Instructions

1. Assess Requirements

Determine the backup strategy based on:

  • RPO (Recovery Point Objective): How much data loss is acceptable? (minutes → WAL/binlog streaming, hours → periodic dumps)
  • RTO (Recovery Time Objective): How fast must recovery complete? (minutes → hot standby, hours → restore from backup)
  • Database size: Small (<10GB) → full dumps; Large (>100GB) → incremental/WAL archiving
  • Compliance: Retention requirements (30 days, 1 year, 7 years for financial data)

2. Implement Backup Strategy

PostgreSQL

# Full logical backup (small-medium databases)
pg_dump -Fc --no-owner --no-acl -h $DB_HOST -U $DB_USER $DB_NAME | \
  gzip | aws s3 cp - s3://backups/pg/$(date +%Y%m%d_%H%M%S).dump.gz

# WAL archiving for point-in-time recovery (large databases)
# postgresql.conf:
#   archive_mode = on
#   archive_command = 'aws s3 cp %p s3://backups/pg-wal/%f'

# Base backup + WAL for PITR
pg_basebackup -D /backups/base -Ft -z -P -h $DB_HOST -U replication

MySQL

# Full logical backup
mysqldump --single-transaction --routines --triggers --all-databases \
  -h $DB_HOST -u $DB_USER -p$DB_PASS | gzip > backup_$(date +%Y%m%d).sql.gz

# Binary log for point-in-time recovery
mysqlbinlog --read-from-remote-server --host=$DB_HOST --raw binlog.000001

MongoDB

# Full backup with oplog for PITR
mongodump --uri="$MONGO_URI" --oplog --gzip --archive | \
  aws s3 cp - s3://backups/mongo/$(date +%Y%m%d_%H%M%S).archive.gz

3. Backup Rotation Policy

Implement grandfather-father-son rotation:

  • Daily: Keep last 7 days
  • Weekly: Keep last 4 Sundays
  • Monthly: Keep last 12 first-of-months
  • Yearly: Keep indefinitely (or per compliance)

4. Backup Verification

Every backup strategy must include automated verification:

# Download latest backup
# Restore to temporary database
# Run integrity checks (row counts, checksum of critical tables)
# Compare against production counts
# Alert if variance > 0.1%
# Tear down temporary database

5. Disaster Recovery Runbook

Generate a step-by-step runbook covering:

  • How to identify which backup to restore
  • Exact restore commands with parameters
  • How to verify the restored data
  • How to redirect application traffic to the restored instance
  • Communication template for stakeholders
  • Post-incident review checklist

Examples

Example 1: PostgreSQL backup with S3 and verification

User prompt:

Set up automated PostgreSQL backups for my production database (250GB). I need daily full backups stored in S3, WAL archiving for point-in-time recovery, and automated verification that backups are restorable.

Agent output:

#!/bin/bash
# scripts/backup-postgres.sh
set -euo pipefail

TIMESTAMP=$(date +%Y%m%d_%H%M%S)
S3_BUCKET="s3://myapp-backups/postgres"
DB_HOST="${DB_HOST:?required}"
DB_NAME="${DB_NAME:?required}"

echo "[$(date)] Starting backup of ${DB_NAME}..."

# Create base backup with checksums
pg_basebackup \
  -h "$DB_HOST" -U replication \
  -D /tmp/backup_${TIMESTAMP} \
  -Ft -z -P --checkpoint=fast --wal-method=stream

# Upload to S3
aws s3 cp /tmp/backup_${TIMESTAMP}/base.tar.gz \
  "${S3_BUCKET}/base/${TIMESTAMP}/base.tar.gz" \
  --storage-class STANDARD_IA

# Upload WAL files
aws s3 sync /tmp/backup_${TIMESTAMP}/pg_wal/ \
  "${S3_BUCKET}/base/${TIMESTAMP}/pg_wal/"

# Cleanup local
rm -rf /tmp/backup_${TIMESTAMP}

# Record backup metadata
echo "{\"timestamp\":\"${TIMESTAMP}\",\"type\":\"full\",\"size\":\"$(aws s3 ls ${S3_BUCKET}/base/${TIMESTAMP}/ --summarize | tail -1)\"}" >> /var/log/backup-history.jsonl

echo "[$(date)] Backup complete: ${TIMESTAMP}"

Example 2: Disaster recovery runbook

User prompt:

Create a disaster recovery runbook for our PostgreSQL database. Include steps for full restore, point-in-time recovery to a specific timestamp, and failover to a read replica.

Agent produces a detailed runbook with exact commands, estimated time per step, verification queries, and a communication template for notifying the team during an incident.

Guidelines

  • Always encrypt backups at rest (S3 SSE-KMS, or gpg before upload)
  • Test restores monthly — an untested backup is not a backup
  • Store backups in a different region than production
  • Use separate IAM credentials for backup operations with minimal permissions
  • Monitor backup job completion — alert immediately if a backup fails
  • Document the restore process so any team member can execute it under pressure
  • For databases over 500GB, prefer incremental backups (pgBackRest, Percona XtraBackup)
  • Keep backup credentials in a secrets manager, never in scripts
  • Calculate actual RTO by running restore drills — estimated RTO is usually optimistic

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 覆盖 PostgreSQL、MySQL、MongoDB、Redis 四大主流数据库的自动化备份与灾难恢复
  • 提供 RPO/RTO 评估框架,支持从分钟级到年度的数据保护策略
  • 包含完整的备份验证、轮换策略和灾难恢复操作手册
Trigger Precision95/100

Highlights

  • 触发词精准完整,涵盖数据库备份、恢复、灾难恢复等核心场景
  • 边界清晰,不易与其他 Skill 重叠
Structure and Standards95/100

Highlights

  • Phase/步骤清晰,从需求评估到实施、验证、恢复手册完整闭环
  • 提供端到端可执行脚本示例和灾难恢复 runbook 模板
Execution Reliability90/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常处理
  • 强调备份验证、加密、权限最小化、监控等企业级最佳实践
Evidence Verifiability (mean of the first four)94/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Determine the backup strategy based on: **RPO** (Recovery Point Objective): How much data loss is acceptable? (minutes → WAL/binlog streaming, hours → periodic dumps) **RTO** (Recovery Time Objective): How fast must recovery complete? (minutes → hot standby, hours → restore from backup) **Database size**: Small (<10GB) → full dumps; Large (>100GB) → incremental/WAL archiving **Compliance**: Retention requirements (30 days, 1 year, 7 years for financial data)

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.