aws-blocks
Skill0 starsChanged 8 days agoApache-2.0View on GitHub
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.
- Reads credentials
5 other projects use a version of this, 4 of them edited.
Adopted by
Most recently taken up by
- delorenj/skillsedited, first seen Nov 7, 2026
- thiago-shopper/claude-skillsedited, first seen Nov 1, 2026
- opensite-ai/opensite-skillsword for word, first seen Nov 1, 2026
- aws/agent-toolkit-for-awsedited, first seen Oct 13, 2026
- richardnroman/Synthetic-Data-Exchange-Licensing-Platformedited, first seen Jul 26, 2026
Other versions5 projects use a version of this.
Word for word · 1
- opensite-ai/opensite-skills★ 15100% same
Edited · 4
- aws/agent-toolkit-for-aws★ 3.5k99% same
- delorenj/skills★ 1799% same
- richardnroman/Synthetic-Data-Exchange-Licensing-Platform★ 099% same
- thiago-shopper/claude-skills★ 099% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- amazon-bedrockSkill
- aws-ai-mlSkill
- aws-authSkill
- aws-billing-and-cost-managementSkill
- aws-cdkSkill
- aws-cloudformationSkill
- aws-computeSkill
- aws-containersSkill
- aws-databaseSkill
- aws-deploymentSkill
- aws-iamSkill
- aws-investigationSkill
- aws-messaging-and-streamingSkill
- aws-networkingSkill
- aws-observabilitySkill
- aws-sdk-js-v3-usageSkill
- aws-sdk-python-usageSkill
- aws-sdk-swift-usageSkill
- aws-securitySkill
- aws-serverlessSkill
- aws-storageSkill
- aws-well-architected-reviewSkill
- launch-with-awsSkill
- signing-in-to-awsSkill
The file
We split this skill into the rules it gives an agent
11 rules. 3 are common, 0 are distinctive, and 8 are very specific to this project.
3
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
All Building Blocks work locally without AWS (mocks persist to .bb-data/)
- Very specific: line 40
Pitfall: do not import ... from '../aws-blocks/index.ts' in a script/test to call the API — that gives you the *server* definition object, …
- Very specific: line 83
When the CLI detects amplify/backend.ts, it automatically integrates AWS Blocks with your Amplify backend.
- Common: line 106
After scaffolding, refer to node_modules/@aws-blocks/blocks/README.md for the complete development workflow including:
- Very specific: line 115
When implementing a specific Building Block, read its package README for the detailed API reference (e.g., …
- Very specific: line 118
Use await auth.requireAuth(context) in every method that shouldn't be public — ApiNamespace methods are unauthenticated by default
- Very specific: line 119
Use new AppSetting(scope, id, { secret: true }) for API keys and credentials — never hardcode or use .env files
- Common: line 120
Always attach a schema to KVStore/AppSetting that accepts user data — the RPC layer validates structure but not business logic
- Very specific: line 121
Do not add broad * IAM policies — each Building Block already grants least-privilege scoped to its own resources
- Very specific: line 122
Never change blockPublicAccess on FileBucket — serve public files through CloudFront instead
- Common: line 126
Add WAF and API Gateway throttling via CDK for public-facing apps — not included by default
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AWS Blocks Application Development
Package naming: All packages are published under the
@aws-blocksscope (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 sandboxand long-lived environments withnpm run deployusing least-privilege credentials
Framework model (how a Blocks app fits together)
These are the load-bearing facts about how a Blocks app is wired. They prevent the most common agent mistakes; none are guessable from general React/Node/AWS knowledge.
Backend defines the API; the frontend imports it, fully typed. You write methods in
aws-blocks/index.tsand call them from the frontend:import { api, authApi } from 'aws-blocks'; const todos = await api.listTodos(); // typed, awaited callAt runtime that import resolves to an auto-generated client proxy (
aws-blocks/client.js), not the server module — the types come from your backend, the transport is injected. The JSON-RPC transport is invisible: never build request payloads by hand orfetch()the API directly (only for one-off connectivity troubleshooting). Just import the namespace and call the method.- Pitfall: do not
import ... from '../aws-blocks/index.ts'in a script/test to call the API — that gives you the server definition object, which behaves differently from the client. Import from'aws-blocks'(the package name).
Methods are namespaced
A call is always namespace.method(...) — e.g. api.createTodo(title), api.listTodos(). The namespace is the string you passed as the second argument to new ApiNamespace(scope, '<name>', …). A bare method name with no namespace will not resolve. (Auth is the same shape but pre-built: authApi exposes getAuthState/setAuthState — sign-up is authApi.setAuthState({ action: 'signUp', … }), not a bare signUp.)
Auth is a Building Block, not hand-rolled
Get the current user inside a method with await auth.requireAuth(context) (throws if unauthenticated). On the frontend, mount the ready-made UI from @aws-blocks/blocks/ui:
import { Authenticator, onAuthChange } from '@aws-blocks/blocks/ui';
authContainer.appendChild(Authenticator(authApi));
onAuthChange(authApi, (user) => { /* re-render for signed-in/out */ });Sign-up auto-confirms (no email round-trip) when the auth block is constructed without a codeDelivery callback. This is a local/dev convenience only — it accepts an account without verifying ownership of the email. For production, pass a codeDelivery callback so sign-up requires email verification.
How the deployed frontend reaches the backend
The deployed browser fetches /.blocks-sandbox/config.json at runtime to discover the API base ({"apiUrl":"/aws-blocks/api"}), which CloudFront proxies same-origin to API Gateway — no CORS to configure, no endpoint to hardcode. The "is the frontend wired to the backend?" check is curl <cloudfront-url>/.blocks-sandbox/config.json, not /config.json (which returns an S3 NoSuchKey). This is a public-facing surface: see Security Considerations below for the CloudFront security headers, requireAuth on mutating methods, explicit CORS_ALLOWED_ORIGINS, and the WAF / API Gateway throttling to add before exposing it in production.
Scaffolding a New Project
npx @aws-blocks/create-blocks-app my-app
cd my-appTo add AWS Blocks to an existing project:
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:
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:
npx @aws-blocks/create-blocks-app my-app --template demo
cd my-appAvailable 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.envfiles - 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
blockPublicAccesson FileBucket — serve public files through CloudFront instead - Configure
CORS_ALLOWED_ORIGINSexplicitly for production — avoid wildcards - For cross-domain deployments, pass
crossDomain: trueto auth constructors (enablesSameSite=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
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

