Agent Skills by ALSEL
汎用DevOps・インフラ⭐ リポ 2品質スコア 69/100

amazon-alexa

Amazon Alexaとの完全統合により、インテリジェント音声スキルを構築できます。Claude を脳として Alexa をアシスタントに変換するプロジェクト(Auri)に対応し、AWS エコシステム(Lambda、DynamoDB、Polly、Transcribe、Lex、Smart Home)との連携を実現します。

description の原文を見る

Integracao completa com Amazon Alexa para criar skills de voz inteligentes, transformar Alexa em assistente com Claude como cerebro (projeto Auri) e integrar com AWS ecosystem (Lambda, DynamoDB, Polly, Transcribe, Lex, Smart Home).

SKILL.md 本文

AMAZON ALEXA — Claudeを使ったインテリジェント音声

概要

Amazon Alexaとの完全統合により、インテリジェントな音声スキルの作成、Claudeをブレイン(Auriプロジェクト)としてAlexaを変換、AWSエコシステム(Lambda、DynamoDB、Polly、Transcribe、Lex、スマートホーム)との統合が可能です。

このスキルを使う場合

  • このドメイン領域で専門的なサポートが必要な場合

このスキルを使わない場合

  • タスクがAmazon Alexaと関連していない場合
  • より単純で具体的なツールでリクエストに対応できる場合
  • ユーザーがドメイン専門知識なしで汎用的なサポートが必要な場合

仕組み

あなたはAlexaおよびAWS音声のエキスパートです。ミッション: ClaudeをLLMバックエンドとして使用し、ニューラル音声、永続的なメモリ、 スマートホーム制御を備えた、超インテリジェントなアシスタントに あらゆるAlexaデバイスを変換すること。キープロジェクト: AURI。


1. エコシステムの概要

[Alexa Device] → [Alexa Cloud] → [AWS Lambda] → [Claude API]
    音声          音声認識         ロジック       インテリジェンス
      ↑               ↑               ↑                ↑
   ユーザー        インテント      ハンドラー     Anthropic
                               + DynamoDB
                               + Polly TTS
                               + APL Visual

Auriアーキテクチャのコンポーネント

コンポーネントAWSサービス機能
音声 → テキストAlexa ASRネイティブ音声認識
NLUASK Interaction Model + Lex V2インテントとスロットの抽出
バックエンドAWS Lambda (Python/Node.js)ロジックとオーケストレーション
LLMClaude API (Anthropic)インテリジェンスと応答
永続化Amazon DynamoDB履歴と設定
テキスト → 音声Amazon Polly (ニューラル)Auriの自然な音声
ビジュアルインターフェースAPL (Alexa Presentation Language)Echo Showのスクリーン
スマートホームAlexa Smart Home APIデバイス制御
オートメーションAlexa Routines APIインテリジェントなルーチン

2.1 前提条件


## Ask Cli

npm install -g ask-cli
ask configure

## Aws Cli

pip install awscli
aws configure

テンプレートでスキルを作成

ask new
--template hello-world
--skill-name auri
--language pt-BR

└── .Ask/Ask-Resources.Json


## 2.3 呼び出し名の設定

`models/pt-BR.json`ファイルにて:
```json
{
  "interactionModel": {
    "languageModel": {
      "invocationName": "auri"
    }
  }
}

3.1 Auriの必須インテント

{
  "interactionModel": {
    "languageModel": {
      "invocationName": "auri",
      "intents": [
        {"name": "AMAZON.HelpIntent"},
        {"name": "AMAZON.StopIntent"},
        {"name": "AMAZON.CancelIntent"},
        {"name": "AMAZON.FallbackIntent"},
        {
          "name": "ChatIntent",
          "slots": [{"name": "query", "type": "AMAZON.SearchQuery"}],
          "samples": [
            "{query}",
            "me ajuda com {query}",
            "quero saber sobre {query}",
            "o que voce sabe sobre {query}",
            "explique {query}",
            "pesquise {query}"
          ]
        },
        {
          "name": "SmartHomeIntent",
          "slots": [
            {"name": "device", "type": "AMAZON.Room"},
            {"name": "action", "type": "ActionType"}
          ],
          "samples": [
            "{action} a {device}",
            "controla {device}",
            "acende {device}",
            "apaga {device}"
          ]
        },
        {
          "name": "RoutineIntent",
          "slots": [{"name": "routine", "type": "RoutineType"}],
          "samples": [
            "ativa rotina {routine}",
            "executa {routine}",
            "modo {routine}"
          ]
        }
      ],
      "types": [
        {
          "name": "ActionType",
          "values": [
            {"name": {"value": "liga", "synonyms": ["acende", "ativa", "liga"]}},
            {"name": {"value": "desliga", "synonyms": ["apaga", "desativa", "desliga"]}}
          ]
        },
        {
          "name": "RoutineType",
          "values": [
            {"name": {"value": "bom dia", "synonyms": ["acordar", "manhã"]}},
            {"name": {"value": "boa noite", "synonyms": ["dormir", "descansar"]}},
            {"name": {"value": "trabalho", "synonyms": ["trabalhar", "foco"]}},
            {"name": {"value": "sair", "synonyms": ["saindo", "goodbye"]}}
          ]
        }
      ]
    }
  }
}

4.1 Pythonメインハンドラー

import os
import time
import anthropic
import boto3
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.handler_input import HandlerInput
from ask_sdk_core.utils import is_intent_name, is_request_type
from ask_sdk_model import Response
from ask_sdk_dynamodb_persistence_adapter import DynamoDbPersistenceAdapter

## ============================================================

@sb.request_handler(can_handle_func=is_request_type("LaunchRequest"))
def launch_handler(handler_input: HandlerInput) -> Response:
    attrs = handler_input.attributes_manager.persistent_attributes
    name = attrs.get("name", "")
    greeting = f"Oi{', ' + name if name else ''}! Eu sou a Auri. Como posso ajudar?"
    return (handler_input.response_builder
            .speak(greeting).ask("Em que posso ajudar?").response)


@sb.request_handler(can_handle_func=is_intent_name("ChatIntent"))
def chat_handler(handler_input: HandlerInput) -> Response:
    try:
        # Obter query
        slots = handler_input.request_envelope.request.intent.slots
        query = slots["query"].value if slots.get("query") else None
        if not query:
            return (handler_input.response_builder
                    .speak("Pode repetir? Nao entendi bem.").ask("Pode repetir?").response)

        # Carregar historico
        attrs = handler_input.attributes_manager.persistent_attributes
        history = attrs.get("history", [])

        # Montar mensagens para Claude
        messages = history[-MAX_HISTORY:]
        messages.append({"role": "user", "content": query})

        # Chamar Claude
        client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
        response = client.messages.create(
            model=CLAUDE_MODEL,
            max_tokens=512,
            system=AURI_SYSTEM_PROMPT,
            messages=messages
        )
        reply = response.content[0].text

        # Truncar para nao exceder timeout
        if len(reply) > MAX_RESPONSE_CHARS:
            reply = reply[:MAX_RESPONSE_CHARS] + "... Quer que eu continue?"

        # Salvar historico
        history.append({"role": "user", "content": query})
        history.append({"role": "assistant", "content": reply})
        attrs["history"] = history[-50:]  # Manter ultimas 50
        handler_input.attributes_manager.persistent_attributes = attrs
        handler_input.attributes_manager.save_persist

## 4.2 Lambda環境変数

ANTHROPIC_API_KEY=sk-... (Secrets Managerに保存) DYNAMODB_TABLE=auri-users AWS_REGION=us-east-1


## 4.3 Requirements.Txt

ask-sdk-core>=1.19.0 ask-sdk-dynamodb-persistence-adapter>=1.19.0 anthropic>=0.40.0 boto3>=1.34.0


---

## 5.1 テーブルの作成

```bash
aws dynamodb create-table \
  --table-name auri-users \
  --attribute-definitions AttributeName=userId,AttributeType=S \
  --key-schema AttributeName=userId,KeyType=HASH \
  --billing-mode PAY_PER_REQUEST \
  --region us-east-1

5.2 ユーザースキーマ

{
  "userId": "amzn1.ask.account.XXXXX",
  "name": "Joao",
  "history": [
    {"role": "user", "content": "..."},
    {"role": "assistant", "content": "..."}
  ],
  "preferences": {
    "language": "pt-BR",
    "voice": "Vitoria",
    "personality": "assistente profissional"
  },
  "smartHome": {
    "devices": {},
    "routines": {}
  },
  "updatedAt": 1740960000,
  "ttl": 1748736000
}

5.3 自動TTL(古いデータを期限切れにする)

import time

## 保存時に180日のTTLを追加

attrs["ttl"] = int(time.time()) + (180 * 24 * 3600)

6.1 利用可能な音声(ポルトガル語)

音声言語タイプ推奨
Vitoriapt-BRニューラル✅ Auri PT-BR
Camilapt-BRニューラル代替案
Ricardopt-BRStandard男性
Inespt-PTニューラルポルトガル

6.2 レスポンスへのPolly統合

import boto3
import base64

def synthesize_polly(text: str, voice_id: str = "Vitoria") -> str:
    """Pollyオーディオ URLを返してAlexaで使用します。"""
    client = boto3.client("polly", region_name="us-east-1")
    response = client.synthesize_speech(
        Text=text,
        OutputFormat="mp3",
        VoiceId=voice_id,
        Engine="neural"
    )
    # S3に保存してURLを返す
    # (Alexaでカスタムオーディオを使用するために必要)
    return upload_to_s3(response["AudioStream"].read())

def speak_with_polly(handler_input, text, voice_id="Vitoria"):
    """カスタムPolly音声を使用してSSML経由で応答を返す。"""
    audio_url = synthesize_polly(text, voice_id)
    ssml = f'<speak><audio src="{audio_url}"/></speak>'
    return handler_input.response_builder.speak(ssml)

6.3 音声制御用のSSML

<speak>
  <prosody rate="90%" pitch="+5%">
    Oi! Eu sou a Auri.
  </prosody>
  <break time="0.5s"/>
  <emphasis level="moderate">Como posso ajudar?</emphasis>
</speak>

7.1 チャットテンプレート

{
  "type": "APL",
  "version": "2023.3",
  "theme": "dark",
  "mainTemplate": {
    "parameters": ["payload"],
    "items": [{
      "type": "Container",
      "width": "100%",
      "height": "100%",
      "backgroundColor": "#1a1a2e",
      "items": [
        {
          "type": "Text",
          "text": "AURI",
          "fontSize": "32px",
          "color": "#e94560",
          "textAlign": "center",
          "paddingTop": "20px"
        },
        {
          "type": "Text",
          "text": "${payload.lastResponse}",
          "fontSize": "24px",
          "color": "#ffffff",
          "padding": "20px",
          "maxLines": 8,
          "grow": 1
        },
        {
          "type": "Text",
          "text": "Diga algo para continuar...",
          "fontSize": "18px",
          "color": "#888888",
          "textAlign": "center",
          "paddingBottom": "20px"
        }
      ]
    }]
  }
}

7.2 レスポンスにAPLを追加

@sb.request_handler(can_handle_func=is_intent_name("ChatIntent"))
def chat_with_apl(handler_input: HandlerInput) -> Response:
    # ... Claudeからreplyを取得 ...

    # デバイスがAPLをサポートしているかチェック
    supported = handler_input.request_envelope.context.system.device.supported_interfaces
    has_apl = getattr(supported, "alexa_presentation_apl", None) is not None

    if has_apl:
        apl_directive = {
            "type": "Alexa.Presentation.APL.RenderDocument",
            "token": "auri-chat",
            "document": CHAT_APL_DOCUMENT,
            "datasources": {"payload": {"lastResponse": reply}}
        }
        handler_input.response_builder.add_directive(apl_directive)

    return handler_input.response_builder.speak(reply).ask("Mais alguma coisa?").response

8.1 スマートホームスキルの有効化

skill.jsonに以下を追加:

{
  "apis": {
    "smartHome": {
      "endpoint": {
        "uri": "arn:aws:lambda:us-east-1:123456789:function:auri-smart-home"
      }
    }
  }
}

8.2 スマートホームハンドラー

def handle_smart_home_directive(event, context):
    namespace = event["directive"]["header"]["namespace"]
    name = event["directive"]["header"]["name"]
    endpoint_id = event["directive"]["endpoint"]["endpointId"]

    if namespace == "Alexa.PowerController":
        state = "ON" if name == "TurnOn" else "OFF"
        # スマートホームAPIを呼び出す
        control_device(endpoint_id, {"power": state})
        return build_smart_home_response(endpoint_id, "powerState", state)

    elif namespace == "Alexa.BrightnessController":
        brightness = event["directive"]["payload"]["brightness"]
        control_device(endpoint_id, {"brightness": brightness})
        return build_smart_home_response(endpoint_id, "brightness", brightness)

8.3 デバイスの検出

def handle_discovery(event, context):
    return {
        "event": {
            "header": {
                "namespace": "Alexa.Discovery",
                "name": "Discover.Response",
                "payloadVersion": "3"
            },
            "payload": {
                "endpoints": [
                    {
                        "endpointId": "light-sala-001",
                        "friendlyName": "Luz da Sala",
                        "displayCategories": ["LIGHT"],
                        "capabilities": [
                            {
                                "type": "AlexaInterface",
                                "interface": "Alexa.PowerController",
                                "version": "3"
                            },
                            {
                                "type": "AlexaInterface",
                                "interface": "Alexa.BrightnessController",
                                "version": "3"
                            }
                        ]
                    }
                ]
            }
        }
    }

デプロイ完全ガイド(スキル+ Lambda)

cd auri/ ask deploy

ステータス確認

ask status

シミュレーターでテスト

ask dialog --locale pt-BR

インテント固有テスト

ask simulate
--text "abrir auri"
--locale pt-BR
--skill-id amzn1.ask.skill.YOUR-SKILL-ID


## Lambdaを手動作成

aws lambda create-function \
  --function-name auri-skill \
  --runtime python3.11 \
  --role arn:aws:iam::ACCOUNT:role/auri-lambda-role \
  --handler lambda_function.handler \
  --timeout 8 \
  --memory-size 512 \
  --zip-file fileb://function.zip

## Alexaトリガーを追加

aws lambda add-permission \
  --function-name auri-skill \
  --statement-id alexa-skill-trigger \
  --action lambda:InvokeFunction \
  --principal alexa-appkit.amazon.com \
  --event-source-token amzn1.ask.skill.YOUR-SKILL-ID

Secrets Managerの使用

aws secretsmanager create-secret
--name auri/anthropic-key
--secret-string '{"ANTHROPIC_API_KEY": "sk-..."}'

Lambda SDKでアクセス:

import boto3, json def get_secret(secret_name): client = boto3.client('secretsmanager') response = client.get_secret_value(SecretId=secret_name) return json.loads(response['SecretString'])


---

## フェーズ1 — セットアップ(1日目)

[ ] Amazon Developer アカウント作成完了 [ ] AWS アカウント設定済み(フリーティア) [ ] ASK CLI インストール・設定完了 [ ] IAM ロール作成済み(権限: Lambda、DynamoDB、Polly、Logs) [ ] Anthropic API キーを Secrets Manager に保存済み


## フェーズ2 — ベーススキル(2~3日目)

[ ] ask new --template hello-world --skill-name auri 実行 [ ] インタラクションモデル定義済み(pt-BR.json) [ ] LaunchRequest ハンドラー動作確認 [ ] ChatIntent ハンドラーと Claude 統合 [ ] ask deploy 動作確認 [ ] ASK シミュレーターで基本テスト完了


## フェーズ3 — 永続化(4日目)

[ ] DynamoDB テーブル作成済み [ ] 履歴の永続化動作確認 [ ] TTL 設定完了 [ ] ユーザー設定が保存される


## フェーズ4 — Polly + APL(5~6日目)

[ ] Polly 統合済み(Vitoria ニューラル音声) [ ] APL チャットテンプレート作成完了 [ ] Echo Show シミュレーターで APL 動作確認


## フェーズ5 — スマートホーム(オプション)

[ ] スマートホームスキル有効化済み [ ] デバイス検出動作確認 [ ] PowerController 実装完了 [ ] 実デバイスでテスト完了


## フェーズ6 — パブリッシュ

[ ] すべての機能を完全テスト [ ] パフォーマンス確認(< 8s タイムアウト) [ ] Amazon 認定をサブミット [ ] Alexa Skills Store で公開


---

## 11. クイックコマンド

| アクション | コマンド |
|------|---------|
| スキル作成 | `ask new --template hello-world` |
| デプロイ | `ask deploy` |
| シミュレート | `ask simulate --text "abre a auri"` |
| 対話的ダイアログ | `ask dialog --locale pt-BR` |
| ログ表示 | `ask smapi get-skill-simulation` |
| モデル検証 | `ask validate --locales pt-BR` |
| スキルエクスポート | `ask smapi export-package --skill-id ID` |
| スキル一覧 | `ask list skills` |

---

## 12. リファレンス

- Python 完全テンプレート: `assets/boilerplate/lambda_function.py`
- インタラクションモデル PT-BR: `assets/interaction-models/pt-BR.json`
- APL チャットテンプレート: `assets/apl-templates/chat-interface.json`
- スマートホーム例: `references/smart-home-api.md`
- ASK SDK Python ドキュメント: https://github.com/alexa/alexa-skills-kit-sdk-for-python
- Claude + Alexa ガイド: https://www.anthropic.com/news/claude-and-alexa-plus

## ベストプラクティス

- プロジェクトの要件について明確で具体的なコンテキストを提供する
- すべての提案をプロダクション コードに適用する前に確認する
- 包括的な分析のために他の補完的なスキルと組み合わせる

## よくある落とし穴

- このスキルをドメイン専門知識外のタスクに使用する
- 特定のコンテキストを理解せずに推奨事項を適用する
- 正確な分析のための十分なプロジェクトコンテキストを提供していない

ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ

詳細情報

作者
JantonioFC
リポジトリ
JantonioFC/skillsbank
ライセンス
MIT
最終更新
2026/5/9

Source: https://github.com/JantonioFC/skillsbank / ライセンス: MIT

本サイトは GitHub 上で公開されているオープンソースの SKILL.md ファイルをクロール・インデックス化したものです。 各スキルの著作権は原作者に帰属します。掲載に問題がある場合は info@alsel.co.jp または /takedown フォームよりご連絡ください。
原作者: JantonioFC · JantonioFC/skillsbank · ライセンス: MIT