implement-background-job
Use when adding or reviewing an Active Job / Sidekiq / Solid Queue worker.
Skill by igmarin
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/igmarin-implement-background-job
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/implement-background-job
What's inside
- Skill name
implement-background-job- Description
- Use when adding or reviewing an Active Job / Sidekiq / Solid Queue worker. Cover idempotency, retry_on, and discard_on. Trigger words: background job, Active Job, Sidekiq, Solid Queue, worker.
- License
- MIT
- Metadata
- version: 1.0.0 · user-invocable: true
- Instructions
- 109 lines in SKILL.md · view on GitHub
Files (4)
- BACKENDS.md
- SKILL.md
- job_patterns.md · assets/
- retry_examples.md · assets/
SKILL.md (first lines)
# Implement Background Job
Use this skill when the task is to add, configure, or review background jobs in a Rails application.
## HARD-GATE
```text
EVERY job MUST have its test written and validated BEFORE implementation:
1. Write the job spec (idempotency, retry, error handling)
2. Run the spec — verify it fails
3. ONLY THEN write the job class
The authoritative perform contract — EVERY perform method does exactly three things:
1. Load the record from the passed ID
2. Guard for idempotency / permanent no-op conditions
3. Delegate the side effect or orchestration to a service object
If perform needs more than that, extract a service.
EVERY job that performs a side effect (charge, email, API call) MUST have
an idempotency check BEFORE the side effect.
```
## Core Rules
| Aspect | Rule |
|--------|------|
| Arguments | Pass IDs, not objects |
| Retries | `retry_on` (explicit `attempts:`) for transient; `discard_on` for permanent errors |
| Backend (Rails 8) | Solid Queue (database-backed, no Redis) |
| Backend (Rails 7) | Sidekiq + Redis for high throughput |
| Recurring | `config/recurring.yml` (Solid Queue) or cron/sidekiq-cron |
| Anti-patterns | No ActiveRecord objects as args; no `:inline`/`:async` in production; no business logic in `perform` |
## Core Process
1. Write the job spec first — idempotency, retry, and error handling — and run it to confirm it fails.
2. Write the job class following the perform contract in HARD-GATE.
3. Add `retry_on` with explicit `attempts:` limit and `discard_on` for at least one permanent error.
4. Run the full test suite.
5. Enqueue or perform the job twice — confirm the second run is a no-op.
6. For recurring jobs, define them in `config/recurring.yml` (Rails 8) or the chosen scheduler config.
## Extended Resources
**Rails 8 vs Rails 7**
| Aspect | Rails 7 and earlier | Rails 8 |
|--------|---------------------|---------|
| Default | No default; set `queue_adapter` (often Sidekiq) | **Solid Queue** (database-backed) |
| Dev/test | `:async` or `:inline` | Same |
| Recurring | External (cron, sidekiq-cron) | `config/recurring.yml` |
| Dashboard | Third-party (Sidekiq Web) | **Mission Control Jobs** |
**Examples**
**Thin job with idempotency and retry:**
```ruby
class SendInvoiceReminderJob < ApplicationJob
queue_as :default
retry_on Net::OpenTimeout, wait: :polynomially_longer, attempts: 5
discard_on ActiveRecord::RecordNotFound
def perform(invoice_id)
invoice = Invoice.find(invoice_id)
return if invoice.reminder_sent_at?
InvoiceReminders::Send.call(invoice:)
end
end
```
**Service owns the side effect and state update:**
```ruby
module InvoiceReminders
class Send
def self.call(invoice:)
InvoiceMailer.overdue(invoice).deliver_now
invoice.update!(reminder_sent_at: Time.current)
end
end
end
```
- [BACKENDS.md](./BACKENDS.md) — Solid Queue vs Sidekiq setup, configuration details, and Redis requirements.
Load these files only when their specific content is needed:
- **[assets/job_patterns.md](assets/job_patterns.md)** — Use when implementing multi-step orchestration or batch job patterns
- **[assets/retry_examples.md](assets/retry_examples.md)** — Use when configuring `retry_on`/`discard_on` for specific error classes beyond the basic patterns above
## Output Checklist
- [ ] Backend decision stated (Rails version/scale → Solid Queue or Sidekiq)
- [ ] Job spec shown first; command run; confirms failure before implementation
- [ ] `perform` receives IDs, loads record, guards idempotency, delegates to service
- [ ] `retry_on` with `attempts:` limit and `discard_on` for permanent error
- [ ] Double-run verification confirms second run is a no-op
- [ ] Recurring job (if any) defined in `config/recurring.yml` or scheduler config
- [ ] If ops docs requested: record backend, retry, recurring schedule, and idempotency decisions in `process_log.md`
## Integration
| Skill | When to chain |
|-------|---------------|
| **review-migration** | Solid Queue uses DB tables; add migrations safely |
| **security-check** | Jobs receive serialized input; validate like any entry point |
| **write-tests** | TDD gate: write job spec before implementation; use `perform_enqueued_jobs` |
| **create-service-object** | Keep `perform` thin; call service objects for business logic |From igmarin/rails-agent-skills, MIT.
More from igmarin/rails-agent-skills
- 0.619score
implement-authorization
igmarin
Use when adding or reviewing Rails authorization with Pundit, CanCanCan, or policy objects.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
seed-database
igmarin
Use when choosing seeds, fixtures, or factories for Rails dev/test data.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
version-api
igmarin
Use when versioning a Rails REST API (v1/v2, deprecation, Sunset headers).
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
setup-environment
igmarin
Use when onboarding onto a Rails app: Ruby version, Docker, env, database, test suite.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
create-engine
igmarin
Use when scaffolding a new Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
implement-hotwire
igmarin
Use when adding Turbo Frames, Turbo Streams, or Stimulus controllers.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
extract-engine
igmarin
Use when extracting a host-app feature into a Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
optimize-performance
igmarin
Use when investigating N+1s, slow queries, caching, or query plans in Rails.
SkillAFreshness: A★ 28Claude Code +9 - 0.616score
load-context
igmarin
Use before writing code, specs, or a PRD in an existing Rails app.
SkillAFreshness: A★ 28Claude Code +9 - 0.614score
create-engine-installer
igmarin
Use when writing an install generator for a Rails engine (migrations, config).
SkillAFreshness: A★ 28Claude Code +9 - 0.614score
apply-code-conventions
igmarin
Use when applying daily Rails conventions by path (DRY, YAGNI, PORO, CoC, KISS).
SkillAFreshness: A★ 28Claude Code +9 - 0.614score
implement-graphql
igmarin
Use when building or reviewing a graphql-ruby schema, resolver, or mutation.
SkillAFreshness: A★ 28Claude Code +9
Signals
- Stars
- 28
- Forks
- 8
- Open issues
- 0
- Contributors
- 7
- Last commit (this folder)
- Sep 28, 2026 (1 month ago)
- Last release
- May 16, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- MIT
- Repository
- github.com/igmarin/rails-agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from igmarin
- 0.619score
implement-hotwire
igmarin
Use when adding Turbo Frames, Turbo Streams, or Stimulus controllers.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
optimize-performance
igmarin
Use when investigating N+1s, slow queries, caching, or query plans in Rails.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
extract-engine
igmarin
Use when extracting a host-app feature into a Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
implement-authorization
igmarin
Use when adding or reviewing Rails authorization with Pundit, CanCanCan, or policy objects.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
create-engine
igmarin
Use when scaffolding a new Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
seed-database
igmarin
Use when choosing seeds, fixtures, or factories for Rails dev/test data.
SkillAFreshness: A★ 28Claude Code +9
Cite this page
implement-background-job skill. Agent Mart. https://agentmart.dev/skills/igmarin-implement-background-job (last updated 2026-10-24)