AgentSkillsCN

hk-weather

从香港天文台(HKO)API获取香港实时天气数据。当用户询问香港天气、气温、降雨量、湿度、天气预报、台风信号、暴雨预警、天气警告、紫外线指数,或任何与香港天气相关的具体问题时使用此功能。同时,也可用于回答“要不要带伞”“穿什么衣服”或“在香港安排户外活动”等问题。

SKILL.md
--- frontmatter
name: hk-weather
description: Query real-time Hong Kong weather data from the Hong Kong Observatory (HKO) API. Use when the user asks about Hong Kong weather, temperature, rainfall, humidity, forecasts, typhoon signals, rainstorm warnings, weather warnings, UV index, or any weather-related question specific to Hong Kong. Also triggers for questions about whether to bring an umbrella, what to wear, or outdoor activity planning in HK.

HK Weather Skill

Query Hong Kong weather using the official HK Observatory (天文台) API. No API key needed.

API Base

code
https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType={TYPE}&lang={LANG}

Languages: en (English), tc (繁體中文), sc (简体中文). Default to user's language.

Quick Reference

QuerydataTypeWhat you get
Current conditionsrhrreadTemperature, humidity, rainfall by district, UV, warnings
9-day forecastfndDaily forecast with min/max temp, weather, wind
Today's forecastflwGeneral situation, forecast description, outlook
Active warningswarnsumList of active warnings (empty {} = none)
Warning detailswarningInfoDetailed warning descriptions
Special tipsswtSpecial weather tips from HKO

For earthquake data: https://data.weather.gov.hk/weatherAPI/opendata/earthquake.php?dataType=qem&lang=en

How to Query

  1. Use curl to call the appropriate endpoint
  2. Parse the JSON response
  3. Present relevant info to user in a readable format

Example: Current Weather

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=en" | python3 -m json.tool

Key fields in response:

  • temperature.data[]{ place, value, unit } (station temperatures)
  • humidity.data[]{ value, unit } (humidity %)
  • rainfall.data[]{ place, max, unit } (district rainfall in mm)
  • uvindex.data[] → UV readings
  • icon[] → weather condition icon numbers
  • warningMessage → active warning text (if any)

Example: 9-Day Forecast

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang=en" | python3 -m json.tool

Key fields:

  • weatherForecast[]{ forecastDate, week, forecastWeather, forecastMaxtemp, forecastMintemp, forecastWind, ForecastIcon }
  • generalSituation → overall weather description

Presentation Guidelines

  • Show temperature range (min-max) when available
  • Mention rainfall if > 0mm in any district
  • Always mention active warnings prominently (typhoon/rainstorm signals are critical in HK)
  • For forecasts, group by date and show weather + temp range
  • Use weather emoji: ☀️ 🌤️ ⛅ 🌥️ ☁️ 🌧️ ⛈️ 🌪️ as appropriate
  • For Chinese responses, use 繁體中文 (match HK style)

Full API Details

See references/api-endpoints.md for complete endpoint documentation, response schemas, and weather icon mappings.