agentleFS
RidhuanDEVRidhuanDEV/claude-skills/shadow-db/SKILL.md

shadow-db

Skill1 starsChanged yesterdayMITView on GitHub

Live Database Inspection, ERD & Data Warehousing. Use when inspecting live DBs via shadow_db MCP, running read-only SQL diagnostics, generating DBML/Mermaid ERDs, diffing schemas, or building Star Schema DW and Pentaho (.ktr/.kjb) ETL jobs.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill whenever the Monarch invokes /shadow-db or works on database inspection, query performance (EXPLAIN ANALYZE), zero-downtime …

    line 8
  2. Very specific:

    Always inspect estimated vs actual row counts (EXPLAIN (ANALYZE, BUFFERS) on non-mutating SELECT or rolled-back test BEGIN ...

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/shadow-db — Multi-Engine Database Inspector, Schema Diff, Auto-ERD, Migration Safety & Data Warehouse Generator

Use this skill whenever the Monarch invokes /shadow-db or works on database inspection, query performance (EXPLAIN ANALYZE), zero-downtime schema evolution, cross-database migration (e.g. MySQL ↔ PostgreSQL ↔ SQL Server), or ETL / Data Warehouse Star Schema (dim_* / fact_*) + Pentaho PDI (.ktr/.kjb) design.

Connects to the shadow_db MCP server (inspect_database_schema, run_readonly_query, generate_dbml_and_erd, compare_database_schemas, generate_cross_db_etl_and_warehouse) and pairs with /shadow-data (data lifecycle & migrations) and /shadow-resilience (backup restore compatibility).


1. Supported Engines (Auto-Detected from .env or DSN)

  1. PostgreSQL / Supabase / Neon / TimescaleDB / CockroachDB / Redshift (postgres://)
  2. MySQL / MariaDB / TiDB / SingleStore (mysql://, mariadb://)
  3. Microsoft SQL Server / Azure SQL (mssql://, sqlserver://)
  4. MongoDB (mongodb://, mongodb+srv://)
  5. SQLite (sqlite://, .db, .sqlite)

2. Core Capabilities & Workflow

  1. Read-Only by Default Inspection (inspect_database_schema, run_readonly_query):
    • Automatically reads DATABASE_URL or DB_* from <projectPath>/.env.
    • Enforces a strict Read-Only SQL Gate (SELECT, EXPLAIN, SHOW, PRAGMA only). Any schema mutation or data deletion requires explicit confirmation from the Monarch.
  2. Auto-Generate ERD (generate_dbml_and_erd):
    • Generates docs/db/schema.dbml (dbdiagram.io) and docs/db/ERD.md (Mermaid erDiagram) from the live database.
  3. Cross-Database Schema Drift & Compatibility Check (compare_database_schemas):
    • Compares two live databases (e.g. Local vs Staging/Production, or MySQL vs PostgreSQL) and identifies missing tables, missing columns, and type mismatches before deployment.
  4. Migration Safety & Restore Compatibility (Integrated with /shadow-data):
    • Audits pending migrations to prevent table-locking operations (DROP COLUMN, RENAME COLUMN, or unindexed foreign keys on large tables) and ensures backup restore compatibility with /shadow-resilience.
  5. Cross-DB Migration, Data Warehouse Star Schema, Pentaho PDI & Cron (generate_cross_db_etl_and_warehouse):
    • Generates 6 production-ready artifacts in docs/db/etl/:
      1. 01_target_ddl_<engine>.sql (translated DDL for postgres, mysql, mssql, clickhouse, or bigquery)
      2. 02_star_schema_warehouse_<engine>.sql (dim_* & fact_* Star Schema with surrogate keys and audit timestamps)
      3. 03_etl_migration_blueprint.md (batch chunking, watermark strategy, and idempotent upsert patterns)
      4. 04_pentaho_sync_transformation.ktr (Pentaho Spoon Transformation XML with parameterized connections)
      5. 05_pentaho_master_job.kjb (Pentaho Master Job XML with DB pre-check and failure alert hops)
      6. 06_cron_and_airflow_orchestrator.py (Python Cron runner with anti-overlap file lock + Apache Airflow DAG)
  6. Planner Cardinality, MVCC & Lock Wait Diagnostics (Read-Only EXPLAIN):
    • Always inspect estimated vs actual row counts (EXPLAIN (ANALYZE, BUFFERS) on non-mutating SELECT or rolled-back test BEGIN ... EXPLAIN ANALYZE ... ROLLBACK) before adding indexes; check composite index column selectivity (high-selectivity equality filters before range filters).
    • Monitor MVCC dead tuples/autovacuum lag and inspect pg_locks / pg_stat_activity wait chains when diagnosing slow queries or deadlocks (pair with /shadow-debug).
  7. Execution Approval & Target Environment Boundary (L0–L4):
    • Unknown DB hosts/environments fail closed (BLOCKED_UNKNOWN_ENVIRONMENT). Read-only SELECT/EXPLAIN diagnostics on verified local/dev DBs are L0/L1; any DDL/data mutation or staging/production access is L4: HIGH_IMPACT requiring explicit Monarch approval (shadow-monarch/scripts/execution_approval_gate.py).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.