My name is Thomas Desmond: Full Stack Developer, Speaker, Educator, & Author.

Month: February 2017

The Components that Make Up an Alexa Skill

This post will give the big picture of the components that make up an Amazon Alexa Skill. It will contain next to no code. But will introduce you to the pieces and terminology used in the Alexa world.

First, let us start what an Alexa skill is. The skill is essentially an action or function that your Amazon Echo device will perform. A skill is invoked by asking Alexa a specific phrase.

Examples of skills would be

  • Alexa, what is the weather today?
  • Alexa, where is my stuff?
  • Alexa, will it rain today?

At a very high level, each of these phrases invokes a skill where Alexa will parse the words. The words are then sent to a predetermined function (set of code) in the cloud-based on what the phrase was, the function performs a series of actions, then a result is returned back to your Echo device. This high-level flow is the same for all skills. Let’s dive in and get into the details of how this process works.


The main components that makeup Alexa Skill:

  • Utterances
  • Intent Schema
  • AWSLambda

Utterances (text)

As I said above you have to speak a specific phrase to your Echo device in order to invoke the skill. These phrases are called utterances. Utterances are contained in a simple text file. They are the phrases that Alexa is on the lookout for and if she recognizes a user’s phrase as an utterance she knows what action to perform.

AddIntent what is 2 plus 2
AddIntent add 2 and 2

SubtractIntent what is 5 minus 2
SubtractIntent subtract 5 and 2

The first words you see AddIntent and SubtractIntent are individual intents within a skill. Skills can have more than one intent. And in the case above it has two intents. Essentially an add and subtract. Right now the skill is extremely basic and only capable of recognizing the above hard-codes phrases.

So that is very basic and we want our users to be able to add and subtract any whole numbers. For that, we need to tell Alexa to expect any number. We do that by still using our utterances but also combining that with and intentSchema file. Here is an example of an utterances file allowing for the addition of any two whole numbers.

AddIntent what is {firstNumber} plus {secondNumber}
AddIntent add {firstNumber} and {secondNumber}

SubtractIntent what is {firstNumber} minus {secondNumber}
SubtractIntent subtract {firstNumber} and {secondNumber}

Our utterances text file now contains placeholders instead of hardcoded values, great! But how is Alexa supposed to make sense of {firstNumber} and {secondNumber}? That is where the intentSchema JSON file comes in.

Intent Schema (JSON)

The intentSchema provides meaning to our variables. Instead of variables, amazon calls them slots so I will refer to them as such. Each slot is filled by whatever the user says. If the user asked, “What is 10 plus 5”. Alexa would know that 10 refers to firstNumber and 5 refers to secondNumber.

Here is an example intentSchema.json file.

    "intents": [{
		"intent": "AddIntent",
		"slots": [{
			"name": "firstNumber",
			"type": "AMAZON.NUMBER"
		}, {
			"name": "secondNumber",
			"type": "AMAZON.NUMBER"
	}, {
		"intent": "SubtractIntent",
		"slots": [{
			"name": "firstNumber",
			"type": "AMAZON.NUMBER"
		}, {
			"name": "secondNumber",
			"type": "AMAZON.NUMBER"

By using the utterances.txt and intentSchema.json together our Echo device is capable of understanding whatever number a user says. Alexa knows to expect any potential number in our slot firstNumber and secondNumber because we match the same name and give it an Amazon.Number type.

I do not want to get too detailed right now into the intentSchema files but they are a powerful method for gathering dynamic user input for your skill. Expect more posts in the future getting into the more powerful aspects of the intentSchema file.

Amazon AWS Lambda

Now that we have Alexa understanding what a user says. We need to tie that together with our function in the cloud to actually do some processing based on what the user said. We create an AWS Lambda function for this.


“AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of the Amazon Web Services. It is a compute service that runs code in response to events and automatically manages the compute resources required by that code.”

The lambda function is connected to our particular skill so the event that causes it to fire is the user says a specific utterance that Alexa was expecting. Alexa creates a JSON object based on the user’s phrase, the lambda function performs actions on data inside of the JSON object, and last it creates a JSON object of its own to send back to Alexa as a response. It is your responsibility as the developer to write a lambda function to do the processing and creation of the JSON object to send back to Alexa.

This JSON object sent back to Alexa will contain the response for Alexa to repeat back to the user. This whole process happens very quickly. As long as your lambda function is efficient and does not need to do a lot of computing you should be able to get your response back within a second.

Currently, functions for AWS Lambda can be written in Node.js (JavaScript), Python, and Java (Java 8 compatible), as well as C#. Also, it is very noteworthy to know that as of right now Alexa skills can only be hosted on US East (N. Virginia) and EU (Ireland) regions. Lambda functions for other purposes can be hosted in many other regions but if you are creating one to be used with an Alexa skill it must be hosted in one of the mentioned regions.

To bring it all together there are three major pieces that make up an Alexa skill. We have the utterances, intentSchema, and the AWS Lambda function. Expect a more technical guide very soon on how to create your own Alexa Skill. If anything confused you in this article feel free to leave a comment and I can clarify.



Palomar Mountain Snow Hiking

Friday at work and no plans for Saturday. So I started asking around and seeing what coworkers were planning. I honed in on plans with Tom, snowshoeing up at Palomar Mountain! It had been pouring rain by Southern California standards for the past few days, so we were hoping for a good bit of snow on Palomar Mountain.

Palomar Mountain peak sits at 6138 feet. It is one of the closest mountains to San Diego that has the potential for real snow in the Winter months. Weather reports expected snow above 5000 feet, so we had ideas of lots of snow in our minds.

We set off early Saturday morning in Tom’s Subaru up towards Palomar Mountain. The drive out was amazingly green. With all the rain we had been having the valleys and hills were green with life. Yes, it was mostly shrubs and grass, but for Southern California, this is some of the greenest I have seen the valleys in a while.

We pressed on and made our way towards Palomar Mountain. We were a little disappointed at first as we came up the mountain road because we barely started to see patches of snow at 5000 feet and only solid snow around 5500 feet. Even then the snow may have only been 2 to 6 inches deep. We pressed on though and went all the way to the gates in front of the public parking area for the observatory. The observatory parking lot was gated off so there really was nowhere to park. We got out of the car anyway and enjoyed the crisp cold air on Palomar mountain for the first time that day.


From the end of South Grade Road before the observatory parking lot

The air was frigid, and the clothes I had on were from when it was still 60 degrees earlier that day back at home. I quickly put on my warmer clothes and began to romp around in the snow. This spot we were at was the highest elevation point that is most readily available by a car. And even here the snow was not too much more than 6 inches thick. The second sad part was we were not even allowed to park here so we would have to go down in elevation before we could park. Which only meant less snow.

Still, we went down the mountain and ended up parking at the entrance to Fry Creek Campground. The campground is closed during the winter months but still is a fun spot to explore. It is almost like a winter ghost town filled with camping sites. The snow just shallow enough where snowshoes would be a burden and just thick enough where it made it mildly difficult to walk without them. We decided to do our hike without the snowshoes and not even bring them with us.

We started walking up the snow-covered road into the campground. Our first stop was the sign designating all the camping spot locations, and we noticed a trail that went around the entire campground. We headed out the find the trail. It was a snow-covered trail but ultimately not too difficult to find. The snow fell in a pattern where the snow was flat where the trail should have been. We followed the flattened snow around the camp.


Trail sign in Fry Creek Campground

It was a little serene to be hiking a snowed over a trail that had no previous footprints on it. We were almost blazing the trail for ourselves. The fresh crunch of snow under each footstep was great. It became apparent that this trail was not meant to be used during the snow or rainy season as it went right through multiple waterways. We found ourselves hopping and jumping through a few water-covered areas.


Stream crossing along the trail

A very surprising thing we noticed were ladybugs. Yes, ladybugs. I saw a large clump of red stuff on a tree. I had not seen anything like it before, so I went in for a closer inspection. The red stuff was dozens of ladybugs. They must be hunkering down for the winter trying to hold out through the cold temperatures waiting for spring. I never would have expected to see ladybugs up here this time of year especially so open to all the elements. They must hibernate this time of the year.


Ladybugs bunched up on a pine tree

After about a mile of walking on the trail and losing the trail a few times, we found ourselves at the very end of the campgrounds. It was a great spot to take a break and enjoy the solitude of having the entire campground to ourselves.

We had some great conversations together talking about work, politics, and even a bit of the future of technology. This definitely was a great thought-provoking setting. As we rested and talked, it began to rain. Or so we thought it did. We had been standing under the trees and drops of water were falling on us. I walked around a little to enjoy the rain, and to my surprise, in the open areas with no trees, there was no rain. So it was not actually raining, but the snow stuck on the branches of the trees was melting, and it came down as if it was raining.

After a good rest and good conversation, we headed back. We did not head back the same way we came but decided to parallel a stream. We did not have a good idea of where it would lead us but if all else failed we would just follow it back up. Surprisingly though it led us to a road covered in snow. We followed the road assuming it would take us back to the campsites.

Indeed it did. We were actually back very close to the entrance of the camping area in no time. We decided we did not need to hike too much more so headed back towards the car. It was an enjoyable hike walking on snow with no tracks and blazing our own trail at times. There was plenty of snow around to be fun and get your boots soaked and feet cold. There was even enough snow for some decorated snowmen that someone had made earlier in the day.


Snowman in Fry Creek Campground

That ended our exploration of a snow-covered Palomar Mountain. It was a satisfying trip. There was plenty of snow to make the trip fun. And some good company never hurts.

© 2020 The Tom Bomb

Theme by Anders NorenUp ↑