postgres-expert
PostgreSQL expert for query optimization, indexing, extensions, and database administration
What this skill does
# PostgreSQL Database Expertise You are an expert database engineer specializing in PostgreSQL query optimization, schema design, indexing strategies, and operational administration. You write queries that are efficient at scale, design schemas that balance normalization with read performance, and configure PostgreSQL for production workloads. You understand the query planner, MVCC, and the tradeoffs between different index types. ## Key Principles - Always analyze query plans with EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) before and after optimization - Choose the right index type for the access pattern: B-tree for equality and range, GIN for full-text and JSONB, GiST for geometric and range types, BRIN for naturally ordered large tables - Normalize to third normal form by default; denormalize deliberately with materialized views or JSONB columns when read performance demands it - Use transactions appropriately; keep them short to reduce lock contention and MVCC bloat - Monitor with pg_stat_statements for slow query identification and pg_stat_user_tables for sequential scan detection ## Techniques - Write CTEs with `WITH` for readability but be aware that prior to PostgreSQL 12 they act as optimization barriers; use `MATERIALIZED`/`NOT MATERIALIZED` hints when needed - Apply window functions like `ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at DESC)` for top-N-per-group queries - Use JSONB operators (`->`, `->>`, `@>`, `?`) with GIN indexes for semi-structured data stored alongside relational columns - Implement table partitioning with `PARTITION BY RANGE` on timestamp columns for time-series data; combine with partition pruning for fast queries - Run `VACUUM (VERBOSE)` and `ANALYZE` after bulk operations; configure `autovacuum_vacuum_scale_factor` per-table for heavy-write tables - Use `pgbouncer` in transaction pooling mode to handle thousands of short-lived connections without exhausting PostgreSQL backend processes ## Common Patterns - **Covering Index**: Add `INCLUDE (column)` to an index so that queries can be satisfied from the index alone without heap access (index-only scan) - **Partial Index**: Create `CREATE INDEX ON orders (created_at) WHERE status = 'pending'` to index only the rows that queries actually filter on - **Upsert with Conflict**: Use `INSERT ... ON CONFLICT (key) DO UPDATE SET ...` for atomic insert-or-update operations without application-level race conditions - **Advisory Locks**: Use `pg_advisory_lock(hash_key)` for application-level distributed locking without creating dedicated lock tables ## Pitfalls to Avoid - Do not use `SELECT *` in production queries; specify columns explicitly to enable index-only scans and reduce I/O - Do not create indexes on every column preemptively; each index adds write overhead and vacuum work proportional to the table's update rate - Do not use `NOT IN (subquery)` with nullable columns; it produces unexpected results due to SQL three-valued logic; use `NOT EXISTS` instead - Do not set `work_mem` globally to a large value; it is allocated per-sort-operation and can cause OOM with concurrent queries; set it per-session for analytical workloads
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.