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.
npx agentmods add instructions/nbari/pg_exporter/copilot-instructionsgit clone --depth 1 https://github.com/nbari/pg_exporterWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01924 | $0.01924 |
| Opus 5 | $0.00962 | $0.00962 |
| Sonnet 5 | $0.00385 | $0.00385 |
| Haiku 4.5 | $0.00192 | $0.00192 |
Grade A, and why
pg_exporter copilot-instructions.md 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 3d 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.
How it starts
The opening of the file, as written. The whole thing — 286 lines — stays where its author put it; the contents beside it link to each section on GitHub.
GitHub Copilot Instructions for pg_exporter
Project Overview
This is a PostgreSQL metrics exporter written in Rust. It collects metrics from PostgreSQL and exposes them in Prometheus format. Safety and reliability are paramount - all code must handle edge cases gracefully without panics.
Language & Tooling
- Language: Rust (latest stable)
- Formatting:
cargo fmt --all -- --check - Linting:
cargo clippy --all-targets --all-features -- -D warnings - Testing:
just test(runs clippy, fmt, and all tests) - Build Tool:
justcommand runner (see.justfile)
Critical Safety Rules
1. Always Use try_get() Instead of get()
NEVER use row.get() - it panics on NULL or type mismatches.
// ❌ WRONG - Will panic on NULL
let value: i64 = row.get("column");
// ✅ CORRECT - Safe handling
let value: i64 = row.try_get("column").unwrap_or(0);
2. Always Cast SQL Numeric Columns
PostgreSQL NUMERIC type doesn't directly map to Rust types. Always use explicit casts.
// ❌ WRONG - Type mismatch
SELECT total_time FROM pg_stat_statements
// ✅ CORRECT - Explicit cast
SELECT total_time::double precision FROM pg_stat_statements
SELECT calls::bigint FROM pg_stat_statements
3. Always Check Denominator Before Division
Prevent division by zero in both SQL and Rust.
// ❌ WRONG - Division by zero
let ratio = hits / (hits + misses);
// ✅ CORRECT - Safe division
let total = hits + misses;
let ratio = if total > 0 { hits as f64 / total as f64 } else { 0.0 };
SQL version:
-- ✅ CORRECT
CASE WHEN (shared_blks_hit + shared_blks_read) > 0
THEN shared_blks_hit::double precision / (shared_blks_hit + shared_blks_read)
ELSE 0.0
END as cache_hit_ratio
4. Always Check Extension Availability
Handle missing extensions gracefully with fetch_optional().
// ✅ CORRECT - Check extension exists
let result = sqlx::query("SELECT * FROM pg_stat_statements LIMIT 1")
.fetch_optional(&pool)
.await?;
if result.is_none() {
warn!("pg_stat_statements extension not available");
return Ok(());
}
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.
- 3d ago First seen · 286 lines · 1,924 tokens per session scan A 1e06b0ae31b4
pg_exporter copilot-instructions.md is an instructions file published in the GitHub repository nbari/pg_exporter (49 stars, last pushed 11d ago), licensed BSD-3-Clause. It adds 1,924 tokens to every session, about $0.0096 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.
Other instructions, from other repositories
expense-budget-tracker AGENTS.md
Instructions for kirill-markin/expense-budget-tracker, covering expense-budget-tracker, rules, components, supported clients and key paths.
postgres-skills AGENTS.md
Instructions for neondatabase/postgres-skills, covering agents.md, repository overview, creating a new skill, directory structure and naming conventions.
ai-dba-workbench CLAUDE.md
Claude Code instructions for pgEdge/ai-dba-workbench, covering claude standing instructions, primary agent role, trivial-edit carve-out, project structure and key files.
mcp-database CLAUDE.md
Claude Code instructions for DiegoBulhoes/mcp-database, covering claude.md, commands, architecture, invariants (do not weaken) and adding or changing a tool.
pgbent copilot-instructions.md
Copilot instructions for gregs1104/pgbent: This file exists for GitHub Copilot compatibility. The canonical agent guide is AGENTS.md at the repository root.
pg-toolbelt CLAUDE.md
Claude Code instructions for supabase/pg-toolbelt, a project described as: Postgres migrations made easy.