← 返回 Skills 市场
fy39913

cn-weather

作者 fy39913 · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
311
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install cn-weather-skill
功能描述
查询中国城市实时天气信息。当用户询问某个城市的天气、气温、湿度、风力、天气预报,或者说"今天天气怎么样"、"XX天气"、"帮我查天气"等时,必须使用此skill。支持全国所有城市,数据来自中国气象局官方接口,实时准确。即使用户只是提到某地天气或想了解出行穿衣建议,也应优先触发此skill获取实时数据。
使用说明 (SKILL.md)

天气查询 Skill

通过中国气象局官方接口,分两步查询城市实时天气信息。


工作流程

第一步:获取气象站点编号

调用站点查询接口,将城市名转为气象站点 ID:

curl --location 'https://data.cma.cn/kbweb/home/getStationID' \
  --header 'Content-Type: application/json' \
  --data '{"city":"\x3C城市名>"}'

说明:

  • \x3C城市名> 替换为用户输入的城市,例如 张家港北京上海
  • 响应中提取站点编号字段(如 stationID 或类似字段)
  • 若返回多个站点,优先取第一个或与城市名最匹配的站点

示例请求:

curl --location 'https://data.cma.cn/kbweb/home/getStationID' \
  --header 'Content-Type: application/json' \
  --data '{"city":"张家港"}'

第二步:查询实时天气

使用上一步获取的站点编号,查询当前天气数据:

curl --location 'https://weather.cma.cn/api/now/\x3C站点编号>' \
  --header 'Accept: application/json, text/javascript, */*; q=0.01'

说明:

  • \x3C站点编号> 替换为第一步返回的站点 ID,例如 58349
  • 响应包含温度、湿度、风向、风速、天气现象等字段

示例请求:

curl --location 'https://weather.cma.cn/api/now/58349' \
  --header 'Accept: application/json, text/javascript, */*; q=0.01'

结果展示规范

获取天气数据后,按以下格式整理并回复用户:

📍 \x3C城市名> 实时天气
━━━━━━━━━━━━━━━━━━
🌡️  温度:XX°C
🤔 体感温度:XX°C
💧 湿度:XX%
🌬️  风向:XX风
💨 风速:X级(XX m/s)
☁️  天气:XX(晴/多云/小雨等)
👁️  能见度:XX km
⏱️  更新时间:XXXX-XX-XX XX:XX
  • 若接口返回字段名为英文,对照常见字段进行中文映射(temperature→温度,humidity→湿度,windDirection→风向,windSpeed→风速,weather→天气现象等)
  • 若某字段缺失,跳过该行,不显示"未知"或空值
  • 结尾可根据天气数据给出简短的出行或穿衣建议(1~2句话)

错误处理

情况 处理方式
城市名无法识别 / 站点 ID 为空 告知用户未找到该城市的气象站点,建议尝试更换城市全称或相邻城市
第二步接口请求失败 告知用户天气数据暂时无法获取,建议稍后重试
返回数据字段异常 展示能解析的字段,忽略异常字段,不中断回复

注意事项

  • 两步接口必须按顺序执行,第一步成功后才能执行第二步
  • 城市名建议使用中文全称,如"张家港市"效果与"张家港"相同
  • 本接口为中国气象局数据,仅支持中国大陆城市;若用户询问港澳台或境外城市,提示暂不支持并建议使用其他渠道
安全使用建议
This skill appears coherent and low-risk, but verify these practical points before installing: (1) the skill makes outbound requests to data.cma.cn and weather.cma.cn — confirm your environment permits these network calls and that you trust those endpoints; (2) no credentials are required, but user-supplied city names will be sent to the external API (privacy consideration); (3) SKILL.md examples use curl — ensure the runtime has an HTTP capability or the platform will need to implement the calls; (4) the SKILL.md claims 'official' CMA APIs — consider validating the endpoints and whether an API key or rate limits apply in your deployment. If any of these are unacceptable, do not enable the skill.
功能分析
Type: OpenClaw Skill Name: cn-weather-skill Version: 1.0.1 The skill is a legitimate weather query tool for Chinese cities using official China Meteorological Administration (CMA) APIs (data.cma.cn and weather.cma.cn). The SKILL.md file outlines a standard two-step process to retrieve a station ID and then fetch real-time weather data via curl, with no evidence of data exfiltration, malicious execution, or prompt injection.
能力评估
Purpose & Capability
Name/description (Chinese weather lookup) match the instructions: two-step queries to CMA endpoints to resolve station ID and fetch current weather. Nothing requested is out-of-scope for a weather skill.
Instruction Scope
SKILL.md only instructs two specific HTTP calls (to data.cma.cn and weather.cma.cn) and how to format results; it does not access files, env vars, or other system state. Note: it assumes the agent can make outbound HTTP requests (examples use curl) and will transmit user-supplied city names to external endpoints (privacy consideration).
Install Mechanism
Instruction-only skill with no install spec and no code files. No packages or downloads are requested, so there is no installation risk.
Credentials
No environment variables, credentials, or config paths are required. The lack of secrets or broad credential access is proportionate to a public-weather lookup skill.
Persistence & Privilege
always is false and the skill is user-invocable with normal autonomous invocation allowed; this is expected for a service integration and does not request elevated persistent privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cn-weather-skill
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cn-weather-skill 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Skill 名称由 "weather" 更名为 "cn-weather" - 其余功能与描述保持不变
v1.0.0
Initial release of cn-weather-skill: - Provides real-time weather info for all mainland Chinese cities via the China Meteorological Administration official API. - Supports user queries about weather, temperature, humidity, wind, and forecasts by city name. - Uses a two-step process: first fetch the weather station ID for a city, then retrieve live weather data with that ID. - Returns results in a clear, standardized format with optional clothing/travel suggestions. - Handles errors such as unrecognized cities or failed data fetch gracefully. - Only supports cities in mainland China; prompts users accordingly for unsupported locations.
元数据
Slug cn-weather-skill
版本 1.0.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

cn-weather 是什么?

查询中国城市实时天气信息。当用户询问某个城市的天气、气温、湿度、风力、天气预报,或者说"今天天气怎么样"、"XX天气"、"帮我查天气"等时,必须使用此skill。支持全国所有城市,数据来自中国气象局官方接口,实时准确。即使用户只是提到某地天气或想了解出行穿衣建议,也应优先触发此skill获取实时数据。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 311 次。

如何安装 cn-weather?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cn-weather-skill」即可一键安装,无需额外配置。

cn-weather 是免费的吗?

是的,cn-weather 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

cn-weather 支持哪些平台?

cn-weather 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 cn-weather?

由 fy39913(@fy39913)开发并维护,当前版本 v1.0.1。

💬 留言讨论