SKILL.md
1.6 KB查看排版效果| 1 | --- |
| 2 | name: weather-forecast |
| 3 | description: 查询任意城市或地点的当前天气与未来数日预报(温度、天气状况、降水概率、风速、湿度),无需 API Key,数据来自 Open-Meteo。 |
| 4 | --- |
| 5 | |
| 6 | # 天气查询 |
| 7 | |
| 8 | 查询指定城市/地点的实时天气和未来 1~7 天预报。数据源为 Open-Meteo(免费、无需 API Key)。 |
| 9 | |
| 10 | ## 用法 |
| 11 | |
| 12 | ``` |
| 13 | python3 weather.py "北京" |
| 14 | python3 weather.py "Tokyo" --days 3 |
| 15 | python3 weather.py --lat 39.9 --lon 116.4 --days 2 |
| 16 | ``` |
| 17 | |
| 18 | - 第一个参数为城市名(中文或英文),自动解析坐标;也可以直接用 `--lat`/`--lon` 指定经纬度。 |
| 19 | - `--days N`:预报天数,默认 1(含今天)。 |
| 20 | - `--lang zh|en`:输出语言,默认跟随城市语言。 |
| 21 | |
| 22 | ## 输出示例 |
| 23 | |
| 24 | ``` |
| 25 | 北京 · 2026-10-31 |
| 26 | 晴 12°C(体感 11°C) 湿度 34% 西南风 12 km/h |
| 27 | 明天 11-01:多云 8~16°C 降水概率 10% |
| 28 | ``` |
| 29 | |
| 30 | ## 机制 |
| 31 | |
| 32 | - 城市→坐标:Open-Meteo Geocoding API(`https://geocoding-api.open-meteo.com/v1/search?name=<城市>&count=1&language=zh&format=json`)。 |
| 33 | - 天气:Open-Meteo Forecast API(`https://api.open-meteo.com/v1/forecast?latitude=&longitude=¤t=temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m,wind_direction_10m&daily=weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max&timezone=auto&forecast_days=N`)。 |
| 34 | - WMO weather code 映射为中文/英文天气状况描述。 |
| 35 | - 纯 Python 标准库(urllib),无第三方依赖;输出简洁,适合直接转述给用户。 |
| 36 | |
| 37 | ## 隐私与安全 |
| 38 | |
| 39 | - 不收集任何个人信息;仅向 Open-Meteo 公共接口发起查询。 |
| 40 | - 不含任何密钥或账号凭据。 |
文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。

