From backend-development
非同期処理のバックエンドとフロントエンドを実装する際のベストプラクティスをまとめたスキルです。非同期処理が必要なWebサービスのフロントエンドおよびバックエンドを実装する際に利用されます。
How this skill is triggered — by the user, by Claude, or both
Slash command
/backend-development:async-processing-best-practicesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Webアプリケーションにおける非同期処理を実現するための実装ガイドです。
references/01_infrastructure.mdreferences/02_typescript_bullmq.mdreferences/03_aws_serverless.mdreferences/04_gcp_serverless.mdreferences/05_backend_rails.mdreferences/06_backend_bullmq.mdreferences/07_backend_aws.mdreferences/08_backend_gcp.mdreferences/09_frontend_hotwire.mdreferences/10_frontend_nextjs.mdreferences/11_frontend_vuejs.mdreferences/12_frontend_react.mdreferences/13_deployment.mdreferences/14_solid_cable.mdreferences/15_troubleshooting.mdWebアプリケーションにおける非同期処理を実現するための実装ガイドです。
次の場合にこのガイドラインを参照してください。
HTTPレスポンを返す際に処理が完了している必要がないものについては非同期処理で実現することを検討します。主に以下の観点で非同期処理の採用を考えます。
以下の要素から実現手法を選択します
主に以下のパターンによって構築します。
| 観点 | Rails (Solid Queue) | Rails (Sidekiq) | BullMQ | AWS Serverless | GCP Serverless |
|---|---|---|---|---|---|
| 追加インフラ | なし | Redis | Redis | SQS, DynamoDB等 | Cloud Tasks, Firestore |
| スケーラビリティ | 中 | 高 | 高 | 非常に高 | 非常に高 |
| 運用負荷 | 低 | 中 | 中 | 低 | 低 |
| コスト(低負荷時) | 低 | 中 | 中 | 非常に低 | 非常に低 |
| リアルタイム通知 | ActionCable | ActionCable | 独自実装 | AppSync Events | Firestore |
| 最大処理時間 | 無制限 | 無制限 | 無制限 | 15分(Lambda) | 60分(Cloud Run) |
| 適したユースケース | 小〜中規模Rails | 中〜大規模Rails | Node.js全般 | AWS中心のサーバーレス | GCP中心のサーバーレス |
バックエンド実装時には、以下の観点について各実現手法ごとのベストプラクティスを参照してください。
パラメータの受け取り方
エラー発生時の処理と通知
進捗の状態管理
その他
| 実現手法 | リファレンス |
|---|---|
| Ruby on Rails (ActiveJob) | @references/05_backend_rails.md |
| TypeScript BullMQ | @references/06_backend_bullmq.md |
| AWS Serverless (Lambda + SQS) | @references/07_backend_aws.md |
| GCP Serverless (Cloud Run + Cloud Tasks) | @references/08_backend_gcp.md |
フロントエンド実装時には、以下の観点について各フレームワークごとのベストプラクティスを参照してください。
非同期処理の呼び出し方
状態管理と表示
接続復帰処理
エラーハンドリング
| フレームワーク | リファレンス |
|---|---|
| Rails Hotwire (Turbo + Stimulus + ActionCable) | @references/09_frontend_hotwire.md |
| Next.js (React / App Router) | @references/10_frontend_nextjs.md |
| Vue.js 3 (Composition API) | @references/11_frontend_vuejs.md |
| React (Webpacker/Shakapacker) | @references/12_frontend_react.md |
本番環境にデプロイする際の設定やベストプラクティスは以下を参照してください。
Redis不要でActionCableを使用したい場合は、Solid Cableを利用できます。
問題が発生した場合は以下を参照してください。
ステージング環境と本番環境で同じデータベースを共有している場合、以下の設定が必要です。
# config/solid_queue.yml
staging:
workers:
- queues:
- <%= ENV.fetch('QUEUE_PREFIX', 'staging') %>_default
production:
workers:
- queues:
- <%= ENV.fetch('QUEUE_PREFIX', 'production') %>_default
# app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base
queue_as do
prefix = ENV.fetch('QUEUE_PREFIX', Rails.env)
"#{prefix}_default"
end
end
# config/cable.yml
staging:
adapter: solid_cable
channel_prefix: <%= ENV.fetch('CABLE_PREFIX', 'staging') %>
production:
adapter: solid_cable
channel_prefix: <%= ENV.fetch('CABLE_PREFIX', 'production') %>
詳細は @references/13_deployment.md の「環境分離設定」を参照してください。
npx claudepluginhub xtone/ai_development_tools --plugin backend-developmentProvides async job processing patterns with Celery, ARQ, Redis, and Temporal for background tasks, workflows, scheduling, retries, rate limiting, and monitoring. Use for task queues and distributed execution.
Configures SolidQueue, SolidCache, and SolidCable for background jobs, caching, and WebSockets in Rails 8+ apps. Enforces no Sidekiq/Redis per team rules.
Implements Python background jobs with task queues (Celery, RQ), workers, idempotency, and state machines for async tasks like emails, reports, and media processing.