rust-repository

Automate a Rust data access layer with sqlx, PgPool, and retry logic.

1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/gar-ai/mallorn --skill rust-repository
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-repository
Source: https://github.com/gar-ai/mallorn/tree/main/.claude/skills/rust-patterns-repository
Command: npx skills add https://github.com/gar-ai/mallorn --skill rust-repository

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a reusable Rust repository pattern and data access layer using sqlx, PgPool, and transaction/retry primitives, enabling reliable database operations in backend services.

Core Features & Use Cases

  • Repository pattern with typed queries and pool-backed connections.
  • Atomic batch processing with FOR UPDATE SKIP LOCKED to coordinate concurrent workers.
  • Robust retry logic with exponential backoff and jitter to recover from transient errors.
  • Heartbeat-based detection of stale processing and easy reset on startup.
  • Read-only test mode for safe validation and fixtures.

Quick Start

Create a Rust project, wire a PgPool into VideoRepository, and run a sample that claims a batch and updates statuses.

Frequently Asked Questions about rust-repository

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

FAQPage Schema
How do I implement a Rust repository pattern with sqlx for reliable database operations?

A Rust repository pattern with sqlx structures data access around typed queries and a PgPool connection, providing a reusable abstraction layer that standardizes database interactions and ensures reliable state updates across backend services.

How does FOR UPDATE SKIP LOCKED coordinate concurrent workers in Rust batch processing?

FOR UPDATE SKIP LOCKED coordinates concurrent workers by atomically claiming available rows during batch processing, preventing multiple Rust workers from processing the same database records simultaneously while allowing safe parallel execution.

What is the best way to handle sqlx transient errors and retries in Rust backend services?

Handling sqlx transient errors requires robust retry logic with exponential backoff and jitter, allowing Rust backend services to automatically recover from temporary database connection failures without manual intervention.

Can I detect stale processing and reset heartbeat statuses in a Rust postgres pooling setup?

Yes, heartbeat-based staleness detection identifies inactive processing tasks within a Rust postgres pooling setup, enabling automatic resets of stale statuses on startup to maintain reliable state updates and prevent worker lockups.

Does this Rust data access layer support read-only test mode for safe validation?

Yes, the Rust data access layer supports a read-only test mode for safe validation, allowing developers to test typed queries and fixtures against the sqlx PgPool without modifying persistent database state or risking data corruption.