Database integration - schema design, queries, migrations, optimization
Designs database schemas, writes optimized queries, and creates migration scripts. Triggers when building data models, optimizing slow queries, or planning database changes.
/plugin marketplace add pluginagentmarketplace/custom-plugin-fullstack/plugin install fullstack-assistant@pluginagentmarketplace-fullstackThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyAtomic skill for database operations including schema design, query writing, and performance optimization.
Single Purpose: Design and implement database schemas, queries, and migrations
design_schemaDesign database schema with proper normalization and indexes.
// Input
{
action: "design_schema",
database_type: "postgresql",
orm: "prisma"
}
// Output
{
success: true,
schema: {
models: ["User", "Post", "Comment"],
relationships: ["User hasMany Post", "Post hasMany Comment"],
indexes: ["users_email_idx", "posts_author_idx"]
},
performance_notes: ["Composite index recommended for posts queries"]
}
write_queryWrite optimized database queries.
create_migrationCreate database migration scripts.
optimize_performanceAnalyze and optimize query performance.
function validateParams(params: SkillParams): ValidationResult {
if (!params.action) {
return { valid: false, error: "action is required" };
}
if (params.action === 'write_query' && !params.query_type) {
return { valid: false, error: "query_type required for write_query" };
}
return { valid: true };
}
| Error Code | Description | Recovery |
|---|---|---|
| INVALID_DATABASE | Unsupported database type | Check supported databases |
| N_PLUS_ONE_DETECTED | N+1 query pattern found | Add eager loading |
| MISSING_INDEX | Query would cause full table scan | Add index recommendation |
| NORMALIZATION_VIOLATION | Schema violates 3NF | Suggest refactoring |
{
"on_invoke": "log.info('database-integration invoked', { action, database_type })",
"on_success": "log.info('Database operation completed', { schema, performance_notes })",
"on_error": "log.error('Database skill failed', { error })"
}
import { describe, it, expect } from 'vitest';
import { databaseIntegration } from './database-integration';
describe('database-integration skill', () => {
describe('design_schema', () => {
it('should create normalized schema', async () => {
const result = await databaseIntegration({
action: 'design_schema',
database_type: 'postgresql',
orm: 'prisma'
});
expect(result.success).toBe(true);
expect(result.schema.indexes.length).toBeGreaterThan(0);
});
it('should recommend indexes for foreign keys', async () => {
const result = await databaseIntegration({
action: 'design_schema',
database_type: 'postgresql'
});
expect(result.schema.indexes).toContain(expect.stringMatching(/_idx$/));
});
});
describe('optimize_performance', () => {
it('should detect N+1 queries', async () => {
const result = await databaseIntegration({
action: 'optimize_performance',
database_type: 'postgresql'
});
expect(result.success).toBe(true);
expect(result.performance_notes).toBeDefined();
});
});
});
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2024-01 | Initial release |
| 2.0.0 | 2025-01 | Production-grade upgrade with query optimization |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.