There are a lot of examples of Claude Skills out there which include
separate code files that Claude can use to execute something. But
Skills can be just a single SKILL.md file describing and algorithm
and/or a way to communicate with some API, its schema, authorization
and authentication patterns, error handling etc.
Considering that Claude already knows how to make external requests with
curl or fetch etc, you don’t necessarily need to code the API interactions
themselves. Sometimes that might be beneficial if you want to hide certain aspects
such as token management, error handling, retries, logging, etc. But for
most simple cases describing the solution in SKILL.md might be sufficient,
especially when prototyping.
When planning my vacations, I like to use holiday-weather.com to check what to expect. So I wondered if I would be able to teach it to use that. The solution is a bit hacky, but it works.
Here is a session example and below you can find the SKILL.md prompt.
Session example
> What is average high tmp on Tenerife in December?
⏺ I'll help you find the average high temperature on Tenerife in
December using the weather data skill.
> The "Average Weather" skill is running
⎿ Allowed 4 tools for this command
⏺ I'll find the average high temperature on Tenerife in December. Let me start by searching for Tenerife's location data.
⏺ Bash(curl 'https://www.holiday-weather.com/search/autocomplete?term=tenerife')
⎿ [
{
"value": "Tenerife (Spain, Canary Islands)",
… +31 lines
⏺ Now let me fetch the average weather data for Tenerife and extract
the high temperature values.
⏺ Bash(curl 'https://www.holiday-weather.com/tenerife/averages/' | grep -E "high_low_temperature_avg_high_temp_c_values")
⎿ <input id="high_low_temperature_avg_high_temp_c_values" value="[20,20,21,22,23,25,27,28,27,25,23,20]">
⏺ The average high temperature on Tenerife in December is 20°C (68°F).
The data shows that Tenerife has quite consistent temperatures throughout the year,
with December being one of the cooler months alongside January and February, all
averaging around 20°C for the daily high.
> Is the ocean warm at that time of the year?
⏺ Let me check the average sea temperature for Tenerife in December.
⏺ Bash(curl 'https://www.holiday-weather.com/tenerife/averages/' | grep -E "sea_temperature_c_values")
⎿ <input id="sea_temperature_c_values" value="[20,19,19,20,20,22,22,23,24,24,22,21]">
⏺ The average sea temperature in Tenerife in December is 21°C (70°F).
This is quite pleasant for swimming! While it's not tropical-warm, 21°C is
definitely comfortable enough for most people to swim, especially compared to
other European destinations in December. The water stays relatively warm
year-round in Tenerife thanks to its location in the Canary Islands off the
coast of Africa, making it a popular winter sun destination.
SKILL.md code
This skill file describes basically how to make 2 requests. The first request is to find the location and its URL. The second request fetches the averages itself. That algorithm is enough for Claude to be able to do its magic.
---
name: Average Weather
description: Query average weather data for locations around the world
allowed-tools: Bash, Read, Grep, Glob, Fetch, Curl
---
# Average Weather
This skill enables obtaining average weather information from various
places around the whole world by utilizing holiday-weather.com website
data.
## When to Use This Skill
Activate this skill when users request average weather information such as:
* Average Temperature
* Average High/Low Temperature
* Average Day Temperature
* Average Night Temperature
* Average Rainfall
* Average Daily Sunshine Hours
* Average Sea Temperature
## Usage
Use `curl` or `fetch` depending on whatever you have available in your environment right now.
### Find location
First you need to find the URL for the right location that the user is asking about.
For that you use the `https://www.holiday-weather.com/search/autocomplete` URL with
query parameter `term`. For example when the user is searching for `Malaga` you can use
```
curl 'https://www.holiday-weather.com/search/autocomplete?term=malaga'
```
This gives you a JSON result list such as:
```
[
{"value":"Malaga (Spain)","country_short":"ES","is_country":false,"url":"\/malaga\/","id":622},
{"value":"Malaga Airport (Spain)","country_short":"ES","is_country":false,"url":"\/malaga_airport\/","id":4842020},
{"value":"Malaga del Fresno (Spain, Castilla-La Manacha)","country_short":"ES","is_country":false,"url":"\/malaga_del_fresno_es\/","id":3910079}
]
```
From that list you can pick the relevant item based on what the user asked you.
And move to the next step which is discovering the actual averages of the location.
You need to remember the `url` from the item you picked here.
### Find average weather in a location
To discover average weather for all months in a year you need to curl or fetch
the `url` from the previous autocomplete response plus `averages/` appended to it,
i.e. `https://www.holiday-weather.com/malaga/averages`
```
curl 'https://www.holiday-weather.com/malaga/ | grep -E "c_values|days_values"
```
Then depending on what the user is searching for you need to find the answer in
the right `input` based on its `id` attribute.
You can have inputs with these `id` in response:
* `temperature_c_values`
* `high_low_temperature_avg_high_temp_c_values`
* `high_low_temperature_avg_low_temp_c_values`
* `day_temperature_c_values`
* `night_temperature_c_values`
* `precipitation_rain_days_values`
* `daily_sun_hours_c_values`
* `sea_temperature_c_values`
Example:
```
<input class="c_values" type="hidden" id="day_temperature_c_values" name="values" value="[13,13,15,16,20,24,26,27,24,20,16,13]">
```
From `value`, you can find the answer in the array based on months' index.
i, For January you would take the first element from `[13,13,15,16,20,24,26,27,24,20,16,13]`
which is `13`.
That means the avg day temperature in Malaga in January is 13 Celsius degree.