db-intelligence
Unified database intelligence for PostgreSQL, MySQL, SQLite, and MongoDB in one skill: detect the engine, connect credential-safe, extract schema, build an…
Skill by cskwork
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/cskwork-db-intelligence-c903e8
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, testing, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
db-intelligence- Description
- Unified database intelligence for PostgreSQL, MySQL, SQLite, and MongoDB in one skill: detect the engine, connect credential-safe, extract schema, build an entity-relationship graph, and run read-first queries. Use BEFORE coding to establish domain language, domain data shapes, and real data evidence (specify/explore stage); use during hardening/QA for read-only data verification of selects, updates, and deletions. Triggers: database, DB, schema, domain data, data shapes, ER diagram, PostgreSQL, MySQL, SQLite, MongoDB, mongosh, psql, sqlite3, 'check the data', 'what does the table look like', 'verify in DB'.
- License
- MIT
- Metadata
- author: cskwork · version: 1.0.0 · consolidates: postgres-intelligence, mysql-intelligence, mongodb-intelligence, sql-check
- Instructions
- 124 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (7)
- .env.example
- SKILL.md
- mongodb.md · reference/
- mysql.md · reference/
- postgres.md · reference/
- sqlite.md · reference/
- config.py · scripts/
SKILL.md (first lines)
# db-intelligence One skill, four engines. Contract: **schema before SQL, evidence before claims, reads before writes.** The output of this skill is not just query results — it is a *domain evidence artifact* other agents (specifier, coder, QA) can consume. ## Step 1 — Detect the engine | Signal | Engine | Reference | |---|---|---| | `psql`, port 5432, `pg_catalog`, DATABASE_URL `postgres://` | PostgreSQL | `reference/postgres.md` | | `mysql`, port 3306, JDBC `mysql:`, MyBatis/JPA against MySQL | MySQL | `reference/mysql.md` | | a `.db`/`.sqlite`/`.sqlite3` file, `better-sqlite3`, embedded/local store | SQLite | `reference/sqlite.md` | | `mongodb://` URI, collections, aggregation, `mongosh` | MongoDB | `reference/mongodb.md` | Can't tell? Look at the repo: ORM config (`application.yml`, `mybatis`, `prisma/schema.prisma`, `knexfile`, `mongoose`), docker-compose services, and `.env*` keys name the engine. Multiple engines in one task are normal — open each engine's reference and keep one evidence artifact. Project-specific routing (which logical DB owns which table prefix, which environments are allowed) lives in **domain packs**: check `reference/domain/*.md` in this skill (local-only, never synced publicly) and any `sql-check`-style router in the project's `.agents/skills/` — obey them first. ## Hard rules (all engines) 1. **Never open or print `.env` / credential files.** Scripts and CLIs load credentials at runtime; you see results, never passwords. Never echo a connection string containing a password. 2. **Read-first.** `SELECT` / `find` / `EXPLAIN` run freely. Any `UPDATE`/`DELETE`/`INSERT`/DDL/`updateMany`/`deleteMany`: show the exact statement + expected row count to the user, get approval, then run, then re-`SELECT` to verify the effect. Writes to prod are forbidden. 3. **`WHERE`-less UPDATE/DELETE is always a bug.** Refuse and ask. 4. **Schema before SQL.** Never guess table, column, or field names. Extract or load schema metadata first; RAG over it to pick tables. 5. **LIMIT by default** (≤1000) on exploratory reads. Prefer explicit columns over `SELECT *`. 6. **Max 3 retry refinements** on query errors, then report the blocker. 7. **Evidence, not bulk.** Quote the executed statement, row count, and the deciding rows in your report. Large dumps go to scratch files, get read, get deleted. 8. **Code is the oracle for code claims.** When explaining why a production query/CTE/ORM call behaves a certain way, first quote the actual SQL from the repo (mapper XML, migration, ORM output) and evaluate ONLY the conditions that text contains. Never evaluate conditions inferred from requirements prose or column names — a plausible invented condition is the classic false root cause. If you cannot locate the real query, say so instead of reconstructing it. ## Step 2 — Schema → entity graph (the domain model) This is what makes the data *domain knowledge* rather than rows: 1. Extract schema (per-engine command in its reference file). **Staleness check first**: if a `schema_metadata.json` (or cached DDL dump) already exists, compare its mtime against the repo's migration/DDL files (`migration*/`, `db/`, `*.sql`, `prisma/`, Flyway/Liquibase dirs) — older than the newest migration means re-extract before trusting it. MongoDB has no migrations: re-sample when the metadata is older than the feature you are specifying, or on any field-shape surprise. 2. Build the **entity-relationship graph**: nodes = tables/collections, edges = FKs / embedded refs / join-table links. For engines without declared FKs (MongoDB, legacy MySQL), infer edges from `*_id` naming and sampled values. 3. Record the **ubiquitous language**: table/column comments, enum/code values and their meanings, status-flag semantics (`_YN`, `del_yn`, soft deletes). 4. Note **data-shape gotchas**: nullable columns that are "never null in practice", JSON columns, date encodings, charset/collation, multi-tenancy keys. Output shape (write it to the path the task names, else `db-evidence.md`): ```markdown # DB evidence — <task/feature> ## Engines & connections (names + source environment e.g. dev/audit — never credentials; non-prod data is never prod truth) ## Entity graph (mermaid erDiagram or adjacency list, relevant slice only) ## Ubiquitous language (term → table.column → meaning, code values decoded) ## Data shapes (types, nullability-in-practice, gotchas) ## Queries run (statement → row count → deciding rows) ## Open questions (what the data could not answer) ``` Keep the graph to the **relevant slice** — the 5–15 entities the task touches, not the whole schema. **Cache the stable part in the domain pack.** Entity-graph edges and ubiquitous language change rarely; data shapes and row realities drift. When a `reference/domain/<project>.md` pack exists, read its cached graph slice first and only re-verify the *data* (shapes, counts, code values) against the live DB. After a session that mapped new entities or decoded new terms, append them to the domain pack (dated) so the next run starts warm. No pack, recurring project → offer to create one. ## Step 3 — Query Natural language → statement, using the schema metadata (never guesses). Per-engine syntax, executors, retry-error taxonomy, and performance analysis live in the reference files. Multi-step analysis: prefer one statement that answers the question over N round trips. ## Step 4 — Present Three formats when useful, at minimum the first: **data table** (≤20 rows shown, note total), **analysis** (direct answer + notable pattern/outlier), and optionally a **chart** via the legacy visualizer scripts. ## Reference map | File | When | |---|---| | `reference/postgres.md` | psql, information_schema/pg_catalog, EXPLAIN ANALYZE, existing postgres-intelligence scripts | | `reference/mysql.md` | mysql CLI, multi-DB routing, existing mysql-intelligence scripts | | `reference/sqlite.md` | sqlite3 CLI, file discovery, PRAGMA schema/introspection, WAL/locking gotchas | | `reference/mongodb.md` | mongosh, sample-based schema inference, aggregation pipelines, existing mongodb-intelligence scripts | | `reference/domain/*.md` | local-only domain packs: per-project DB routing, environments, known failure classes (gitignored — may be absent on a fresh install) | **Done =** engine stated · schema loaded before any statement · entity-graph
From cskwork/pi-setup-public, MIT.
More from cskwork/pi-setup-public
- 0.543score
playwright-cli
cskwork
Operate a browser directly and inspect or author Playwright tests with playwright-cli.
SkillAFreshness: AClaude Code +9 - 0.543score
browser-qa
cskwork
Run browser QA with reviewable YAML scenarios, engine selection, and browser/API evidence.
SkillAFreshness: AClaude Code +9 - 0.543score
ego-browser
cskwork
When you need a browser, read this Skill by default.
SkillAFreshness: AClaude Code +9 - 0.538score
pi-settings
cskwork
Configure pi's own settings.json and audit skill-link leakage - skill isolation from the shared ~/.agents/skills hub, subagent model routing and fallbacks…
SkillAFreshness: AClaude Code +9 - 0.538score
find-skills
cskwork
Discover and assess installable skills when the user asks to find, compare, or add agent capabilities.
SkillAFreshness: AClaude Code +9 - 0.538score
pi-sixpack
cskwork
SwarmForge-style six-role gated coding pipeline run with pi subagents: specifier → coder → cleaner → sw-architect ∥ hardender → qa, with adaptive packs…
SkillAFreshness: AClaude Code +9 - 0.537score
unslop
cskwork
Remove AI writing patterns when the user explicitly requests unslop.
SkillAFreshness: AClaude Code +9 - 0.514score
domain-modeling
cskwork
Build and sharpen a project's domain model.
SkillAFreshness: AClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 31, 2026 (1 month ago)
- Last release
- Oct 12, 2026 (17 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- MIT
- Repository
- github.com/cskwork/pi-setup-public
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from cskwork
- 0.586score
bughunt
cskwork
Find and fix interaction bugs in games, CRUD apps, AI chat and media apps with seeded self-playing personas, per-step invariant oracles, reproducible failure…
SkillAFreshness: A★ 3Claude Code +9 - 0.586score
image-first-ui
cskwork
Image-first interface creation.
SkillAFreshness: A★ 3Claude Code +9 - 0.586score
motion-graphics
cskwork
Make code-driven motion-graphics videos rendered from HTML, frame-accurate and reproducible.
SkillAFreshness: A★ 3Claude Code +9 - 0.586score
gpt-image-2
cskwork
Generate images with ChatGPT's current image model (GPT Image 2 at the time of writing, and whatever model succeeds it) inside your agent, using your existing…
SkillAFreshness: A★ 3Claude Code +9 - 0.586score
diagram-design
cskwork
Create branded architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant…
SkillAFreshness: A★ 3Claude Code +9 - 0.586score
db-intelligence
cskwork
Unified database intelligence for PostgreSQL, MySQL, SQLite, and MongoDB in one skill: detect the engine, connect credential-safe, extract schema, build an…
SkillAFreshness: A★ 3Claude Code +9
Cite this page
db-intelligence skill. Agent Mart. https://agentmart.dev/skills/cskwork-db-intelligence-c903e8 (last updated 2026-10-24)