Skip to content
Skills Library
Programming · Analysis

dev10x-db:db

/dev10x-db: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.

Licence
MIT
Last repository change
08.11.2026

Assessment and security

90/ 100Class: good
Format15 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 08.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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.

Original author description

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.

How it works

  1. Orchestration
  2. Query Planning Workflow
  3. Context Discovery Convention
  4. Safety Rules
  5. Anti-Patterns
  6. Schema Memory File Format
  7. Integration
Original SKILL.md headings · 120 lines, 544 words
SKILL.md preview
---
name: dev10x-db:db
invocation-name: dev10x-db:db
description: >
  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.
user-invocable: false
---

# 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:

1. `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:

1. **Load schema context** — search for schema memory files and
   project-specific db skills (see Context Discovery below)
2. **Verify table and column names** — never guess; cross-reference
   the schema files or run an `information_schema` query
3. **Write the query** — use verified names only
4. **Execute via engine-specific skill** — delegate to the appropriate
   execution layer (e.g., `dev10x-db:db-psql` for PostgreSQL)

## Context Discovery Convention

Generic skills discover database context by searching these
resources (in order, first match wins per resource type):

### Schema files

1. `~/.config/Dev10x/db-*-schema.md` — global schema docs
   (preferred, see `references/config-resolution.md`)

### Database configuration

Handled by `dev10x-db:db-psql` — see its SKILL.md for the full
search order. Key locations:

1. `$DB_CONFIG` environment variable (explicit override)
2. Plugin skill directory (`skills/db-psql/databases.yaml`)
3. `~/.config/Dev10x/databases.yaml` — XDG; preferred global location
4. `~/.claude/memory/Dev10x/databases.yaml` — deprecated fallback
5. Sibling plugin skills (`skills/*/databases.yaml`)
6. User skill directories (`~/.claude/skills/*/databases.yaml`)
7. Marketplace plugins (`~/.claude/plugins/marketplaces/*/skills/*/databases.yaml`)

### Additional context

- **Project db skills**: any skill matching `*:db` pattern (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

1. **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
2. **Write queries**: print the raw SQL and tell the user to run
   it manually. Never attempt workarounds or bypass safety checks
3. **Use timeouts** — all queries should have statement timeouts to
   prevent runaway execution
4. **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`):

```markdown
# <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:db-psql`** — PostgreSQL via psql wrapper
- **`dev10x-db:sql-handoff`** — hands write statements to the user and
  verifies them with a SELECT afterwards

Versions

The database has no other skills named dev10x-db:db.

Database snapshot: 13.11.2026 · package version cd62a3fb28e6 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90dev10x: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…
  • 100database-optimization
    Optimize SQL queries, indexes, and identify N+1 problems. Use for database performance and migration review.
  • 100db-review
    Reviews database schemas, queries, and migrations for correctness, performance, security, and best practices. Use when reviewing SQL migration files or when the user mentions database review, schema review, or query audit.
  • 100database-designer
    Use when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.
  • 100sql-database-assistant
    This skill should be used when the user asks to "optimize SQL queries", "explore database schemas", "generate migration SQL", "analyze query performance", or "document database structure".
  • 100sql-pro
    Optimizes SQL queries, designs database schemas, and troubleshoots performance issues. Use when a user asks why their query is slow, needs help writing complex joins or aggregations, mentions database performance issues, or wants to design or migrate a schema. Invoke for complex…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.