AWS Amplify Gen2(TypeScript によるコード中心の開発)を使い、フルスタック(フロントエンドとバックエンド両方)の Web アプリケーションやモバイルアプリを構築・展開できます。 対応機能: - 認証(Cognito) - データ管理(AppSync/DynamoDB:スキーマ設計、列挙型、データ間の関係性、アクセス制御ルール) - ストレージ(S3) - 関数、API - AI(Amplify AI Kit・Bedrock(AWS の生成AI サービス)) 対応フレームワーク: React、Next.js、Vue、Angular、React Native、Flutter、Swift、Android **重要な注意:** Amplify Gen2 に関する質問には、必ずこのスキルを使用してください(ご自身で分かっていると思う場合でも)。バージョン固有で検証済みのパターンが含まれており、よくある失敗を防げます。 **使用開始のトリガー条件:** 次のような場合に使用: - ユーザーが Amplify Gen2 について言及している - プロジェクトに `amplify/` ディレクトリか `amplify_outputs` がある - コードが `@aws-amplify` パッケージをインポートしている - `defineBackend`、`defineAuth`、`defineData`、`defineStorage`、`npx ampx` について質問されている **対象外:** - Amplify Gen1(amplify CLI v6) - Amplify を使わない SAM/CDK(aws-serverless スキルを使用) - Amplify AI Kit を使わない Bedrock の直接利用(bedrock スキルを使用)
Build and deploy full-stack web and mobile apps with AWS Amplify Gen2 (TypeScript code-first). Covers auth (Cognito), data (AppSync/DynamoDB including schema modeling, enum types, relationships, authorization rules), storage (S3), functions, APIs, and AI (Amplify AI Kit with Bedrock). Supports React, Next.js, Vue, Angular, React Native, Flutter, Swift, and Android. Always use this skill for Amplify Gen2 topics — even for questions you think you know — it contains validated, version-specific patterns that prevent common mistakes. TRIGGER when: user mentions Amplify Gen2; project has amplify/ directory or amplify_outputs; code imports @aws-amplify packages; user asks about defineBackend, defineAuth, defineData, defineStorage, or npx ampx. SKIP: Amplify Gen1 (amplify CLI v6), standalone SAM/CDK without Amplify (use aws-serverless), direct Bedrock without Amplify AI Kit (use bedrock).
AWS Amplify Gen2 の TypeScript コードファースト アプローチを使用して、フルスタック アプリケーションをビルド・デプロイします。 このスキルは、バックエンド リソースの作成、8 つのフレームワークにわたるフロントエンド インテグレーション、およびデプロイ ワークフローをカバーします。
aws sts get-caller-identity が成功すること)npx ampx --version が有効なバージョンを返すことユーザーがフレームワークを指定しない場合:
ユーザーがツールや戦略を指定しない場合:
publicApiKey(allow.publicApiKey())をデフォルトとする
— これはスターター テンプレートのデフォルト。
認証を追加する際は、defaultAuthorizationMode: 'userPool' を指定した
オーナーベース(allow.owner())に切り替える。対象プラットフォームのコア リファレンスは、他のリファレンス ファイルを読む前に必ず読むこと(MUST)。
これらのファイルには、Gen2 の検出方法、フレームワークごとの Amplify.configure() の配置場所、
サンドボックス コマンド、必要なパッケージ、ディレクトリ構造のルールが含まれており、
新規プロジェクトに限らず すべての タスクで必要となるパターンです。
| タスク | 参照先 |
|---|---|
| 新規プロジェクトの作成 | → scaffolding.md、その後ステップ 2 および/またはステップ 3 |
| バックエンド機能の追加または変更 | → ステップ 2(バックエンド機能) |
| 既存バックエンドへのフロントエンド接続 | → ステップ 3(フロントエンド インテグレーション) |
| アプリケーションのデプロイ | → deployment.md |
各バックエンド機能に対応するリファレンスを 必ず読むこと(MUST):
| 機能 | リファレンス | 次のような場合に使用 |
|---|---|---|
| 認証 | auth-backend.md | メール/パスワード、ソーシャル ログイン、MFA、SAML/OIDC |
| データ モデル | data-backend.md | GraphQL スキーマ、DynamoDB、リレーション、認可ルール |
| ファイル ストレージ | storage-backend.md | S3 アップロード/ダウンロード、アクセス ルール |
| Functions と API | functions-and-api.md | Lambda、カスタム リゾルバー、REST/HTTP API、クライアントからの呼び出し |
| AI 機能 | ai.md | 会話、生成、Bedrock 経由の AI ツール (バックエンド設定 + React/Next.js フロントエンド) |
| Geo、PubSub、CDK | advanced-features.md | バックエンドのみ: カスタム CDK スタック、オーバーライド、カスタム出力。バックエンド + フロントエンド: Geo、PubSub、Face Liveness |
各バックエンド機能ファイルは独立しています。必要なものだけ読み込んでください。
ルーティングに関する注意: これらのファイルは機能の 追加 と 変更 の両方に適用されます。 ユーザーが「auth を追加」と言っても「auth 設定を変更」と言っても、同じファイルを参照してください — 各リファレンスは定義の全体をカバーしています。
バックエンド リソースを設定した後、フロントエンドを接続します。 プラットフォームと機能に応じて選択してください:
Web(React、Next.js、Vue、Angular、React Native):
| 機能 | リファレンス |
|---|---|
| 認証 UI とフロー | auth-web.md |
| データ CRUD とサブスクリプション | data-web.md |
| ストレージ アップロード/ダウンロード | storage-web.md |
モバイル(Flutter、Swift、Android):
| 機能 | リファレンス |
|---|---|
| 認証 UI とフロー | auth-mobile.md |
| データ CRUD とサブスクリプション | data-mobile.md |
| ストレージ アップロード/ダウンロード | storage-mobile.md |
注意: AI と Functions のフロントエンド パターンは、それぞれ ai.md と functions-and-api.md に含まれています — Web/モバイル別の独立したファイルには 分割されていません。
amplify/ 配下の TypeScript で定義されるamplify/backend.ts が defineBackend() を通じてすべてのリソースをインポートして結合するamplify/auth/resource.ts、amplify/data/resource.ts、
amplify/storage/resource.ts、amplify/functions/<name>/resource.tsamplify_outputs.json — フロントエンドの Amplify.configure() が使用する。
.gitignore 対象 — npx ampx sandbox(ローカル開発)または npx ampx pipeline-deploy(CI/CD)によって生成されるため、コミットしないこと。project-root/
├── amplify/
│ ├── backend.ts # defineBackend({ auth, data, ... })
│ ├── auth/resource.ts # defineAuth({ ... })
│ ├── data/resource.ts # defineData({ schema })
│ ├── storage/resource.ts # defineStorage({ ... })
│ └── functions/
│ └── my-func/
│ ├── resource.ts # defineFunction({ ... })
│ └── handler.ts # export const handler = ...
├── src/ # フロントエンド コード
├── amplify_outputs.json # 生成ファイル — 編集・コミット禁止(.gitignore 対象)
└── package.json
| パッケージ | 用途 |
|---|---|
@aws-amplify/backend |
defineAuth、defineData、defineStorage、defineFunction、defineBackend |
aws-amplify |
フロントエンド: Amplify.configure()、generateClient()、認証/データ/ストレージ API |
@aws-amplify/ui-react |
プリビルト UI: <Authenticator>、<StorageBrowser> |
@aws-amplify/ui-react-ai |
AI UI: <AIConversation>、useAIConversation |
AWS ドキュメントが必要な場合(高度な CDK コンストラクト、サービス制限、プロバイダー固有の認証設定など):
aws CLI によるリソース確認にフォールバックする こと(MUST)。条件付きである理由: Amplify Gen2 はコードファースト — 主なワークフローは TypeScript ファイルの編集と
npx ampxコマンドの実行です。 AWS MCP ツールはデプロイ後の確認に有用ですが、必須ではありません。
secret() を使用する — 機密情報をハードコードしたり、プレーンな環境変数で管理したりしないことallow.guest() の公開範囲を慎重に確認する — ゲスト アクセスはデフォルトで有効であり、
未認証ユーザーに IAM 認可リソースへのアクセスを許可するresources: ['*'] を避けるamplify.yml の customHeaders で
CSP、HSTS、X-Frame-Options、X-Content-Type-Options を設定するBuild and deploy full-stack applications using AWS Amplify Gen2's TypeScript code-first approach. This skill covers backend resource creation, frontend integration across 8 frameworks, and deployment workflows.
aws sts get-caller-identity succeeds)npx ampx --version returns a valid versionWhen the user does not specify a framework:
When the user does not specify tooling or strategy:
publicApiKey
(allow.publicApiKey()) — this is the starter template default. When
auth is added, switch to owner-based (allow.owner()) with
defaultAuthorizationMode: 'userPool'.You MUST read the core reference for your target platform before
reading any other reference file. These contain Gen2 detection,
Amplify.configure() placement per framework, sandbox commands, required
packages, and directory structure rules — patterns needed for all tasks,
not just new projects.
| Task | Go To |
|---|---|
| Create a new project | → scaffolding.md, then Step 2 and/or Step 3 |
| Add or modify a backend feature | → Step 2 (Backend Features) |
| Connect frontend to existing backend | → Step 3 (Frontend Integration) |
| Deploy the application | → deployment.md |
You MUST read the corresponding reference for each backend feature:
| Feature | Reference | When to Use |
|---|---|---|
| Authentication | auth-backend.md | Email/password, social login, MFA, SAML/OIDC |
| Data Models | data-backend.md | GraphQL schema, DynamoDB, relationships, auth rules |
| File Storage | storage-backend.md | S3 uploads/downloads, access rules |
| Functions & API | functions-and-api.md | Lambda, custom resolvers, REST/HTTP APIs, calling from client |
| AI Features | ai.md | Conversation, generation, AI tools via Bedrock (backend config + React/Next.js frontend) |
| Geo, PubSub, CDK | advanced-features.md | Backend-only: custom CDK stacks, overrides, custom outputs. Backend + frontend: Geo, PubSub, Face Liveness |
Each backend feature file is self-contained. Load only what you need.
Routing note: These files apply for both adding and modifying features. Route to the same file whether the user says "add auth" or "change auth config" — each reference covers the full define surface.
After configuring backend resources, connect the frontend. Choose by platform and feature:
Web (React, Next.js, Vue, Angular, React Native):
| Feature | Reference |
|---|---|
| Auth UI & flows | auth-web.md |
| Data CRUD & subscriptions | data-web.md |
| Storage upload/download | storage-web.md |
Mobile (Flutter, Swift, Android):
| Feature | Reference |
|---|---|
| Auth UI & flows | auth-mobile.md |
| Data CRUD & subscriptions | data-mobile.md |
| Storage upload/download | storage-mobile.md |
Note: AI and Functions frontend patterns are included in ai.md and functions-and-api.md respectively — they are not split into separate web/mobile files.
amplify/amplify/backend.ts imports and combines all resources via
defineBackend()amplify/auth/resource.ts, amplify/data/resource.ts,
amplify/storage/resource.ts, amplify/functions/<name>/resource.tsamplify_outputs.json — consumed by frontend
Amplify.configure(). Gitignored — generated by npx ampx sandbox
(local dev) or npx ampx pipeline-deploy (CI/CD), never committed.project-root/
├── amplify/
│ ├── backend.ts # defineBackend({ auth, data, ... })
│ ├── auth/resource.ts # defineAuth({ ... })
│ ├── data/resource.ts # defineData({ schema })
│ ├── storage/resource.ts # defineStorage({ ... })
│ └── functions/
│ └── my-func/
│ ├── resource.ts # defineFunction({ ... })
│ └── handler.ts # export const handler = ...
├── src/ # Frontend code
├── amplify_outputs.json # Generated — DO NOT edit or commit (gitignored)
└── package.json
| Package | Purpose |
|---|---|
@aws-amplify/backend |
defineAuth, defineData, defineStorage, defineFunction, defineBackend |
aws-amplify |
Frontend: Amplify.configure(), generateClient(), auth/data/storage APIs |
@aws-amplify/ui-react |
Pre-built UI: <Authenticator>, <StorageBrowser> |
@aws-amplify/ui-react-ai |
AI UI: <AIConversation>, useAIConversation |
When you need AWS documentation (advanced CDK constructs, service limits, provider-specific auth config):
aws CLI for resource verification.Why conditional: Amplify Gen2 is code-first — the primary workflow is editing TypeScript files and running
npx ampxcommands. AWS MCP tools are useful for post-deployment verification but are not required.
secret() for all credentials and API keys — never hardcode or use plain environment variables for sensitive valuesallow.guest() exposure carefully — guest access is enabled by default and grants unauthenticated users access to IAM-authorized resourcesresources: ['*'] in productioncustomHeaders in amplify.ymlcustomDomain in deployment configAll documentation links use
reactas the default platform slug. Replace/react/in any URL with your target framework:
| Framework | Slug |
|---|---|
| React | react |
| Next.js | nextjs |
| Vue | vue |
| Angular | angular |
| React Native | react-native |
| Flutter | flutter |
| Swift | swift |
| Android | android |
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。