Blog Post

Microsoft Blog for PostgreSQL
5 MIN READ

Postgres Skills: Give Your AI Agent PostgreSQL Expertise

Aditi_Gupta's avatar
Aditi_Gupta
Icon for Microsoft rankMicrosoft
Sep 15, 2026

Modern application development increasingly relies on AI agents to generate code, configure services, and accelerate delivery. But generic agents often stop at plausible SQL or broad recommendations. They do not reliably inspect the live database, account for PostgreSQL versions and extensions, distinguish self-hosted from managed environments, apply production guardrails, or verify that a change actually works.

That gap matters when database decisions affect security, performance, availability, and customer experience. A syntactically correct query can still create an isolation issue, use an incompatible feature, recommend an unsupported managed-service command, or leave an application with a design that does not scale.

The solution: PostgreSQL Skills

PostgreSQL Skills closes this gap by giving agents the PostgreSQL expertise, live context, execution tools, and validation workflow needed to turn a generic answer into a safe, production-ready outcome that solves the application’s business problem. Its 32 expert sub-skills support PostgreSQL running locally, self-hosted, or on any cloud; Azure Database for PostgreSQL and HorizonDB. The plugin includes postgres-mcp for live database access and Azure CLI integration for managed-service operations. One install works across GitHub Copilot CLI, VS Code, Claude Code, and Codex CLI.

Domain

What you can do

PostgreSQL Anywhere

Build vector search, partition tables, implement row-level security, index JSONB data, and analyze query regressions on local, self-hosted, or cloud deployments

Azure Database for PostgreSQL & HorizonDB

Provision and scale servers, configure HA/DR and PITR, use Entra ID authentication, plan major-version upgrades, and get HorizonDB (Preview) guidance

You do not need to choose a sub-skill or tell the agent which rules apply. The plugin checks your environment and routes each request to the guidance that fits your deployment.

Live database context and PostgreSQL expertise, together

The included postgres-mcp server gives your agent structured access to the database you are using. It can inspect schemas, roles, extensions, and server capabilities, run queries, and apply changes you approve. This grounds the work in live database state instead of assumptions.

The sub-skills guide how the agent uses that access. They define what to check, which rules apply to your deployment, when to ask for confirmation, and how to validate the outcome. Together, postgres-mcp and the sub-skills help the agent move from a generic answer to a change that fits your database and has been verified.

Try it yourself

Choose a host and follow the setup path for your operating system.

  1. Install your host
  2. Add the marketplace and install PostgreSQL Skills

GitHub Copilot CLI

copilot plugin marketplace add microsoft/postgres-skills
copilot plugin install postgres-skills@postgres-skills
copilot plugin list # confirm postgres-skills is active

Claude Code

/plugin marketplace add microsoft/postgres-skills
/plugin install postgres-skills@postgres-skills
/plugin # confirm the plugin appears as installed

Codex CLI

codex plugin marketplace add microsoft/postgres-skills
codex plugin add postgres-skills
codex plugin list # confirm postgres-skills is active

See it work: three developer scenarios

PostgreSQL anywhere: enforce tenant isolation

Prompt: "Add row-level security so each tenant can only access its own data."

A generic agent with SQL access can write a CREATE POLICY statement. But it may not inspect table ownership, BYPASSRLS roles, existing policies, or how your application establishes tenant context. The policy can look correct while still leaving an isolation gap.

With PostgreSQL Skills, the agent inspects the live schema and role model, identifies the tenant key, accounts for owner bypass behavior, and proposes the policy against your actual tables. It asks before enabling RLS, then tests allowed and denied access with representative roles. You get a verified security boundary, not just policy syntax.

PostgreSQL application development: build hybrid search

Prompt: "Add semantic and keyword search to my product catalog."

A generic agent can generate a pgvector query and a full-text search query. It still leaves you to reconcile two result sets, choose compatible indexes, and adapt the example to your schema and PostgreSQL version.

With PostgreSQL Skills, the agent inspects your catalog schema and extension availability, designs the embedding and text-search columns, creates the appropriate indexes, and combines both signals with reciprocal rank fusion. It runs the search against your data and verifies the result before calling the implementation complete.

Azure PostgreSQL: connect an application without passwords or public access

Prompt: "Connect my application to Azure Database for PostgreSQL without passwords or public internet access."

A generic agent with Azure CLI access may provide the right ingredients: Entra authentication, a managed identity, and a private endpoint. It may not check which server is targeted, whether private networking is already configured, how the application identity maps to PostgreSQL, or whether disabling an existing authentication path will break deployed applications.

With PostgreSQL Skills, the agent confirms the Azure connection and discovers the server, subscription, resource group, networking mode, and current authentication configuration. It identifies the application identity, proposes a private and passwordless connection plan, and explains every Azure and PostgreSQL object that will change. It asks before modifying identity, authentication, or network access, validates token-based connectivity, and leaves existing access in place until you confirm it can be removed.

Guardrails for safe execution

Acting on a database is only useful if it is safe on any host. One rule is universal:

  • Every destructive or non-reversible action is confirmed with you first. This applies without exception on self-hosted and Azure deployments.

If you're connected to Azure, three more rules kick in automatically:

  • Azure guidance uses `azure_pg_admin`, never `SUPERUSER`. It never assumes access that the managed service does not grant.
  • No `ALTER SYSTEM` and no OS-level access on Flexible Server. Azure changes go through az ... parameter set, matching how the service actually works.
  • Connection-aware gating. Azure-only guidance loads only after the live connection confirms isAzure: true. It never guesses your environment or applies Azure rules to a database that is not one.

Get started

  • Repo: github.com/microsoft/postgres-skills. Visit the PostgreSQL Skills repository for installation commands, usage examples, and contribution guidance. 
  • Explore the open-source collection of PostgreSQL skills for AI coding agents, including installation commands, usage examples, and contribution guidance.
  • Contribute: Follow CONTRIBUTING.md to add a reference file, register its triggers in the routing table, run the validation checks, and submit a pull request.
  • Feedback: open an issue on the repo with what you tried and what broke

The takeaway: generic agents can produce plausible database code, but solving real application problems requires PostgreSQL expertise, live environment context, production guardrails, and validation. PostgreSQL Skills brings those capabilities together so your agent can move beyond suggesting an answer to delivering a safe, deployment-aware, and verified outcome.

Updated Sep 16, 2026
Version 4.0
No CommentsBe the first to comment