# Add a skill

Give an agent a skill: a reusable process it loads only when a request needs it. The skill's description tells the agent when.

## Before you start

You need an agent. See [Create an agent](/docs/agents/create-agent.md).

## Add a skill

**Studio**

1. In your project, open **Agents**.

2. Click your agent.

3. Click **Edit**.

4. Under **Add skills**, click **Add skill**.

5. Enter `split-bill` as the **Name**.

6. Enter `Split a restaurant bill and its tip between people.` as the **Description**.

7. Enter the **Instructions**:

   ```prompt
   1. Add the tip to the bill.
   2. Divide the total by the number of people, rounding each share to the penny.
   3. Answer with the total and each person's share.
   ```

8. Click **Create skill**. The new skill is ticked for you.

9. Click **Save**.

10. Open **Chat**.

11. Pick your agent under the message box.

12. Write "Use the split-bill skill: £84.50 with an 18% tip between three people." in the message box.

13. Press Enter. You should now see the reply show **Loaded skill** with `split-bill`, and each person's share, £33.24.

To edit or delete a skill later, open **Building blocks** > **Skills**.

**Code**

1. Create the skill. Its folder and `name` are its ID:

```markdown title="skills/split-bill/SKILL.md"
---
name: split-bill
description: Split a restaurant bill and its tip between people.
---

1. Add the tip to the bill.
2. Divide the total by the number of people, rounding each share to the penny.
3. Answer with the total and each person's share.
```

2. Start the project with `npm run dev`.
3. Open **Chat** in Studio.
4. Pick Support assistant.
5. Ask "Use the split-bill skill: £84.50 with an 18% tip between three people." You should now see the reply show **Loaded skill: split-bill** and each person's share, £33.24.

### Try it in a sandbox

```playground
step: Create a project | npm create -y veryfront@latest support-desk -- --template ai-agent --yes
step: Before you start: the agent | cd support-desk && mkdir -p agents && printf '%s\n' 'import { agent } from "veryfront/agent";' '' 'export default agent({' '  id: "support",' '  name: "Support assistant",' '  system: "Answer customer questions about orders and refunds. Keep replies to two sentences.",' '});' > agents/support.ts
step: Create the skill | mkdir -p skills/split-bill && printf '%s\n' '---' 'name: split-bill' 'description: Split a restaurant bill and its tip between people.' '---' '' '1. Add the tip to the bill.' '2. Divide the total by the number of people, rounding each share to the penny.' "3. Answer with the total and each person's share." > skills/split-bill/SKILL.md
step: Start it | npm run dev
agent: support
ask: Use the split-bill skill: £84.50 with an 18% tip between three people.
tool: veryfront__load_skill
expect: £33.24
```

**API**

1. Set `PROJECT` to your project's ID ([Find your IDs](/docs/authentication/api-keys.md#find-your-ids)): `export PROJECT=<id>`.
2. Create the skill with your [API key](/docs/authentication/api-keys.md). Its `name` is its ID:

```bash
curl -X POST https://api.veryfront.com/projects/$PROJECT/skills \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'EOF'
{
  "name": "split-bill",
  "description": "Split a restaurant bill and its tip between people.",
  "instructions": "1. Add the tip to the bill.\n2. Divide the total by the number of people, rounding each share to the penny.\n3. Answer with the total and each person's share."
}
EOF
```

3. Give it to your agent, here `support`:

```bash
curl -X PUT https://api.veryfront.com/projects/$PROJECT/agents/support \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"skill_ids": ["split-bill"]}'
```

4. Get the agent. You should now see `"skill_ids": ["split-bill"]`:

```bash
curl https://api.veryfront.com/projects/$PROJECT/agents/support \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

### Try it in a sandbox

```playground
step: Set PROJECT | export PROJECT=$VERYFRONT_PROJECT_ID
step: Before you start: an agent | curl -X POST https://api.veryfront.com/projects/$PROJECT/agents -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"id": "support", "name": "Support assistant", "system_prompt": "Answer customer questions about orders and refunds. Keep replies to two sentences."}'
step: Create the skill | curl -X POST https://api.veryfront.com/projects/$PROJECT/skills -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"name": "split-bill", "description": "Split a restaurant bill and its tip between people.", "instructions": "1. Add the tip to the bill.\n2. Divide the total by the number of people, rounding each share to the penny.\n3. Answer with the total and each person'\''s share."}'
step: Give it to your agent | curl -X PUT https://api.veryfront.com/projects/$PROJECT/agents/support -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"skill_ids": ["split-bill"]}'
check: curl https://api.veryfront.com/projects/$PROJECT/agents/support -H "Authorization: Bearer $VERYFRONT_API_KEY"
expect: "skill_ids":["split-bill"]
```

## With MCP

`my-project` is your project's reference: its slug or its ID. Your agent here is `support`; `veryfront__list_agents` lists them.

1. Call `veryfront__create_skill`:

```json
{
  "project_reference": "my-project",
  "name": "split-bill",
  "description": "Split a restaurant bill and its tip between people.",
  "instructions": "1. Add the tip to the bill.\n2. Divide the total by the number of people, rounding each share to the penny.\n3. Answer with the total and each person's share."
}
```

2. Call `veryfront__update_agent` with `"agent_id": "support"`, `"project_reference": "my-project"` and `"skill_ids": ["split-bill"]`.
3. Call `veryfront__get_agent_source` with `"agent_id": "support"` and `"project_reference": "my-project"`. It worked when `skill_ids` is `["split-bill"]`.

## Next steps

* [Add a tool](/docs/agents/tools.md)
* [Write an agent's instructions](/docs/agents/prompts.md)
