[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B1DAE9C268R55AS8YQD0WM":3,"skill-same:01M7B1DAE9C268R55AS8YQD0WM":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7B1DAE9C268R55AS8YQD0WM","job-patterns",null,"Implements shallow background jobs with _later\u002F_now conventions using Solid Queue. Use when adding background processing, async operations, scheduled tasks, or when user mentions jobs, queues, workers, or background processing. WHEN NOT: Business logic implementation (use model-patterns), controller work (use crud-patterns), or mailer delivery (use mailer-patterns).","dbillion\u002Fhermes-skills-public","dbillion","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F49393855?v=4","01M7AVH8QPGCM8WKWS22TRT0T6","Oludayo Adeoye","01M7AVH8RD1JJWA0YS9CFEWAV9",0,"MIT","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Frails-ai-agents\u002F.claude_37signals\u002Fskills\u002Fjob-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: job-patterns\ndescription: >-\n  Implements shallow background jobs with _later\u002F_now conventions using Solid\n  Queue. Use when adding background processing, async operations, scheduled\n  tasks, or when user mentions jobs, queues, workers, or background processing.\n  WHEN NOT: Business logic implementation (use model-patterns), controller\n  work (use crud-patterns), or mailer delivery (use mailer-patterns).\nlicense: MIT\ncompatibility: Ruby 3.3+, Rails 8.0+, Solid Queue\n---\n\n# Job Patterns (37signals)\n\nJobs orchestrate. Models do the work. Background jobs are thin wrappers around model methods.\n\n## Project knowledge\n\n**Tech Stack:** Rails 8.2 (edge), Solid Queue, ActiveJob\n**Pattern:** Thin jobs call model methods; models have `_later`\u002F`_now` pairs\n\n**Commands:**\n```bash\nbin\u002Frails generate job NotifyRecipients        # Generate job\nbundle exec rake solid_queue:start             # Run worker\nbin\u002Frails runner \"puts SolidQueue::Job.count\"  # Check queue\nbin\u002Frails runner \"SolidQueue::Job.destroy_all\" # Clear jobs\n```\n\n## Why shallow jobs\n\n- Business logic stays in models (testable, reusable)\n- Jobs are simple orchestrators\n- Easy to run sync or async\n- Can call methods directly in tests\n- Clearer separation of concerns\n\n## Why _later\u002F_now convention\n\n- Clear which version is async\n- Default method can be sync (explicit async)\n- Easy to switch between sync\u002Fasync\n- Testable (call `_now` in tests)\n\n## Core pattern: shallow job\n\nThe job receives a model and calls its `_now` method. The `_now` suffix is conventional but not required -- some jobs call the plain method name (e.g., `notifiable.notify_recipients`).\n\n```ruby\n# app\u002Fjobs\u002Fnotify_recipients_job.rb\nclass NotifyRecipientsJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(notifiable)\n    notifiable.notify_recipients_now\n  end\nend\n```\n\nThe model defines both `_later` and `_now` methods:\n\n```ruby\n# In model or concern\ndef notify_recipients_later\n  NotifyRecipientsJob.perform_later(self)\nend\n\ndef notify_recipients_now\n  recipients.each do |recipient|\n    next if recipient == creator\n    Notification.create!(recipient: recipient, notifiable: self, action: notification_action)\n  end\nend\n\n# Default to sync\ndef notify_recipients\n  notify_recipients_now\nend\n\n# Trigger async from callbacks\nafter_create_commit :notify_recipients_later\n```\n\n## Job patterns\n\n### Notification job\n\n```ruby\nclass NotifyRecipientsJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(notifiable)\n    notifiable.notify_recipients_now\n  end\nend\n```\n\n### Batch processing job\n\n```ruby\nclass DeliverBundledNotificationsJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform\n    Notification::Bundle.deliver_all_now\n  end\nend\n```\n\n### Cleanup job\n\n```ruby\nclass SessionCleanupJob \u003C ApplicationJob\n  queue_as :low_priority\n\n  def perform\n    Session.cleanup_old_sessions_now\n  end\nend\n```\n\n### Event tracking job\n\n```ruby\nclass TrackEventJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(eventable, action, options = {})\n    eventable.track_event_now(action, options)\n  end\nend\n```\n\n### Broadcasting job\n\n```ruby\nclass BroadcastUpdateJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(broadcastable)\n    broadcastable.broadcast_update_now\n  end\nend\n```\n\n### External API job\n\n```ruby\nclass DispatchWebhookJob \u003C ApplicationJob\n  queue_as :webhooks\n  retry_on StandardError, wait: :exponentially_longer, attempts: 5\n\n  def perform(webhook, event)\n    webhook.dispatch_now(event)\n  end\nend\n```\n\n## Retry and error handling\n\n```ruby\nclass DispatchWebhookJob \u003C ApplicationJob\n  discard_on Webhook::InvalidUrl                              # Don't retry\n  retry_on StandardError, wait: :exponentially_longer, attempts: 5  # Backoff\n  retry_on CustomError, wait: 5.minutes, attempts: 3          # Fixed interval\n\n  rescue_from Webhook::Timeout do |exception|\n    webhook.mark_as_slow!\n    raise exception  # Re-raise to trigger retry\n  end\n\n  def perform(webhook, event)\n    webhook.dispatch_now(event)\n  end\nend\n```\n\n## Current attributes in jobs\n\nAlways set and reset `Current` context:\n\n```ruby\nclass NotifyRecipientsJob \u003C ApplicationJob\n  before_perform do |job|\n    notifiable = job.arguments.first\n    Current.account = notifiable.account\n    Current.user = notifiable.creator if notifiable.respond_to?(:creator)\n  end\n\n  after_perform { Current.reset }\n\n  def perform(notifiable)\n    notifiable.notify_recipients_now\n  end\nend\n```\n\n## Performance patterns\n\n### Batch processing\n\n```ruby\n# Enqueue in batches\nCard.active.pluck(:id).each_slice(100) do |batch|\n  ProcessCardsJob.perform_later(batch)\nend\n\nclass ProcessCardsJob \u003C ApplicationJob\n  def perform(card_ids)\n    Card.where(id: card_ids).find_each(&:process_now)\n  end\nend\n```\n\n### Debouncing (avoid duplicate jobs)\n\n```ruby\ndef reindex_later\n  return if reindex_job_queued?\n  ReindexBoardJob.perform_later(id)\nend\n\ndef reindex_job_queued?\n  SolidQueue::Job.exists?(\n    job_class: \"ReindexBoardJob\",\n    arguments: [id].to_json,\n    finished_at: nil\n  )\nend\n```\n\n## Testing jobs\n\n### Test model methods directly (preferred)\n\n```ruby\nclass CommentTest \u003C ActiveSupport::TestCase\n  test \"notify_recipients_now creates notifications\" do\n    comment = comments(:logo_comment)\n    assert_difference -> { Notification.count }, 2 do\n      comment.notify_recipients_now\n    end\n  end\nend\n```\n\n### Verify job is enqueued\n\n```ruby\nclass NotifyRecipientsJobTest \u003C ActiveJob::TestCase\n  test \"enqueues job\" do\n    comment = comments(:logo_comment)\n    assert_enqueued_with job: NotifyRecipientsJob, args: [comment] do\n      NotifyRecipientsJob.perform_later(comment)\n    end\n  end\nend\n```\n\n### Verify callbacks enqueue jobs\n\n```ruby\ntest \"creating comment enqueues notification job\" do\n  card = cards(:logo)\n  assert_enqueued_with job: NotifyRecipientsJob do\n    card.comments.create!(body: \"Great work!\", creator: users(:david))\n  end\nend\n```\n\nSee `references\u002Fsolid-queue.md` for Solid Queue configuration and\n`references\u002Frecurring-jobs.md` for recurring job setup.\n\n## Boundaries\n\n- **Always:** Keep jobs thin (call model methods), follow the `_later`\u002F`_now` naming convention (though the `_now` suffix is not strictly enforced), put business logic in models, set queue priorities, implement retry strategies, test model methods directly\n- **Ask first:** Before putting business logic in jobs, before using Redis\u002FSidekiq, before running jobs synchronously in production\n- **Never:** Put business logic in jobs, use Sidekiq\u002FResque (use Solid Queue), enqueue jobs in transactions (may not commit), forget `Current.reset` in jobs, skip retry strategies for unreliable operations\n","# Job Patterns (37signals)\n\nJobs orchestrate. Models do the work. Background jobs are thin wrappers around model methods.\n\n## Project knowledge\n\n**Tech Stack:** Rails 8.2 (edge), Solid Queue, ActiveJob\n**Pattern:** Thin jobs call model methods; models have `_later`\u002F`_now` pairs\n\n**Commands:**\n```bash\nbin\u002Frails generate job NotifyRecipients        # Generate job\nbundle exec rake solid_queue:start             # Run worker\nbin\u002Frails runner \"puts SolidQueue::Job.count\"  # Check queue\nbin\u002Frails runner \"SolidQueue::Job.destroy_all\" # Clear jobs\n```\n\n## Why shallow jobs\n\n- Business logic stays in models (testable, reusable)\n- Jobs are simple orchestrators\n- Easy to run sync or async\n- Can call methods directly in tests\n- Clearer separation of concerns\n\n## Why _later\u002F_now convention\n\n- Clear which version is async\n- Default method can be sync (explicit async)\n- Easy to switch between sync\u002Fasync\n- Testable (call `_now` in tests)\n\n## Core pattern: shallow job\n\nThe job receives a model and calls its `_now` method. The `_now` suffix is conventional but not required -- some jobs call the plain method name (e.g., `notifiable.notify_recipients`).\n\n```ruby\n# app\u002Fjobs\u002Fnotify_recipients_job.rb\nclass NotifyRecipientsJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(notifiable)\n    notifiable.notify_recipients_now\n  end\nend\n```\n\nThe model defines both `_later` and `_now` methods:\n\n```ruby\n# In model or concern\ndef notify_recipients_later\n  NotifyRecipientsJob.perform_later(self)\nend\n\ndef notify_recipients_now\n  recipients.each do |recipient|\n    next if recipient == creator\n    Notification.create!(recipient: recipient, notifiable: self, action: notification_action)\n  end\nend\n\n# Default to sync\ndef notify_recipients\n  notify_recipients_now\nend\n\n# Trigger async from callbacks\nafter_create_commit :notify_recipients_later\n```\n\n## Job patterns\n\n### Notification job\n\n```ruby\nclass NotifyRecipientsJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(notifiable)\n    notifiable.notify_recipients_now\n  end\nend\n```\n\n### Batch processing job\n\n```ruby\nclass DeliverBundledNotificationsJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform\n    Notification::Bundle.deliver_all_now\n  end\nend\n```\n\n### Cleanup job\n\n```ruby\nclass SessionCleanupJob \u003C ApplicationJob\n  queue_as :low_priority\n\n  def perform\n    Session.cleanup_old_sessions_now\n  end\nend\n```\n\n### Event tracking job\n\n```ruby\nclass TrackEventJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(eventable, action, options = {})\n    eventable.track_event_now(action, options)\n  end\nend\n```\n\n### Broadcasting job\n\n```ruby\nclass BroadcastUpdateJob \u003C ApplicationJob\n  queue_as :default\n\n  def perform(broadcastable)\n    broadcastable.broadcast_update_now\n  end\nend\n```\n\n### External API job\n\n```ruby\nclass DispatchWebhookJob \u003C ApplicationJob\n  queue_as :webhooks\n  retry_on StandardError, wait: :exponentially_longer, attempts: 5\n\n  def perform(webhook, event)\n    webhook.dispatch_now(event)\n  end\nend\n```\n\n## Retry and error handling\n\n```ruby\nclass DispatchWebhookJob \u003C ApplicationJob\n  discard_on Webhook::InvalidUrl                              # Don't retry\n  retry_on StandardError, wait: :exponentially_longer, attempts: 5  # Backoff\n  retry_on CustomError, wait: 5.minutes, attempts: 3          # Fixed interval\n\n  rescue_from Webhook::Timeout do |exception|\n    webhook.mark_as_slow!\n    raise exception  # Re-raise to trigger retry\n  end\n\n  def perform(webhook, event)\n    webhook.dispatch_now(event)\n  end\nend\n```\n\n## Current attributes in jobs\n\nAlways set and reset `Current` context:\n\n```ruby\nclass NotifyRecipientsJob \u003C ApplicationJob\n  before_perform do |job|\n    notifiable = job.arguments.first\n    Current.account = notifiable.account\n    Current.user = notifiable.creator if notifiable.respond_to?(:creator)\n  end\n\n  after_perform { Current.reset }\n\n  def perform(notifiable)\n    notifiable.notify_recipients_now\n  end\nend\n```\n\n## Performance patterns\n\n### Batch processing\n\n```ruby\n# Enqueue in batches\nCard.active.pluck(:id).each_slice(100) do |batch|\n  ProcessCardsJob.perform_later(batch)\nend\n\nclass ProcessCardsJob \u003C ApplicationJob\n  def perform(card_ids)\n    Card.where(id: card_ids).find_each(&:process_now)\n  end\nend\n```\n\n### Debouncing (avoid duplicate jobs)\n\n```ruby\ndef reindex_later\n  return if reindex_job_queued?\n  ReindexBoardJob.perform_later(id)\nend\n\ndef reindex_job_queued?\n  SolidQueue::Job.exists?(\n    job_class: \"ReindexBoardJob\",\n    arguments: [id].to_json,\n    finished_at: nil\n  )\nend\n```\n\n## Testing jobs\n\n### Test model methods directly (preferred)\n\n```ruby\nclass CommentTest \u003C ActiveSupport::TestCase\n  test \"notify_recipients_now creates notifications\" do\n    comment = comments(:logo_comment)\n    assert_difference -> { Notification.count }, 2 do\n      comment.notify_recipients_now\n    end\n  end\nend\n```\n\n### Verify job is enqueued\n\n```ruby\nclass NotifyRecipientsJobTest \u003C ActiveJob::TestCase\n  test \"enqueues job\" do\n    comment = comments(:logo_comment)\n    assert_enqueued_with job: NotifyRecipientsJob, args: [comment] do\n      NotifyRecipientsJob.perform_later(comment)\n    end\n  end\nend\n```\n\n### Verify callbacks enqueue jobs\n\n```ruby\ntest \"creating comment enqueues notification job\" do\n  card = cards(:logo)\n  assert_enqueued_with job: NotifyRecipientsJob do\n    card.comments.create!(body: \"Great work!\", creator: users(:david))\n  end\nend\n```\n\nSee `references\u002Fsolid-queue.md` for Solid Queue configuration and\n`references\u002Frecurring-jobs.md` for recurring job setup.\n\n## Boundaries\n\n- **Always:** Keep jobs thin (call model methods), follow the `_later`\u002F`_now` naming convention (though the `_now` suffix is not strictly enforced), put business logic in models, set queue priorities, implement retry strategies, test model methods directly\n- **Ask first:** Before putting business logic in jobs, before using Redis\u002FSidekiq, before running jobs synchronously in production\n- **Never:** Put business logic in jobs, use Sidekiq\u002FResque (use Solid Queue), enqueue jobs in transactions (may not commit), forget `Current.reset` in jobs, skip retry strategies for unreliable operations\n",{"name":5,"license":15,"description":7,"compatibility":24},"Ruby 3.3+, Rails 8.0+, Solid Queue","master","f341c46fed021656175d5c9ccc67a72126e50bfb","skills\u002Frails-ai-agents\u002F.claude_37signals\u002Fskills\u002Fjob-patterns","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public","https:\u002F\u002Fgithub.com\u002Fdbillion","I enjoy writing codes,teaching programming, solving problems, tasted automation in Python and never looked back😋😋😋💞","2026-10-14 03:31:55",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add dbillion\u002Fhermes-skills-public --skill job-patterns",{"tool":38,"command":39},"bunx","bunx skills add dbillion\u002Fhermes-skills-public --skill job-patterns",{"tool":41,"command":42},"pnpm","pnpm dlx skills add dbillion\u002Fhermes-skills-public --skill job-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Frails-ai-agents\u002F.claude_37signals\u002Fskills\u002Fjob-patterns\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Frecurring-jobs.md","REFERENCE","参考文档",3572,"https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Frails-ai-agents\u002F.claude_37signals\u002Fskills\u002Fjob-patterns\u002Freferences\u002Frecurring-jobs.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fsolid-queue.md",3366,"https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Frails-ai-agents\u002F.claude_37signals\u002Fskills\u002Fjob-patterns\u002Freferences\u002Fsolid-queue.md",[57,64,71,80,87,94],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7B25T0V7RBKES86Y3RTXQRN","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall.","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7B25DSBBMZRHVD28MAX7N5X","gemini-vision-fallback","Vision fallback: Gemini REST API if vision_analyze blocked.","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Fvision\u002Fgemini-vision-fallback\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":75,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7B22XW9QXT2ZWWXVZDFWYZP","twitter-cli","Use twitter-cli for ALL Twitter\u002FX operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke whenever user requests any Twitter interaction.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Ftwitter-cli\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Ftwitter-cli\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7B22QMWY1B4F7BC114RG4S6","prism-scan","Structural analysis through dynamically generated cognitive lenses. Generates the optimal analytical lens for the specific code\u002Fartifact, then executes it. Finds conservation laws, structural invariants, and concrete bugs that vanilla analysis misses. Use on any code file, system design, or text artifact.","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Fts-superhermes-prism-scan\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7B22JA5XCAP1ACT6V50WYR1","prism-reflect","Constraint transparency: analyzes an artifact structurally, then analyzes what its own analysis concealed. Produces a conservation law AND a constraint report showing what was maximized, what was sacrificed, and what to investigate next. The only AI skill that knows what it can't see.","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Fts-superhermes-prism-reflect\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7B22EB15M75M4X3C52YGDCC","prism-full","Full Prism: multi-pass structural analysis with mandatory adversarial self-correction. Designs custom analytical passes, executes them with chaining, then attacks its own findings before synthesizing. Use for maximum depth on important code or artifacts.","https:\u002F\u002Fgithub.com\u002Fdbillion\u002Fhermes-skills-public\u002Fblob\u002Fmaster\u002Fskills\u002Fts-superhermes-prism-full\u002FSKILL.md",[],[]]