AgentSkillsCN

weather

通过免费API获取实时天气与预报信息(无需API密钥)。适用于需要查询任意地点的天气、气温、预报信息,或气候状况的场景。

SKILL.md
--- frontmatter
name: weather
description: Get current weather and forecasts using free APIs (no API key required). Use when asked about weather, temperature, forecasts, or climate conditions for any location.

Weather

Get weather data using free services - no API keys needed.

wttr.in (Primary)

Fast, simple, works everywhere.

Quick check:

bash
curl -s "wttr.in/London?format=3"
# Output: London: ⛅️ +8°C

Compact format:

bash
curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"
# Output: London: ⛅️ +8°C 71% ↙5km/h

Full forecast:

bash
curl -s "wttr.in/London?T"

Format Codes

CodeMeaning
%cWeather condition emoji
%tTemperature
%hHumidity
%wWind
%lLocation
%mMoon phase

Tips

  • URL-encode spaces: wttr.in/New+York or wttr.in/San%20Francisco
  • Airport codes work: wttr.in/JFK, wttr.in/SFO
  • Units: ?m metric, ?u USCS (Fahrenheit)
  • Limit days: ?1 today only, ?0 current only
  • Save as image: curl -s "wttr.in/Berlin.png" -o weather.png

Open-Meteo (JSON API)

Better for programmatic use. Free, no key.

bash
curl -s "https://api.open-meteo.com/v1/forecast?latitude=37.77&longitude=-122.42&current_weather=true"

Response includes: temperature, windspeed, weathercode, time.

Get coordinates first

bash
curl -s "https://geocoding-api.open-meteo.com/v1/search?name=San+Francisco&count=1"

Examples

San Francisco right now:

bash
curl -s "wttr.in/San+Francisco?format=3"

Tokyo 3-day forecast:

bash
curl -s "wttr.in/Tokyo?3T"

JSON weather for coordinates:

bash
curl -s "https://api.open-meteo.com/v1/forecast?latitude=35.68&longitude=139.69&current_weather=true&hourly=temperature_2m"