Get Custom Skill Sample Code


The Alexa Skills Kit provides sample code for 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 sample code illustrates some specific concepts that are useful when you design and implement Alexa skills, such as connecting to databases and other AWS services, and storing information between service invocations.

Getting the source code for the samples

The sample skills are available as GitHub repositories. You can fork a repository to your own GitHub account and clone it to your desktop, or download a zip file of the entire repository from GitHub.

The repositories are in the alexa-samples 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 contains the Alexa Skills Kit SDKs:

Deploy and test 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:

Programming concepts

The following table provides an index of specific coding concepts and the sample code that illustrate them.

Concept Description Sample code
NUMBER slots The NUMBER slot type converts numeric words into digits that you can then manipulate as numbers. Trivia skill
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
Fact 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
Fact skill

Sample code

The following sample code demonstrates a basic Hello World skill and other features of the ASK SDK:


Was this page helpful?

Last updated: Jan 26, 2024