Queue Work That Never Runs Twice
Make each queue transaction safe to re-run and split business-rule failures from technical ones, so a retry never pays the same invoice twice.
What it is for
The transactional discipline for queue-driven automations: business keys, dispatcher and performer split apart, an existence check before anything irreversible, and business exceptions kept out of the retry path. Reach for it when a process will run unattended at volume against a system that charges money or sends things. It prevents double payments and queues that jam on a single bad row.
The skill
Build every high-volume process as queue transactions, and make each transaction safe to run again. 1. Give each item a reference that is the business key - invoice number, order id, employee id - never a row number and never a timestamp. Configure the queue to reject an item whose reference is already there, so a re-run of the dispatcher cannot add the same work a second time. 2. Split the job in two: a dispatcher that only reads the source and adds items, and a performer that takes one item at a time and processes it. Never do both in one run. 3. Put everything the performer needs into the item itself. A performer that goes back to re-read the source file breaks the day the file moves. 4. Immediately before the step that costs money - submit, post, pay, send - check whether that key already exists in the target system. If it does, mark the item successful instead of doing it again. 5. Separate the two kinds of failure. A rule violation in the data is a business exception: fail the item, do not retry, and record which rule. A timeout, a missing element, a dropped session is an application exception: fail it so it can be retried. 6. Set the retry count on the queue, not with a loop inside the performer. A loop inside the performer retries a half-finished transaction. 7. End every transaction by returning the application to a known state - dialogs closed, search box cleared, back on the home screen - before the next item is taken. 8. Log the item reference on every log line. An error report without the reference cannot be investigated the next morning. The failure this prevents: a retry that submits the same payment a second time, and one bad row that retries forever while the queue never empties.
How to install it
1. Open the tool and start a new conversation, project or template. 2. Paste the text below wherever the tool keeps standing instructions — usually called system prompt, instructions, or persona. 3. Save it so it applies to every run rather than a single message.