database-patterns

Guide SQL and NoSQL database schema design, indexing, and query optimization.

7|4|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/MadAppGang/magus --skill database-patterns-madappgang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-patterns
Source: https://github.com/MadAppGang/magus/tree/main/plugins/dev/skills/backend/database-patterns
Command: npx skills add https://github.com/MadAppGang/magus --skill database-patterns-madappgang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complexities of designing efficient database schemas, implementing robust data access patterns, writing optimized queries, and managing database migrations and transactions for both SQL and NoSQL databases.

Core Features & Use Cases

  • Schema Design: Provides guidance on normalization, common table structures, and relationship modeling.
  • Indexing Strategies: Details various index types and best practices for performance optimization.
  • Query Patterns: Offers examples for efficient querying, pagination, upserts, and soft deletes.
  • Repository Pattern: Demonstrates interface and implementation for clean data access.
  • Transaction Management: Explains basic transactions, isolation levels, and locking.
  • Migration Management: Outlines migration structure and best practices.
  • NoSQL Patterns: Covers document design and single-table design for DynamoDB.
  • Use Case: When designing a new e-commerce platform, use this Skill to define optimal table structures for products and orders, implement efficient indexing for fast product searches, and set up a transactional system for order processing.

Quick Start

Use the database-patterns skill to generate a SQL schema for a blog with posts, users, and comments.

Frequently Asked Questions about database-patterns

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

FAQPage Schema
What's the best way to design a database schema for a new application?

Database schema design involves normalization, relationship modeling, and common table structures to ensure data integrity. This Skill provides comprehensive guidance on structuring tables efficiently, defining optimal relationships, and generating SQL schemas for applications like blogs or e-commerce platforms.

How do I optimize SQL queries and implement indexing strategies?

Query optimization requires understanding various index types and performance best practices. This Skill details indexing strategies, efficient query patterns, pagination, upserts, and soft deletes to accelerate data retrieval and minimize database load.

How does transaction management handle isolation levels and locking?

Transaction management ensures data consistency through basic transactions, isolation levels, and locking mechanisms. This Skill explains how to set up transactional systems for order processing and maintain robust data access across SQL and NoSQL databases.

Can I use the repository pattern for NoSQL databases like DynamoDB?

The repository pattern works with NoSQL databases by providing a clean data access interface. This Skill demonstrates repository implementations and covers NoSQL patterns including document design and single-table design specifically for DynamoDB.

What are the best practices for database migration management?

Database migration management requires structured migration frameworks and adherence to best practices. This Skill outlines migration structure, connection pooling, and migration strategies to ensure smooth database schema evolution and deployment.