Db
Safe database query planning for Claude Code. When querying any database, ensures schema-first construction and read-only safety so queries are accurate and never modify production data. TRIGGER when: code needs database queries, schema discovery, or SQL construction. DO NOT TRIGGER when: no database interaction needed, or user is writing application code that happens to mention SQL in comments.From its SKILL.md
npx -y skills add Dev10x-Guru/Dev10x-Claude --skill dbAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 8 stars8 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
4.4 KB, as published. Nobody here has run it
Database Query Planning
Orchestration
This skill follows references/task-orchestration.md patterns.
Create a task at invocation, mark completed when done:
REQUIRED: Create a task at invocation. Execute at startup:
TaskCreate(subject="Plan database query", activeForm="Planning query")
Mark completed when done: TaskUpdate(taskId, status="completed")
Schema-first query construction for safe, accurate database queries.
Query Planning Workflow
Before writing any SQL:
- Load schema context — search for schema memory files and project-specific db skills (see Context Discovery below)
- Verify table and column names — never guess; cross-reference
the schema files or run an
information_schemaquery - Write the query — use verified names only
- Execute via engine-specific skill — delegate to the appropriate
execution layer (e.g.,
Dev10x:db-psqlfor PostgreSQL)
Context Discovery Convention
Generic skills discover database context by searching these resources (in order, first match wins per resource type):
Schema files
~/.config/Dev10x/db-*-schema.md— global schema docs (preferred, seereferences/config-resolution.md)
Database configuration
Handled by Dev10x:db-psql — see its SKILL.md for the full
search order. Key locations:
$DB_CONFIGenvironment variable (explicit override)- Plugin skill directory (
skills/db-psql/databases.yaml) ~/.config/Dev10x/databases.yaml— XDG; preferred global location~/.claude/memory/Dev10x/databases.yaml— deprecated fallback- Sibling plugin skills (
skills/*/databases.yaml) - User skill directories (
~/.claude/skills/*/databases.yaml) - Marketplace plugins (
~/.claude/plugins/marketplaces/*/skills/*/databases.yaml)
Additional context
- Project db skills: any skill matching
*:dbpattern (e.g.,tt:db,acme:db) — project-specific aliases, common queries, and DSN configuration - CLAUDE.md database sections: database connection info or references in project instructions
Always load available context before constructing queries.
Safety Rules
- Read-only queries only — SELECT, WITH (CTEs), EXPLAIN, and SHOW are allowed. Never run INSERT, UPDATE, DELETE, DROP, ALTER, CREATE, TRUNCATE, or other write operations through automated tools
- Write queries: print the raw SQL and tell the user to run it manually. Never attempt workarounds or bypass safety checks
- Use timeouts — all queries should have statement timeouts to prevent runaway execution
- Limit large result sets — use LIMIT on exploratory queries;
never
SELECT *on production tables without a WHERE clause
Anti-Patterns
| Anti-Pattern | What to Do Instead |
|---|---|
| Guess table/column names | Load schema files first, or query information_schema.tables / information_schema.columns |
| Retry with random name variations | Stop and look up the correct name in schema docs |
SELECT * on large tables | Use specific columns and LIMIT |
| Inline DSN strings in prompts | Use the engine-specific skill's wrapper script |
| Skip schema check for "simple" queries | Always verify — even common tables have gotchas |
Schema Memory File Format
Schema files should follow this template. Place them at
~/.config/Dev10x/db-<name>-schema.md (preferred global
path per references/config-resolution.md):
# <Project> Database Schema — <database-name>
## <Domain Group>
| Table | Key Columns | Notes |
|-------|-------------|-------|
| `table_name` | id, name, status, foreign_key_id | Brief purpose |
## Common Gotchas
- Table `actual_name` (NOT `guessed_name`)
- Money fields store JSON: `field::jsonb->>'amount'`
## Common Queries
### Find X by Y
\```sql
SELECT ... FROM ... WHERE ...
\```
Integration
This skill provides query planning guidance. Actual query execution is handled by engine-specific skills:
Dev10x:db-psql— PostgreSQL via psql wrapper