hangfire-job

Generates Hangfire background jobs for ERP modules with recurring, fire-and-forget, and continuation patterns.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/Aurelian1974/ERPEnterprise --skill hangfire-job-aurelian1974
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hangfire-job
Source: https://github.com/Aurelian1974/ERPEnterprise/tree/main/.github/skills/hangfire-job
Command: npx skills add https://github.com/Aurelian1974/ERPEnterprise --skill hangfire-job-aurelian1974

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Implementing reliable background processing in a modular .NET ERP requires consistent patterns for scheduling, retries, idempotency, and registration. This Skill provides ready-to-apply templates for Hangfire jobs so recurring tasks, async processing, and scheduled work follow the same architectural rules across modules. ## Core Features & Use Cases - Recurring Jobs: Register cron-scheduled jobs (daily reports, cleanup, reminders) via RecurringJob.AddOrUpdate inside IModuleInstaller modules. - Fire-and-Forget Jobs: Enqueue jobs from command handlers with IBackgroundJobClient after commit, e.g., generating an invoice PDF after approval. - Production Rules: Enforces async Task signatures, AutomaticRetry attributes, idempotency, structured logging, SQL Server storage with a dedicated hangfire schema, and secured dashboard access. - Use Case: When a user asks to send overdue invoice reminders every morning, generate an InvoiceReminderJob class, register it in the Finance module, and schedule it with Cron.Daily(hour: 8). ## Quick Start Ask the assistant to create a Hangfire recurring job that sends invoice reminder emails daily at 08:00 UTC in the Finance module.

Frequently Asked Questions about hangfire-job

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

FAQPage Schema
How do I create a recurring background job with Hangfire in .NET?▼

Create a scoped job class with an async Task method, register it in DI, then call RecurringJob.AddOrUpdate with a unique job ID, the method expression, and a cron expression such as Cron.Daily(hour: 8). Register recurring jobs after the host is built in Program.cs.

How to trigger a Hangfire fire-and-forget job from a command handler?▼

Inject IBackgroundJobClient into the handler and call Enqueue with an expression like j => j.GenerateAsync(invoiceId, tenantId, CancellationToken.None) after the transaction commits. This keeps the HTTP response unblocked while the job runs asynchronously.

Does Hangfire support SQL Server storage for job persistence?▼

Yes, configure it with UseSqlServerStorage passing your connection string and SqlServerStorageOptions. Recommended settings include a dedicated hangfire schema, sliding invisibility timeout of five minutes, and DisableGlobalLocks enabled.

Why should Hangfire job methods be async Task instead of void?▼

Async void methods cannot be tracked or retried by Hangfire, so failures are silently lost. Job methods must return Task and accept a CancellationToken with a default value so Hangfire can manage cancellation and retries correctly.

How do I make Hangfire jobs idempotent and safe to retry?▼

Design jobs so running them multiple times produces no duplicate effects, such as marking records as processed after handling them. Add AutomaticRetry with explicit attempts and delays, and log individual item errors without aborting the entire job.