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.
- 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.
npm i @ibm-adw/skill-toolkit -g -sNo other installation is required, and you can get started immediately.
Launch the starter kit
- In your command-line tool, type the following
npxcommand:npx adw-create-skill MySkillThis command creates a repository on your local machine that is called MySkill.
- 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.
- 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:
- 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.
- 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 is8888. - 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 is3000.
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
- Type the following command:
cd MySkill npm packThis command creates a
.tgzarchive inside your repository. - Open your instance of Digital Worker and go to the skill catalog.
- Click Import and select the
.tgzarchive.
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.
package.json file.