Skip to main content
skill CX Codex

aws-sdk-swift-usage — Claude Code skill: AWS SDK for Swift patterns

Teaches the agent the aws-sdk-swift patterns: clients, struct configs, credential resolvers, waiters. Useful when a Swift project talks to AWS.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage -a claude-code
Open on GitHub

What aws-sdk-swift-usage does

This skill gives the agent reference patterns for writing Swift against aws-sdk-swift. SDK operations are all async, so the examples use an @main entry point with static func main() async throws and build the client with try await S3Client().

Everything lives in one SKILL.md: client creation, struct configs, credential resolvers (static keys and assume role), waiters, pagination, presigned URLs. Request and response models sit under <Service>ClientTypes, like S3ClientTypes.Bucket or DynamoDBClientTypes.AttributeValue.

The part that breaks builds: classes such as S3ClientConfiguration are deprecated. You need the struct form, S3Client.S3ClientConfig, with parameters in declaration order and a region every time. The skill tells you to check <Service>Client.swift inside the SDK for the exact order.

What it helps with

  • Write an async Swift entry point that calls AWS services
  • Swap a deprecated S3ClientConfiguration for the struct config
  • Set up assume role on top of a base credential resolver
  • Wait for a bucket to exist before reading from it
  • Walk every object in a bucket page by page

Example prompts for the agent

  • Write Swift code that uploads a file to S3 with aws-sdk-swift, entry point @main
  • Rewrite this DynamoDB client config as the struct type, no deprecated class
  • Generate a presigned URL for file.pdf

How to install aws-sdk-swift-usage

1Skills CLI (Vercel)

npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage -a claude-code

2Manually: put the files in place

~/.claude/skills/aws-sdk-swift-usage/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/aws-sdk-swift-usage/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about aws-sdk-swift-usage

How do I install aws-sdk-swift-usage in Claude Code?

Run npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage -a claude-code. The skill lands in ~/.claude/skills/aws-sdk-swift-usage/SKILL.md.

What does aws-sdk-swift-usage do?

It hands the agent working patterns for aws-sdk-swift: client setup, struct configs, credential resolvers, waiters, pagination and presigned URLs. It kicks in when you ask for Swift code that calls AWS services.

Why does parameter order in the config matter?

The SDK expects config parameters in declaration order, otherwise the code will not compile. For a given service the skill points you to <Service>Client.swift in the SDK sources for the exact sequence.

Source text

SKILL.md · Apache-2.0
---
name: aws-sdk-swift-usage
description: |
  AWS SDK for Swift development patterns. Use when writing Swift code that uses AWS services via aws-sdk-swift package.
---

# AWS SDK for Swift

## Async Code Structure

All SDK operations are async. Use `@main` entry point:

```swift
@main
struct Main {
    static func main() async throws {
        let client = try await S3Client()
        // ... async operations
    }
}
```

## CRITICAL: Use Struct Config Types

NEVER use `S3ClientConfiguration` or `DynamoDBClientConfiguration` - these are DEPRECATED classes.

ALWAYS use the struct-based config types:

- `S3Client.S3ClientConfig` (not S3ClientConfiguration)
- `DynamoDBClient.DynamoDBClientConfig` (not DynamoDBClientConfiguration)  
- `STSClient.STSClientConfig` (not STSClientConfiguration)

Config parameters MUST be in declaration order. Region is ALWAYS required when creating a config. Check the service client source for exact order.

```swift
// CORRECT - struct config
let config = try await S3Client.S3ClientConfig(region: "us-west-2")
let client = S3Client(config: config)

// WRONG - deprecated class
// let config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
```

## Client Creation

All service clients follow the same pattern: `<Service>Client` with `<Service>Client.<Service>ClientConfig`.

Model types (structs/enums used in requests/responses) are namespaced under `<Service>ClientTypes`:

- `S3ClientTypes.Bucket`, `S3ClientTypes.Object`
- `DynamoDBClientTypes.AttributeValue`
- `CloudWatchClientTypes.MetricDatum`, `CloudWatchClientTypes.Dimension`

```swift
import AWSS3
import AWSDynamoDB

// Simple - auto-detects region
let s3 = try await S3Client()
let dynamo = try await DynamoDBClient()

// With region
let s3 = try S3Client(region: "us-west-2")

// With config - parameters must be in declaration order
let config = try await S3Client.S3ClientConfig(
    useFIPS: true,
    awsRetryMode: .adaptive,
    maxAttempts: 5,
    region: "us-west-2"
)
let client = S3Client(config: config)

// With custom endpoint and credentials
let config = try await S3Client.S3ClientConfig(
    awsCredentialIdentityResolver: resolver,
    region: "us-west-2",
    endpoint: "https://s3.custom-endpoint.com"
)
```

Common config parameters (MUST follow declaration order):

- `awsCredentialIdentityResolver` - Custom credentials
- `useFIPS` - Enable FIPS endpoints
- `useDualStack` - Enable dual-stack endpoints
- `awsRetryMode` - Retry strategy (.adaptive, .standard, .legacy)
- `maxAttempts` - Max retry attempts
- `region` - AWS region
- `httpClientEngine` - Custom HTTP client (requires HttpClientConfiguration parameter):

  ```swift
  import ClientRuntime
  let httpConfig = HttpClientConfiguration()
  let httpClient = URLSessionHTTPClient(httpClientConfiguration: httpConfig)
  let config = try await S3Client.S3ClientConfig(
      region: "us-east-1",
      httpClientEngine: httpClient
  )
  ```

- `endpoint` - Custom endpoint URL

For service-specific config options or exact parameter order, check `Sources/Services/AWS<Service>/Sources/AWS<Service>/<Service>Client.swift` in the SDK.

## Credential Resolvers

```swift
import AWSSDKIdentity
import SmithyIdentity

// Static credentials - pass credential object directly
let creds = AWSCredentialIdentity(accessKey: "AKIA...", secret: "...")
let resolver = StaticAWSCredentialIdentityResolver(creds)

// Assume role - REQUIRES underlying resolver
let underlying = try DefaultAWSCredentialIdentityResolverChain()
let resolver = try STSAssumeRoleAWSCredentialIdentityResolver(
    awsCredentialIdentityResolver: underlying,
    roleArn: "arn:aws:iam::123456789012:role/MyRole",
    sessionName: "session-name"
)

// Use in config
let config = try await S3Client.S3ClientConfig(
    awsCredentialIdentityResolver: resolver,
    region: "us-west-2"
)
```

## Waiters

Import `SmithyWaitersAPI`. WaiterOptions requires `maxWaitTime` parameter:

```swift
import AWSS3
import SmithyWaitersAPI

let client = try await S3Client()
_ = try await client.waitUntilBucketExists(
    options: WaiterOptions(maxWaitTime: 120.0),
    input: HeadBucketInput(bucket: "my-bucket")
)
```

## Pagination

```swift
let input = ListObjectsV2Input(bucket: "my-bucket")
for try await page in client.listObjectsV2Paginated(input: input) {
    for object in page.contents ?? [] {
        print(object.key ?? "")
    }
}
```

## Presigned URLs

```swift
let url = try await client.presignedURLForGetObject(
    input: GetObjectInput(bucket: "my-bucket", key: "file.pdf"),
    expiration: 3600
)
```

## Common Operations

```swift
// Put object
_ = try await client.putObject(input: PutObjectInput(
    body: .data(data),
    bucket: "bucket",
    key: "key"
))

// Get object
let output = try await client.getObject(input: GetObjectInput(bucket: "bucket", key: "key"))
let data = try await output.body?.readData()

// List buckets
let response = try await client.listBuckets(input: ListBucketsInput())
for bucket in response.buckets ?? [] {
    print(bucket.name ?? "")
}
```

© aws · Apache-2.0 · aws/agent-toolkit-for-aws

Similar skills

Everything for Cloud: AWS, Azure, GCP →

From the same set133

creating-secrets-using-best-practices Walks the agent through creating an AWS Secrets Manager secret with a dedicated KMS key, a tight IAM policy and rotation. Useful when the secret is headed for production. CX Codex +1 6,700installs storing-and-querying-vectors A skill that walks the agent through Amazon S3 Vectors: create a vector bucket and index, put embeddings, run similarity search. CX Codex +1 6,600installs querying-data-lake A skill that runs SQL in Amazon Athena: it picks a workgroup, stops destructive statements for confirmation and reports what the query cost. CX Codex +1 6,600installs exploring-data-catalog Audits and inventories AWS Glue Data Catalog, S3 Tables, and Redshift-federated catalogs. Built for mapping account data assets in read-only mode. CX Codex +1 6,600installs finding-data-lake-assets Resolves data lake and lakehouse asset references across AWS Glue Data Catalog, S3, S3 Tables, and Redshift. Useful when you need to locate a table by keyword, column, or S3 path. CX Codex +1 6,500installs creating-data-lake-table Creates managed Iceberg tables in Amazon S3 Tables: bucket, namespace, schema, partitioning and access. Useful when data needs an analytics-ready home. CX Codex +1 6,500installs aws-amplify Skill for building and deploying full-stack apps with AWS Amplify Gen2. Configure auth, databases, storage, and AI via TypeScript code — supports React, Next.js, Vue, Flutter, and more. CX Codex +1 6,600installs ingesting-into-data-lake Moves data from S3 files, JDBC databases, DynamoDB, BigQuery, or Snowflake into AWS data lake tables. Defaults to S3 Tables or Iceberg and configures Glue jobs. CX Codex +1 6,600installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor