Skip to content

opensite-ai/opensite-skills / aws-sdk-js-v3-usage

aws-sdk-js-v3-usage

Unverified

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.

FileKindSize
.aws-skill-metadataother18 B
SKILL.mdskill md8.5 KB
references/clients.mdmarkdown3.6 KB
references/credentials.mdmarkdown3.4 KB
references/dynamodb.mdmarkdown2.8 KB
references/effective-practices.mdmarkdown2.3 KB
references/error-handling.mdmarkdown1.6 KB
references/lambda.mdmarkdown1.7 KB
references/performance.mdmarkdown1.9 KB
references/s3.mdmarkdown2.7 KB
references/schemas.mdmarkdown1.7 KB
references/sigv4a.mdmarkdown1.5 KB
references/typescript.mdmarkdown1.1 KB

references/effective-practices.md

View on GitHub
# Effective Practices Reference

## Client Reuse

Create one client per region+credentials combination. Don't create clients inside loops:

```js
// WRONG:
for (const item of items) {
  const client = new S3Client({ region, credentials });
  await client.send(new PutObjectCommand(item));
}

// OK:
const client = new S3Client({ region, credentials });
for (const item of items) {
  await client.send(new PutObjectCommand(item));
}
```

## Don't Read or Mutate `client.config`

`client.config` is a resolved form — `region` becomes `async () => "us-east-1"`, credentials are wrapped, etc. Reading or writing it directly will cause errors:

```js
// WRONG: — throws "config.region is not a function"
client.config.region = "us-west-2";

// WRONG: — throws "client.config.endpoint is not a function"
const endpoint = await client.config.endpoint();
```

To use multiple regions, create separate clients (share credentials to avoid duplicate resolution):

```js
import { fromTemporaryCredentials } from "@aws-sdk/credential-providers";
const creds = fromTemporaryCredentials({ params: { RoleArn: "..." } });
const east = new S3Client({ region: "us-east-1", credentials: creds });
const west = new S3Client({ region: "us-west-2", credentials: creds });
```

To get the resolved endpoint for a specific operation:

```js
import { getEndpointFromInstructions } from "@smithy/middleware-endpoint";
const endpoint = await getEndpointFromInstructions(
  { Bucket, Key },
  GetObjectCommand,
  { region: "us-west-2", useDualstackEndpoint: false, useFipsEndpoint: false }
);
console.log(endpoint.url.toString());
```

## Always Read or Discard Streaming Responses

Unread streams hold sockets open → socket exhaustion / memory leak:

```js
const { Body } = await client.send(new GetObjectCommand({ Bucket, Key }));

// OK: read
const bytes = await Body.transformToByteArray();

// OK: pipe
await client.send(new PutObjectCommand({ Bucket: dest, Key, Body }));

// OK: discard
await (Body.destroy?.() ?? Body.cancel?.());

// WRONG: — socket stays open
// (no action on Body)
```

## Cross-Region Connection Timeouts (Node.js 20+)

For cross-region requests that hit `ETIMEDOUT` / `AggregateError`:

```js
import net from "node:net";
net.setDefaultAutoSelectFamilyAttemptTimeout(500); // default is 250ms
```
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall