agentleFS
shinzoxDshinzoxD/knackbox/skills/coding/message-queue-design/SKILL.md

message-queue-design

Skill0 starsChanged 5 months agoApache-2.0View on GitHub

Design queue and pub/sub systems — Kafka, SQS, Rabbit, NATS —

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not promise exactly-once from the broker alone.

    line 65
  2. Distinctive:

    Do not invent broker-specific settings you cannot see.

    line 73
  3. Distinctive:

    "Just use Kafka": ask the delivery and replay needs first.

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Message Queue Design

Queues move work you can afford to do later. Default is at-least-once. Exactly-once is a property of the handler + store, not the broker logo.

For HTTP callbacks, use webhook-design. For sockets, use websocket-design. For API contracts, use api-design.

Workflow

  1. Work type: command vs event, latency budget, loss tolerance.
  2. Broker shape: competing consumers (queue) vs fan-out (pub/sub).
  3. Keying / partition / shard: what must stay ordered, what can race.
  4. Payload: schema, version, PII, size, idempotency key.
  5. Producer: transactional outbox if the DB write and publish must not diverge.
  6. Consumer: visibility timeout / ack, retry + backoff, poison / DLQ, idempotent handler on the event id.
  7. Failure: replay, rewind, and who pages when the DLQ grows.
  8. Ops: lag, oldest-unacked, poison rate, schema-compat checks.

Output format

## Queue design: <workflow>

**Broker / pattern:** queue | bus | log
**Delivery promise:** at-least-once (state how you make it safe)

### Topics / queues
…

### Keys / ordering
…

### Producer
outbox? schema?

### Consumer
ack, retry, DLQ, idempotency

### Failure / replay
…

### Metrics
lag, poison, age

Rules

  1. Do not promise exactly-once from the broker alone.
  2. Handlers must be idempotent on a stable event id.
  3. Retry without a DLQ is how you infinite-loop a bad payload.
  4. Visibility timeout > p99 handler time, or you double-process healthy work.
  5. Ordering is per key/partition, never global, unless the user accepts a single-threaded consumer.
  6. PII in payloads needs retention and redaction like any store.
  7. Do not invent broker-specific settings you cannot see; name the control (retention, DLQ redrive, IAM).

Edge cases

  • "Just use Kafka": ask the delivery and replay needs first.
  • Huge payloads: store a pointer; do not stuff 50MB into the broker.
  • Request/reply over a queue: usually the wrong tool; prefer a sync API with a job id.
  • Poison that used to work: version the schema; do not silently drop.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.