postgres-job-queue

Implement a PostgreSQL job queue with priority scheduling and SKIP LOCKED batch claiming.

11|4|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/wpank/ai --skill postgres-job-queue
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-job-queue
Source: https://github.com/wpank/ai/tree/main/skills/backend/postgres-job-queue
Command: npx skills add https://github.com/wpank/ai --skill postgres-job-queue

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pgx, uuid, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a robust job queueing system using PostgreSQL, eliminating the need for external message brokers like Redis or RabbitMQ for many use cases.

Core Features & Use Cases

  • Priority Scheduling: Jobs can be assigned priorities for ordered execution.
  • Batch Claiming: Safely and concurrently claim multiple jobs using SKIP LOCKED.
  • Progress Tracking: Monitor the progress of long-running jobs.
  • Stale Job Recovery: Automatically reclaims jobs that were not completed due to worker failures.
  • Use Case: You need to process a large number of background tasks, such as sending emails or generating reports, and want a resilient system that leverages your existing PostgreSQL database.

Quick Start

Use the postgres-job-queue skill to claim a batch of jobs of type 'email' for the current worker.

Frequently Asked Questions about postgres-job-queue

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a background job queue in PostgreSQL without Redis?

Build a background job queue in PostgreSQL by creating a dedicated schema with specific functions for job management. This approach eliminates external message brokers, enabling resilient task processing using your existing database infrastructure.

How does SKIP LOCKED work for concurrent task claiming in PostgreSQL?

SKIP LOCKED enables batch claiming of jobs in PostgreSQL by allowing concurrent workers to safely acquire multiple rows without blocking each other. This ensures efficient, parallel task processing across distributed workers.

Can I track the progress of long-running background jobs in a PostgreSQL task queue?

Yes, you can track progress of long-running background jobs in a PostgreSQL task queue. The system provides progress tracking capabilities alongside priority scheduling to monitor and manage task execution status effectively.

What is the best way to recover stale background jobs after a worker failure?

Recover stale background jobs after a worker failure by implementing automatic reclamation logic. This PostgreSQL job queue mechanism automatically detects incomplete tasks and returns them to the pool for execution by active workers.

Do I need external message brokers like RabbitMQ for priority task scheduling?

No, you do not need external message brokers like RabbitMQ for priority task scheduling. PostgreSQL can handle ordered execution natively, allowing you to assign priorities to background jobs directly within your database.