sqs-consumer
Skill1 starsChanged 2 months agoMITView on GitHub
Build and review an AWS SQS consumer correctly — classify every error terminal vs retryable, delete only after the downstream write succeeds, match visibility timeout to handler runtime, confirm the redrive policy and DLQ, handle partial batch failures, and make handlers idempotent. Use when building an SQS consumer, reviewing one, or when messages redeliver forever / land in the DLQ unexpectedly.
In this repository73 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bigquery-analyticsSkill
- cache-invalidationSkill
- mongo-aggregationSkill
- mongo-modelingSkill
- postgres-aggregationSkill
- postgres-indexingSkill
- redis-coordinationSkill
- redis-patternsSkill
- review-querySkill
- code-migrationSkill
- cut-releaseSkill
- data-migrationSkill
- deploy-serviceSkill
- hotfixSkill
- rollbackSkill
- design-endpointSkill
- design-eventSkill
- design-schemaSkill
- evolve-contractSkill
- scaffold-nestjs-moduleSkill
- scaffold-projectSkill
- incident-responseSkill
- investigate-bugSkill
- on-callSkill
- postmortemSkill
- audit-skillsSkill
- distill-review-styleSkill
- write-skillSkill
- debug-with-tracesSkill
- define-alertsSkill
- instrument-serviceSkill
- evaluate-dependencySkill
- grillSkill
- handoffSkill
- orientSkill
- phased-deliverySkill
- spikeSkill
- to-questionnaireSkill
- write-adrSkill
- write-prdSkill
- devops-pr-reviewSkill
- go-backend-pr-reviewSkill
- nestjs-backend-pr-reviewSkill
- python-backend-pr-reviewSkill
- react-frontend-pr-reviewSkill
- bisectSkill
- break-couplingSkill
- dead-code-sweepSkill
- deslopifySkill
- extract-moduleSkill
- rebase-cleanSkill
- resolve-merge-conflictsSkill
- split-commitSkill
- tddSkill
- wait-whatSkill
- wide-renameSkill
- bullmqSkill
- kafkaSkill
- audit-dependenciesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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
- Distinctive: line 36
Must be > the max handler runtime (incl.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
SQS consumer
The review corpus's #1 queue rule: every error path must be classified terminal vs retryable. An error that is neither deleted nor DLQ'd redelivers forever.
Message lifecycle
- Receive (long-poll:
WaitTimeSeconds=20, not busy-poll). - Process the message.
- On success —
DeleteMessage. Never delete before the downstream write succeeds — delete-then-write means a crash loses the message. - On retryable failure (transient 5xx, throttle, lock timeout) — do not
delete; let the visibility timeout expire and SQS redelivers. Optionally
ChangeMessageVisibilityto add backoff. - On terminal failure (bad payload, validation, a 4xx that won't change) —
don't retry. Either delete + record the failure, or let it go to the DLQ via
maxReceiveCount. Decide which per message type.
Redrive & DLQ
- Confirm the deployed queue has the redrive policy the code assumes. The code
relying on "it'll go to the DLQ after 5 tries" is wrong if the queue's
RedrivePolicy/maxReceiveCountisn't actually set. Check the infra. - DLQ retention ≥ source retention. Alarm on
ApproximateNumberOfMessagesVisibleon the DLQ (observability/define-alerts). - Have a documented DLQ redrive path (re-process after a fix) — SQS supports redrive-from-DLQ.
Visibility timeout
- Must be > the max handler runtime (incl. retries/backoff inside the handler). If the handler can run 90s and visibility is 30s, the message reappears and is processed concurrently → duplicates.
- For long jobs, extend visibility with a heartbeat (
ChangeMessageVisibility) rather than one huge timeout.
Batches
ReceiveMessagereturns up to 10. If you process a batch and one fails, the whole batch redelivers unless you useReportBatchItemFailures(Lambda event source) / delete the successful ones individually and leave the failed.- Per-item try/catch + continue — one bad message must not fail the batch.
Idempotency
- SQS standard queues are at-least-once — handlers must be idempotent (dedup on a message/business id, or naturally idempotent writes).
- FIFO queues give exactly-once processing within the dedup window + ordering
per
MessageGroupId— but still design idempotent.
Anti-patterns
- ❌ An error path that's neither deleted nor DLQ'd.
- ❌
DeleteMessagebefore the write succeeds. - ❌ Visibility timeout shorter than the handler can run.
- ❌ Assuming a DLQ exists without checking the queue's redrive policy.
- ❌ One bad message failing the whole batch.
- ❌ A non-idempotent handler on a standard queue.
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
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.

