Borrowing it
Nothing to install: this file belongs to nbari/pg_exporter. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/nbari/pg_exporter/main/.github/copilot-instructions.mdgit clone --depth 1 https://github.com/nbari/pg_exporterWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/nbari/pg_exporter/copilot-instructions)<a href="https://agentmods.dev/instructions/nbari/pg_exporter/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/nbari/pg_exporter/copilot-instructions/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/nbari/pg_exporter/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/nbari/pg_exporter/copilot-instructions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01924 | $0.01924 |
| Opus 5.5 | $0.00770 | $0.00770 |
| Sonnet 5.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 2mo 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.
- 2mo 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 (52 stars, last pushed 13d ago), licensed BSD-3-Clause. It adds 1,924 tokens to every session, about $0.0077 per session on Opus 5.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.
pg_exporter copilot-instructions.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| pg_exporter copilot-instructions.mdnbari/pg_exporter | Instructions file | 52 | 13d ago | BSD-3-Clause | A | 1,924 | GitHub Copilot |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | today | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |