Developing your own skills with the skill toolkit

 Removed in 20.0.3  Developers can create their own skills from scratch to enrich the catalog beyond what is currently available. A toolkit is provided with IBM Automation Digital Worker, so you can create skills tailored to your use-case.

This toolkit contains the following things:
  • A starter kit, which creates the file structure and templates that you need to create a skill.
  • A test kit, which allows you to test the code that you are implementing as you go along.

Prerequisites

You must have Node 10.10.0 or later.

The toolkit is available as an NPM module, which you must install with the following command:
npm i @ibm-adw/skill-toolkit -g -s

No other installation is required, and you can get started immediately.

Note: For more information about the command line parameters, see the NPM documentation.

Launch the starter kit

To launch the starter kit and generate a skill sample, follow these steps:
  1. In your command-line tool, type the following npx command:
    npx adw-create-skill MySkill

    This command creates a repository on your local machine that is called MySkill.

  2. Follow the instructions that are displayed on your screen. You must enter the following type of information:
    • The name of the package: The name used to identify the NPM module when you publish it, and optionally, it can be prefixed with a scope. For example: @MyScope/MySkillPackage
    • The name of the skill: The name that appears in the Digital Worker user interface.
    • The description of the skill
    • The author of the skill: The author to use in the package.json file, in plain text format.
    • The category this skill belongs to, among the three possible categories: understand, act, and decide.
    • The level of the skill: Either tech_preview or released. For example, if your skill is not fully ready for production, you can tag it as tech_preview.
  3. When the screen prompts you to generate a sample skill, select yes to create a sample skill with ready-to-use functions. If you select no, you generate a sample skill with only an outline of functions.

    After you select an option, the repository MySkill that was created in step 1 is filled with the initial structure of your project, which looks like the following structure:

    MySkill
    ├── .eslintrc.json
    ├── .gitignore
    ├── .npmignore
    ├── nls
    │   ├── en.json
    ├── package.json
    ├── README.md
    ├── DOCUMENTATION.md
    ├── skill-api.js
    ├── skill-config.js
    ├── skill-documentation.md
    ├── skill-spec.json
    └── tests
        ├── skill-api.test.js
        └── skill-config.test.js

Implement and test your skill

After the file structure of the skill is created, open your IDE of choice and load the project to start working with it and implement your skill.

You can use the test kit that is also provided to test your changes and see how it would look like in the user interface.

In the command-line tool, you must start the client and the server.
  1. To start the server, type the following command:
    npx adw-launch-server MySkill [SERVER_PORT]

    [SERVER_PORT] is the port where the skill endpoint is available. If not specified, the default is 8888.

  2. To start the client, open a new terminal window and type the following command:
    npx adw-launch-client [CLIENT_PORT] [SERVER_PORT]

    [CLIENT_PORT] is the port where the test kit client application is running. If not specified, the default is 3000.

You can then access a local version of the user interface, where you can see the results of your implementation in the configuration form. Side-panes are available for you to see the metadata of the skill (as read-only), the skill documentation, and the list of components that you can add in this skill. To add a component from this list, you can use the code snippets that are provided in each component.

After you modify the code for your skill, you can refresh the local test interface, and see your changes directly.

Deploy your skill

When you are satisfied with your skill and want to integrate it in Digital Worker, you must deploy your skill:
  1. Type the following command:
    cd MySkill
    npm pack

    This command creates a .tgz archive inside your repository.

  2. Open your instance of Digital Worker and go to the skill catalog.
  3. Click Import and select the .tgz archive.

When the import is finished, you can see your skill in the skill catalog. You can add it in a digital worker task, and configure it.

Note: When you deploy a skill that you developed with the skill toolkit, you must bundle any private packages not available on public NPM with the skill. For more information, see Known limitations and issues.
Important: If you need to modify this skill, you can go through this procedure again. However, before you re-create the archive file and re-import it, you must increment the version number in the package.json file.