121 lines
3.9 KiB
Markdown
121 lines
3.9 KiB
Markdown
# Implémentation des skills
|
|
|
|

|
|
|
|
<table width="100%">
|
|
<tr>
|
|
<td><a href="../">← Retour à Claude Code Best Practice</a></td>
|
|
<td align="right"><img src="../../!/claude-jumping.svg" alt="Claude" width="60" /></td>
|
|
</tr>
|
|
</table>
|
|
|
|
---
|
|
|
|
<a href="#weather-svg-creator"><img src="../../!/tags/implemented-hd.svg" alt="Implemented"></a>
|
|
|
|
Deux skills sont implémentés dans ce repo dans le cadre du pattern d'architecture **Command → Agent → Skill**, démontrant deux patterns d'invocation de skill distincts : les **skills d'agent** (préchargés) et les **skills** (invoqués directement).
|
|
|
|
---
|
|
|
|
## Weather SVG Creator (Skill)
|
|
|
|
**Fichier** : [`.claude/skills/weather-svg-creator/SKILL.md`](../../.claude/skills/weather-svg-creator/SKILL.md)
|
|
|
|
```yaml
|
|
---
|
|
name: weather-svg-creator
|
|
description: Creates an SVG weather card showing the current temperature for
|
|
Dubai. Writes the SVG to orchestration-workflow/weather.svg and updates
|
|
orchestration-workflow/output.md.
|
|
---
|
|
|
|
# Weather SVG Creator Skill
|
|
|
|
This skill creates a visual SVG weather card and writes the output files.
|
|
|
|
## Task
|
|
Create an SVG weather card displaying the temperature for Dubai, UAE,
|
|
and write it along with a summary to output files.
|
|
|
|
## Instructions
|
|
You will receive the temperature value and unit (Celsius or Fahrenheit)
|
|
from the calling context.
|
|
|
|
### 1. Create SVG Weather Card
|
|
Generate a clean SVG weather card...
|
|
|
|
### 2. Write SVG File
|
|
Write the SVG content to `orchestration-workflow/weather.svg`.
|
|
|
|
### 3. Write Output Summary
|
|
Write to `orchestration-workflow/output.md`...
|
|
|
|
...
|
|
```
|
|
|
|
C'est un **skill** — invoqué directement par la commande via l'outil Skill. Il reçoit les données de température depuis le contexte de conversation et crée la carte météo SVG et le résumé de sortie.
|
|
|
|
---
|
|
|
|
## Weather Fetcher (Skill d'agent)
|
|
|
|
**Fichier** : [`.claude/skills/weather-fetcher/SKILL.md`](../../.claude/skills/weather-fetcher/SKILL.md)
|
|
|
|
```yaml
|
|
---
|
|
name: weather-fetcher
|
|
description: Instructions for fetching current weather temperature data
|
|
for Dubai, UAE from Open-Meteo API
|
|
user-invocable: false
|
|
---
|
|
|
|
# Weather Fetcher Skill
|
|
|
|
This skill provides instructions for fetching current weather data.
|
|
|
|
## Task
|
|
Fetch the current temperature for Dubai, UAE in the requested unit
|
|
(Celsius or Fahrenheit).
|
|
|
|
## Instructions
|
|
1. Fetch Weather Data: Use the WebFetch tool to get current weather data
|
|
- Celsius URL: https://api.open-meteo.com/v1/forecast?latitude=25.2048&longitude=55.2708¤t=temperature_2m&temperature_unit=celsius
|
|
- Fahrenheit URL: https://api.open-meteo.com/v1/forecast?latitude=25.2048&longitude=55.2708¤t=temperature_2m&temperature_unit=fahrenheit
|
|
2. Extract Temperature: From the JSON response, extract `current.temperature_2m`
|
|
3. Return Result: Return the temperature value and unit clearly.
|
|
|
|
...
|
|
```
|
|
|
|
C'est un **skill d'agent** — préchargé dans le `weather-agent` au démarrage via le champ de frontmatter `skills:`. Il n'est pas invoqué directement ; à la place, il sert de connaissance de domaine injectée dans le contexte de l'agent. Note `user-invocable: false` qui le masque du menu de commandes `/`.
|
|
|
|
---
|
|
|
|
## Deux patterns de skill
|
|
|
|
| Pattern | Invocation | Exemple | Différence clé |
|
|
|---------|-----------|---------|----------------|
|
|
| **Skill** | `Skill(skill: "name")` | `weather-svg-creator` | Invoqué directement via l'outil Skill |
|
|
| **Skill d'agent** | Préchargé via le champ `skills:` | `weather-fetcher` | Injecté dans le contexte de l'agent au démarrage |
|
|
|
|
---
|
|
|
|
## 
|
|
|
|
**Skill** — invoque directement via une commande slash :
|
|
```bash
|
|
$ claude
|
|
> /weather-svg-creator
|
|
```
|
|
|
|
---
|
|
|
|
## 
|
|
|
|
Demande à Claude d'en créer un pour toi — il génère le fichier markdown avec frontmatter YAML et corps dans `.claude/skills/my-skill/SKILL.md`
|
|
|
|
# My Skill
|
|
|
|
Instructions for what the skill does.
|
|
```
|