drizzle-db

majiayu000's avatarfrom majiayu000

Query the project's database using Drizzle ORM. Use when the user asks about database contents, schema inspection, or data queries. Supports read-only mode for safety.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

The Drizzle DB Connector is a robust Claude skill designed to facilitate seamless interaction between AI agents and project databases using Drizzle ORM. It enables users to perform complex SQL queries, inspect database schemas, and retrieve real-time data directly through natural language. Engineered with a 'safety-first' approach, it features a default read-only mode to prevent accidental data modification, making it an essential tool for developers and data analysts who need quick, secure access to database insights.

Use Cases

  • Database Schema Inspection: Quickly retrieve table structures, column types, and relationships to understand the project's data architecture without manual SQL writing.
  • Real-time Data Debugging: Execute targeted SELECT queries to verify application state, troubleshoot record inconsistencies, and confirm data persistence during development.
  • Ad-hoc Reporting and Analysis: Generate instant summaries, count records, or perform table joins to extract business metrics and insights directly within the chat interface.
  • Secure Data Exploration: Safely browse production or staging databases using the enforced read-only mode, ensuring data integrity while performing audits or checks.
namedrizzle-db
descriptionQuery the project's database using Drizzle ORM. Use when the user asks about database contents, schema inspection, or data queries. Supports read-only mode for safety.

Drizzle DB Connector

Execute SQL queries against the project's database through Drizzle ORM.

When to use

  • User asks about database contents or data
  • Need to inspect database schema or tables
  • Querying data for analysis or debugging
  • Checking database state

How to use

Run queries using the query script located in this skill's directory:

node .claude/skills/drizzle-db/scripts/query.js "SELECT * FROM users LIMIT 10"

The script:

  • Connects to the database using the project's Drizzle configuration
  • Executes the SQL query
  • Returns results as JSON

Configuration

This skill is configured during installation:

  • dialect: Database type (sqlite/postgres/mysql)
  • databasePath: For SQLite - direct path to .db file (e.g., ./apps/web/data/app.db)
  • drizzleConfigPath: For Postgres/MySQL - path to drizzle.config.ts
  • readOnly: Whether to enforce read-only queries (default: true)

Configuration is stored in .claude/skills/drizzle-db/.config.json

Example config for SQLite:

{
  "dialect": "sqlite",
  "databasePath": "./apps/web/data/app.db",
  "readOnly": true
}

Read-only mode

When readOnly is true (default), the following operations are blocked:

  • INSERT
  • UPDATE
  • DELETE
  • DROP
  • ALTER
  • TRUNCATE
  • CREATE

Only SELECT queries are allowed for safety.

Examples

# Get all users
node .claude/skills/drizzle-db/scripts/query.js "SELECT * FROM users"

# Count records
node .claude/skills/drizzle-db/scripts/query.js "SELECT COUNT(*) FROM posts"

# Join tables
node .claude/skills/drizzle-db/scripts/query.js "SELECT u.name, p.title FROM users u JOIN posts p ON u.id = p.user_id"

# Get schema information
node .claude/skills/drizzle-db/scripts/query.js "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"

Limitations

  • Requires Node.js and the project's Drizzle setup
  • Read-only mode prevents data modifications by default
  • Queries timeout after 30 seconds
  • Results are limited to 1000 rows by default

Troubleshooting

If queries fail:

  1. Verify drizzle.config.ts path is correct in .config.json
  2. Ensure database connection credentials are set
  3. Check that Drizzle dependencies are installed: npm install drizzle-orm
  4. Verify database is accessible from current environment