home / skills / jeremylongshore / claude-code-plugins-plus-skills / database-backup-automator

This skill automates database backups across PostgreSQL, MySQL, MongoDB, and SQLite, generating scripts, schedules, and restore procedures to protect data.

npx playbooks add skill jeremylongshore/claude-code-plugins-plus-skills --skill database-backup-automator

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
2.4 KB
---
name: automating-database-backups
description: |
  This skill automates database backups using the database-backup-automator plugin. It creates scripts for scheduled backups, compression, encryption, and restore procedures across PostgreSQL, MySQL, MongoDB, and SQLite. Use this when the user requests database backup automation, disaster recovery planning, setting up backup schedules, or creating restore procedures. The skill is triggered by phrases like "create database backup", "automate database backups", "setup backup schedule", or "generate restore procedure".
---

## Overview

This skill streamlines the creation of database backup solutions. It generates scripts, configures schedules, and provides comprehensive restore procedures, ensuring data safety and efficient recovery.

## How It Works

1. **Analyze Requirements**: Determines the database type (PostgreSQL, MySQL, MongoDB, or SQLite) and backup requirements (frequency, retention).
2. **Generate Scripts**: Creates backup scripts with compression and encryption.
3. **Schedule Backups**: Sets up cron jobs for automated, scheduled backups.
4. **Document Restore**: Generates clear, concise restore procedures.

## When to Use This Skill

This skill activates when you need to:
- Create a backup schedule for a database.
- Automate the database backup process.
- Generate scripts for database restoration.
- Implement a disaster recovery plan for a database.

## Examples

### Example 1: Setting up Daily Backups for PostgreSQL

User request: "Create daily backups for my PostgreSQL database."

The skill will:
1. Generate a `pg_dump` script with compression and encryption.
2. Create a cron job to run the backup script daily.

### Example 2: Automating Weekly Backups for MongoDB

User request: "Automate weekly backups for my MongoDB database."

The skill will:
1. Generate a `mongodump` script with compression and encryption.
2. Create a cron job to run the backup script weekly and implement a retention policy.

## Best Practices

- **Retention Policies**: Implement clear retention policies to manage storage space.
- **Testing Restores**: Regularly test restore procedures to ensure data integrity.
- **Secure Storage**: Store backups in secure, encrypted locations, preferably offsite.

## Integration

This skill can integrate with cloud storage plugins (S3, GCS, Azure) for offsite backup storage and monitoring plugins for backup success/failure alerts.

Overview

This skill automates database backup workflows for PostgreSQL, MySQL, MongoDB, and SQLite. It generates backup and restore scripts, configures scheduled execution, and adds compression and encryption for secure storage. The result is a repeatable, documented backup process that supports disaster recovery and operational continuity.

How this skill works

The skill first determines the database type and captures requirements like frequency, retention, and target storage. It then generates platform-appropriate scripts (pg_dump, mysqldump, mongodump, sqlite3) with compression and optional encryption. Next it produces scheduling definitions (cron entries) and retention logic, and finally it creates clear restore procedures and recommended verification steps.

When to use it

  • You need an automated backup schedule for a production or development database.
  • You want scripted backups with compression and encryption for regulatory or security needs.
  • You are creating a disaster recovery plan and need documented restore steps.
  • You need retention policies and scheduled pruning to control storage usage.
  • You want to integrate backups with offsite storage like S3, GCS, or Azure.

Best practices

  • Define retention windows and automated pruning to avoid uncontrolled storage growth.
  • Encrypt backups at rest and in transit; keep encryption keys separate from backup files.
  • Schedule regular restore tests to validate backups and discover drift early.
  • Use offsite storage and versioned buckets to protect against local failures.
  • Limit credentials in scripts and use least-privilege accounts or temporary tokens.

Example use cases

  • Create daily encrypted pg_dump backups and a cron job that uploads to S3 with 30-day retention.
  • Generate weekly mongodump scripts with gzip compression and a rotating retention policy.
  • Set up hourly MySQL backups on a replica server with automated pruning and monitoring hooks.
  • Provide a one-file restore procedure for SQLite with integrity checks and verification steps.
  • Add integration instructions to push backups to GCS or Azure Blob Storage and configure alerts on failure.

FAQ

Can this skill encrypt backups and manage keys?

Yes. It adds encryption steps using standard tools (gpg or openssl) and recommends key management practices, but it does not store keys for you.

Does it support cloud storage targets?

Yes. The generated scripts include examples for S3, GCS, and Azure Blob Storage and can be adapted to other storage plugins.