npx skills add ...
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-js-v3-usage
AWS SDK for JavaScript v3 development patterns. Use when writing JavaScript or TypeScript code that uses AWS services via @aws-sdk/* packages (aws-sdk-js-v3), or when asked about schemas, runtime validation, serialization, or code generation in the context of the JS/TS AWS SDK.
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-js-v3-usage
Do not use emojis in any code, comments, or output when this skill is active.
@aws-sdk/client-* — one per service, generated by smithy-typescript; one-to-one with AWS services and operations@aws-sdk/lib-* — higher-level helpers (e.g. lib-dynamodb, lib-storage)@aws-sdk/* (no prefix) — utility packages (mostly internal; don't import deep paths)Always import from the package root:
Bare-bones (preferred — smaller bundle):
Aggregated (v2-style but NOT v2, larger bundle):
No global config in v3 — pass config to each client. region is always required; set it explicitly or via AWS_REGION env var.
Do not read or mutate client.config after instantiation — it is a resolved form (e.g. region becomes an async function). See references/effective-practices.md.
For HTTP handler (NodeHttpHandler from @smithy/node-http-handler), retry strategy, endpoint details, logging, FIPS, dual-stack, protocol selection, and S3-specific options → see references/clients.md.
All providers from @aws-sdk/credential-providers. Credentials are lazy and cached per client until ~5 min before expiry.
Share credentials and socket pool across multi-region clients:
For all providers (Cognito, SSO, web identity, custom chains, STS region priority) → see references/credentials.md.
Always read or discard streaming responses — unread streams leave sockets open (socket exhaustion):
Streams can only be read once.
Use paginate* functions instead of manual token handling:
Use @aws-sdk/lib-dynamodb to work with native JS types instead of AttributeValues:
For marshall options, large numbers (NumberValue), pagination, and aggregated client → see references/dynamodb.md.
For presigned POST, signed headers, waiter options → see references/s3.md.
Check e.name or instanceof for specific error types. See references/error-handling.md for full patterns.
For runtime validation, serialization to non-default formats, or questions about what schemas are in jsv3 → see references/schemas.md.
Streaming deadlock warning: with limited sockets, don't await the request and stream body separately — chain them. See references/performance.md.
Add custom logic to all commands on a client:
Steps (in order): initialize → serialize → build → finalizeRequest → deserialize
Initialize clients outside the handler (container reuse), make API calls inside. For one-time async setup, use a lazy init flag inside the handler:
See references/lambda.md for Lambda layers and versioning.
Response fields are typed as T | undefined by default. Use AssertiveClient from @smithy/types to remove | undefined, or NodeJsClient / BrowserClient to narrow streaming blob types. See references/typescript.md.
S3 MRAP and certain other features require SigV4a. You must install and side-effect-import exactly one of:
@aws-sdk/signature-v4-crt — Node.js only, better performance@aws-sdk/signature-v4a — Node.js + browsers, pure JSSee references/sigv4a.md for full details and MRAP ARN format.