hangfire

hangfire is a skill for Claude Code, Codex from znlgis/opengis-skills. It costs 95 tokens per session (4,195 once invoked), scanned A, original, MIT.

A .NET system for storing and running background jobs outside the main web request. Jobs can run immediately, later, or on a repeating schedule, and their state is saved in a database or other supported store.

In plain words
What is it for?
Use it for email sending, scheduled processing, recurring maintenance, queued work, chained jobs, and monitoring job queues through its dashboard.
Why use it?
It prevents long or scheduled work from blocking web requests and allows jobs to be retried after failures, restarts, deployments, or machine outages.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for email sending, scheduled processing, recurring maintenance, queued work, chained jobs, and monitoring job queues through its dashboard.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/znlgis/opengis-skills/hangfire
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add znlgis/opengis-skills --skill hangfire
Clone the repo
git clone --depth 1 https://github.com/znlgis/opengis-skills

Made for: Claude Code, Codex.

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 hangfire

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/hangfire"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/hangfire.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,195 The whole file, excluding the scripts and references it only reads on demand.
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.00095 $0.04195
Opus 5.5 $0.00038 $0.01678
Sonnet 5.5 $0.00019 $0.00839
Haiku 4.5 $0.00010 $0.00419

Measured 4d ago against content hash c2b099ae52d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

hangfire 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 4d 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.

csharp/hangfire/SKILL.md · 386 lines

How it starts

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

项目地址: https://github.com/HangfireIO/Hangfire

官方文档: https://docs.hangfire.io/

NuGet: Hangfire.Core 1.8.25(核心)、Hangfire.AspNetCore 1.8.25(ASP.NET Core 宿主)

存储/配套: Hangfire.SqlServer 1.8.25、Hangfire.PostgreSql 1.21.1、Hangfire.InMemory 1.0.0、Hangfire.Dashboard.BasicAuthorization 1.0.2(截至 2026-10,NuGet)

目标框架: netstandard2.0 / netcoreapp3.0+ / .NET Framework 4.5.1+(Hangfire.Core 为 netstandard2.0)

许可证: LGPL-3.0

概述

Hangfire 把后台任务持久化到数据库(或内存/Redis),由独立的 worker 池拉取执行。任务在进程重启、部署滚动、机器宕机后仍会重试,这是它与 Task.Run / IHostedService 的本质区别。

  • 三种任务形态:fire-and-forget(Enqueue)、延迟(Schedule)、周期(RecurringJob.AddOrUpdate + Cron)
  • 持久化存储:SQL Server、PostgreSQL、MySQL、Redis、内存等,通过 UseXxxStorage 挂载
  • 自动重试:默认失败后按指数退避重试 10 次,可用 [AutomaticRetry] 覆盖
  • 仪表盘:/hangfire 可视化队列、重试、成功/失败任务与服务器心跳
  • 任务链:ContinueJobWith 串联依赖任务
  • 多实例安全:基于存储的分布式锁,多台服务器/多个容器共享同一存储时任务不会被重复执行
概念 说明
Job 一个待执行的方法调用(序列化后进存储)
Queue 任务队列,默认 default,可自定义并用 [Queue("name")] 指定
Server 执行任务的进程角色,AddHangfireServer() 或 UseHangfireServer() 启动
Storage 任务与状态持久化位置,必须显式配置

安装

方式一:dotnet CLI

# ASP.NET Core 宿主:核心 + 宿主集成
dotnet add package Hangfire.AspNetCore

# 存储实现(任选一个)
dotnet add package Hangfire.SqlServer
dotnet add package Hangfire.PostgreSql

# 本地开发 / 单元测试用内存存储
dotnet add package Hangfire.InMemory

方式二:PackageReference

<ItemGroup>
  <PackageReference Include="Hangfire.AspNetCore" Version="1.8.25" />
  <PackageReference Include="Hangfire.SqlServer" Version="1.8.25" />
  <PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
</ItemGroup>

方式三:包管理器控制台

Install-Package Hangfire.AspNetCore -Version 1.8.25
Install-Package Hangfire.SqlServer -Version 1.8.25

验证安装

dotnet list package | grep -i hangfire

最小可运行验证(控制台,内存存储,无需数据库):

using Hangfire;
using Hangfire.InMemory;

GlobalConfiguration.Configuration.UseInMemoryStorage();

using var server = new BackgroundJobServer();

BackgroundJob.Enqueue(() => Console.WriteLine("job ran: {0}", DateTime.Now));
Console.ReadLine();

Read the full file on GitHub · 386 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. 4d ago First seen · 386 lines · 95 tokens per session scan A c2b099ae52d8

Subscribe to this mod's changes

hangfire is a skill published in the GitHub repository znlgis/opengis-skills (76 stars, last pushed 5d ago), licensed MIT. It adds 95 tokens to every session and 4,195 once invoked, about $0.0004 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-10-28.

Related

Other skills, from other repositories

convex-cron-jobs

Scheduled function patterns for background tasks including interval scheduling, cron expressions, job monitoring, retry strategies, and best practices for long-running tasks.

waynesutton/convexskills · 33 tokens

convex-cron-jobs

Scheduled function patterns for background tasks including interval scheduling, cron expressions, job monitoring, retry strategies, and best practices for long-running tasks.

J-StaR-Films-Studios/VibeCode-Protocol-Suite · 33 tokens

trigger-authoring-tasks

Covers writing backend Trigger.dev tasks with @trigger.dev/sdk: defining task() and schemaTask(), the run function and its ctx, retries, waits, queues and concurrency, idempotency keys, run metadata, logging, triggering other tasks (and the Result shape), scheduled/cron tasks, and the essentials of trigger.config.ts.…

triggerdotdev/trigger.dev · 115 tokens

selecting-vizro-charts

Use this skill when choosing chart types, applying Plotly Express conventions, configuring colors, building KPI cards, or adding tables (AG Grid) to Vizro dashboards. Activate when the user asks which chart fits their data, needs custom chart functions, wants to set colors or palettes, is creating KPI metric cards, or…

mckinsey/vizro · 78 tokens

grpc

Build or review gRPC services and clients in .NET. USE FOR: ASP.NET Core gRPC, protobuf contracts, unary or streaming RPC, gRPC client factory, interceptors, deadlines, cancellation, channel reuse, backend service integration. DO NOT USE FOR: broad browser-facing APIs without gRPC-Web tradeoff review, SignalR realtime…

managedcode/dotnet-skills · 95 tokens

winforms

Build, maintain, or modernize Windows Forms applications with practical guidance on designer-driven UI, event handling, data binding, MVP separation, and migration to modern .NET. USE FOR: working on Windows Forms UI, event-driven workflows, or classic LOB applications; migrating WinForms from .NET Framework to modern…

managedcode/dotnet-skills · 122 tokens