# Create a skill (more details)

The interest of creating a skill is to modularize and structure your chatbot. We can also share the skill to the community

### Structure of your competence

* (my-skill)
  * my-skill.js
  * my-skill.converse

Let's create our scenario as usual in the JS file:

```javascript
import code from './my-skill.converse'

export default {
    code
}
```

And in the ConverseScript

```typescript
@Intent(/hello/i)
hey() {
    > Hey !
}
```

### With parameters

If we want to send parameters, such as a token, the skill must return a function:

`skills/my-skill.js`

```javascript
import code from './my-skill.converse'

export default function(token) {
    return {
        code
    }
}
```

In your main script:

```javascript
import mySkill from './skills/my-skill'

export default {
    skills: {
        mySkill: mySkill('my-token')
    }
}
```

It is possible to write it this way too:

```javascript
import mySkill from './skills/my-skill'

export default {
    skills: {
        mySkill: {
            skill: mySkill,
            params: ['my-token']
        }
    }
}
```

This time, the value of `mySkill` is an object with two properties:

* `skill`: the path to competence
* `params`: the parameters to send to the function of the competency

### An asynchronous skill

The skill can return a promise

`skills/my-skill.js`

```javascript
import code from './my-skill.converse'

export default function() {
    return new Promise((resolve) => {
        setTimeout(() => {
            resolve({
                code
            })
        }, 2000)
    })
}
```

So let's send the skill to the `resolve()` function of the promise. In the main script:

```javascript
import mySkill from './skills/my-skill'

export default {
    skills: {
        mySkill
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.newbot.io/use-newbot-framework-js/create-a-skill-more-details.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
