Skip to main content
skill CX Codex

pgque-postgres-queue — Claude Code skill: Postgres queue

A skill that walks you through PgQue, a snapshot-based Postgres queue written in pure PL/pgSQL. Useful when events need to move inside the database.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add reason-machines/trending-skills --skill pgque-postgres-queue -a claude-code
Open on GitHub

What pgque-postgres-queue does

PgQue follows the PgQ design: events land in rotating tables and batches close on a tick. There is no row-level locking, since batches are snapshots and tables are cleared with TRUNCATE. Dead tuples do not pile up. Each subscriber gets its own copy of every batch, so fan-out comes for free.

The skill covers the install path: a single SQL file, the pgque_reader, pgque_writer and pgque_admin roles, plus calls like pgque.create_queue, pgque.subscribe, pgque.send, pgque.receive, pgque.ack and pgque.nack. Producer and consumer examples use Python with psycopg2. The lower-level API is there too, including pgque.insert_event and pgque.get_batch_events.

You need Postgres 14+ and a ticker: pg_cron or an external scheduler running pgque.ticker() every second. Skip the ticker and enqueue still works, but no batches appear and consumers stay idle. Delivery takes roughly 1–2 s, which is the trade-off of the snapshot approach.

What it helps with

  • run an event queue inside Postgres without C extensions
  • deliver one event to several services independently
  • stop dead tuples from bloating queue tables
  • write a Python producer and consumer with psycopg2
  • set up retries and dead-letter handling for failed batches

Example prompts for the agent

  • set up PgQue in my database: create the orders queue and an order-processor subscriber
  • show me how to send a new_order event with pgque.send and receive it in the consumer
  • explain when to use pgque.ack versus pgque.nack for a failed order

How to install pgque-postgres-queue

1Skills CLI (Vercel)

npx skills add reason-machines/trending-skills --skill pgque-postgres-queue -a claude-code

2Manually: put the files in place

~/.claude/skills/pgque-postgres-queue/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pgque-postgres-queue/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about pgque-postgres-queue

How do I install pgque-postgres-queue in Claude?

Run npx skills add reason-machines/trending-skills --skill pgque-postgres-queue -a claude-code. The skill lands in ~/.claude/skills/pgque-postgres-queue/SKILL.md.

What does pgque-postgres-queue do?

It guides the agent through setting up and using PgQue, a PL/pgSQL queue built on snapshots and table rotation. It covers installation, roles, the queue API and Python examples.

What does PgQue need to run?

Postgres 14+ and a running ticker: pg_cron or an external scheduler calling pgque.ticker() once a second. Without it, no batches are created.

Similar skills

All skills for Data and databases →

From the same set42

anubis-android-app-manager A skill for building and configuring Anubis, an Android app manager that freezes app groups through Shizuku depending on VPN state. CX Codex +1 427installs huashu-design-html-native Turns a plain-language request into a finished file: prototype, slide deck, animation or infographic in HTML/CSS/JS. No Figma involved. CX Codex +1 426installs cc-design-html-prototyping This skill builds HTML mockups, slide decks, and interactive prototypes. Use it to explore visual directions before implementing an interface. CX Codex +1 423installs lingbot-map-3d-reconstruction A skill for streaming 3D scene reconstruction from images or video: point clouds, camera poses, depth maps. Useful when you need geometry out of a long frame sequence. CX Codex +1 418installs aube-package-manager Guidance for using aube, a Rust-based Node.js package manager, across dependencies, workspaces, CI, and migrations from other package managers. CX Codex +1 392installs create-simulated-aeronautics-mod This skill covers development for Create Simulated, from force-providing blocks to physics contraptions. Use it when building Minecraft planes, airships, or land vehicles. CX Codex +1 391installs permiso-accessibility-permissions A skill for coding agents that shows how to add a guided macOS accessibility permission panel to a Swift app. CX Codex +1 386installs gpt2api-openai-gateway This skill walks your agent through deploying a self-hosted Anthropic-compatible gateway over chatgpt.com and wiring up an account pool. CX Codex +1 378installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor