Skip to main content
skill CX Codex

aws-blocks — Claude Code skill: build backends from code

Guides your agent through AWS Blocks: picking Building Blocks, local development, deployment. Useful when the backend lives in an aws-blocks/ directory.

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

What aws-blocks does

AWS Blocks is an Infrastructure-from-Code framework. Each Building Block bundles CDK, SDK and local mocks behind one API, so the frontend gets typed imports with no client generation. The skill tells your agent which block fits the job: KVStore, DistributedTable, Database, AuthBasic, AuthCognito, Realtime, AsyncJob, FileBucket and more.

It triggers when you mention AWS Blocks, when the project has an aws-blocks/ directory, or when code imports @aws-blocks packages. Everything ships under that scope: @aws-blocks/core, @aws-blocks/blocks, @aws-blocks/bb-kv-store. Local work needs no AWS credentials, and mocks persist to .bb-data/. Scaffold a new app with npx @aws-blocks/create-blocks-app my-app, or run the same command with a dot to add AWS Blocks to an existing project.

ApiNamespace methods are unauthenticated by default, so every method that should not be public needs await auth.requireAuth(context). Keep secrets in new AppSetting(scope, id, { secret: true }) rather than .env files. For production, set CORS_ALLOWED_ORIGINS explicitly instead of wildcards, and leave blockPublicAccess on FileBucket alone — serve public files through CloudFront. WAF and API Gateway throttling are not part of the setup; add them through CDK.

What it helps with

  • pick the right Building Block for storage or auth
  • run local development without AWS credentials
  • guard a method with auth.requireAuth
  • move secrets out of .env into AppSetting
  • set CORS and monitoring before deploying

Example prompts for the agent

  • Add AWS Blocks to this project and sketch an API for a todo list
  • Which Building Block should I use for session storage — KVStore or DistributedTable?
  • Check my aws-blocks/ for methods missing auth.requireAuth

How to install aws-blocks

1Skills CLI (Vercel)

npx skills add aws/agent-toolkit-for-aws --skill aws-blocks -a claude-code

2Manually: put the files in place

~/.claude/skills/aws-blocks/SKILL.md

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

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

Questions about aws-blocks

How do I install aws-blocks in Claude?

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

What does the aws-blocks skill do?

It walks your agent through AWS Blocks development: choosing Building Blocks, building APIs, running local development and deploying the app.

Do I need AWS credentials for local development?

No. All Building Blocks run locally and mocks persist to .bb-data/. Credentials are only needed for deployment.

Source text

SKILL.md · Apache-2.0
---
name: aws-blocks
description: Guides building full-stack applications with AWS Blocks — an Infrastructure-from-Code framework. Applies when creating APIs, selecting Building Blocks (KVStore, DistributedTable, Database, AuthBasic, AuthCognito, Realtime, AsyncJob, FileBucket, etc.), running local development, or deploying AWS Blocks applications. Also covers AWS Blocks topics with validated, version-specific patterns that prevent common mistakes. Triggers when user mentions AWS Blocks; project has aws-blocks/ directory; code imports @aws-blocks packages.
---

# AWS Blocks Application Development

> **Package naming:** All packages are published under the `@aws-blocks` scope (e.g., `@aws-blocks/core`, `@aws-blocks/blocks`, `@aws-blocks/bb-kv-store`).

## Overview

AWS Blocks is an Infrastructure-from-Code framework where Building Blocks bundle CDK, SDK, and local mocks into a single API. It provides 18+ Building Blocks covering storage, authentication, real-time communication, background jobs, file management, AI/search, email, and observability — all working locally without AWS credentials.

**Key characteristics:**

- One `aws-blocks/` directory defines the entire backend
- Frontend imports are fully typed — no client generation needed
- All Building Blocks work locally without AWS (mocks persist to `.bb-data/`)
- Deploy ephemeral, individual testing environments with `npm run sandbox` and long-lived environments with `npm run deploy` using least-privilege credentials

## Scaffolding a New Project

```bash
npx @aws-blocks/create-blocks-app my-app
cd my-app
```

### To add AWS Blocks to an existing project:

```bash
npx @aws-blocks/create-blocks-app .
```

This detects the existing project and adds an `aws-blocks/` workspace alongside your code.

### To add AWS Blocks to an Amplify Gen 2 project:

```bash
npx @aws-blocks/create-blocks-app .
```

When the CLI detects `amplify/backend.ts`, it automatically integrates AWS Blocks with your Amplify backend.

### With a specific template:

```bash
npx @aws-blocks/create-blocks-app my-app --template demo
cd my-app
```

### Available Templates

| Template | Description |
|----------|-------------|
| `default` | Vite + lit-html starter app with basic authentication, data persistence, and realtime to help demonstrate basic app architecture and patterns (used when --template is omitted) |
| `bare` | Vite + lit-html starter with a single "hello world" API method and a bare frontend |
| `react` | React + Vite starter with a single API endpoint and typed React frontend |
| `backend` | Backend-only — no frontend, just the AWS Blocks API with a single endpoint |
| `demo` | Todo app with AuthBasic, KVStore, DistributedTable, Zod schemas, indexes, and auth-protected CRUD |
| `auth-cognito` | Full AuthCognito passwordless email-OTP with roles, device management, and Authenticator UI |
| `nextjs` | Next.js + React starter with AWS Blocks backend integration (SSR + Server Components) |

## Development Workflow

After scaffolding, refer to **node_modules/@aws-blocks/blocks/README.md** for the complete development workflow including:

- Core concepts (Architecture, Building Block selection)
- Project structure and Scope organization
- Error handling patterns
- Schema validation
- Local development
- Best practices and common mistakes
- Deployment IAM role setup and security guidance

When implementing a specific Building Block, read its package README for the detailed API reference (e.g., `node_modules/@aws-blocks/bb-kv-store/README.md`). These are the authoritative docs for your installed version.

## Security Considerations

- Use `await auth.requireAuth(context)` in every method that shouldn't be public — ApiNamespace methods are **unauthenticated by default**
- Use `new AppSetting(scope, id, { secret: true })` for API keys and credentials — never hardcode or use `.env` files
- Always attach a schema to KVStore/AppSetting that accepts user data — the RPC layer validates structure but not business logic
- Do not add broad `*` IAM policies — each Building Block already grants least-privilege scoped to its own resources
- Never change `blockPublicAccess` on FileBucket — serve public files through CloudFront instead
- Configure `CORS_ALLOWED_ORIGINS` explicitly for production — avoid wildcards
- For cross-domain deployments, pass `crossDomain: true` to auth constructors (enables `SameSite=None; Secure; Partitioned`)
- Enable `monitoring: { enabled: true, snsTopicArn: '...' }` on Hosting for production alerts
- Add WAF and API Gateway throttling via CDK for public-facing apps — not included by default
- Logger provides serialization safety (circular refs, type coercion) but does NOT redact sensitive content — never pass raw credentials, tokens, or secrets to Logger methods; sanitize context objects before logging

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

Similar skills

Everything for Cloud: AWS, Azure, GCP →

From the same set133

amazon-opensearch-service Guides migration, provisioning, vector search, log analytics, and distributed tracing across Amazon OpenSearch Service and Serverless. Works with AWS CLI and agent tools. CX Codex +1 5,500installs querying-aws-s3 A skill that answers S3 questions with Athena SQL: object counts, recent uploads and deletions, storage class breakdowns, tag lookups. CX Codex +1 5,500installs amazon-aurora-postgresql A skill that runs Aurora PostgreSQL chores from the chat: cluster creation, ACU sizing, commitment pricing, upgrades. Built for teams whose Postgres already lives in AWS. CX Codex +1 5,600installs amazon-elasticache This skill routes ElastiCache work from engine selection and setup to data modeling, GenAI caching, vector search, monitoring, and migration. CX Codex +1 5,400installs querying-aws-cloudwatch Runs SQL queries via Amazon Athena on CloudWatch logs exported as Apache Iceberg tables in S3 Tables. Useful for network traffic audits and incident investigations. CX Codex +1 5,500installs amazon-aurora-mysql A skill for Amazon Aurora MySQL clusters: creating and modifying them, sizing ACUs, evaluating storage, and planning version upgrades. CX Codex +1 5,200installs cloudfront A skill for Amazon CloudFront: decide when a CDN fits, manage certificates, lock down origins and restrict who sees your content. CX Codex +1 5,200installs processing-s3-uploads-with-step-functions Deploys an S3 upload flow that sends smaller files to Lambda and larger files to Fargate through Step Functions. CX Codex +1 5,000installs

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