Xpersona
Q

QWeather China

CLAWHUB · Unverified

基于中国气象局数据的完整天气服务,通过和风天气API提供实时天气、天气预报、生活指数、空气质量等全方位天气信息。专为中国用户优化,数据更准确,功能更全面。 Skill: QWeather China Owner: uni-huang Summary: 基于中国气象局数据的完整天气服务,通过和风天气API提供实时天气、天气预报、生活指数、空气质量等全方位天气信息。专为中国用户优化,数据更准确,功能更全面。 Tags: china:1.3.1, forecast:1.3.1, latest:1.2.2, qweather:1.3.1, utility:1.3.1, weather:1.3.1 Version history: v1.2.2 | 2026-04-12T23:39:53.501Z | user Security compliance update: complete env vars declaration, detailed permissions, placeholder config values v1.2.1 | 2026-04-12T16:43:20.913Z |

62
Rank
84
Safety
1.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17e4brg2cgqrep13q1sxjzbyn8497st:qweather-china
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-uni-huang-qweather-china/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

129,931 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: qweather-china
description: "基于中国气象局数据的完整天气服务,通过和风天气API提供实时天气、天气预报、生活指数、空气质量等全方位天气信息。专为中国用户优化,数据更准确,功能更全面。"
version: "1.2.2"
homepage: https://dev.qweather.com/
author: uni-huang
license: MIT-0
metadata:
  openclaw:
    emoji: "🇨🇳"
    requires:
      bins: ["python3", "curl"]
      env:
        required:
          - QWEATHER_API_HOST
          - QWEATHER_PROJECT_ID
          - QWEATHER_CREDENTIALS_ID
          - QWEATHER_PRIVATE_KEY_PATH
        optional:
          - QWEATHER_DEFAULT_LOCATION
          - QWEATHER_CACHE_DIR
    permissions:
      filesystem:
        read:
          - ~/.config/qweather/config.json
          - ~/.config/qweather/private.pem
          - ~/.cache/qweather/
        write:
          - ~/.cache/qweather/
      network:
        endpoints:
          - "*.qweatherapi.com"
---

# QWeather China Skill

基于中国气象局数据的完整天气服务Skill,提供准确、本地化的天气信息。

## 目标
给用户提供可靠的实时天气与预报(不依赖通用 web_search)。
自动处理地点输入(城市名/经纬度/locationId)。
支持"今天/明天/后天/未来N天"等表达。

## 触发条件
用户提到:天气、气温、下雨、降温、风、湿度、预报、今天/明天/后天、未来几天。
一旦判定是天气问题,优先本 skill。

## 功能特点

### ✅ 核心功能
1. **实时天气** - 当前温度、体感温度、湿度、风速、降水等
2. **天气预报** - 3天/7天详细预报,包含白天夜间天气
3. **生活指数** - 穿衣、洗车、运动、紫外线等生活建议
4. **空气质量** - 实时AQI、污染物浓度
5. **天气预警** - 官方天气预警信息

### ✅ 数据优势
- **数据源**: 中国气象局官方数据
- **准确性**: 针对中国气候特点优化
- **本地化**: 中文天气描述,符合中国用户习惯
- **完整性**: 日出日落、月相、能见度等全方位信息

### ✅ 用户体验
- **智能建议**: 基于天气的穿衣、出行建议
- **多城市支持**: 支持全国主要城市
- **缓存优化**: 减少API调用,提高响应速度
- **错误处理**: 完善的错误处理和降级机制
- **智能地点处理**: 自动识别城市名、经纬度、locationId
- **自然语言理解**: 支持"今天/明天/后天/未来N天"等表达

## 工作流

### 1. 获取地点
- 若用户提供地点:调用 `qweather_location_lookup({location})`
- 若未提供地点:
  - 若 env 存在 `QWEATHER_DEFAULT_LOCATION`:使用默认地点,并明确说明"按默认地点查询"
  - 否则追问用户城市/地点

### 2. 判断查询类型
- **"现在/当前/实时"**:调用 `weather_now({location})`
- **"今天/明天/后天/未来N天"**:调用 `weather_forecast({location, days})`
  - 建议 days 映射:
    - 今天:days=1
    - 明天:days=2(输出前2天,重点标明第2天)
    - 后天:days=3(重点标明第3天)
    - "未来几天":默认 days=3;用户说 N 天则用 N(上限 15)

### 3. 输出格式
- **地点**:解析后的 name
- **实时**:天气现象、气温/体感、湿度、风向风力、观测时间
- **预报**:每天最高/最低、白天/夜间天气、降水(如有)、风力

## 约束
- **不要使用 web_search 代替天气数据源**。
- **API 失败时**:返回明确错误,并提示检查环境变量:
  - `QWEATHER_API_HOST` - API 主机地址
  - `QWEATHER_PROJECT_ID` - 项目ID (sub)
  - `QWEATHER_CREDENTIALS_ID` - 凭据ID (kid)
  - `QWEATHER_PRIVATE_KEY_PATH` - 私钥文件路径(建议使用 `~/.config/qweather/private.pem`)
- **默认地点**:使用 `QWEATHER_DEFAULT_LOCATION` 设置默认查询地点
- **安全注意**:私钥文件应存放在独立目录(如 `~/.config/qweather/`),并设置 600 权限

## 跨平台兼容性

### ✅ 完全支持的操作系统
- **Windows** (7/8/10/11, Server 2012+)
- **Linux** (Ubuntu, Debian, CentOS, Fedora, etc.)
- **macOS** (10.15+)

### ✅ 编码自动处理
- **Windows控制台**:自动处理GBK编码,将Unicode表情转换为文本描述
- **Linux/macOS终端**:原生支持UTF-8,完整显示Unicode字符
- **智能检测**:运行时自动检测系统编码并适配

### ✅ 新增工具模块
- **encoding_utils.py**:编码处理核心模块
- **safe_print()函数**:替代标准print,自动处理编码
- **系统检测**:自动识别平台和编码设置

### ✅ 向后兼容
- 完全兼容v1.1.0的所有功能
- 现有配置无需修改
- API接口保持不变

## 配置要求

### 必需配置
1. **和风天气API认证**(通过环境变量或 config.json 配置)
   - `QWEATHER_API_HOST`: API 主机地址(如 `p54up4xhmm.re.qweatherapi.com`)
   - `QWEATHER_PROJECT_ID`: 项目ID (

README.md

# QWeather China Skill for OpenClaw

基于中国气象局数据的完整天气服务技能,专为OpenClaw优化。

## 🎯 功能特点

### 🌤️ 完整天气服务
- **实时天气**: 温度、湿度、风力、降水等
- **天气预报**: 3天/7天详细预报
- **生活指数**: 穿衣、洗车、运动、紫外线等
- **空气质量**: 实时AQI、污染物数据
- **天气预警**: 官方预警信息

### 🇨🇳 中国本地化
- **数据源**: 中国气象局官方数据
- **准确性**: 针对中国气候特点优化
- **中文支持**: 完整中文天气描述
- **城市覆盖**: 全国主要城市

### 🚀 高性能
- **智能缓存**: 减少API调用
- **错误恢复**: 自动降级和重试
- **快速响应**: 优化请求处理

## 📦 安装

### 自动安装
```bash
# Windows
install.bat

# Linux/Mac
chmod +x install.sh
./install.sh
```

### 手动安装
1. 复制本目录到OpenClaw技能目录
2. 安装Python依赖:
   ```bash
   pip install pyjwt cryptography requests
   ```
3. 配置私钥文件:
   ```bash
   # 创建配置目录
   mkdir -p ~/.config/qweather
   
   # 复制私钥到独立位置(推荐)
   cp /path/to/your/qweather-private.pem ~/.config/qweather/private.pem
   chmod 600 ~/.config/qweather/private.pem
   ```
4. 测试安装:
   ```bash
   python qweather.py now --city beijing
   ```

## 🔧 配置

### 环境变量配置(推荐)
在OpenClaw环境或系统环境中配置:

```bash
# 必需配置
export QWEATHER_API_HOST="p54up4xhmm.re.qweatherapi.com"
export QWEATHER_PROJECT_ID="4FKRV2BREH"
export QWEATHER_CREDENTIALS_ID="CGWFM979C7"
export QWEATHER_PRIVATE_KEY_PATH="~/.config/qweather/private.pem"

# 可选配置
export QWEATHER_DEFAULT_LOCATION="beijing"
export QWEATHER_CACHE_DIR="~/.cache/qweather"
```

### config.json 配置
也可以通过 `config.json` 配置:

```json
{
  "qweather": {
    "enabled": true,
    "api_host": "p54up4xhmm.re.qweatherapi.com",
    "jwt": {
      "kid": "CGWFM979C7",
      "sub": "4FKRV2BREH",
      "private_key_path": "~/.config/qweather/private.pem"
    },
    "cache": {
      "enabled": true,
      "directory": "~/.cache/qweather"
    }
  }
}
```

**注意**:私钥文件应存放在独立目录(如 `~/.config/qweather/`),不要与其他应用共享。

## 📖 使用方法

### 在OpenClaw中直接使用
```
用户: 北京天气怎么样?
助手: 🌤️ 北京当前天气...
```

### 命令行使用
```bash
# 实时天气
python qweather.py now --city beijing

# 3天预报
python qweather.py forecast --city shanghai --days 3

# 生活指数
python qweather.py indices --city guangzhou

# 空气质量
python qweather.py air --city hangzhou

# 完整报告
python qweather.py full --city chengdu
```

### 支持的查询格式
1. `[城市]天气` - 实时天气
2. `[城市]温度` - 当前温度
3. `[城市]今天/明天/后天天气` - 特定日期
4. `[城市]预报` - 3天预报
5. `[城市]未来N天预报` - N天预报
6. `[城市]生活指数` - 生活指数
7. `[城市]空气质量` - 空气质量
8. `[城市]需要带伞吗` - 雨伞建议
9. `[城市]穿什么` - 穿衣建议

### 支持的城市
- 北京 (beijing)
- 上海 (shanghai)
- 广州 (guangzhou)
- 深圳 (shenzhen)
- 杭州 (hangzhou)
- 成都 (chengdu)
- 武汉 (wuhan)
- 南京 (nanjing)
- 西安 (xian)
- 重庆 (chongqing)

或直接使用城市代码:`101010100` (北京)

## 🛠️ 开发

### 项目结构
```
qweather-china/
├── qweather.py          # 核心天气服务
├── openclaw_integration.py # OpenClaw集成
├── examples.py          # 使用示例
├── SKILL.md            # 技能文档
├── README.md           # 本文件
├── config.json         # 配置文件
├── openclaw_config.yaml # OpenClaw配置
├── install.bat         # Windows安装脚本
└── install.sh          # Linux安装脚本
```

### 扩展功能
1. **添加新城市**: 在`config.json`的`cities`部分添加
2. **自定义模板**: 修改`openclaw_config.yaml`的`templates`部分
3. **添加新命令**: 在`openclaw_integration.py`中添加处理函数

### 测试
```bash
# 运行示例
python examples.py

# 测试集成
python openclaw_integration.py

# 

_meta.json

{
  "ownerId": "kn78r7pjgartfr0h0mr1pajnf982sxrw",
  "slug": "qweather-china",
  "version": "1.2.2",
  "publishedAt": 1776037193501
}

RELEASE_README.md

# qweather-china v1.2.0 发布说明

## 🎉 版本亮点

### 核心优化功能
1. **智能地点记忆** - 优先从记忆(MEMORY.md)读取用户所在城市
2. **分级响应机制** - 简单问题直接结论,复杂问题完整信息
3. **问法兼容性** - 含义相同的问题得到相同回答
4. **跨平台兼容性** - Windows/Linux/macOS全支持
5. **中文语法优化** - 符合中文表达习惯

## 📁 发布文件结构

### 核心文件(必须包含)
```
qweather-china/
├── SKILL.md                    # 技能说明文档
├── openclaw_config.yaml       # OpenClaw配置
├── qweather.py                # 和风天气API客户端
├── encoding_utils.py          # 跨平台编码工具
├── location_handler.py        # 智能地点处理器
├── simple_question_fix.py     # 分级响应核心逻辑(优化版)
└── examples.py               # 使用示例
```

### 配置文件
```
config.json                   # 和风天气API配置
install.bat                   # Windows安装脚本
install.sh                    # Linux/macOS安装脚本
```

### 文档文件
```
README.md                    # 用户文档
RELEASE_README.md           # 发布说明(本文件)
```

## 🔧 核心功能说明

### 1. 智能地点记忆
- 用户问"天气怎么样?" → 自动使用记忆中的北京
- 用户问"上海天气怎么样?" → 使用指定的上海
- 兜底机制:无记忆时使用默认北京

### 2. 分级响应机制
#### 简洁模式(简单问题直接结论):
- "天气怎么样?" → 天气、温度、风力、建议
- "冷不冷?" → 温度 + 体感 + 建议
- "热不热?" → 温度 + 体感 + 建议
- "要不要带伞?" → ✅/❌ + 原因
- "下雨吗?" → 🌧️/☀️ + 建议
- "风大吗?" → 风力等级 + 描述
- "湿度怎么样?" → 湿度百分比 + 舒适度

#### 详细模式(复杂问题完整信息):
- "详细说说天气" → 完整天气报告
- 包含:实时天气、今天预报、生活建议、总结

### 3. 问法兼容性
含义相同的问题得到相同回答:
- "现在外面冷不冷?" = "冷不冷?"
- "风力大吗?" = "风大吗?"
- "需要带伞吗?" = "要不要带伞?"
- "有雨吗?" = "下雨吗?"

## 🚀 安装与配置

### 1. 前置要求
- Python 3.8+
- OpenClaw 已安装
- 和风天气API密钥(免费申请)

### 2. 安装步骤
```bash
# 方法1:使用clawhub安装
clawhub install qweather-china

# 方法2:手动安装
git clone https://github.com/your-repo/qweather-china.git
cd qweather-china
pip install -r requirements.txt
```

### 3. 配置和风天气API
1. 前往 https://dev.qweather.com/ 注册账号
2. 创建项目,获取API密钥
3. 配置 `config.json` 文件

## 📋 使用示例

### 基本使用
```python
from simple_question_fix import SimpleQuestionFix

weather = SimpleQuestionFix(user_city="beijing")

# 简洁回答
print(weather.ask("天气怎么样?"))
# 输出:您在北京现在:晴,13.0°C(体感9.0°C),2级风,今天2.0°C~15.0°C

print(weather.ask("冷不冷?"))
# 输出:您在北京:有点冷 🧥 体感9.0°C,今天2.0°C~15.0°C

# 详细回答
print(weather.ask("详细说说天气"))
# 输出:完整天气报告...
```

### OpenClaw集成
```yaml
# openclaw_config.yaml 配置示例
skills:
  qweather-china:
    enabled: true
    config_path: "~/.openclaw/skills/qweather-china/config.json"
    default_city: "beijing"
```

## 🧪 测试用例

### 测试所有简单问题
```python
from simple_question_fix import SimpleQuestionFix

weather = SimpleQuestionFix(user_city="beijing")

test_questions = [
    "天气怎么样?",
    "冷不冷?",
    "热不热?",
    "要不要带伞?",
    "下雨吗?",
    "风大吗?",
    "湿度怎么样?",
    "温度多少?",
    "详细说说天气",
]

for question in test_questions:
    answer = weather.ask(question)
    print(f"问题:{question}")
    print(f"回答:{answer}")
    print("-" * 40)
```

## 🔄 版本历史

### v1.2.0 (2026-03-15)
- ✅ 智能地点记忆功能
- ✅ 分级响应机制
- ✅ 问法兼容性优化
- ✅ 跨平台编码支持
- ✅ 中文语法优化

### v1.1.1 (2026-03-13)
- ✅ 修复Windows编码问题
- ✅ 优化错误处理
- ✅ 改进API调用稳定性

### v1.0.0 (2026-03-12)
- ✅ 基础天气查询功能
- ✅ 和风天气API集成
- ✅ 基本配置支持

## 📞 支持与反馈

- GitHub Issues: https://github.com/your-repo/qweather-china/issues
- 文档: https://docs.your-site.com/qweather-china
- 邮箱: support@your-site.com

## 📄

skill-card.md

## Description:

Provides localized China weather information through the QWeather API, including current conditions, forecasts, life indices, air quality, and weather alerts.

This skill is ready for commercial/non-commercial use.

## Publisher:

[uni-huang](https://clawhub.ai/user/uni-huang)

### License/Terms of Use:

MIT-0

## Use Case:

External users and developers use this skill to let an agent answer China-focused weather questions, including current weather, forecasts, air quality, life indices, and practical weather guidance. It can also be used from the command line after QWeather credentials and cache settings are configured.

### Deployment Geography for Use:

China

## Known Risks and Mitigations:

Risk: The skill handles a QWeather signing key and reads credential-related configuration paths, which could expose credentials if misconfigured.

Mitigation: Use a dedicated QWeather private key stored under ~/.config/qweather/private.pem with restrictive permissions, and avoid printing credential-related environment values in errors.

Risk: A stale .openclaw private-key path remains in openclaw_config.yaml.

Mitigation: Remove or replace the stale .openclaw key path before installing the skill in a sensitive environment.

Risk: If QWEATHER_API_HOST is not constrained, signed requests could be sent to an unapproved host.

Mitigation: Validate QWEATHER_API_HOST against approved qweatherapi.com hosts before sending JWT-authenticated requests.

Risk: Dependencies may be installed without a pinned lock file.

Mitigation: Install dependencies from a pinned lock file or an isolated virtual environment.

## Reference(s):

- [QWeather China on ClawHub](https://clawhub.ai/uni-huang/skills/qweather-china)
- [QWeather Developer Portal](https://dev.qweather.com/)
- [QWeather Documentation](https://dev.qweather.com/docs/)
- [QWeather City Resources](https://dev.qweather.com/docs/resource/city/)

## Skill Output:

**Output Type(s):** [Text, Markdown, Shell commands, Configuration, Guidance]

**Output Format:** [Markdown-style natural-language weather responses with optional shell commands and configuration snippets]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Uses QWeather API results and local cache when configured.]

## Skill Version(s):

1.2.2 (source: SKILL.md frontmatter and server release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to QWeather China and adjacent AI workflows.