PluginBench
Skill
Fail
Audit score 45

aws-sdk-swift-usage

aws/agent-toolkit-for-aws

How to install aws-sdk-swift-usage

npx skills add https://github.com/aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage
Claude Code
Cursor
Windsurf
Cline
Full instructions (SKILL.md)

Source of truth, from aws/agent-toolkit-for-aws.


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:

@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.

// 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
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):

    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

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:

import AWSS3
import SmithyWaitersAPI

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

Pagination

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

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

Common Operations

// 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 ?? "")
}

Related skills

More from aws/agent-toolkit-for-aws and the wider catalog.

AW

aws-iam

aws/agent-toolkit-for-aws

"Verified corrections for IAM behaviors that AI agents frequently get\

2.6k installsAudited
AW

aws-serverless

aws/agent-toolkit-for-aws

Builds, deploys, manages, debugs, configures, and optimizes serverless applications on AWS using Lambda, API Gateway, Step Functions, EventBridge, and SAM/CDK. Covers cold starts, CORS debugging, event source mappings, troubleshooting, concurrency, SnapStart, Powertools, function URLs, EventBridge Scheduler, Lambda layers, and production readiness. Triggers on mentions of Lambda, API Gateway, Step Functions, SAM templates, CDK serverless stacks, DynamoDB stream triggers, SQS event sources, cold starts, timeouts, 502/504 errors, throttling, concurrency, CORS, Powertools, or any event-driven architecture on AWS, even without the word "serverless." Does not apply to EC2, ECS/Fargate containers, or Amplify hosting.

2.4k installsAudited
AW

aws-cdk

aws/agent-toolkit-for-aws

Authors, deploys, and troubleshoots AWS infrastructure using CDK with TypeScript or Python. Covers best practices, stack architecture, and construct patterns. Always use when writing CDK constructs, bootstrapping environments, running cdk deploy/synth/diff, fixing CDK or CloudFormation errors, planning stack structure, importing existing resources, resolving drift, or refactoring stacks without resource replacement.

2.3k installsAudited
AW

aws-observability

aws/agent-toolkit-for-aws

Builds, configures, debugs, and optimizes AWS observability using CloudWatch (Logs Insights, Metrics, Alarms, Dashboards, EMF), X-Ray, CloudTrail, and ADOT. Covers Log Insights query syntax (fields, filter, stats, parse, pattern, join, subqueries), alarm configuration (metric, composite, anomaly detection, missing data treatment), dashboard design, custom metrics (PutMetricData, EMF, metric filters), X-Ray tracing (ADOT, sampling rules, annotations vs metadata), ADOT collector config, and CloudTrail auditing. Use when the user mentions CloudWatch, Log Insights, alarms, INSUFFICIENT_DATA, dashboards, custom metrics, EMF, X-Ray, traces, sampling, CloudTrail, who deleted, ADOT, OpenTelemetry, observability, monitoring, synthetics, canaries, or troubleshooting alarm behavior. Do NOT use for application logging setup, container log drivers, or security threat detection.

2.2k installsAudited
AM

amazon-bedrock

aws/agent-toolkit-for-aws

Builds generative AI applications on Amazon Bedrock. Covers model invocation (Converse API, InvokeModel), RAG with Knowledge Bases, Bedrock Agents, Guardrails, and AgentCore. Use when invoking models, setting up Knowledge Bases, creating agents, applying guardrails, deploying to AgentCore, troubleshooting Bedrock errors (ThrottlingException, AccessDeniedException), or choosing models (Claude, Llama, Nova, Titan). ALSO USE for prompt caching setup and debugging, quota health checks and throttling diagnosis, cost attribution and tracking, migrating between Claude model generations (4.5 to 4.6 to 4.7), chunking strategies, API selection (Converse vs InvokeModel), guardrail capabilities, and model selection. Also covers AgentCore Payments setup (x402, microtransactions, Payment Manager, Connector, Instrument, Coinbase CDP, Stripe Privy, 402 Payment Required, pay for content, paid endpoint, agent payments). NOT for custom model training, Rekognition, or Comprehend.

2.1k installs
AW

aws-billing-and-cost-management

aws/agent-toolkit-for-aws

|

2.1k installs