Agent skill · data analytics · jeremylongshore

archiving-databases

Process use when you need to archive historical database records to

Why this skill is useful

Adds specific SQL commands and cloud storage integration patterns for archiving databases that the AI wouldn't reliably generate on its own.

What it needs

Requires aws, az, gsutil, mysql, psql installed locally. Requires aws, azure, gcs account access. About 5k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Database Archival System Overview Implement automated data archival pipelines that move historical records from primary database tables to archive storage (archive tables, S3, Azure Blob, or GCS) based on age, status, or access frequency criteria. Prerequisites Database credentials with SELECT, INSERT, and DELETE permissions on source and archive tables Cloud storage credentials (AWS S3, Azure Blob, or GCS) if archiving to cold storage psql or mysql CLI for executing archival queries aws s3, az storage, or gsutil CLI for cloud storage uploads Understanding of data retention requirements and compliance policies (GDPR, HIPAA, SOX) Current table sizes: SELECT pgsizepretty(pgtotalrelationsize('tablename')) to identify archival candidates Instructions 1. Identify archival candidates by finding large tables with time-based data: SELECT relname, nlivetup, pgsizepretty(pgtotalrelationsize(relid)) FROM pgstatusertables ORDER BY pgtotalrelationsize(relid) DESC LIMIT 10 Focus on tables where historical data is rarely queried: logs, audit trails, events, old orders, expired sessions 2. Define archival criteria for each table: Age-based: Records older than N days/months (WHERE createdat < NOW() - INTERVAL '1 year') Status-based: Records in terminal state (WHERE status IN ('completed', 'cancelled', 'expired')) Combined: Old AND terminal (WHERE createdat < NOW() - INTERVAL '6 months' AND status = 'completed') Calculate the expected volume: SELECT COUNT(), pgsizepretty(pgcolumnsize(t.)) FROM tablename t WHERE <criteria> 3. Handle referential integrity by archiving in dependency order: Archive child records first (orderitems before orders) For tables with active foreign key references, verify no active records reference the candidates: SELECT COUNT() FROM activechild WHERE parentid IN (SELECT id FROM parent WHERE <archivecriteria>) Option: cascade archive by archiving parent and all descendants together 4. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/archiving-databases--8bb7fd

View the source on GitHub

Browse the @skills marketplace