agentleFS
Sagargupta16Sagargupta16/agent-brain/skills/db-ops/SKILL.md

db-ops

Skill2 starsChanged 11 days agoMITView on GitHub

Database work on the user's apps with a read-only-first posture. Inspect schema and live data (Neon or another hosted Postgres via its MCP server or CLI, local SQLite or Postgres via the repo's own CLI), answer what tables and columns exist and whether prod and local point at the same database, then on ask author and run migrations (Alembic for Python backends, Drizzle for TypeScript ones) against an empty database and a seeded copy, verifying row counts before and after. Use when the user says "now see the neon db of this project", "did we use the same DB as the other app by mistake?", "why is drizzle pushing .sql?", "migrate the local db as well to test", "give me the complete schema list", or "DB migrated to new table". Never runs UPDATE or DELETE against production without an explicit, specific go-ahead, never prints a connection string, and never queries across all users when the ask is about one account.

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. cilangzzz/yudao-skill-pro★ 39same name
    2. brickhu/skills★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository16 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    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:

    write it with an up and a down.

    line 53
  2. Distinctive:

    run it against an empty database, then against a seeded copy of dev

    line 55
  3. Distinctive:

    Never run UPDATE, DELETE, DROP or TRUNCATE against production without an explicit go-ahead that names the table and the change.

    line 79
  4. Distinctive:

    Never print or log a connection string, password or token.

    line 81
  5. Distinctive:

    Never query across all users when the ask is about one account.

    line 83
  6. Distinctive:

    Never hand-edit applied migration files or the alembic/drizzle history table.

    line 85
  7. Very specific:

    Never drizzle-kit push or alembic upgrade head against prod as a way to "see if it works".

    line 86
  8. Distinctive:

    Never chain commands with a double ampersand.

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

db-ops

Schema, migrations and "which database is this actually pointing at". A platform skill such as neon-postgres (if installed) covers provider specifics; this skill is the procedure around it.

Read first

  • Your always-on rules, if you keep them. Secrets and boundaries: "can you look at prod" is not authorization to write to prod; never query all users' rows for a one-account question; tools that "get connection string" (for example a Neon connection-URI tool) return a live password inline, so never call them, refer to DATABASE_URL by name.
  • The repo CLAUDE.md for its database facts (dialect per environment, migration tool, conventions such as an empty downgrade()), plus brain recall <repo> database for anything learned before.
  • A provider skill, if installed, for pooled vs direct connections, branching, scale-to-zero and instant restore.

Procedure

  1. Identify the database before anything else, read-only: which env var the app reads (DATABASE_URL, NEON_DATABASE_URL, a SQLite path), where it is set for dev (.env.example names only, never values) and prod (hosting env, names only via the platform CLI or MCP), and whether two apps share one database project. Print app | env | host label | dialect | shared with.
  2. Schema inventory: alembic current and alembic history (Python) or drizzle-kit introspection (TypeScript); list tables, columns, indexes, foreign keys. For a hosted provider use its read tools; for SQLite sqlite3 <db> .schema. Never a SELECT without LIMIT on prod.
  3. Answer the question asked with that inventory. "Why is drizzle pushing .sql" means drizzle-kit push is applying a diff directly instead of generating a migration file; show the config line that causes it and stop.
  4. Migration, only on ask:
    • write it with an up and a down; Alembic autogenerate then read the diff, never trust autogenerate blind; Drizzle generate then read the SQL
    • run it against an empty database, then against a seeded copy of dev
    • SELECT count(*) per affected table before and after; print both
    • one migration per change; never hand-edit migration history
  5. Data corrections (recompute a derived column, backfill): dev first, print the affected row count, and on prod only after the user names the table and the change ("yes update X in prod"); wrap in a transaction, count before and after, keep the rollback statement in the receipt.
  6. Receipt.

Output

| app | env | host | dialect | shared with |
| <app> | prod | neon (label from the provider) | postgres | none |

| table | rows before | rows after | migration | verified |
| users | 1,204 | 1,204 | 0007_add_index | count + alembic current |

rollback: <exact command or "not applicable">
not done: <prod writes awaiting the user's named go-ahead>

Must not

  • Never run UPDATE, DELETE, DROP or TRUNCATE against production without an explicit go-ahead that names the table and the change.
  • Never print or log a connection string, password or token; env var names only; never call a connection-URI tool.
  • Never query across all users when the ask is about one account; filter by the identity from the first query.
  • Never hand-edit applied migration files or the alembic/drizzle history table.
  • Never drizzle-kit push or alembic upgrade head against prod as a way to "see if it works"; dev and the seeded copy are for that.
  • Never chain commands with a double ampersand; one per line.

Non-goals

Provider platform specifics (a provider skill, if installed), prod health checks (prod-check), merging the migration PR (ship), SQL performance tuning beyond an index suggestion, and edits to personal data files (spreadsheets, exports) that are data, not a database.

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.