db-handler
Manage database schemas, Drizzle ORM, migrations, and data modeling. Use when creating tables, modifying columns, or planning database changes.
Best use case
db-handler is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Manage database schemas, Drizzle ORM, migrations, and data modeling. Use when creating tables, modifying columns, or planning database changes.
Manage database schemas, Drizzle ORM, migrations, and data modeling. Use when creating tables, modifying columns, or planning database changes.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "db-handler" skill to help with this workflow task. Context: Manage database schemas, Drizzle ORM, migrations, and data modeling. Use when creating tables, modifying columns, or planning database changes.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/db-handler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How db-handler Compares
| Feature / Agent | db-handler | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Manage database schemas, Drizzle ORM, migrations, and data modeling. Use when creating tables, modifying columns, or planning database changes.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Database Handler
## Instructions
### 1. Creating a New Table
1. **Draft**: Create the `pgTable` definition in `src/db/schema/{domain}.ts`.
2. **Columns**: Add ID (UUID), timestamps, and data columns.
- **Mandatory**: Use Zod schema for any JSONB columns.
3. **Relations**: Define `relations` and Foreign Keys.
4. **Verification**: Ask the user: "Is this structure correct? Are there any missing relations?"
5. **Migration**:
- **DO NOT** generate migration files (e.g., `drizzle-kit generate`).
- **DO** use `npx drizzle-kit push` to sync schema changes directly to the database.
### 2. Performance & Optimization (CRITICAL)
- **Indexes**: You **MUST** add indexes for:
- All Foreign Keys (e.g., `userId`, `planId`).
- Columns frequently used in `WHERE` clauses (e.g., `status`, `email`).
- Columns used for sorting (e.g., `createdAt`).
- **N+1 Prevention**:
- **NEVER** allow fetching data inside a loop.
- Use Drizzle's Relational Query API (`with: { ... }`) or explicit `.leftJoin()` to fetch related data in a single query.
### 3. Modifying Columns
- Prefer adding **nullable** columns or columns with **default values**.
- Avoid breaking changes without explicit confirmation.
### 4. Types & Enums
- **Enums**: Export as constants (`export const roleEnum = ...`).
- **Types**: Do NOT export inferred types. Let consumers infer them.
## Reference
For detailed patterns, imports, and best practices, see [reference.md](reference.md).Related Skills
error-handler-advisor
Proactively reviews error handling patterns and suggests improvements using Result types, proper error propagation, and idiomatic patterns. Activates when users write error handling code or use unwrap/expect.
ui-handler
Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.
theme-handler
Manage and update application themes using shadcn and tweakcn.
stripe-handler
Handle Stripe payments, custom checkouts, and webhook fulfillment outside of standard plans/credits.
seo-handler
Manage SEO, sitemaps, and metadata for optimal search engine visibility
s3-upload-handler
Handle S3 file uploads including UI components, client-side logic, and server-side processing
replicate-handler
Integrate with Replicate AI for running models (image generation, LLMs, etc.).
plate-handler
Implement rich text editors using Plate.js. Supports creating both simple (comment/chat) and detailed (document/blog) editors.
plans-handler
Manage subscription plans, pricing, and quotas. Use when adding plan features, updating limits, or building pricing pages.
inngest-handler
Create and manage Inngest functions for reliable background jobs, workflows, and scheduled tasks.
env-handler
Manage environment variables securely. Handles distinction between .env (template) and .env.local (secrets).
email-handler
Create and send transactional emails using React Email. Covers templates, layout integration, and sending logic.