Process use when you need to archive historical database records to reduce primary database size.

MITAuto-check passedBackend & APIs

Install Archiving Databases

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill archiving-databases -a claude-code

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace archiving-databases --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/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/archiving-databases .claude/skills/archiving-databases && 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
archiving-databases
GitHub stars
2.8k
Token cost
~2.1k tokens
SKILL.md length
956 words
Files
5 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Process use when you need to archive historical database records to reduce primary database size.

  • Works in 10 steps: Identify archival candidates by finding… → Define archival criteria for each table → Handle referential integrity by… → …
  • You need to archive historical database records to reduce primary database size
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Calls aws and az

What it does

Archiving Databases is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to archive historical database records to reduce primary database size. This skill automates moving old data to archive tables or cold storage (S3, Azure Blob, GCS). Trigger with phrases like "archive old database records", "implement data retention policy", "move historical data to cold storage", or "reduce database size with archival".

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts, reference files and assets (for example `assets/README.md`, `references/README.md` and `scripts/README.md`). Compatibility notes: Designed for Claude Code

It sits in Backend & APIs, covering File uploads and storage. It works with Microsoft Azure. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • You need to archive historical database records to reduce primary database size
  • With phrases like archive old database records
  • Implement data retention policy
  • Move historical data to cold storage

Example prompts

  • “archive old database records”
  • “implement data retention policy”
  • “move historical data to cold storage”
  • “/archiving-databases”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(aws:s3:*), Bash(az:storage:*)

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Identify archival candidates by finding large tables with time-based data
  2. Define archival criteria for each table
  3. Handle referential integrity by archiving in dependency order
  4. Create archive destination tables matching the source schema plus metadata columns
  5. Implement the archival operation as an atomic batch
  6. For cloud storage archival, export data to files before upload
  7. Process archival in batches to avoid long-running transactions and excessive lock time
  8. Run VACUUM ANALYZE on source tables after archival to reclaim disk space and update statistics. For large archival operations (>30% of…
  9. Implement data retrieval procedures for archived data
  10. Schedule recurring archival with a cron job or database scheduler. Run weekly or monthly. Include monitoring that alerts on: archival job…

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(psql:*)
    • Bash(mysql:*)
    • Bash(aws:s3:*)
    • Bash(az:storage:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/, which the agent can run.

    Shell commands in SKILL.md call:

    • aws
    • az

    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
    • docs.aws.amazon.com
    • reorg.github.io

    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.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Archiving Databases loads about 2.1k tokens when it runs, and up to ~2.1k if it reads all its reference files. Until then it costs about 96 tokens; SKILL.md has 956 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~96
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.1k

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); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 23ea8d4, republished under its MIT licence (© jeremylongshore). 956 words, ~2,058 tokens.

Download SKILL.mdSave it as .claude/skills/archiving-databases/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
archiving-databases
description
Process use when you need to archive historical database records to reduce primary database size. This skill automates moving old data to archive tables or cold storage (S3, Azure Blob, GCS). Trigger with phrases like "archive old database records", "implement data retention policy", "move historical data to cold storage", or "reduce database size with archival".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(aws:s3:*), Bash(az:storage:*)
compatibility
Designed for Claude Code
version
1.27.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
database, azure, archiving-databases

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 pg_size_pretty(pg_total_relation_size('table_name')) to identify archival candidates

Instructions

  1. Identify archival candidates by finding large tables with time-based data:

    • SELECT relname, n_live_tup, pg_size_pretty(pg_total_relation_size(relid)) FROM pg_stat_user_tables ORDER BY pg_total_relation_size(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 created_at < NOW() - INTERVAL '1 year')
    • Status-based: Records in terminal state (WHERE status IN ('completed', 'cancelled', 'expired'))
    • Combined: Old AND terminal (WHERE created_at < NOW() - INTERVAL '6 months' AND status = 'completed')
    • Calculate the expected volume: SELECT COUNT(*), pg_size_pretty(pg_column_size(t.*)) FROM table_name t WHERE <criteria>
  3. Handle referential integrity by archiving in dependency order:

    • Archive child records first (order_items before orders)
    • For tables with active foreign key references, verify no active records reference the candidates: SELECT COUNT(*) FROM active_child WHERE parent_id IN (SELECT id FROM parent WHERE <archive_criteria>)
    • Option: cascade archive by archiving parent and all descendants together
  4. Create archive destination tables matching the source schema plus metadata columns:

    • CREATE TABLE orders_archive (LIKE orders INCLUDING ALL)
    • ALTER TABLE orders_archive ADD COLUMN archived_at TIMESTAMPTZ DEFAULT NOW()
    • ALTER TABLE orders_archive ADD COLUMN archive_batch_id UUID
    • Remove foreign key constraints on archive tables (archived data is self-contained)
  5. Implement the archival operation as an atomic batch:

    • Generate a batch ID: SELECT gen_random_uuid() AS batch_id
    • Insert into archive: INSERT INTO orders_archive SELECT *, NOW(), batch_id FROM orders WHERE <criteria>
    • Verify row counts match: SELECT COUNT(*) FROM orders_archive WHERE archive_batch_id = batch_id
    • Delete from source only after verification: DELETE FROM orders WHERE id IN (SELECT id FROM orders_archive WHERE archive_batch_id = batch_id)
    • Wrap in a transaction for atomicity
  6. For cloud storage archival, export data to files before upload:

    • PostgreSQL: COPY (SELECT * FROM orders WHERE <criteria>) TO '/tmp/archive_orders_2023.csv' WITH CSV HEADER
    • Compress: gzip /tmp/archive_orders_2023.csv
    • Upload: aws s3 cp /tmp/archive_orders_2023.csv.gz s3://archive-bucket/orders/2023/ --sse aws:kms
    • Store manifest: record file path, row count, checksum, and date range in an archive_manifest table
  7. Process archival in batches to avoid long-running transactions and excessive lock time:

    • Archive 10,000-50,000 rows per batch
    • Add a short delay between batches (100-500ms) to allow other transactions to proceed
    • Log progress after each batch for monitoring and restart capability
  8. Run VACUUM ANALYZE on source tables after archival to reclaim disk space and update statistics. For large archival operations (>30% of table), consider VACUUM FULL during a maintenance window (requires exclusive lock).

  9. Implement data retrieval procedures for archived data:

    • For archive tables: direct SQL queries with UNION ALL between active and archive tables
    • For cloud storage: import script that restores specific date ranges from S3/GCS to temporary tables
    • Document retrieval procedures for support and compliance teams
  10. Schedule recurring archival with a cron job or database scheduler. Run weekly or monthly. Include monitoring that alerts on: archival job failure, unexpected archive volume (too many or too few records), and source table size not decreasing after archival.

Show full SKILL.md (385 more words)Show less

Output

  • Archive table DDL with matching schema plus metadata columns
  • Archival scripts (SQL and shell) for batch extraction, verification, and deletion
  • Cloud storage upload scripts with compression and encryption
  • Archive manifest table tracking all archival batches with metadata
  • Retrieval scripts for restoring archived data when needed
  • Cron job configuration for scheduled recurring archival

Error Handling

ErrorCauseSolution
Foreign key violation during DELETEActive child records still reference archived parentArchive child records first; verify no active references exist before deleting parent records
Disk space not reclaimed after archivalPostgreSQL marks deleted rows as dead tuples but does not release spaceRun VACUUM FULL table_name during maintenance window; or use pg_repack for online space reclamation
Archive batch interrupted mid-transactionNetwork failure, timeout, or crash during archivalTransaction rollback ensures atomicity; restart from the last completed batch using batch_id tracking
Cloud storage upload failsNetwork timeout, credential expiration, or bucket permissionsImplement retry with exponential backoff; verify credentials before starting; use multipart upload for files >100MB
Archived data needed for auditCompliance request requires access to archived recordsQuery archive tables directly; or restore from cloud storage using the archive manifest to locate the correct files

Examples

Archiving 2 years of completed orders to reduce database size by 60%: An orders table with 50M rows (120GB) contains 30M completed orders older than 1 year. Archival moves these to orders_archive in batches of 50,000 rows over 3 hours during off-peak. Source table drops to 20M rows (48GB). VACUUM reclaims 72GB. Query performance on active orders improves by 40%.

Tiered archival to S3 with Parquet format: Orders 6-12 months old move to archive tables (warm tier, queryable via SQL). Orders older than 12 months export to S3 as Parquet files (cold tier, retrievable on request). Parquet format reduces storage costs by 80% compared to CSV. Archive manifest tracks 156 Parquet files across 36 monthly partitions.

GDPR-compliant data retention with automatic purging: Archival script moves user data older than 3 years to archive tables. A separate purge job permanently deletes archive records older than 7 years. Both jobs log actions to an immutable audit trail. Monthly compliance report shows record counts by age tier and confirms purge completion.

Resources

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

Files

SKILL.md and 4 other files (scripts, references, assets) in skills/.curated/archiving-databases of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md
  • scripts/archival/README.md

Open the folder on GitHubat commit 23ea8d4

Compare with similar skills

Archiving Databases 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.

Archiving Databases compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Archiving Databases this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.1kAutomated safety check: PassMIT
FoundatioFoundatioFx/Foundatio2.1k—~3.9kAutomated safety check: PassApache-2.0
TakeoverPentesterFlow/agent1.4k—~3.3kAutomated safety check: PassApache-2.0
Azure Storage Blob Pymicrosoft/skills3.1k—~2.3kAutomated safety check: PassMIT
Azure Storage Blob Rustmicrosoft/skills3.1k—~2.7kAutomated safety check: PassMIT
Cloud Retention Configmukul975/Privacy-Data-Protection-Skills295—~3.7kAutomated safety check: PassApache-2.0

Similar skills

  • Foundatio

    FoundatioFx/Foundatio

    A skill your agent uses when working with Foundatio infrastructure abstractions for .NET -- caching, queuing, messaging, file storage, distributed locking, or background jobs.

    2.1k GitHub stars~3.9k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Takeover

    PentesterFlow/agent

    Subdomain takeover playbook — sweep subdomains for dangling CNAMEs / NS records pointing at unclaimed third-party resources (GitHub Pages, S3, Heroku, Azure, Netlify, Shopify, ...), confirm with the…

    1.4k GitHub stars~3.3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Azure Storage Blob Py

    microsoft/skills

    Official

    Azure Blob Storage SDK for Python. An agent skill from microsoft/skills.

    3.1k GitHub stars~2.3k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Azure Storage Blob Rust

    microsoft/skills

    Official

    Azure Blob Storage library for Rust. An agent skill from microsoft/skills.

    3.1k GitHub stars~2.7k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Cloud Retention Config

    mukul975/Privacy-Data-Protection-Skills

    Configures cloud storage retention policies across AWS S3, Azure Blob Storage, and Google Cloud Storage.

    295 GitHub stars~3.7k tokensUpdated 6 mo ago
    Legal & ComplianceAuto-check passed
  • Managedcode Storage

    managedcode/dotnet-skills

    Use ManagedCode.Storage when a .NET application needs a provider-agnostic storage abstraction with explicit configuration, container selection, upload and download flows, and backend-specific…

    486 GitHub stars~723 tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Analyzing Text With NLP

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to perform natural language processing and text analysis using the nlp-text-analyzer plugin.

    2.8k GitHub starsUsed in 1 repo~819 tokens
    Auto-check passed
  • Building Neural Networks

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill allows AI assistant to construct and configure neural network architectures using the neural-network-builder plugin.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Detecting Data Anomalies

    jeremylongshore/tons-of-skills-marketplace

    Process identify anomalies and outliers in datasets using machine learning algorithms.

    2.8k GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Explaining Machine Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill enables AI assistant to provide interpretability and explainability for machine learning models.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Optimizing Prompts

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill optimizes prompts for large language models (llms) to reduce token usage, lower costs, and improve performance.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Works with

Questions about Archiving Databases

What does Archiving Databases do?

Process use when you need to archive historical database records to reduce primary database size. Archiving Databases is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to archive historical database records to reduce primary database size.

When should I use Archiving Databases?

Archiving Databases fits situations like: you need to archive historical database records to reduce primary database size; with phrases like archive old database records; implement data retention policy; move historical data to cold storage.

How do I install Archiving Databases in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill archiving-databases -a claude-code`. Or copy the skill folder (skills/.curated/archiving-databases in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/archiving-databases in your project. Claude Code loads it when a task matches its description.

How do I install Archiving Databases in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill archiving-databases -a codex`. Or copy the skill folder (skills/.curated/archiving-databases in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/archiving-databases in your project. Codex loads it when a task matches its description.

Can I use Archiving Databases 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 jeremylongshore/tons-of-skills-marketplace --skill archiving-databases -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/archiving-databases, .gemini/skills/archiving-databases, .github/skills/archiving-databases and .opencode/skills/archiving-databases in your project.

What does Archiving Databases need to run?

Going by SKILL.md and its folder, Archiving Databases needs the command-line tools its instructions call (aws and az). Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(aws:s3:*), Bash(az:storage:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Archiving Databases access the network?

SKILL.md names 3 domains. As links in the text: postgresql.org, docs.aws.amazon.com and reorg.github.io. This is read from the text; nothing was executed.

Is Archiving Databases 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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Archiving Databases use?

Archiving Databases is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Archiving Databases use?

About 2.1k tokens (SKILL.md is roughly 8.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17 tokens, read only when the agent opens those files.

What are the alternatives to Archiving Databases?

Skills that share tags, products or a category with Archiving Databases: Foundatio (FoundatioFx/Foundatio, 2.1k stars), Takeover (PentesterFlow/agent, 1.4k stars), Azure Storage Blob Py (microsoft/skills, 3.1k stars) and Azure Storage Blob Rust (microsoft/skills, 3.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Archiving Databases?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,821 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 8, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.