> sqs
You are an expert in Amazon SQS (Simple Queue Service), the fully managed message queuing service. You help developers build decoupled, event-driven architectures using standard queues (at-least-once, best-effort ordering) and FIFO queues (exactly-once, ordered), dead-letter queues for failed messages, and Lambda triggers for serverless processing — scaling from zero to millions of messages per second.
curl "https://skillshub.wtf/TerminalSkills/skills/sqs?format=md"Amazon SQS — Managed Message Queue
You are an expert in Amazon SQS (Simple Queue Service), the fully managed message queuing service. You help developers build decoupled, event-driven architectures using standard queues (at-least-once, best-effort ordering) and FIFO queues (exactly-once, ordered), dead-letter queues for failed messages, and Lambda triggers for serverless processing — scaling from zero to millions of messages per second.
Core Capabilities
Send and Receive Messages
import { SQSClient, SendMessageCommand, ReceiveMessageCommand, DeleteMessageCommand } from "@aws-sdk/client-sqs";
const sqs = new SQSClient({ region: "us-east-1" });
const QUEUE_URL = process.env.SQS_QUEUE_URL!;
// Send message
async function sendOrder(order: { id: string; items: any[]; total: number }) {
await sqs.send(new SendMessageCommand({
QueueUrl: QUEUE_URL,
MessageBody: JSON.stringify(order),
MessageAttributes: {
OrderType: { DataType: "String", StringValue: order.total > 1000 ? "high-value" : "standard" },
},
DelaySeconds: 0,
}));
}
// FIFO queue: send with deduplication and grouping
async function sendFifoMessage(userId: string, event: any) {
await sqs.send(new SendMessageCommand({
QueueUrl: FIFO_QUEUE_URL,
MessageBody: JSON.stringify(event),
MessageGroupId: userId, // Messages for same user processed in order
MessageDeduplicationId: event.id, // Prevents duplicate processing within 5 min
}));
}
// Receive and process (polling)
async function pollMessages() {
const response = await sqs.send(new ReceiveMessageCommand({
QueueUrl: QUEUE_URL,
MaxNumberOfMessages: 10,
WaitTimeSeconds: 20, // Long polling (reduces empty responses)
VisibilityTimeout: 60, // 60s to process before message becomes visible again
MessageAttributeNames: ["All"],
}));
for (const message of response.Messages || []) {
try {
const order = JSON.parse(message.Body!);
await processOrder(order);
// Delete after successful processing
await sqs.send(new DeleteMessageCommand({
QueueUrl: QUEUE_URL,
ReceiptHandle: message.ReceiptHandle!,
}));
} catch (error) {
console.error(`Failed to process ${message.MessageId}:`, error);
// Message becomes visible again after VisibilityTimeout
}
}
}
Lambda Trigger
# SAM template — SQS → Lambda
Resources:
OrderProcessor:
Type: AWS::Serverless::Function
Properties:
Handler: processor.handler
Runtime: nodejs20.x
Events:
SQSEvent:
Type: SQS
Properties:
Queue: !GetAtt OrderQueue.Arn
BatchSize: 10
MaximumBatchingWindowInSeconds: 5
FunctionResponseTypes:
- ReportBatchItemFailures # Partial batch failure support
OrderQueue:
Type: AWS::SQS::Queue
Properties:
VisibilityTimeout: 300
RedrivePolicy:
deadLetterTargetArn: !GetAtt DeadLetterQueue.Arn
maxReceiveCount: 3 # After 3 failures → DLQ
DeadLetterQueue:
Type: AWS::SQS::Queue
Properties:
MessageRetentionPeriod: 1209600 # 14 days
// Lambda handler with partial batch failure reporting
export async function handler(event: SQSEvent) {
const batchItemFailures: { itemIdentifier: string }[] = [];
for (const record of event.Records) {
try {
const order = JSON.parse(record.body);
await processOrder(order);
} catch (error) {
batchItemFailures.push({ itemIdentifier: record.messageId });
}
}
return { batchItemFailures }; // Only failed messages retry
}
Installation
npm install @aws-sdk/client-sqs
Best Practices
- Long polling — Set
WaitTimeSeconds: 20to reduce empty receives and API costs - Dead-letter queues — Configure DLQ with
maxReceiveCount: 3-5; investigate failed messages, don't lose them - FIFO for ordering — Use FIFO queues when message order matters; MessageGroupId determines ordering scope
- Visibility timeout — Set to 6x your processing time; prevents premature redelivery
- Batch operations — Send/receive/delete in batches of 10; reduces API calls and costs
- Partial batch failures — Return
batchItemFailuresfrom Lambda; only failed messages retry - Idempotent consumers — SQS guarantees at-least-once; design processors to handle duplicate messages safely
- Message attributes — Use message attributes for routing/filtering; avoid parsing body just for routing
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zoho
Integrate and automate Zoho products. Use when a user asks to work with Zoho CRM, Zoho Books, Zoho Desk, Zoho Projects, Zoho Mail, or Zoho Creator, build custom integrations via Zoho APIs, automate workflows with Deluge scripting, sync data between Zoho apps and external systems, manage leads and deals, automate invoicing, build custom Zoho Creator apps, set up webhooks, or manage Zoho organization settings. Covers Zoho CRM, Books, Desk, Projects, Creator, and cross-product integrations.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> zipkin
Deploy and configure Zipkin for distributed tracing and request flow visualization. Use when a user needs to set up trace collection, instrument Java/Spring or other services with Zipkin, analyze service dependencies, or configure storage backends for trace data.