SQL Database Assistant
Use when the user asks to write SQL queries, optimize database performance, generate migrations, explore database schemas, or work with ORMs like Prisma, Drizzle, TypeORM, or SQLAlchemy.
Before & after
Same prompt, same agent — the only difference is the skill.
I can help you write that query. You'd need to join your customer and order tables, filter for customers with multiple orders, and then compare spending across quarters. The exact structure would depend on your database schema, but a query like this would generally involve aggregation functions and date comparisons. If you share your table names and column structure, I can give you more specific SQL. What database system are you using, and do you have your schema handy?
REPEAT CUSTOMER QUERY - PostgreSQL
SELECT
c.customer_id,
c.name,
q3.amount as q3_total,
q4.amount as q4_total,
ROUND((q4.amount - q3.amount) / q3.amount * 100, 1) as growth_pct
FROM customers c
LEFT JOIN (
SELECT customer_id, SUM(amount) as amount
FROM orders
WHERE date_trunc('quarter', order_date) = '2026-Q3'
GROUP BY customer_id
) q3 ON c.customer_id = q3.customer_id
LEFT JOIN (
SELECT customer_id, SUM(amount) as amount
FROM orders
WHERE date_trunc('quarter', order_date) = '2026-Q4'
GROUP BY customer_id
) q4 ON c.customer_id = q4.customer_id
WHERE
q3.amount IS NOT NULL
AND q4.amount IS NOT NULL
AND q4.amount > q3.amount
ORDER BY growth_pct DESC;
EXECUTION PLAN
Seq scan on orders q4: 12ms
Hash join on customer_id: 8ms
Sort by growth_pct: 4ms
Total: 24ms
OPTIMIZATION
Index on orders(customer_id, order_date) cuts query to 6ms
Add if run frequency > 2x daily
ORM EQUIVALENT (Prisma)
const repeatCustomers = await prisma.$queryRaw`
...same query above
`;About this skill
name: sql-database-assistant description: Use when Use when the user asks to write SQL queries, optimize database performance, generate migrations, explore database schemas, or work with ORMs like Prisma, Drizzle, TypeORM, or SQLAlchemy.
Sql Database Assistant
Use when the user asks to write SQL queries, optimize database performance, generate migrations, explore database schemas, or work with ORMs like Prisma, Drizzle, TypeORM, or SQLAlchemy.
What you get
- Public GitHub repo (alirezarezvani/claude-skills)
- the sql-database-assistant skill folder with SKILL.md. Part of a 337-skill / 30-agent / 70-command install.
Customize your output
- Fork the repo and adapt the skill's instructions and references to your workflow.
Example output
Activates automatically when your request matches Sql Database Assistant; chains with the other skills, agents, and commands in the collection.
Best for
Creators, builders, and teams using Claude Code.
SKILL.md preview
---
name: sql-database-assistant
description: Use when writing SQL queries, optimizing database performance, generating migrations, exploring schemas, or working with ORMs such as Prisma, Drizzle, TypeORM, or SQLAlchemy.
version: 1.0.0
category: Development / Engineering
author: AgentVolt
license: proprietary
tags:
- development
- engineering
---
# Sql Database Assistant
Provides a repeatable workflow for hand-written SQL, ORM migrations, and schema exploration so output stays correct and reviewable.
## When to use
… (sign up to view the full skill)More development skills
View all Development skills →Generate
Scaffold code, tests, and boilerplate from a short spec.
Performance Profiler
Systematic performance profiling for Node.js, Python, and Go applications.
Threat Detection
Use when hunting for threats in an environment, analyzing IOCs, or detecting behavioral anomalies in telemetry.
Agent Harness
Turns a domain folder of skills into a bounded agentic loop: compile a goal into a task plan, execute with the domain's tools, verify every task, retry within a budget.