postgres-schema-design

Designs PostgreSQL schemas for SQLModel-driven apps with JSONB indexing and FK constraints.

Updated Feb 3, 2026
One-click install
npx skills add https://github.com/ThaiG2Pro/ai-agent-sale-v1 --skill postgres-schema-design-thaig2pro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-schema-design
Source: https://github.com/ThaiG2Pro/ai-agent-sale-v1/tree/main/.gemini/skills/postgres-schema-design
Command: npx skills add https://github.com/ThaiG2Pro/ai-agent-sale-v1 --skill postgres-schema-design-thaig2pro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps engineers design robust PostgreSQL schemas for SQLModel-based applications by providing guidance on data-type selection, manual indexing strategies, JSONB usage, and constraints.

Core Features & Use Cases

  • Guidance on selecting appropriate PostgreSQL data types (BIGINT GENERATED ALWAYS AS IDENTITY, TEXT versus VARCHAR, NUMERIC, TIMESTAMPTZ) and when to apply JSONB with GIN indexes.
  • Manual indexing recommendations for foreign keys and frequently queried columns, plus design patterns for CHECK and UNIQUE constraints.
  • Clear scope boundaries: schema design only, not queries, async patterns, or pgvector setup; promotes consistent, maintainable schemas across teams.

Quick Start

Follow these guidelines to design PostgreSQL schemas for SQLModel-powered projects, focusing on data types, indexing, JSONB usage, and constraints.

Frequently Asked Questions about postgres-schema-design

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

FAQPage Schema
How do I design a PostgreSQL schema for a SQLModel application?

Design PostgreSQL schemas for SQLModel applications by selecting appropriate data types, creating manual indexes on foreign keys, and implementing JSONB structures with proper constraints to ensure robust data models.

When should I use JSONB with GIN indexes in PostgreSQL schema design?

Use JSONB with GIN indexes in PostgreSQL schema design when you need to store and query flexible, unstructured data while maintaining efficient lookup performance and applying necessary constraints.

What are the best practices for foreign key indexing and constraints in PostgreSQL?

Best practices for foreign key indexing in PostgreSQL involve creating manual indexes on frequently queried columns and foreign keys, combined with safe FK constraints and CHECK or UNIQUE constraints for data integrity.

Does this PostgreSQL schema design guidance cover query optimization or async patterns?

No, the PostgreSQL schema design guidance explicitly excludes query optimization, async patterns, and pgvector setup, focusing strictly on data types, indexing, JSONB usage, and constraints.

Why should I use TIMESTAMPTZ and BIGINT GENERATED ALWAYS AS IDENTITY in PostgreSQL?

Use TIMESTAMPTZ and BIGINT GENERATED ALWAYS AS IDENTITY in PostgreSQL to enforce technical requirements for robust data models, ensuring proper numeric precision and timezone-aware timestamp tracking.

How do I choose between TEXT and VARCHAR or manage numeric precision in PostgreSQL?

Choose between TEXT and VARCHAR and manage numeric precision in PostgreSQL by following schema design guidance that enforces strict technical requirements for data type selection and maintainable models.