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.
npx skills add tmj-90/gaffer --skill background-jobsgit clone --depth 1 https://github.com/tmj-90/gafferWrote 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.
[](https://agentmods.dev/skills/tmj-90/gaffer/background-jobs)<a href="https://agentmods.dev/skills/tmj-90/gaffer/background-jobs"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/background-jobs/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.
<a href="https://agentmods.dev/skills/tmj-90/gaffer/background-jobs"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/background-jobs.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00080 | $0.01398 |
| Opus 5.5 | $0.00032 | $0.00559 |
| Sonnet 5.5 | $0.00016 | $0.00280 |
| Haiku 4.5 | $0.00008 | $0.00140 |
Grade A, and why
background-jobs 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 16d 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.
How it starts
The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Add a background job
A background job is a promise the request made and a worker must keep, later, maybe on another machine, maybe twice. Queues deliver at least once: a worker that crashes, times out or pauses past its visibility window gets its job handed to another worker while it may still finish. Design for redelivery, overlap and partial failure first.
Steps
- Use the repo's job system. A queue library (BullMQ, Celery, Sidekiq, River,
Hangfire, Quartz), a database-backed queue or outbox, or the platform queue (SQS,
Pub/Sub). Call
search_lorefor it and its retry defaults; never add a second system for one job. Time-driven work belongs to thescheduled-jobsskill. - Keep the payload small and versioned. Identifiers (
orderId) and a schema version, never whole objects that will be stale when the job runs. Validate the payload at the worker like any untrusted input; an invalid payload is a permanent failure. - Enqueue atomically with the state change. Write the row and the job in one
transaction (a jobs/outbox table in the same database, drained by a relay), or
enqueue only after commit. Enqueue-before-commit creates jobs for rows that rolled
back; enqueue-after-commit without an outbox loses the job if the process dies in
between. An outbox relay either runs as one instance or claims rows with
FOR UPDATE SKIP LOCKED. - Make the handler idempotent. Redelivery is normal. Key the effect on the job id
or a natural key: a unique constraint on the result row, a processed-jobs table
written in the same transaction as the effect, or a conditional update
(
… WHERE status = 'pending'). External side effects (email, webhook, charge) pass an idempotency key or go through a deduplicating ledger (theidempotency-and-retriesskill). - Fence overlapping workers. If the job holds a lease (visibility timeout,
locked_until, a lock row), a paused or slow worker can outlive it while a second worker runs the same job. Heartbeat to extend the lease while working, and make the final write conditional on still owning it, in the same transaction as the job's database effects (UPDATE jobs SET status='done' WHERE id = ? AND lease_token = ?; 0 rows → roll back); a worker whose lease was lost must not commit. Ack or delete the message only after the work commits (acks_late-style), never on receipt. See theconcurrency-and-asyncskill for fencing tokens. - Classify failures and bound retries. Transient (timeouts, connection resets,
502/503/504,429honouringRetry-After, deadlocks and serialization failures): retry with exponential backoff, jitter and a maximum attempt count. Permanent (validation, other 4xx, missing row): fail immediately. After the last attempt, move to a dead-letter queue or afailedstatus with the error, visible and requeueable (theerror-handlingskill). - Set limits deliberately. Per-job timeout shorter than the visibility window or lease; worker concurrency sized to the downstream's capacity; a poison job isolated so it cannot block the queue; graceful shutdown stops taking jobs and finishes or releases in-flight ones before the deadline.
- Instrument it. Log job enqueued/started/succeeded/failed/dead-lettered with the
job id, attempt number and the correlation id from the originating request (the
structured-logging-and-tracingskill); expose queue depth, age of oldest job, and duration metrics. - Test the lifecycle, one test per AC exercising the AC's own behaviour, plus:
- the job is enqueued with the state change and absent when the transaction rolls back;
- the handler run twice with the same job produces one effect;
- two workers claiming concurrently process it once;
- a worker paused past its lease cannot commit after resuming, and a worker killed
mid-job has its job retried and completed once (the paused- and crashed-holder
tests in the
concurrency-and-asyncskill, step 9); - a transient failure retries then succeeds; a permanent failure dead-letters without retrying.
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.
- 16d ago Changed · +32 lines c7a524ec1a4f
- 19d ago First seen · 63 lines · 80 tokens per session scan A c9134284f068
background-jobs is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 80 tokens to every session and 1,398 once invoked, about $0.0003 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-09-28.
Other skills, from other repositories
bulwark-brainstorm
Role-based brainstorming with dual modes: --scoped (sequential Task tool, 5 roles) and --exploratory (Agent Teams peer debate, 4 roles). Use for feasibility assessment and idea validation.
plan-creation
Create structured implementation plans via a 4-role scrum team (Product Owner, Architect, Eng/Delivery Lead, QA/Critic) with optional Agent Teams peer debate mode.
anthropic-validator
Validates Claude Code assets (skills, hooks, agents, commands, MCP servers, plugins) against official Anthropic standards. Fetches latest docs dynamically and produces structured validation reports.
create-subagent
Generates single-purpose Claude Code sub-agents for use via the Task tool. Use when creating dedicated sub-agents, scaffolding agent definitions, or generating agents with diagnostics and permissions setup.
test-audit
Audit test suites for T1-T4 violations using AST analysis, mock detection, and multi-stage synthesis. Invoke when user asks to audit tests, check test quality, find mock violations, review test effectiveness, or inspect test suites for over-mocking. Triggers automatic rewrites when quality gates fail.
code-review
Comprehensive code review with distinct aspect based sections. Use when reviewing code, checking for security issues, finding type safety problems, auditing code quality, or when user asks to review code, PRs or changes. Three-phase workflow runs static tools, LLM judgment, and writes diagnostic log.