Assists with designing schemas, writing performant queries, managing indexes, and operating PostgreSQL databases. Use when working with JSONB, full-text search, window functions, CTEs, row-level security, replication, or performance tuning. Trigger words: postgresql, postgres, sql, database, jsonb, rls, window functions, cte.
PostgreSQL is an advanced relational database with features that often eliminate the need for separate tools: JSONB for semi-structured data, built-in full-text search, window functions for analytics, recursive CTEs for hierarchical queries, row-level security for multi-tenant isolation, and streaming replication for high availability. It supports partitioning, multiple index types (B-tree, GIN, GiST, BRIN), and connection pooling via PgBouncer.
UUID primary keys with gen_random_uuid(), TIMESTAMP WITH TIME ZONE for all timestamps, appropriate constraints (CHECK, UNIQUE, foreign keys with ON DELETE), and partitioning for time-series data.JSONB for truly dynamic data with GIN indexes for containment queries, but prefer proper columns for known fields since they provide better validation and performance.EXPLAIN ANALYZE output rather than guesswork, use partial indexes for filtered queries, expression indexes for computed values, and covering indexes with INCLUDE for index-only scans.tsvector generated columns with GIN indexes, use ts_rank() for relevance scoring, and choose the appropriate language configuration for stemming.current_setting().pg_stat_statements, run VACUUM ANALYZE after bulk operations, and set up streaming replication with Patroni for high availability.User request: "Set up a PostgreSQL database with row-level security for multi-tenant isolation"
Actions:
tenant_id column and UUID primary keysALTER TABLE ... ENABLE ROW LEVEL SECURITYcurrent_setting('app.tenant_id') for per-request isolationapp.tenant_id per connectionOutput: A multi-tenant database where tenant data is isolated at the database level, preventing cross-tenant data leaks.
User request: "Implement search across articles with relevance ranking and highlighting"
Actions:
search_vector generated column using to_tsvector('english', title || ' ' || body)@@ with plainto_tsquery() and rank results with ts_rank()ts_headline() for highlighting matched terms in resultsOutput: A fast full-text search with relevance ranking, highlighting, and GIN index-backed performance.
UUID primary keys to avoid sequential ID enumeration and merge conflicts.TIMESTAMP WITH TIME ZONE for all timestamps; never use TIMESTAMP which loses timezone context.EXPLAIN ANALYZE output, not guesswork; measure before optimizing.JSONB for truly dynamic data, not as a replacement for proper columns.VACUUM ANALYZE after bulk operations since stale statistics lead to bad query plans.npx skills add TerminalSkills/postgresql下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer