postgres

A guide for working with PostgreSQL, a database system that stores application data in tables. It covers running SQL queries, exploring database schemas, retrieving data, and using parameterized values for safer queries.

In plain words
What is it for?
Use it to inspect tables and schemas, read or change database records, and run SQL queries with separate input values.
Why use it?
It helps agents work with database data without putting user values directly into SQL, which can create SQL-injection security risks. It also provides patterns for understanding the database before querying it.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tallclub/matimo/postgres
Any agent
npx skills add tallclub/matimo --skill postgres
Clone the repo
git clone --depth 1 https://github.com/tallclub/matimo

Made for: Claude Code, Codex.

Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,923 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.01923
Opus 5 $0.00013 $0.00962
Sonnet 5 $0.00005 $0.00385
Haiku 4.5 $0.00003 $0.00192

Measured 2d ago against content hash f1c0559a8d38, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

postgres scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

typescript/packages/postgres/skills/postgres/SKILL.md · 294 lines

How it starts

The opening of the file, as written. The whole thing — 294 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostgreSQL

This skill teaches you how to safely execute SQL queries against a PostgreSQL database using Matimo tools, with emphasis on parameterized queries, schema awareness, and safe patterns.

Tools You Will Use

Tool Purpose
postgres-execute-sql Execute any SQL statement against a connected Postgres database

Executing a Query

Use postgres-execute-sql to run SQL statements. The tool supports parameterized queries for safety.

Parameters

Parameter Type Description
sql string SQL statement to execute. Use $1, $2, etc. for parameterized values
params array Optional array of parameter values (matched by position to $1, $2, etc.)
schema string Optional schema name for table qualification

Critical: Always Use Parameterized Queries

NEVER interpolate user-provided values directly into SQL strings. Always use $1, $2 placeholders.

// ✅ SAFE — parameterized
{
  "sql": "SELECT * FROM users WHERE email = $1",
  "params": ["[email protected]"]
}

// ❌ DANGEROUS — SQL injection risk
{
  "sql": "SELECT * FROM users WHERE email = '[email protected]'"
}

This prevents SQL injection attacks regardless of the input content.


Read Operations

Select with Parameters

{
  "sql": "SELECT id, name, email FROM users WHERE id = $1",
  "params": [42]
}

Select with Multiple Conditions

{
  "sql": "SELECT * FROM orders WHERE status = $1 AND created_at > $2",
  "params": ["pending", "2025-01-01"]
}

Count Records

{
  "sql": "SELECT count(*) as total FROM users WHERE active = $1",
  "params": [true]
}

Pagination Pattern

{
  "sql": "SELECT id, name, email FROM users ORDER BY created_at DESC LIMIT $1 OFFSET $2",
  "params": [20, 0]
}

Increment the offset by the limit for each page: 0, 20, 40, 60...

Join Queries

{
  "sql": "SELECT u.name, o.total, o.status FROM users u JOIN orders o ON u.id = o.user_id WHERE o.status = $1 ORDER BY o.created_at DESC LIMIT $2",
  "params": ["completed", 10]
}

Read the full file on GitHub · 294 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 294 lines · 26 tokens per session scan A f1c0559a8d38

Subscribe to this mod's changes

postgres is a skill published in the GitHub repository tallclub/matimo (11 stars, last pushed 2d ago), licensed MIT. It adds 26 tokens to every session and 1,923 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

safe-sql-execution

Use whenever code will build, return, fetch, or execute SQL that runs against a user's real Postgres database — even when the request reads like an ordinary feature or bug fix and never says "security," "injection," or "SafeSqlFragment." This covers: writing or editing any pg-meta function, query builder, or endpoint…

supabase/supabase · 221 tokens

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens

db-repair

Auto-fix gbrain's Postgres access so the brain stays available. When any gbrain command or MCP tool result carries a GBRAINDBACCESS marker (or an operator reports the brain database is down), run the hardcoded gbrain db-repair ladder: diagnose, apply the safe tier, verify. The action is ALWAYS the hardcoded command …

garrytan/gbrain · 96 tokens

postgres-adopt

Detect which gbrain engine is in use (PGLite vs Postgres), prefer Postgres for agent-harness installs, install/provision Postgres (Supabase discovery via SUPABASEACCESSTOKEN, local Postgres, opt-in Docker), and move an existing PGLite brain with the guarded engine migration. Detection is one engine-free command; the…

garrytan/gbrain · 85 tokens

amazon aurora dsql

Deprecated compatibility redirect for Aurora DSQL guidance. Use when a request concerns DSQL, Aurora DSQL, distributed SQL, DSQL schemas, migrations, queries, authentication, performance, or application development.

awslabs/mcp · 46 tokens

azure-resource-manager-postgresql-dotnet

Azure PostgreSQL Flexible Server SDK for .NET. Database management for PostgreSQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "PostgreSQL", "PostgreSqlFlexibleServer", "PostgreSQL Flexible Server", "Azure Database for…

microsoft/skills · 97 tokens