πŸͺ

microsoft/postgres-skills

πŸͺMarketplace

Agent skills and plugins for PostgreSQL β€” vendor-agnostic best practices plus Azure-specific patterns that AI coding agents can't learn from training data

microsoft/postgres-skills01 PluginsLast Updated Nov 4, 2026

Add this Marketplace

Add marketplace in Claude Code:
$/plugin marketplace add microsoft/postgres-skills

Then open /plugin in Claude Code to pick and install its plugins.

Plugins in this Marketplace1

Postgres Skills

License: MIT Platforms: 3

Postgres Skills is a plugin for Claude Code, GitHub Copilot CLI, and Codex CLI that equips your AI coding agent with PostgreSQL guidance and database tools. Use it to build, troubleshoot, and operate PostgreSQL across local, self-hosted, and cloud environments, including Azure Database for PostgreSQL and Azure HorizonDB.

It bundles two skills with 33 reference guides and a local PostgreSQL MCP server. It is not a PostgreSQL extension, database service, or standalone AI assistant. You bring a supported agent and choose which database it can access.

Get started Β· How it works Β· Examples Β· Full catalog

Is this for me?

Who it's for

  • Application developers building PostgreSQL-backed apps, schemas, and queries.
  • DBAs and platform engineers investigating performance and managing database operations.
  • AI application developers building vector search, retrieval-augmented generation (RAG), and knowledge graphs.

Workloads it's useful for

Your taskHow the plugin helps
Diagnose a slow queryInspect the live schema and query plan, then propose a targeted change.
Choose indexes or partitioningMatch the design to your queries, data, and PostgreSQL version.
Build search and AI featuresGuide vector indexing, hybrid retrieval, and RAG implementation.
Add tenant isolationDesign row-level security policies around your tenancy model.
Investigate connection or service issuesCheck the selected environment and follow the relevant PostgreSQL or Azure workflow.
Build a knowledge graphPropose an ontology for review, load it into Apache AGE, and query relationships with openCypher.

What you're probably doing today instead

You may already use an AI agent and database tools. This plugin adds PostgreSQL-specific instructions and references to that workflow.

Today's frictionWhat Postgres Skills adds
Copying schema and settings into promptsInstructions to inspect the selected database and ground recommendations in its context.
Checking generated SQL against documentationVersion-aware guidance and common PostgreSQL pitfalls.
Translating self-hosted commands into managed-service operationsSeparate generic, Azure Database for PostgreSQL, and HorizonDB guidance.
Switching between advice, SQL tools, and cloud commandsA shared agent workflow using PostgreSQL MCP tools and, for Azure operations, the Azure CLI.

Get started

Already have Claude Code, GitHub Copilot CLI, or Codex CLI? You also need Node.js LTS with npx available to launch the MCP server. If you're starting from scratch, follow the first-time setup guide.

  1. Install the plugin from your terminal for the agent you use:

    AgentInstallation commands
    Claude Codeclaude plugin marketplace add microsoft/postgres-skillsclaude plugin install postgres-skills@postgres-skills
    GitHub Copilot CLIcopilot plugin marketplace add microsoft/postgres-skillscopilot plugin install postgres-skills@postgres-skills
    Codex CLIcodex plugin marketplace add microsoft/postgres-skillscodex plugin add postgres-skills@postgres-skills
  2. Start a new agent session so it can load the plugin's skills and MCP tools. Review any tool-access prompts before allowing access.

  3. Connect read-only and try an inspection task:

    Help me connect to my PostgreSQL database using a read-only profile.
    Then show my table names and approximate sizes without reading application rows.
    

    Have your host, port, database name, and user name ready. Enter the password only in the hidden password prompt, never in chat. See the connection setup and data-access disclosure before connecting a sensitive or production database.

Skills only, without database tools

Use skills.sh if you want the guidance without the bundled MCP server:

npx skills add microsoft/postgres-skills --full-depth

Choose postgresql-best-practices, pg-graph, or both. This does not install the PostgreSQL MCP server or establish a database connection. For live database work, use the full plugin above or configure your own compatible tools.

npx skills add microsoft/postgres-skills --skill postgresql-best-practices --full-depth
npx skills add microsoft/postgres-skills --skill pg-graph --full-depth

How it works

The AI agent reads skill instructions and chooses tools. The skills themselves do not execute SQL or run a background service.

ComponentRole
Your AI agentInterprets your request, loads relevant guidance, and invokes available tools.
Two skillspostgresql-best-practices routes PostgreSQL and Azure questions to reference guides. pg-graph covers ontology design, graph construction, and openCypher queries.
PostgreSQL MCP serverRuns locally through npx and sends queries and approved changes to the database you select. MCP stands for Model Context Protocol, the interface between the agent and its tools.
Azure CLI, optionalHandles Azure resource operations after you install it and authenticate. It is not required for generic PostgreSQL work and the plugin does not install it.
flowchart LR
    User[Your request] --> Agent[AI coding agent]
    Skills[Skill instructions and references] --> Agent
    Agent --> MCP[Local PostgreSQL MCP server]
    MCP <--> DB[Selected PostgreSQL database]
    Agent --> CLI[Azure CLI, optional]
    CLI --> Azure[Azure resource management]

For example, ask: "My query went from 200ms to 8 seconds after deployment."

  1. The agent loads query-performance guidance and checks the selected connection.
  2. It inspects the relevant schema, settings, and query plan with read-only tools.
  3. It explains the evidence and proposes a change, including the target and impact.
  4. The skills instruct it to request approval before a write. After an approved change, it checks the result and reports any remaining uncertainty.

Available operations depend on your database permissions, extensions, service features, and agent tool-access settings. The plugin does not grant privileges.

What changes in your architecture

The plugin extends your development tools, not your application's request path. Your app can keep its existing database driver, schema, and deployment architecture. Installing the plugin configures a local MCP process; it does not install PostgreSQL extensions or change database objects. Particular tasks may require separately approved extensions, such as vector for vector search or age for graph work.

When not to use it

  • You need an application database driver or production chatbot backend. This is an agent plugin, not an application runtime or ready-made end-user chat service.
  • You need unattended database administration or guaranteed fixes. Keep monitoring, incident response, and human review in place.
  • You need versioned schema deployment. Keep your migration framework and CI/CD process; review agent-generated changes through your normal workflow.
  • Your policies prohibit sending database metadata or results to an AI provider. Use skills-only guidance with approved, non-sensitive context instead.
  • You only need to run a known SQL statement. Your existing SQL client may be enough.

Security, permissions, and privacy

Your agent launches the plugin's configured @microsoft/postgres-mcp locally through npx. The MCP server can access the database selected by the user and has the permissions of that PostgreSQL role. Query results and diagnostics returned by the server become part of the user's AI-assistant interaction.

Use a dedicated, least-privilege role and a read-only connection profile for exploration. The skills instruct the agent to request explicit confirmation before database writes, CSV imports, graph writes, or Azure resource changes. These are agent instructions, not a database-enforced approval system. Enforce access through PostgreSQL roles, connection access modes, and your agent's tool permissions; do not enable blanket approval for write tools. The skills also instruct the agent to treat database content as untrusted data and retrieve only what the task needs.

The bundled MCP configuration disables postgres-mcp telemetry and does not transmit database content to Microsoft for plugin telemetry. Package installation requires access to the npm registry, and Azure workflows may use the Azure CLI to communicate with Azure after the user authenticates. See the plugin setup and data-access disclosure before connecting a sensitive or production database.

Real-world examples

Try askingAgent workflow
"My query went from 200ms to 8 seconds after deployment."Inspect the plan and schema, explain likely causes, and propose a change for review.
"Set up vector search for my product catalog."Check extensions and indexing options for your environment, then request approval before applying changes.
"Turn my documents into a knowledge graph."Sample approved data, propose an ontology for review, and load the graph only after confirmation.

PostgreSQL anywhere

"What tables do I have, and which are the biggest?" β†’ Introspects your live schema and reports tables, row estimates, and sizes.

"Set up vector search for my product catalog" β†’ Selects the right vector index for your environment and applies the extension and index after you confirm.

"My query went from 200ms to 8 seconds after deployment" β†’ Analyzes the live execution plan and buffer usage to identify the regression.

"Add multi-tenant isolation to these tables" β†’ Designs row-level security policies for your tenancy model and applies them after confirmation.

"Partition my 500M-row events table by month" β†’ Designs the partition layout, checks pruning requirements, and applies the DDL with confirmation.

"Index my JSONB documents for containment queries" β†’ Examines the query pattern and proposes the appropriate GIN index for approval.

Azure Database for PostgreSQL and HorizonDB

"Batch-embed 1 million rows using SQL" β†’ After approval, uses azure_ai SQL functions to call the configured model service in batches while respecting service limits. This can send source text to the model provider and incur inference charges.

"Provision a General Purpose server and scale it to 8 vCores" β†’ Selects the right Azure resources and provisions or scales the server after confirmation.

"Change work_mem on my Azure server" β†’ Clarifies server-wide vs per-database scope, validates the current configuration, and safely applies the parameter change.

"Set up zone-redundant HA and add a read replica" β†’ Configures high availability and a read replica with the required topology and safety checks.

"Roll my database back to 2pm yesterday" β†’ Validates the restore window and creates a point-in-time restored server after confirming the target time.

"I accidentally deleted my server yesterday β€” get it back" β†’ Finds the delete event in the activity log and, after confirmation, revives the server from its retained backup within the 5-day window.

"I can't connect β€” 'SSL connection is required'" β†’ Diagnoses firewall, private endpoint, VNet, DNS, and certificate configuration.

"Add passwordless Entra ID authentication to my app" β†’ Generates the application connection code and managed-identity configuration.

"Upgrade my server from PG13 to PG16" β†’ Validates extension and application compatibility and performs the required pre-check before the upgrade.

"Create an Azure HorizonDB cluster and enable pgvector" β†’ Recognizes the HorizonDB environment and uses cluster and parameter-group guidance instead of applying Flexible Server workflows.

Graph workloads with Apache AGE

"Turn my documents into a knowledge graph" β†’ Samples your data, proposes node labels, edge types, and properties for review, then safely MERGE-loads the approved graph into Apache AGE.

"Generate an ontology from my existing tables" β†’ Reads your schema and foreign keys and proposes tables as node labels and relationships as edges for review before anything is built.

"Answer this by traversing my graph" β†’ Introspects the graph schema, then generates and runs a validated openCypher query.

"Visualize my graph in VS Code" β†’ Returns complete vertices and edges with display labels for the PostgreSQL extension for VS Code graph viewer. Visualization requires that extension separately.

"Why did the graph recommend this?" β†’ Returns the reasoning path, provenance, and confidence bounded by the weakest supporting edge.

Sub-skill Catalog

The plugin contains two installable skills and 33 reference guides, grouped below. "Sub-skills" refers to those guides, not 33 separate plugins.

PostgreSQL Foundational (11 sub-skills)

These sub-skills work with any PostgreSQL deployment β€” self-hosted, RDS, Cloud SQL, Azure, or local.

Sub-skillHelps you withWhat the agent learns that LLMs get wrong
postgresql-vector-searchpgvector setup, HNSW indexes, distance operatorsIndex type selection, recall tuning, operator/index mismatch
postgresql-genai-ragRAG pipelines, hybrid search, chunkingRRF scoring, dimension mismatch, FTS + vector combination
postgresql-extensionsExtension install/upgrade, troubleshootingshared_preload_libraries restart requirement, version compatibility
postgresql-advanced-indexingB-tree, GIN, GiST, BRIN, partial indexesCovering indexes, index-only scan prerequisites, deduplication (PG13+)
postgresql-jsonb-patternsJSONB operators, indexing, query patternsjsonb_path_query (PG12+), GIN trigram anti-patterns, containment vs existence
postgresql-table-partitioningRange/list/hash partitioningPartition pruning failures, default partition traps, PG14+ DETACH CONCURRENTLY
postgresql-row-level-securityMulti-tenant RLS policiesPolicy stacking, leaky view anti-patterns, performance with 1000+ tenants
postgresql-full-text-searchtsvector, tsquery, rankingPhrase search (PG9.6+), custom dictionaries, weighted ranking
postgresql-connection-managementPooling, timeouts, connection lifecyclework_mem multiplication in pools, prepared statement mode traps
postgresql-replicationPublications, subscriptions, CDCRow filter (PG15+), conflict resolution, initial data sync strategies
postgresql-query-performanceEXPLAIN analysis, vacuum, statisticsJIT thresholds, parallel query pitfalls, vacuum/bloat tuning

Azure Database for PostgreSQL (12 sub-skills)

These sub-skills are gated by the connection capability check. They cover managed-service workflows, Azure AI integrations, and platform-specific safety guardrails.

Each Azure reference also includes an On Azure HorizonDB section. For a HorizonDB connection (*.horizondb.azure.com), the skills direct the agent to cluster, az horizondb, and parameter-group guidance instead of Flexible Server commands. Feature availability differs by service and deployment; verify it before acting. See Azure HorizonDB.

Sub-skillHelps you withWhat the agent learns that LLMs get wrong
azure-postgresql-vector-diskannDiskANN for billion-scale vector searchlists vs m/ef_construction tuning, DiskANN is Azure-only
azure-postgresql-genai-patternsSQL-driven embeddings and RAG with azure_aiExternal model calls, batch processing limits, rate limit handling, Path A vs B decision
azure-postgresql-azure-aiazure_ai extension setup, AI functionscreate() vs create_embeddings(), managed identity config
azure-postgresql-intelligent-tuningQuery Store, index recommendationsQuery Store must be enabled first, pg_qs.query_capture_mode
azure-postgresql-entra-id-authPasswordless auth with Entra IDToken refresh before 5-min expiry, managed identity setup
azure-postgresql-connection-poolingBuilt-in PgBouncer configurationPrepared statements break in transaction mode
azure-postgresql-ha-disaster-recoveryZone-redundant HA, PITR, geo-replicasForced vs planned failover, PITR creates NEW server
azure-postgresql-restore-deleted-serverRecovering a deleted server, delete locks5-day window, ReviveDropped via az rest (no az postgres flexible-server subcommand), same subscription/region, HorizonDB clusters unrecoverable
azure-postgresql-networking-sslPrivate endpoints, VNet, SSLVNet chosen at creation (can't change), DigiCert G2 cert
azure-postgresql-provisioningIaC, SKU selection, scalingBurstable limits, storage can't shrink, IOPS scaling
azure-postgresql-extension-lifecycleExtension allowlisting on Azureazure.extensions param, azure_pg_admin role requirement
azure-postgresql-upgrades-maintenanceMajor version upgrades, maintenanceMVU is one-way, no skip-version, --validate-only pre-check

Graph on PostgreSQL β€” Apache AGE (pg-graph, 10 sub-skills)

The pg-graph skill is the single home for graph work on PostgreSQL, covering the full lifecycle: derive an ontology from your data (with a human feedback loop), build the graph, and query it with openCypher, natural-language-to-Cypher, and graph-augmented retrieval. It uses only capabilities available today β€” agent-driven extraction over the MCP query tools (any PostgreSQL with AGE) or the azure_ai extension for in-database work at scale on Azure.

Sub-skillHelps you withWhat the agent learns that LLMs get wrong
ontology-derivationDeriving a graph ontology from structured or unstructured data with a human feedback loopNever finalize an ontology without user approval; agent-driven vs azure_ai modes; no unreleased ai.* primitives
extract-to-graphExtracting, deduplicating, and MERGE-loading entities into AGE from a finalized ontologyIdempotent MERGE on stable business keys to avoid duplicate vertices across repeated extraction
context-dedupEntity resolution and canonicalization of aliasesBlocking for scale, persistent canonical map, resolving via type + graph neighborhood + source snippet
opencypher-age-patternsAGE setup, Cypher wrapping, MATCH/MERGE/CREATE, indexing vertices and edgesCypher must be wrapped in ag_catalog.cypher(...) with a column definition list; search_path ordering
text-to-cypherTurning a natural-language question into a validated openCypher queryGround on schema first, agtype casting, no host bind parameters inside $$...$$; return full objects + disp_label for VS Code graph visualization
graph-schema-introspectionDiscovering labels, edge types, and propertiesUse the ag_label catalog so generated Cypher is grounded, not hallucinated
graph-augmented-ragRetrieval combining vector similarity with graph traversal and rerankingHybrid graph retrieval that goes beyond flat vector search
graph-explainabilityProvenance, reasoning paths, and explainable recommendationsConfidence bounded by the weakest edge on the path; reproducible reasoning trace
azure-ai-semantic-searchEnabling and configuring azure_ai and generating embeddings for semantic searchRead current settings and ask for endpoint/key/deployment β€” never invent them
examplesEnd-to-end worked graph examples spanning schema, query, and resultsGrounded in the wrapping and safety rules from the other pg-graph sub-skills

Contributing

See CONTRIBUTING.md for guidelines on adding or improving skills and sub-skills.

License

MIT

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.