Agent skill
database-management
Specialized skill for database operations with Drizzle ORM and Neon PostgreSQL. Use when working with schema definitions, queries, migrations, or database optimization.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/database-management
SKILL.md
Database Management Skill
This skill provides expertise in managing the Artiefy database using Drizzle ORM with Neon PostgreSQL.
When to Use This Skill
- Creating or modifying database schemas
- Writing complex queries or transactions
- Running migrations and schema changes
- Optimizing query performance
- Setting up new database connections
Key Technologies
- Drizzle ORM: Type-safe SQL queries and schema definitions
- Neon PostgreSQL: Serverless PostgreSQL database
- Migrations: Version-controlled schema changes
Patterns and Conventions
Schema Definition
- Schemas in
drizzle/directory - Use Drizzle's schema API with proper types
- Define relations and constraints
Queries
- Place in
src/server/queries/ - Use prepared statements for performance
- Handle transactions for multi-step operations
Migrations
- Run
npm run db:generateto create migrations - Run
npm run db:migrateto apply changes - Use
npm run db:studiofor visual schema management
Examples
Schema Definition
// drizzle/schema.ts
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
createdAt: timestamp('created_at').defaultNow(),
});
Query with Drizzle
// src/server/queries/getUsers.ts
import { db } from '@/server/db';
import { users } from '@/drizzle/schema';
export async function getUsers() {
return await db.select().from(users);
}
Migration Script
-- migrations/001_create_users.sql
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT NOW()
);
Performance Optimization
- Use indexes on frequently queried columns
- Implement connection pooling with Neon
- Monitor slow queries with
EXPLAIN ANALYZE
Resources
- Drizzle Documentation
- Neon Documentation
- Project config:
drizzle.config.ts - Environment:
src/env.ts
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?