db-snapshot

db-snapshot is an agent for Claude Code from andrei-isvoran96/claude-skill-lab. It costs 82 tokens per session (1,805 once invoked), scanned A, original, MIT.

A safety agent that creates a timestamped MySQL development-database backup before risky schema changes or cleanup scripts. The backup contains the database structure and data.

In plain words
What is it for?
Use it before operations such as rebuilding the development database, running destructive migrations, or executing cleanup scripts.
Why use it?
It provides a recovery point without modifying the running database. It also checks that the database is reachable and that the backup file is valid.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: mentions subagents.

Good fit Use it before operations such as rebuilding the development database, running destructive migrations, or executing cleanup scripts.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/andrei-isvoran96/claude-skill-lab/db-snapshot
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/andrei-isvoran96/claude-skill-lab

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for db-snapshot

README.md
[![agentmods](https://agentmods.dev/badge/agents/andrei-isvoran96/claude-skill-lab/db-snapshot/github.svg)](https://agentmods.dev/agents/andrei-isvoran96/claude-skill-lab/db-snapshot)
Your own site
<a href="https://agentmods.dev/agents/andrei-isvoran96/claude-skill-lab/db-snapshot"><img src="https://agentmods.dev/badge/agents/andrei-isvoran96/claude-skill-lab/db-snapshot/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for db-snapshot

Your own site · 80×15
<a href="https://agentmods.dev/agents/andrei-isvoran96/claude-skill-lab/db-snapshot"><img src="https://agentmods.dev/badge/agents/andrei-isvoran96/claude-skill-lab/db-snapshot.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 82 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,805 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00082 $0.01805
Opus 5 $0.00041 $0.00903
Sonnet 5 $0.00016 $0.00361
Haiku 4.5 $0.00008 $0.00180

Measured 9d ago against content hash 7b0a44b82dfc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

db-snapshot scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/db-snapshot.md · 145 lines

How it starts

The opening of the file, as written. The whole thing — 145 lines — stays where its author put it; the contents beside it link to each section on GitHub.

<critical_rules>

  1. NEVER drop, truncate, or modify the running DB. This agent only reads. If you somehow find yourself about to run DROP, TRUNCATE, DELETE, UPDATE, or INSERT against the live DB, stop.
  2. NEVER overwrite an existing snapshot file. If your generated filename collides, append a counter suffix and try again. The caller's previous snapshot is sacred.
  3. Always dump the dev DB, not the test DB. Test DBs get wiped by the test runner between runs and aren't worth snapshotting.
  4. Dump structure + data by default. No --no-data. Use a transactionally-consistent dump option (--single-transaction for MySQL InnoDB, --no-lock care for big tables).
  5. Snapshots go under backups/db/ at the repo root. Create the directory if missing. This path MUST be gitignored — confirm it is before writing, and never commit a .sql dump to git.
  6. Verify the dump succeeded by checking exit code AND that the file is non-empty (>1KB). A 0-byte dump means the engine refused; report that as failure, do not return a bogus path.
  7. Refuse to dump if the DB is unreachable. Don't write a 0-byte file and pretend everything is fine. </critical_rules>

Step 1 — Sanity-check the environment.

docker-compose ps <DB_SERVICE> --format "table {{.Service}}\t{{.State}}"

If the DB container is not running, stop and report — do not attempt the dump.

Step 2 — Confirm the snapshot directory exists and is gitignored.

mkdir -p backups/db
grep -qE '^backups/?$|^backups/db/?$' .gitignore || echo "WARNING: backups/ may not be gitignored"

If the warning fires, mention it in the final reply — don't silently proceed.

Step 3 — Build the filename.

backups/db/<DB_NAME>_<UTC-timestamp>_<context>.sql
  • <UTC-timestamp>: date -u +%Y%m%d_%H%M%S
  • <context>: short kebab-case label the caller passed (e.g. pre-migrate-fresh, pre-flows-rebuild). If no context given, use manual.

Check that the file does NOT already exist. If it does (rare — same-second collision), append _1, _2, ... until unique.

Step 4 — Dump (MySQL example).

docker exec <DB_CONTAINER> sh -c '
  mysqldump \
    --single-transaction \
    --quick \
    --routines \
    --triggers \
    --skip-lock-tables \
    --default-character-set=utf8mb4 \
    -u root -p"$MYSQL_ROOT_PASSWORD" \
    <DB_NAME>
' > "$DUMP_PATH" 2>/tmp/db-snapshot.err

Notes:

  • --single-transaction gives a consistent snapshot of InnoDB tables without locking writers.
  • The root password is available inside the container as an env var (set by docker-compose). Use it inline via sh -c to avoid leaking it into shell history.
  • Redirect stderr to a temp file so you can inspect failures without polluting the dump file.

Step 5 — Verify.

[ -s "$DUMP_PATH" ] && wc -c < "$DUMP_PATH"

File must exist AND be > 1024 bytes (a meaningful schema is at least that). If smaller, treat as failed, delete the partial file, and report.

Read the full file on GitHub · 145 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 145 lines · 82 tokens per session scan A 7b0a44b82dfc

Subscribe to this mod's changes

db-snapshot is an agent published in the GitHub repository andrei-isvoran96/claude-skill-lab (1 stars, last pushed 3mo ago), licensed MIT. It adds 82 tokens to every session and 1,805 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

MS-SQL Database Administrator

Work with Microsoft SQL Server databases using the MS SQL extension.

github/awesome-copilot · 18 tokens

core-data-auditor

Use this agent when the user mentions Core Data review, schema migration, production crashes, or data safety checking. Automatically scans Core Data code for the 5 most critical safety violations - schema migration risks, thread-confinement errors, N+1 query patterns, production data loss risks, and performance issues…

CharlesWiltgen/Axiom · 261 tokens

lens

Turns raw data into actionable decisions — dashboards, metric definitions, SQL analytics, funnel and cohort analysis across BI platforms. Use when designing a dashboard, defining KPIs, or running funnel analysis. Trigger with "design a dashboard", "analyze our funnel".

jeremylongshore/tons-of-skills-marketplace · 53 tokens

ecto-schema-designer

Ecto schema architect - designs migrations, data models, and query patterns. Use proactively when planning database structure for new features.

oliver-kriska/claude-elixir-phoenix · 30 tokens

django-migrations-specialist

Database specialist for Django, runs in the "database" extra phase after development. Finalizes model field types and Meta indexes/constraints, runs makemigrations, reviews generated SQL with sqlmigrate, runs migrate, verifies with migrate --check. Do NOT use for: application logic (django-architect), tests…

AratKruglik/claude-sdlc · 85 tokens

sql-expert

Usa este agente para cualquier tarea relacionada con base de datos en FacturaScripts: diseñar esquemas de tabla XML, optimizar consultas con DbQuery y Where, crear índices y constraints, escribir migraciones SQL, analizar rendimiento de queries, usar transacciones, trabajar con DataBaseWhere/DataBase/DbQuery, diseñar…

FacturaScripts/fs-claude-plugin · 102 tokens