Get Custom Skill Sample Code
The Alexa Skills Kit provides several samples of custom skills written with the Alexa Skills Kit SDKs. You can deploy and test these samples as AWS Lambda functions on AWS Lambda, a service offering by Amazon Web Services.
The samples illustrate some specific concepts that are useful when designing and implementing Alexa skills, such as connecting to databases and other AWS services, and storing information between service invocations.
- Getting the source code for the samples
- Deploying and testing the samples
- Programming concepts
- Related topics
Getting the source code for the samples
The samples are available as GitHub repositories. You can fork a repository to your own GitHub account and clone it to your desktop, or just download a zip file of the entire repository from GitHub.
The repositories are in the Alexa GitHub organization. You can browse the organization for skill samples or search the organization for "skill sample". You can use the language filter to filter the search results by programming language.
The Alexa GitHub organization also contains the Alexa Skills Kit SDKs:
For samples for each of these SDKs, see the following:
- Sample code for the ASK SDK for Node.js
- Sample code for the ASK SDK for Java
- Sample code for the ASK SDK for Python
Deploying and testing the samples
For details about the ways to test a skill, including the skill samples, see Test Your Skill. In particular, see the following sections:
- Test and Debug Your Custom Skill
- Test Your Skill in the Developer Console
- Test Your Skill with the Alexa Simulator
- Test on an Alexa Device with Your Developer Account
The following table provides an index of specific coding concepts and the samples that illustrate them.
High Low Game skill
|Custom slot types||These types use a list of values that you define for the slot. You can use them for items that are not covered by Amazon's built-in set of types, and they are recommended for most use cases where a slot value is one of a set of possible values.||How To skill|
|Database storage||Your skill might need to persist data between sessions so that users can later resume from where they left off. The Alexa Skills Kit SDK for Node.js provides handling for persisting data using AWS DynamoDB.||High Low Game skill|
|Long-form audio||A skill can send the Alexa service directives to stream audio such as podcasts. For details, see the AudioPlayer Interface Reference.||Audio Player skill|
|Multi-stage conversation||A skill can manage a conversation with different stages, keeping track of which stage the user is in.||Trivia skill
Audio Player skill
|Multiple languages||A skill can support multiple languages. The Alexa Skills Kit SDK for Node.js provides built-in handling for including multiple translations of your skill's text-to-speech and returning the correct one based on the user's locale.||Trivia skill
How To skill
|Session state||When a user asks Alexa to perform an action that is mapped to a particular skill, this opens a new session. All requests from this user are directed to that skill until the session closes. Each request sent to the skill includes a flag that you can use to determine whether a session is new or existing, and you can use session attributes to save data with your response during the session. The Alexa Skills Kit SDK for Node.js provides handling for session state.||Trivia skill
High Low Game skill
Decision Tree skill