databases

Design and optimize MongoDB and PostgreSQL databases for schema, queries, and performance.

15|27|Updated Dec 4, 2025
One-click install
npx skills add https://github.com/kevinnguyen271090/claudekit-engineering --skill databases-kevinnguyen271090
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: databases
Source: https://github.com/kevinnguyen271090/claudekit-engineering/tree/main/databases
Command: npx skills add https://github.com/kevinnguyen271090/claudekit-engineering --skill databases-kevinnguyen271090

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solves?

This Skill simplifies the complex tasks of managing and optimizing databases like PostgreSQL and MongoDB. It addresses challenges such as slow queries, inefficient administration, and complex data migrations, ensuring data storage is performant, reliable, and well-maintained for backend development and data analysis.

Core Features & Use Cases

  • PostgreSQL Management: Guides on administration, query optimization, performance tuning, and using the psql CLI for PostgreSQL databases.
  • MongoDB Operations: Best practices for CRUD operations, aggregation pipelines, indexing strategies, and managing MongoDB Atlas.
  • Database Utilities: Provides scripts for database backup, migration, and performance checks to maintain health and efficiency.
  • Use Case: A developer needs to optimize a slow query in a PostgreSQL database. This Skill can analyze the query, suggest appropriate indexes, and provide commands for performance monitoring and administration.

Quick Start

Generate a PostgreSQL query to retrieve all users who registered in the last 30 days and have made at least one purchase.

Frequently Asked Questions about databases

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize slow queries in PostgreSQL?

Query optimization in PostgreSQL involves analyzing execution plans, adding strategic indexes on frequently filtered columns, and rewriting queries to reduce table scans. Use EXPLAIN ANALYZE to identify bottlenecks, then create indexes on WHERE clause and JOIN columns, and consider query restructuring for complex operations.

What's the best way to design a MongoDB schema for my application?

MongoDB schema design balances embedding documents for related data against referencing for scalability. Model based on access patterns, denormalize frequently accessed data, use arrays for one-to-many relationships, and normalize when data is updated independently across many documents.

How do I set up replication and backups for production databases?

Production replication creates failover replicas; PostgreSQL uses streaming replication or logical replication, MongoDB uses replica sets. Backups combine automated snapshots with point-in-time recovery. Test restore procedures regularly and maintain separate backup storage to ensure reliability and compliance.

Can I use aggregation pipelines to transform data in MongoDB?

Aggregation pipelines process and transform MongoDB documents through stages like $match, $group, $project, and $sort. They filter data, compute statistics, reshape documents, and perform complex analytics within the database, reducing data transfer and improving performance.

When should I add indexes to improve database performance?

Add indexes on columns used in WHERE clauses, JOIN conditions, ORDER BY, and GROUP BY operations. Monitor query performance with EXPLAIN ANALYZE in PostgreSQL or explain() in MongoDB. Avoid over-indexing, which slows writes; balance read optimization against write overhead based on workload patterns.

How do I migrate data between PostgreSQL and MongoDB?

Data migration requires mapping relational schemas to document models, exporting source data, transforming structure, and validating completeness. Use ETL tools, custom scripts, or database-native utilities. Plan for downtime or dual-write strategies, verify record counts and data integrity, and test rollback procedures.