> For the complete documentation index, see [llms.txt](https://docs.joobq.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.joobq.io/best-practices.md).

# Best Practices

Make repeated work safe, failures visible, and recovery routine.

Reliable background processing is a contract between your application, workers, Redis, and downstream systems. Start with these habits:

1. Pass identifiers rather than entire records or secrets.
2. Make repeated execution safe with a business-level idempotency key.
3. Bound external calls and classify failures before retrying.
4. Separate queue plumbing from business services.
5. Test termination, Redis outages, ambiguous acknowledgments, and restore procedures.
6. Measure completed useful work, not only enqueue speed.

Follow the focused guides:

* [Idempotent jobs](/best-practices/idempotency.md): protect business effects across retries.
* [Application architecture](/best-practices/architecture.md): keep handlers small and dependencies explicit.
* [Recovery and migration](/best-practices/recovery.md): preserve evidence and rehearse rollback.
* [Performance testing](/best-practices/performance.md): measure the workload you intend to ship.
* [Troubleshooting](/best-practices/troubleshooting.md): find configuration, queue, and compatibility problems.

{% hint style="warning" %}
No shard alone can promise zero data loss across every infrastructure failure or exactly-once effects in another service. Design persistence, reconciliation, idempotency, and operational recovery together.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.joobq.io/best-practices.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
