Get Started with the ASK Toolkit for Visual Studio Code
The ASK toolkit is an extension for Visual Studio Code (VS Code) that makes it easier for you to develop and deploy Alexa skills. It provides features like code snippet generation, JSON schema validation, and discoverability of features via the Command Palette in VS Code.
The ASK toolkit uses the ASK Command Line Interface (CLI). Commands initiated from within the toolkit call the appropriate ASK CLI commands. In VS Code, the integrated terminal shows the CLI command being called, the output from executing the command, and prompts for user input.
Setup
Prerequisites
-
To use the Alexa templates, download Git and install it.
-
Download VS Code (recommend version 1.22.0) and install it.
-
Download and configure ASK CLI (recommend version 1.4.0). For more information, watch the video and see the documentation for getting started with ASK CLI.
-
(Optional and recommended) Use AWS Lambda to host the backend business logic for your skill. Watch the video and see the documentation for configuring your AWS credentials.
Install the ASK toolkit in VS Code
Consider the following options for installing the ASK toolkit.
-
Install the toolkit by visiting the VS Code marketplace.
-
In VS Code, from the View menu, select Extensions to open the Extensions view. In the search box, type Alexa Skills Kit (ASK) toolkit.
Once you install the toolkit, click Reload. In some cases, you may also need to restart VS Code.
For more information about VS Code extensions, see the VS Code documentation.
Quick start
Step 1: Create a new skill or clone an existing skill
Get started by creating a new skill or by cloning and existing skill.
- To open the Command Palette, from the View menu, select Command Palette. Alternatively, on Windows and Linux, use Ctrl + Shift + P, and on a Mac, Shift + Command + P.
- To see the available commands in the ASK toolkit, in the text box, type ASK.
-
To create a new skill from a template, select
ASK: Create a skill from a template, and then choose from the list of templates.–Or–
To clone an existing skill, select
ASK: Clone a skill. The integrated terminal shows a list of skills that you can clone.
Depending on the skill you created or cloned, the following is the folder structure.
.askfolder, which contains the config file for your skill.modelsfolder, which contains JSON files describing the interaction models.lambdafolder, which is optional and contains the business logic of your skill. For more information, see how to host a custom skill as an AWS Lambda function.skill.json, which is the skill manifest file.
Step 2: Add a code snippet
The toolkit provides code snippet generation for frequently used skill components.
In your model file, for example model/en-US.json, type askModel to show all built-in intents. Select an intent and then press the TAB key to generate the code snippet. To create a blank custom intent, type askModel and then select askModelCustomIntent.
To insert a snippet for an intent handler based on the ASK SDK for Node.js, type askSDK in the JavaScript (.js) file that contains your business logic code.
Step 3: Deploy the skill
You can choose to deploy your entire skill package or parts of your skill. At the Command Palette, see the options by typing ASK: Deploy.
To deploy a specific resource, in the explorer tree view, right-click on the resource. For example, if you right-click the skill.json file, there is an option to Deploy the skill manifest. If you right-click on the lambda folder, there is an option to Deploy to AWS Lambda.
Alternatively, you can use Deploy button on the status bar to deploy a specific resource or entire skill, depending on the settings for the extension. For information about settings, see the 'Configure the toolkit' section in this document.
Step 4: Test the skill
Once you have deployed your skill, you can start testing it on your Alexa-enabled device. You can also use the Alexa Simulator, which is in the developer console on the Test page. To open the developer console, from the Command Palette select ASK: Open the Alexa developer console in the browser.
Next steps
Explore more commands
The toolkit provides access to commands available in the ASK CLI. You can explore commands by opening the Command Palette and typing ASK: More, and then select from the list of commands in the secondary menu.
See the command mapping for ASK toolkit and ASK CLI to understand how the toolkit commands map to the underlying ASK CLI commands.
Enable or disable the toolkit
To disable or enable the toolkit, or to turn on automatic updates, see the VS Code documentation on managing extensions.
Configure the toolkit (optional)
You can configure the toolkit by updating settings in VS Code.
To open settings, on Windows or Linux, from the File menu, select Preferences, and then select Settings. On a Mac, from the Code menu, select Preferences, and then select Settings. For more information, see the VS Code documentation for user and workspace settings.
You can configure the following:
- To specify the ASK CLI profile that the ASK toolkit uses by default, for
"ask.profile", specify the name of the profile that you want to use. For example, in the JSON, type "ask.profile": "profile_name" where profile_name is the name of your profile. - To change the default settings for deployment, for
"ask.defaultDeployResource", specify"all","skill","model","lambda"or"isp". For example, in the JSON, type "ask.defaultDeployResource": "all". - To use the content in the active window as the reference for commands that require file input, for
"ask.doesUseCurrentActivewindowContent"specifytrue. For example, in the JSON, type "ask.doesUseCurrentActivewindowContent": true. - To set the default stage for commands where stage is required, for
"ask.granularCommandDefaultStage"specify"development"or"live". For example, in the JSON, type "ask.granularCommandDefaultStage": "development". - To read the skill ID from the .ask/config file for commands that require the skill ID, for
"ask.shouldUseSkillIdFoundInCurrentWorkspace"specifytrue. For example, in the JSON, type "ask.shouldUseSkillIdFoundInCurrentWorkspace": true.
Command mapping for ASK toolkit and ASK CLI
| Command in toolkit | Underlying CLI command |
|---|---|
| ASK: Clone a skill | |
| ASK: Create a basic skill package | |
| ASK: Create a skill from a template | |
| ASK: Deploy the skill | |
| ASK: Deploy the in-skill product (ISP) | |
| ASK: Deploy the interaction model(s) | |
| ASK: Deploy to AWS Lambda | |
| ASK: Deploy the skill manifest | |
| ASK: Initialize / Configure the ASK CLI | |
| ASK: More commands (low-level commands) | Shows another list with all the additional commands in the command palette (See table below) |
| ASK: Open the Alexa developer console in the browser | Opens the Alexa developer console page in the browser |
| ASK: Open the help documentation in the browser | Opens the ASK CLI documentation in the browser |
| ASK: Simulate the skill | |
| ASK: Delete a skill | |
| ASK: Get AWS Lambda logs from AWS CloudWatch |
"ask lambda log" – only runs if you have configured AWS credentials with the CLI and use AWS Lambda as your endpoint |
| ASK: List the differences between local and remote version of skill resources |
| Command in toolkit (Secondary menu under ASK: More commands (low-level commands) >) | Underlying CLI command |
|---|---|
| Skill - Enable a skill | |
| Model - Get an interaction model for skill | |
| Model - Get the ETag associated with an interaction model | |
| Model - Create/update the new interaction model for skill | |
| Skill - Create a skill base on the skill manifest | |
| Skill - Get the skill manifest | |
| Skill - Update the skill manifest | |
| Skill - List skills based on Vendor ID and chosen profile | |
| Skill - Get the skill status | |
| Skill - Get account linking configuration for a skill | |
| Skill - Delete account linking configuration for a skilll | |
| Skill - List the vendorId associated with your developer account | |
| Skill - Submit a skill for certification | |
| Skill - Withdraw a skill from the certification process | |
| Simulate - Simulate a skill | |
| Simulate - Get the simulate result | |
| Simulate - Invoke a skill | |
| Skill - Vaildate a skill | |
| Skill - Get the skill validation result | |
| Skill - Grant/Add access to a private skill for the account | |
| Skill - Revoke/Delete access to a private skill from the account | |
| Skill - List all accounts that the skill have been privately distributed | |
| Skill - Disable a skill | |
| Skill - Get skill enablement information | |
| ISP - Create an in-skill product | |
| ISP - Update an in-skill product | |
| ISP - Associate an in-skill product with a skill | |
| ISP - Disassociate an in-skill product from a skill | |
| ISP - Get the definition or summary for an in-skill product | |
| ISP - List the in-skill product for a vendor | |
| ISP - List the in-skill product that are associated with a skill | |
| ISP - List the skills that are associated with an in-skill product | |
| ISP - Reset an in-skill product | |
| ISP - Delete an in-skill product | |
| Skill - Get "utterance transcripts"/ ”intent requests history" for a skill | |
| Skill - Delete a skill | |
| AWS Lambda - Get AWS Lambda logs from AWS CloudWatch |