Mycroft Skills Kit
Learn how to use the Mycroft Skills Kit - MSK - to make the creation, testing and submission of Skills a lot easier.
The Mycroft Skills Kit - msk - is a Python-based utility that has been created to make it easier for Skill Authors to create, test and submit Skills to the Skills Marketplace. We hope this utility helps to shorten the development cycle, and remove some of the tedious parts of Skill creation.
msk currently supports the following features:
  • Create a new Skill
  • Create an Intent test for a Skill
  • Upload a Skill
  • Upgrade an existing Skill

Installing msk

NOTE: msk has only been tested on Linux systems
msk comes pre installed on the Mark 1, Picroft and the git installation of Mycroft-core. The utility is self-contained and can be installed separately using pip by typing the following line into the terminal on your Linux system:
1
pip3 install msk
Copied!
You should then see output like the below:
1
Collecting msk
2
Downloading https://files.pythonhosted.org/packages/69/d9/1d41acac01b1e6f9004963606f0b9f939a917e240a955a657f6dc1844836/msk-0.3.8.tar.gz
3
Collecting GitPython (from msk)
4
Using cached https://files.pythonhosted.org/packages/ac/c9/96d7c86c623cb065976e58c0f4898170507724d6b4be872891d763d686f4/GitPython-2.1.10-py2.py3-none-any.whl
5
Collecting typing (from msk)
6
Using cached https://files.pythonhosted.org/packages/05/2b/2b05bf1d5a9dd450447c9a5df3e118a465e5d3cb12b73b7220a5064a403f/typing-3.6.4-py3-none-any.whl
7
Collecting msm>=0.5.13 (from msk)
8
Collecting pygithub (from msk)
9
Collecting gitdb2>=2.0.0 (from GitPython->msk)
10
Using cached https://files.pythonhosted.org/packages/e0/95/c772c13b7c5740ec1a0924250e6defbf5dfdaee76a50d1c47f9c51f1cabb/gitdb2-2.0.3-py2.py3-none-any.whl
11
Collecting pyjwt (from pygithub->msk)
12
Using cached https://files.pythonhosted.org/packages/93/d1/3378cc8184a6524dc92993090ee8b4c03847c567e298305d6cf86987e005/PyJWT-1.6.4-py2.py3-none-any.whl
13
Collecting smmap2>=2.0.0 (from gitdb2>=2.0.0->GitPython->msk)
14
Using cached https://files.pythonhosted.org/packages/e3/59/4e22f692e65f5f9271252a8e63f04ce4ad561d4e06192478ee48dfac9611/smmap2-2.0.3-py2.py3-none-any.whl
15
Building wheels for collected packages: msk
16
Running setup.py bdist_wheel for msk ... done
17
Stored in directory: /home/kathyreid/.cache/pip/wheels/b8/d7/7d/c650d047645e875a4c301821844ded868db716b877fdae8b9b
18
Successfully built msk
19
Installing collected packages: smmap2, gitdb2, GitPython, typing, msm, pyjwt, pygithub, msk
20
Successfully installed GitPython-2.1.10 gitdb2-2.0.3 msk-0.3.8 msm-0.5.14 pygithub-1.39 pyjwt-1.6.4 smmap2-2.0.3 typing-3.6.4
Copied!
To check that the installation was successful msk --help can be run and should list the arguments and options for the utility.

Usage

The normal commands for msk are:
1
msk create
2
msk create-test /opt/mycroft/skills/myskill
3
msk upload /opt/mycroft/skills/myskill
4
msk upgrade /opt/mycroft/skills/myskill
Copied!
If using the built-in installation of msk with a Mycroft device or Mycroft git installation, use mycroft-msk in place of msk:
1
mycroft-msk create
2
mycroft-msk create-test /opt/mycroft/skills/myskill
3
mycroft-msk upload /opt/mycroft/skills/myskill
4
mycroft-msk upgrade /opt/mycroft/skills/myskill
Copied!

Create

Next, we use the msk create function. You will be prompted to enter the required information to help set up your Skill.
1
$ msk create
2
Enter a short unique skill name (ie. "siren alarm" or "pizza orderer"):
3
Feed the Corgi
4
5
Class name: FeedTheCorgiSkill
6
Repo name: feed-the-corgi-skill
7
8
Looks good? (Y/n) Y
9
Enter a one line description for your skill (ie. Orders fresh pizzas from the store):
10
- Reminds you to feed your poor starving Corgi
11
Enter a long description:
12
> Every 24 hours, Mycroft will send you a reminder to feed your Corgi, and tell you what your Corgi was fed the previous day, so you can provide a different delicious meal for your precious Corgi.
13
>
14
Enter some example phrases to trigger your skill:
15
- Have I fed the Corgi today
16
- What did I feed the Corgi yesterday
17
- Remind me to feed the Corgi at 5pm
18
-
19
Enter author: YourGitHubUserName
20
21
Categories define where the skill will display in the Marketplace. It must be one of the following:
22
Daily, Configuration, Entertainment, Information, IoT, Music & Audio, Media, Productivity, Transport.
23
Enter the primary category for your skill:
24
- Daily
25
Enter additional categories (optional):
26
- Productivity
27
-
28
Enter tags to make it easier to search for your skill (optional):
29
- Dogs
30
-
31
32
Would you like to create a GitHub repo for it? (Y/n) Y
33
=== GitHub Credentials ===
34
Username: YourGitHubUserName
35
Password:
36
Counting objects: 12, done.
37
Delta compression using up to 8 threads.
38
Compressing objects: 100% (5/5), done.
39
Writing objects: 100% (12/12), 1.44 KiB | 0 bytes/s, done.
40
Total 12 (delta 0), reused 0 (delta 0)
41
To https://github.com/YourGitHubUserName/feed-the-corgi-skill
42
* [new branch] master -> master
43
Branch master set up to track remote branch master from origin.
44
Created GitHub repo: https://github.com/YourGitHubUserName/feed-the-corgi-skill
45
Created skill at: /opt/mycroft/skills/feed-the-corgi-skill
Copied!
Now, if you look in /opt/mycroft/skills/ you will see that all the files required for the Skill have now been created, including the .voc files.
1
$ ls -las /opt/mycroft/skills/feed-the-corgi-skill
2
total 36
3
4 drwxrwxr-x 5 kathyreid kathyreid 4096 Jun 7 05:20 .
4
4 drwxr-xr-x 103 kathyreid kathyreid 4096 Jun 7 05:18 ..
5
4 drwxrwxr-x 3 kathyreid kathyreid 4096 Jun 7 05:20 dialog
6
4 drwxrwxr-x 8 kathyreid kathyreid 4096 Jun 7 05:20 .git
7
4 -rw-rw-r-- 1 kathyreid kathyreid 21 Jun 7 05:20 .gitignore
8
4 -rw-rw-r-- 1 kathyreid kathyreid 379 Jun 7 05:18 __init__.py
9
4 -rw-rw-r-- 1 kathyreid kathyreid 434 Jun 7 05:20 README.md
10
4 -rw-rw-r-- 1 kathyreid kathyreid 1301 Jun 7 05:20 settingsmeta.yaml
11
4 drwxrwxr-x 3 kathyreid kathyreid 4096 Jun 7 05:20 vocab
Copied!
1
$ ls -las /opt/mycroft/skills/feed-the-corgi-skill/vocab/en-us/
2
total 12
3
4 drwxrwxr-x 2 kathyreid kathyreid 4096 Jun 7 05:20 .
4
4 drwxrwxr-x 3 kathyreid kathyreid 4096 Jun 7 05:20 ..
5
4 -rw-rw-r-- 1 kathyreid kathyreid 16 Jun 7 05:20 corgi.the.feed.intent
Copied!

Create test

msk also provides a function for creating Intent tests, as part of our Automated Testing for Skills.
Please see this ASCII Cinema video to see the process for using msk create-test:
As before if the mycroft-core github installation is used make sure to use mycroft-msk or activate the mycroft-core Python virtual environment. From the mycroft-core folder
$ source .venv/bin/activate
Next, we use the msk create-test function. You must pass the Skill directory location to the command, or it will fail.
1
$ msk create-test /opt/mycroft/skills/feed-the-corgi-skill/
2
3
Which intent would you like to test?
4
1. corgi.the.feed.intent
5
6
> 1
7
8
=== Intent Examples ===
9
Corgi the feed
10
11
Enter an example query: have I fed the corgi today?
12
13
Choose expected dialog (leave empty to skip).
14
1. corgi.the.feed
15
16
> 1
17
Generated test file: /opt/mycroft/skills/feed-the-corgi-skill/test/intent/corgi.the.feed.intent.0.intent.json
Copied!
If we have a look inside the corgi.the.feed.intent.0.intent.json file we can see that the test has been created for us.
1
$ cat /opt/mycroft/skills/feed-the-corgi-skill/test/intent/corgi.the.feed.intent.0.intent.json
2
{
3
"intent_type": "corgi.the.feed",
4
"expected_dialog": "corgi.the.feed",
5
"utterance": "have I fed the corgi today?"
6
}
Copied!

Upload Skill

msk also provides a function for uploading a Skill to the Mycroft Skills Repo, as part of our [Skill Submission Process] (https://mycroft.ai/documentation/skills/skill-submission/).
Please see this ASCII Cinema video to see the process for using msk upload:
If using the msk delivered with the mycroft-core github installation be sure to use mycroft-msk or activate the mycroft-core Python virtual environment. From the mycroft-core folder
$ source .venv/bin/activate
You will now see that your bash prompt is prefixed with (venv).
Next, we use the msk upload command with the path to the Skill:
1
$ msk upload /opt/mycroft/skills/feed-the-corgi-skill/
2
=== GitHub Credentials ===
3
Username: YourGitHubUserName
4
Password:
5
Enter a unique skill name (ie. npr-news or grocery-list): feed-the-corgi
6
Counting objects: 531, done.
7
Delta compression using up to 8 threads.
8
Compressing objects: 100% (339/339), done.
9
Writing objects: 100% (531/531), 123.54 KiB | 0 bytes/s, done.
10
Total 531 (delta 298), reused 304 (delta 177)
11
remote: Resolving deltas: 100% (298/298), completed with 6 local objects.
12
To https://github.com/YourGitHubUserName/mycroft-skills
13
* [new branch] add/feed-the-corgi -> add/feed-the-corgi
14
Branch add/feed-the-corgi set up to track remote branch add/feed-the-corgi from fork.
15
Created pull request: https://github.com/MycroftAI/mycroft-skills/pull/392
Copied!

Upgrade Skill

msk also provides a function for upgrading a Skill once it has been merged into the Mycroft Skills Repo, as part of our [Skill Submission Process] (https://mycroft.ai/documentation/skills/skill-submission/).

Before you upgrade

Before you can use msk upgrade, you must ensure:
  • That your Skill has already been merged with the mycroft-skills repo.
  • That you have made changes to your Skill and that these changes have been committed to the Skill's git repository.
Once your changes are committed, you can then use msk upgrade by passing the location of the Skill folder. Generally we find it's easiest to be inside the Skill's folder in /opt/mycroft/skills/SKILL-NAME and then use the current directory symbol, period .
1
(.venv) [email protected]:/opt/mycroft/skills/kathy-msk-test-skill$ msk upgrade .
2
=== GitHub Credentials ===
3
Username: KathyReid
4
Password:
5
Counting objects: 3, done.
6
Delta compression using up to 8 threads.
7
Compressing objects: 100% (3/3), done.
8
Writing objects: 100% (3/3), 877 bytes | 877.00 KiB/s, done.
9
Total 3 (delta 1), reused 0 (delta 0)
10
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
11
remote:
12
remote: Create a pull request for 'upgrade-kathy-msk-test-skill' on GitHub by visiting:
13
remote: https://github.com/KathyReid/mycroft-skills/pull/new/upgrade-kathy-msk-test-skill
14
remote:
15
To https://github.com/KathyReid/mycroft-skills
16
* [new branch] upgrade-kathy-msk-test-skill -> upgrade-kathy-msk-test-skill
17
Branch 'upgrade-kathy-msk-test-skill' set up to track remote branch 'upgrade-kathy-msk-test-skill' from 'fork'.
18
19
=== Upgrade kathy-msk-test-skill ===
20
21
'This upgrades kathy-msk-test-skill to include the following new commits:
22
23
- [test for msk](https://github.com/KathyReid/kathy-msk-test-skill/commit/6d0e3552314673402e6f44ee90ee29feff6075ca)
24
25
<sub>Created with [mycroft-skills-kit](https://github.com/mycroftai/mycroft-skills-kit) v0.3.10</sub>
26
27
Created PR at: https://github.com/MycroftAI/mycroft-skills/pull/661
Copied!
msk upgrade will create a new PR on the Mycroft Skills Repo, and this will be reviewed using the Skills Acceptance process.
  • If you try to run msk upgrade and your Skill has not yet been merged, you will receive the error:
1
(.venv) [email protected]:/opt/mycroft/skills/kathy-msk-test-skill$ msk upgrade .
2
NotUploaded: The skill kathy-msk-test-skill has not yet been uploaded to the skill store
Copied!
  • If have uncommitted items, you will receive the error:
1
(.venv) [email protected]:/opt/mycroft/skills/kathy-msk-test-skill$ msk upgrade .
2
AlreadyUpdated: The latest version of kathy-msk-test-skill is already uploaded to the skill repo
3
(.venv) [email protected]:/opt/mycroft/skills/kathy-msk-test-skill$ git status
4
On branch master
5
Your branch is up to date with 'origin/master'.
6
7
Changes not staged for commit:
8
(use "git add <file>..." to update what will be committed)
9
(use "git checkout -- <file>..." to discard changes in working directory)
10
11
modified: README.md
12
13
no changes added to commit (use "git add" and/or "git commit -a")
Copied!
You need to ensure that your changes are committed:
1
(.venv) [email protected]:/opt/mycroft/skills/kathy-msk-test-skill$ git commit -a
2
[master 6d0e355] test for msk
3
1 file changed, 3 insertions(+)
4
(.venv) [email protected]:/opt/mycroft/skills/kathy-msk-test-skill$ git push -u origin master
5
Username for 'https://github.com': KathyReid
6
Password for 'https://[email protected]':
7
Counting objects: 3, done.
8
Delta compression using up to 8 threads.
9
Compressing objects: 100% (3/3), done.
10
Writing objects: 100% (3/3), 326 bytes | 326.00 KiB/s, done.
11
Total 3 (delta 2), reused 0 (delta 0)
12
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
13
To https://github.com/KathyReid/kathy-msk-test-skill
14
5c9a7f2..6d0e355 master -> master
15
Branch 'master' set up to track remote branch 'master' from 'origin'.
Copied!

Join our Skills Authoring Community

Last modified 1yr ago