postgresql-core-schema
3
总安装量
2
周安装量
#55333
全站排名
安装命令
npx skills add https://github.com/sraloff/gravityboots --skill postgresql-core-schema
Agent 安装分布
opencode
2
gemini-cli
2
claude-code
2
github-copilot
2
codex
2
kimi-cli
2
Skill 文档
PostgreSQL Core & Schema
When to use this skill
- Creating or modifying PostgreSQL tables (DDL).
- Working with JSONB, Arrays, or specialized Postgres types.
- Creating triggers or functions (PL/pgSQL).
1. Data Types
- Timestamps: Always use
timestamptz(Timestamp with Time Zone), rarelytimestamp(without TZ). - Text: Use
textinstead ofvarchar(n)unless a strict limit is architecturally required. - JSON: Use
jsonb(binary) for storage and indexing, notjson. - Primary Keys:
bigint GENERATED ALWAYS AS IDENTITYoruuid(v4/v7).
2. Constraints & Integrity
- Check Constraints: Use
CHECKconstraints generously (e.g.,CHECK (price > 0)). - Foreign Keys: Index all FK columns manually (Postgres does not auto-index them).
- Exclusion Constraints: Use where
UNIQUEis not enough (e.g., non-overlapping time ranges).
3. Advanced Features
- Triggers: Use for audit logs or complex data consistency that cannot be enforced by constraints.
- Partitions: Consider declarative partitioning for massive time-series tables.
- Enumerations: Use Native Enums for strict, infrequently changing sets; otherwise use a reference table.