ck:databases

Design schemas and write optimized queries for MongoDB and PostgreSQL.

1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/quanganh208/cookmate --skill ck-databases-quanganh208
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ck:databases
Source: https://github.com/quanganh208/cookmate/tree/main/.opencode/skills/databases
Command: npx skills add https://github.com/quanganh208/cookmate --skill ck-databases-quanganh208

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pymongo, psycopg2, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Helps teams and engineers design reliable database schemas and write efficient queries for both document (MongoDB) and relational (PostgreSQL) systems, reducing costly design mistakes and performance regressions.

Core Features & Use Cases

  • Schema design (OLTP & OLAP): guidance for normalized transactional schemas and star-schema analytics models, naming conventions, surrogate keys, and SCD strategies.
  • Query authoring & optimization: SQL, CTEs, window functions, EXPLAIN analysis, and MongoDB aggregation pipelines with index recommendations.
  • Migrations, backups & operations: generate/apply migrations, produce rollbackable DDL, backup/restore utilities, and scripts for performance checks and verification.
  • Use Case: build or extend a recipes platform schema, generate PostgreSQL DDL, propose indexes for main query patterns, and supply MongoDB pipelines for analytics.

Quick Start

Design a normalized PostgreSQL schema for users, recipes, and ingredients, produce the DDL with indexes and a migration file, and provide equivalent MongoDB aggregation pipelines for analytics.

Frequently Asked Questions about ck:databases

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

FAQPage Schema
How do I design a normalized PostgreSQL schema and generate rollbackable migrations?

PostgreSQL schema design involves creating normalized transactional structures with surrogate keys, then generating DDL and rollbackable migration files. This process produces indexed tables and rollback scripts to apply and revert schema changes safely.

What's the best way to optimize MongoDB aggregation pipelines for analytics?

Optimizing MongoDB aggregation pipelines requires analyzing query patterns to propose targeted indexes and efficient pipeline stages. This yields faster analytics queries by reducing document scans and leveraging early filtering and index utilization.

How do I use EXPLAIN analysis to tune PostgreSQL query performance?

PostgreSQL EXPLAIN analysis tunes query performance by examining execution plans to identify sequential scans and inefficient joins. This produces index recommendations and rewritten queries using CTEs or window functions to reduce execution time.

Can I generate backup and restore scripts with verification for both MongoDB and PostgreSQL?

Yes, backup and restore scripts with verification can be generated for both MongoDB and PostgreSQL. This creates automated backup utilities and validation scripts to ensure data integrity before and after restoration operations.

How do I implement star-schema OLAP models and SCD strategies in PostgreSQL?

Implementing star-schema OLAP models in PostgreSQL requires designing fact and dimension tables with Slowly Changing Dimension strategies. This produces analytics-optimized schemas that support historical tracking and efficient aggregations.