database-specialist
Database Specialist
Expert in database engineering, focusing on PostgreSQL, data modeling, complex SQL queries, and performance optimization.
When to Use This Skill
- Designing database schemas (ERD)
- Writing complex SQL queries (CTEs, Window Functions)
- Optimizing slow queries (EXPLAIN ANALYZE)
- Managing database migrations
- Implementing advanced data patterns (Recursive queries, JSONB)
Core Competencies
1. Advanced SQL Methodology
CTEs (Common Table Expressions) Use for readability over nested subqueries.
WITH regional_sales AS (
SELECT region, SUM(amount) as total_sales
FROM orders
GROUP BY region
), top_regions AS (
SELECT region
FROM regional_sales
WHERE total_sales > (SELECT AVG(total_sales) FROM regional_sales)
)
SELECT * FROM top_regions;
Window Functions Use for analytics across rows.
SELECT
product_name,
group_name,
price,
RANK() OVER (PARTITION BY group_name ORDER BY price DESC)
FROM products;
2. Performance & Indexing
The Indexing Strategy
- B-Tree: Default. Good for
=, inequalities, and sorting. - GIN: For JSONB and Full-Text Search.
- GiST: For Geometric data and Range types.
- Partial Index:
CREATE INDEX ... WHERE active = true;(Saves space).
Query Analysis
Always check EXPLAIN (ANALYZE, BUFFERS).
- Seq Scan: Bad for large tables.
- Index Scan: Good.
- Bitmap Heap Scan: Good for combining multiple indexes.
3. Data Integrity
- Foreign Keys: Always enforce relationships.
- Constraints:
CHECK (price > 0),UNIQUE (email). - Transactions: Use
BEGIN; ... COMMIT;for atomic operations.- Isolation Levels: Understand
READ COMMITTEDvsSERIALIZABLE.
- Isolation Levels: Understand
Best Practices
- Never store logic in DB: Keep business logic in app code (mostly), unless it's strictly data validation.
- Migrations: Always use versioned migrations (e.g., Prisma, Flyway).
- Normalize execution: Don't N+1. Batch queries or use joins.
Resources
More from mileycy516-stack/skills
trading-psychology-coach
High-performance mental coach for traders. implementation of "Mental Hand History", A-Game/C-Game mapping, and probabilistic thinking protocols. Use PROACTIVELY to analyze behavior, reduce tilt, and optimize the Human OS.
52frontend-developer
Build React components, implement responsive layouts, and handle client-side state management. Masters React 19, Next.js 15, and modern frontend architecture. Optimizes performance and ensures accessibility.
9vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
6context-manager
Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects.
4design-system-architect
Master design system architecture to create consistent, maintainable, and scalable UI foundations. Establish design tokens, theming hierarchies, type scales, and brand identity codes.
4backend-architect
Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks.
4