PgQue: Instructions file for Claude Code

CLAUDE.md

PgQue CLAUDE.md is an instructions file for Claude Code from NikolayS/PgQue. It costs 2,536 tokens per session, scanned A, original, Apache-2.0.

A set of project instructions for PgQue, a PostgreSQL-based queue that stores and delivers background tasks. It describes the project’s naming, architecture, SQL stack, and supported managed database services.

In plain words
What is it for?
Use it when developing or reviewing PgQue’s SQL and PL/pgSQL code, installation scripts, queue API, delayed delivery, acknowledgements, or dead-letter queue behavior.
Why use it?
It gives coding agents the project rules and design context needed to make consistent changes without guessing how the queue is structured.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is NikolayS/PgQue's own configuration. It tells Claude Code how to work on PgQue itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything PgQue configures →

About the project

PgQue is a PostgreSQL-based event queue that stores a shared log of events and lets each consumer track its own position. Teams use it to build durable event-driven workflows inside PostgreSQL without a separate queue daemon, on PostgreSQL 14 or later. It is installed from one SQL file and advanced by pg_cron or pg_timetable.

NikolayS/PgQue · 1,873 stars · on GitHub

Reuse

Borrowing it

Nothing to install: this file belongs to NikolayS/PgQue. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/NikolayS/PgQue/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/NikolayS/PgQue

Made for: Claude Code.

Wrote 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.

agentmods badge for PgQue CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/nikolays/pgque/claude-md/github.svg)](https://agentmods.dev/instructions/nikolays/pgque/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/nikolays/pgque/claude-md"><img src="https://agentmods.dev/badge/instructions/nikolays/pgque/claude-md/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.

agentmods 80×15 button for PgQue CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/nikolays/pgque/claude-md"><img src="https://agentmods.dev/badge/instructions/nikolays/pgque/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,536 This file is loaded in full into every session.
When invoked 2,536 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.02536 $0.02536
Opus 5.5 $0.01014 $0.01014
Sonnet 5.5 $0.00507 $0.00507
Haiku 4.5 $0.00254 $0.00254

Measured 1mo ago against content hash 6d3b03c8314d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

PgQue CLAUDE.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 1mo 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.

CLAUDE.md · 214 lines

How it starts

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

CLAUDE.md -- PgQue

Project

PgQue (pgque) -- PgQ Universal Edition. Zero-bloat PostgreSQL queue repackaged from PgQ for managed database environments. Repo: NikolayS/pgque.

Naming Convention

  • pgque -- lowercase for schema, package names, CLI, repo, function prefixes
  • PgQue -- capitalized form for prose, headings, README titles
  • Mirrors PostgreSQL ecosystem convention (pgmq, pg_cron, psycopg)

Architecture

Two-layer design:

  • pgque-core: Productization of PgQ (rename, PG14+ modernization, pg_cron, security hardening, single-file install). Mechanical transformation of ~4,028 lines of proven PL/pgSQL.
  • pgque-api: Modern convenience layer (send/receive/ack/nack, DLQ, delayed delivery). New code (~1,500 lines) that must reduce cleanly to PgQ primitives.

See blueprints/SPECx.md for the full specification. See blueprints/SPEC.md for PgQ internals reference (rotation mechanics, snapshot isolation, batch_event_sql algorithm, dual-filter optimization).

Stack

  • Pure SQL + PL/pgSQL (no extensions, no .control file)
  • Anti-extension design: \i pgque.sql to install
  • Works on RDS, Aurora, Cloud SQL, AlloyDB, Supabase, Neon, Crunchy Bridge
  • Optional pg_cron for automated ticker and maintenance
  • PostgreSQL 14+ required (uses pg_snapshot, xid8)

Style Rules

These rules are the source of truth for agentic engineering in this repo. Agents and AI coding tools must read this file before making changes.

SQL Style

  • Follow the Postgres.AI SQL style guide: https://gitlab.com/postgres-ai/rules/-/blob/main/rules/development__db-sql-style-guide.mdc The rules below restate its core plus pgque-specific additions; on any conflict, this file wins.
  • Prefer C-style /* ... */ block comments for anything spanning 2+ lines; use -- only for single-line comments.
  • Comments state what the code cannot: a constraint, a non-obvious invariant, a concurrency hazard. Per-function headers and inline comments say that in 1-3 lines; do NOT write per-function essays or step-by-step narration alongside the code. One consolidated design-notes block per file (or per section) is encouraged for the bigger picture -- keep it C-style, and it may cite the spec (SPEC section 15).
  • Do NOT cite user-story or requirement IDs (US-13.4, I2, G2) or other spec-process artifacts in code, and do not restate the spec at length. Longer rationale lives in blueprints/ and the specs; a short pointer (SPEC section 15, see blueprints/...) is fine.
  • These style rules govern pgque-authored code only. The inherited PgQ engine (batch/tick/rotation and other repackaged PgQ internals) keeps its original comment style and is never restyled.
  • Collapse single-argument keyword clauses onto one line (select 1, from t, where x = y, into v); expand only multi-argument clauses, one argument per line.
  • Lowercase SQL keywords: select, create function, not SELECT, CREATE FUNCTION
  • snake_case for all identifiers
  • Schema-qualify all internal references: pgque.queue, not just queue
  • Root SQL keywords must be left-aligned within the statement. Do not use decorative vertical indentation like select / from / where shifted by different amounts. This is non-negotiable for generated and source SQL.
  • Put and / or at the start of continuation lines, aligned under the statement's where clause indentation.
  • All SECURITY DEFINER functions MUST include SET search_path = pgque, pg_catalog
  • Use xid8 for transaction ID columns, pg_snapshot for snapshot columns
  • Use modern PG14+ function names: pg_current_xact_id() not txid_current()

Read the full file on GitHub · 214 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. 1mo ago Changed · +5 lines · +59 tokens per session 6d3b03c8314d
  2. 2mo ago First seen · 209 lines · 2,477 tokens per session scan A 61f1a6370018

Subscribe to this mod's changes

PgQue CLAUDE.md is an instructions file published in the GitHub repository NikolayS/PgQue (1,873 stars, last pushed 10d ago), licensed Apache-2.0. It adds 2,536 tokens to every session, about $0.0101 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.

Related

PgQue CLAUDE.md compared with instructions from other repositories

PgQue CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
PgQue CLAUDE.mdNikolayS/PgQueInstructions file1.9k10d agoApache-2.0A2,536Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode