Build an open future with us.

Invest in Mycroft and become a community partner.

What is the correct process to create a skill?


#1

I had an error here but I think I’ve figured out the solution.


#2

Hi @DerekCaelin, the process is documented here;

and the process for submitting Skills are here:


#3

I have read the developing skills article and would suggest it is incomplete.
a) The CLI interface is not documented. I enter
’What time is it’
and nothing happens :frowning: except text is moved to previous frame)
on entering :help cli crashes with the following
Traceback (most recent call last):
File “/home/osboxes/mycroft-core/mycroft/client/text/main.py”, line 1070, in
main()
File “/home/osboxes/mycroft-core/mycroft/client/text/main.py”, line 1065, in main
curses.wrapper(gui_main)
File “/usr/lib/python2.7/curses/wrapper.py”, line 43, in wrapper
return func(stdscr, *args, **kwds)
File “/home/osboxes/mycroft-core/mycroft/client/text/main.py”, line 925, in gui_main
if handle_cmd(line[1:]) == 1:
File “/home/osboxes/mycroft-core/mycroft/client/text/main.py”, line 799, in handle_cmd
show_help()
File “/home/osboxes/mycroft-core/mycroft/client/text/main.py”, line 709, in show_help
scr.addstr(16, 0, “:filter (clear|reset) reset filters”)
_curses.error: addstr() returned ERR

Secondly, having looked at the documentation for msm, I sense I have to register my new skiil with my local mycroft before I can test it, Is this correct?


#4

@CAWW, thanks for your feedback, we really appreciate it. We’ve asked a couple other people, and we definitely need to bump up the introductory documentation for building Skills. Big thanks to @steve.penrod for his help with this one:

You don’t actually have to create a new repo to create a Skill. In fact, I rarely do that. Instead you can create the skill on the machine running your mycroft-core instance under the folder: /opt/mycroft/skills

For example, I can create a skill called “SteveDemo” by:

  • mkdir /opt/mycroft/skills/SteveDemo

Then pull down some template code to get started using:

  • cd /opt/mycroft/skills/SteveDemo
  • wget https://github.com/MycroftAI/mycroft-skills/archive/master.tar.gz
  • tar -xz --strip=2 mycroft-skills-master/00__skill_template < master.tar.gz

Finally, just to make sure you don’t have any permissions issues:

  • chmod -R 777 /opt/mycroft/skills/SteveDemo

Now:
*nano __init__.py

As you edit and save the file it will be automatically reloaded. I like to have a SSH session active an running the Mycroft CLI all the time, then edit the code in a different window and watch for errors when loading or testing.

As for the :help issue you reported, I’m not seeing it running on a Mark 1. What platform are you using?


#5

Hi, I just built my first skill and did it this way - (in fact I pulled down the git template, ended up with in a folder I didn’t want it in, copied an existing skill (ip is a good one to butcher) and eventually gave up and worked out how to do it Kathy’s way.

Also, you dont need to upload it to a repo or anything, I spent more time fiddling with the git stuff than I did coding my test skill.

So, I did the mkdir in /opt/mycroft/skills, copied over the files from ip skill and amended the following to get it working :slight_smile: Now Kali (my robot) fires a laser when it hears a combination of any of the two words in the two voc files, e.g. “Hey Kali, blow stuff up” and she responds with anything from the .dialog file, e.g. “Pew Pew”

added files in the vocab/en-us folder - “fire.voc” & “laser.voc” (containing my utterances “fire, shoot, blow” and “laser, gun, stuff”)
then
amended my file .dialog file “fire.laser.dialog” (contains “Firing Laser, Shooting stuff, Pew Pew”)
then
edited init.py (KaliSkill is the name of my skill) Below are the lines I changed (oh and I imported os as well - import os).

class KaliSkill(MycroftSkill):

# The constructor of the skill, which calls MycroftSkill's constructor
def __init__(self):
    super(KaliSkill, self).__init__(name="KaliSkill")

@intent_handler(IntentBuilder("firelaser").require("fire").require("laser"))

def handle_fire_laser_intent(self, message):
    self.speak_dialog("fire.laser")
    os.system('mpg123 /root/kali/laser.mp3 > /dev/null 2>&1')

def create_skill():
return KaliSkill()


#6

Nice work. Yeah, the git stuff is a pain to begin with, but we take you through the hard way first to make it easier to submit it to the mycroft-skills repo, so that others can enjoy the Skill.

Also, massive bonus points for a pew-pew Skill :slight_smile:


#7

i made a skill for mycroft ,but i dont know how to install it.
please anyone help me to do it


#8

Hi there @sdharth_sid as per the direct message I sent you, do you have your Skill available in a GitHub repo? Then we can take a look.

To install a Skill to test it, the Skill needs to be installed at;
/opt/mycroft/skills/

for example if your Skill is called ‘foo’ then you would copy it to:
/opt/mycroft/skills/foo

The Skill will be automatically reloaded, so you should be able to test it straight away in the Mycroft command line (mycroft-cli-client') on Mark or Picroft, or ./start-mycroft debug on Linux.

You should also have a look at the Mycroft Skills Kit (msk) which helps you in the process of creating a Skill;