background-jobs
Designs background job processing: retries, idempotency (safe repeats) and queue management. Use when designing or reviewing async task infrastructure.
- License 许可
- MIT
- 所属仓库
- vibbs/company-os
- 最近更新
- 2026-10-21
- Stars
- ★ 6
- Forks
- 2
01 前言 Front Matter
- name
- background-jobs
- runtimes
- { "claude": { "user-invocable": false } }
- description
- Designs background job processing: retries, idempotency (safe repeats) and queue management. Use when designing or reviewing async task infrastructure.
02 资源文件 3
- 参考文档references/bond-field-definitions.md1.8 KB
- 参考文档references/circular-570-verification.md2.1 KB
- 脚本scripts/validate_bond_verification.py1.6 KB
03 SKILL.md 正文
Background Jobs
Reference
- ID: S-ENG-03
- Category: Engineering
- Inputs: job requirements, retry semantics, throughput targets, failure modes
- Outputs: background job design document → artifacts/engineering/
- Used by: Engineering Agent
- Tool scripts: ./tools/artifact/validate.sh
Purpose
Provides design patterns and conventions for building reliable background job systems with proper retry logic, idempotency guarantees, and queue management to prevent data corruption and ensure at-least-once processing.
Procedure
Step 0: Tech Stack Detection
Read tech_stack.queue from company.config.yaml to determine the job processing framework.
Framework-specific patterns:
| Framework | Language | Job Structure | Retry Config | Dead-Letter |
|---|---|---|---|---|
| BullMQ | TypeScript | Queue + Worker classes, job data as typed interface |
attempts + backoff in job options |
Failed jobs move to __failed__ queue |
| Celery | Python | @app.task decorator, bind=True for self-reference |
max_retries + default_retry_delay on task |
task_reject_on_worker_lost=True |
| Sidekiq | Ruby | include Sidekiq::Worker, perform method |
sidekiq_options retry: N |
Dead set after max retries |
If tech_stack.queue is not configured, present recommendations based on tech_stack.language.
Cross-references: See deployment-strategy for queue infrastructure, observability-baseline for job metrics.
- Identify the jobs to be processed asynchronously and their triggers.
- Classify each job by priority, expected duration, and failure tolerance.
- Design the queue topology: which queues, routing rules, concurrency limits.
- Define retry strategy for each job type: max retries, backoff algorithm (exponential, linear), dead-letter handling.
- Ensure idempotency: define idempotency keys and deduplication windows.
- Design failure handling: what happens on permanent failure, alerting, manual retry paths.
- Define observability: job start/end logging, duration metrics, failure rate dashboards.
- Document rate limiting and backpressure mechanisms.
- Save the design document to
artifacts/engineering/. - Validate the artifact using
./tools/artifact/validate.sh.
Quality Checklist
- [ ] Every job type has a defined retry strategy
- [ ] Idempotency keys are specified for all state-mutating jobs
- [ ] Dead-letter queue handling is defined
- [ ] Concurrency limits prevent resource exhaustion
- [ ] Failure alerting thresholds are specified
- [ ] Backpressure mechanism is documented
- [ ] Observability hooks (logs, metrics, traces) are included
- [ ] Artifact passes validation
04 同仓库更多 Skills
typo-field
Fixture skill with a misspelled top-level field.
spaced-comments
Fixture skill with comments and spaces after block keys.
crlf-comments
Fixture skill with Windows line endings.
claude-fields
Fixture skill using top-level fields Claude Code documents.
workflow-router
Maps an objective to the artifacts, stages and agents it needs. Use when deciding what happens next or which agents to involve.
weekly-review
Summarizes your week: what shipped, AI spend, support themes, security health and next priorities. Use at the end of each week.