Curated library of 41 public AI agent skills for Ruby on Rails development. Organized by category: planning, testing, code-quality, ddd, engines, infrastructure, api, patterns, context, and orchestration. Covers code review, architecture, security, testing (RSpec), engines, service objects, DDD patterns, and TDD automation. Repository workflows remain documented in GitHub but are intentionally excluded from the Tessl tile.
95
93%
Does it follow best practices?
Impact
96%
1.77xAverage score across 41 eval scenarios
Passed
No known issues
Orchestrates robust background job implementation with TDD discipline, proper retry/discard strategies, comprehensive failure scenario testing, and production monitoring to ensure reliable async processing.
Objective: Design background job with clear responsibilities and error handling strategy.
Steps:
Job Design Guidelines:
HARD GATE — Job Design Complete:
If gate fails: Job design is incomplete. Clarify requirements before implementation.
Example Job Design:
# Background Job Design: OrderConfirmationEmail
## Purpose
Send order confirmation email when order is completed
## Trigger
Event-based: Order.status transitions to 'completed'
## Input
- order_id (Integer)
- customer_email (String)
- order_total (Float)
## Output
- Email sent via external API
- Order email_sent_at timestamp updated
## Idempotency
- Check if email already sent before sending
- Use unique job key: "order_confirmation_#{order_id}"
- Update email_sent_at only after successful send
## Error Classification
- Transient: Email API timeout (retry with exponential backoff)
- Transient: Rate limit exceeded (retry with longer delay)
- Permanent: Invalid email address (discard with error logging)
- Permanent: Order not found (discard)
- Configuration: Missing API credentials (alert team)
## Queue
default (normal priority)
## Timeout
30 secondsObjective: Implement background job using TDD discipline.
Before implementing job logic:
HARD GATE — Test Verification:
If test fails for wrong reason: Fix test (not implementation) to accurately test job behavior.
Example Job Test:
# spec/jobs/order_confirmation_email_job_spec.rb
RSpec.describe OrderConfirmationEmailJob do
let(:order) { create(:order, :completed) }
it 'sends confirmation email' do
expect(EmailService).to receive(:send_confirmation).with(order.id, order.customer_email, order.total)
described_class.perform_now(order.id, order.customer_email, order.total)
end
it 'is idempotent' do
expect(EmailService).to receive(:send_confirmation).once
described_class.perform_now(order.id, order.customer_email, order.total)
described_class.perform_now(order.id, order.customer_email, order.total)
end
it 'handles email service errors with retry' do
allow(EmailService).to receive(:send_confirmation).and_raise(EmailService::TimeoutError)
expect { described_class.perform_now(order.id, order.customer_email, order.total) }.to raise_error(EmailService::TimeoutError)
end
endExample Job Implementation:
# app/jobs/order_confirmation_email_job.rb
class OrderConfirmationEmailJob < ApplicationJob
queue_as :default
# Retry on transient errors
retry_on EmailService::TimeoutError, wait: :exponentially_longer, attempts: 5
retry_on EmailService::RateLimitError, wait: :exponentially_longer, attempts: 3
# Discard on permanent errors
discard_on ActiveRecord::RecordNotFound
discard_on EmailService::InvalidEmailError
def perform(order_id, customer_email, order_total)
order = Order.find(order_id)
# Idempotency check
return if order.email_sent_at.present?
# Send email
EmailService.send_confirmation(order_id, customer_email, order_total)
# Update timestamp
order.update(email_sent_at: Time.current)
rescue EmailService::TimeoutError, EmailService::RateLimitError => e
Rails.logger.error("Email service error: #{e.message}")
Rails.logger.error(e.backtrace.first(5).join("\n"))
raise # Will trigger retry
rescue ActiveRecord::RecordNotFound, EmailService::InvalidEmailError => e
Rails.logger.warn("Permanent email error: #{e.message}")
# Will trigger discard
end
endObjective: Configure robust retry and discard strategies for production reliability.
Steps:
retry_on for transient errors (network timeouts, rate limits)discard_on for permanent errors (not found, invalid data)Retry Strategy Guidelines:
HARD GATE — Retry Strategy Configured:
If gate fails: Job is not production-ready. Configure retry/discard strategy.
Example Configuration (Solid Queue - Rails 8+):
# config/initializers/solid_queue.rb
Rails.application.config.after_initialize do
SolidQueue.configure do |config|
config.worker = {
processes: 2,
threads: 5,
polling_interval: 1
}
end
end
# config/recurring.yml
order_confirmation_cleanup:
class: OrderConfirmationCleanupJob
schedule: every 1.day
queue: criticalExample Configuration (Sidekiq):
# config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDIS_URL'] }
config.server_middleware do |chain|
chain.add Sidekiq::Throttler, rate: { limit: 100, period: 1.minute }
end
end
# app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base
# Default retry configuration
retry_on StandardError, wait: :exponentially_longer, attempts: 5
endObjective: Test failure scenarios and set up production monitoring.
Steps:
HARD GATE — Failure Scenarios Tested:
If gate fails: Job is not production-ready. Address failure scenarios.
Example Failure Scenario Tests:
# spec/jobs/order_confirmation_email_job_failure_spec.rb
RSpec.describe OrderConfirmationEmailJob, :focus do
let(:order) { create(:order, :completed) }
it 'retries on transient errors' do
allow(EmailService).to receive(:send_confirmation)
.and_raise(EmailService::TimeoutError)
.then_return(true)
expect(EmailService).to receive(:send_confirmation).twice
described_class.perform_now(order.id, order.customer_email, order.total)
end
it 'discards on permanent errors' do
allow(EmailService).to receive(:send_confirmation)
.and_raise(EmailService::InvalidEmailError)
expect(EmailService).to receive(:send_confirmation).once
expect { described_class.perform_now(order.id, "invalid-email", order.total) }.not_to raise_error
end
it 'logs retry attempts' do
allow(EmailService).to receive(:send_confirmation)
.and_raise(EmailService::TimeoutError)
expect(Rails.logger).to receive(:error).with(/Email service error/)
described_class.perform_now(order.id, order.customer_email, order.total)
end
endExample Monitoring Setup:
# app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base
around_perform do |job, block|
start_time = Time.current
block.call
duration = Time.current - start_time
# Track job metrics
StatsD.timing("jobs.#{job.class.name.underscore}.duration", duration)
StatsD.increment("jobs.#{job.class.name.underscore}.success")
rescue StandardError => e
StatsD.increment("jobs.#{job.class.name.underscore}.failure")
raise
end
end| Predecessor | This Workflow | Successor |
|---|---|---|
| implement-background-job | background-job | production-monitoring |
| tdd | background-job | quality |
| None (standalone) | background-job | deployment |
implement-background-jobimplement-background-job firstNEVER deploy background job to production before:
If gate fails: Job is not production-ready. Address issues before deployment.
If job fails repeatedly in production:
If queue backs up:
# Background Job Implementation Report — [Date]
## Job
- **Name:** OrderConfirmationEmailJob
- **Purpose:** Send order confirmation emails
- **Trigger:** Order.status = 'completed'
- **Queue:** default
## Design
- **Idempotency:** ✓ Implemented (email_sent_at check)
- **Error Classification:** ✓ Complete
- **Transient Errors:** Timeout, RateLimit (retry)
- **Permanent Errors:** RecordNotFound, InvalidEmail (discard)
## Implementation
- **Job Tests:** 3/3 passing
- **Idempotency Tests:** ✓ PASS
- **Failure Scenario Tests:** ✓ PASS
- **Total Coverage:** 95%
## Configuration
- **Retry Strategy:** ✓ Configured (exponential backoff, 5 attempts)
- **Discard Strategy:** ✓ Configured (permanent errors)
- **Timeouts:** ✓ Configured (30 seconds)
- **Monitoring:** ✓ Configured (StatsD metrics)
- **Workers:** ✓ Configured (2 processes, 5 threads each)
## Performance
- **Execution Time:** 1.2 seconds (acceptable)
- **Throughput:** 100 jobs/minute
- **Concurrent Jobs:** ✓ Tested (10 concurrent jobs)
- **Load Test:** ✓ PASS
## Status
**PRODUCTION READY** — All failure scenarios tested, monitoring configureddocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
mcp_server
skills
api
generate-api-collection
implement-graphql
code-quality
apply-code-conventions
apply-stack-conventions
assets
snippets
code-review
refactor-code
respond-to-review
review-architecture
security-check
context
load-context
setup-environment
ddd
define-domain-language
model-domain
review-domain-boundaries
engines
create-engine
create-engine-installer
document-engine
extract-engine
release-engine
review-engine
test-engine
upgrade-engine
infrastructure
implement-background-job
implement-hotwire
optimize-performance
review-migration
seed-database
version-api
orchestration
skill-router
patterns
create-service-object
implement-calculator-pattern
write-yard-docs
planning
create-prd
generate-tasks
plan-tickets
testing
plan-tests
test-service
triage-bug
write-tests
workflows