agentsclimarketplace

Dbfy

Skill kuosuko/dbfy/skills/dbfy

Generate a clean post-merge schema snapshot from a folder of SQL migration files. Use when you need to understand the current database schema but only have migration files, or want to feed one canonical schema into context instead of dozens of individual migrations. Supports SQLite, PostgreSQL (in-memory PGlite), and MySQL (zero-setup pure DDL parser by default; real server with --url). Triggers on: "what does the schema look like", "show me the database structure", "consolidate migrations", "schema snapshot", "current database schema".From its SKILL.md

Install
npx -y skills add kuosuko/dbfy --skill dbfy

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.8 KB, 844 tokens by cl100k_base, as published. Nobody here has run it

dbfy — DB-ify your migrations

When to use

  • You need to understand the current database schema but only have migration files (001-xxx.sql, 002-xxx.sql, etc.)
  • You want one canonical schema file in context instead of 50 migration files
  • You need to verify what the schema looks like after applying all migrations
  • You want to diff schema across git branches
  • A user asks "what tables/columns/indexes exist?"

When NOT to use

  • If you have access to a live database — just run pg_dump --schema-only or .schema directly
  • If you need to inspect data, not structure (dbfy snapshots DDL only)

Usage

# Zero-config: auto-detects the migrations dir AND the dialect from the SQL
npx @kuosuko/dbfy --out -

# Explicit dialect
npx @kuosuko/dbfy --migrations ./migrations --out schema.snapshot.sql --dialect postgres

# MySQL — pure-parse, NO server / Docker needed (dbfy's differentiator)
npx @kuosuko/dbfy --migrations ./migrations --dialect mysql --out -

# MySQL — full fidelity (views/triggers/routines) against a real server
npx @kuosuko/dbfy --dialect mysql --url mysql://root:root@localhost:3306/ --out -

# CI: fail if the committed snapshot is stale (exit 1 on drift)
npx @kuosuko/dbfy --check

Dialects

DialectEngineServer?Notes
sqlitebetter-sqlite3 (in-memory)NoDefault fallback. Zero-setup.
postgresPGlite (in-memory WASM Postgres)NoFull PG type support.
mysqlpure DDL parser (default)NoMilliseconds, no server. Structure only.
mysql + --urlreal MySQL via mysql2YesFull fidelity incl. views/triggers/routines.

MySQL note: MySQL has no embeddable engine, so most tools need a live server or Docker to compute the final schema. dbfy's default MySQL mode parses the DDL directly (folding ALTER TABLE into CREATE TABLE) for an instant, zero-setup snapshot. It covers tables, columns, keys, indexes, and foreign keys; pass --url only when you need stored programs reproduced exactly.

What it does

  1. Discovers migration files matching <number>[-_]<name>.(sql|up.sql)
  2. Spins up an in-memory database (SQLite or PGlite)
  3. Applies each migration in order
  4. Dumps the final schema as a single clean SQL file

Programmatic API

import { snap } from '@kuosuko/dbfy';

const result = await snap({
  migrationsDir: './migrations',
  out: './schema.snapshot.sql',
  dialect: 'postgres',
  includeHeader: true,
});

console.log(result.filesProcessed, 'migrations applied');

Tips for agents

  • Use --out - to pipe the snapshot directly into context without writing a file
  • After running dbfy, you can reason about the full schema in one shot — table names, columns, types, constraints, indexes, foreign keys
  • For destructive migrations (column drops, table renames), the snapshot correctly reflects the post-merge state
  • Re-run dbfy after any migration change to get an updated snapshot
  • Run dbfy bare (no --migrations/--dialect) to let it auto-detect; pass flags only to override
  • In CI, dbfy --check guards against migrations that were changed without refreshing the snapshot
  • If a MySQL snapshot warns about skipped views/triggers, re-run with --url <mysql-url> for full fidelity

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,851. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.