← 返回 Skills 市场
sdk-team

Alibabacloud Iqs Weather Query

作者 alibabacloud-skills-team · GitHub ↗ · v0.0.1-beta.1 · MIT-0
cross-platform ⚠ suspicious
84
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install alibabacloud-iqs-weather-query
功能描述
7-day weather forecast query powered by Alibaba Cloud IQS web search and page reading. Triggers: "weather forecast", "7-day weather", "weekly weather", "weat...
使用说明 (SKILL.md)

IQS Weather Query - 7-Day Weather Forecast

Query 7-day weather forecasts for any city using Alibaba Cloud IQS web search (UnifiedSearch) and page reading (ReadPageBasic) capabilities.

Underlying Service: alibabacloud-iqs-search

Hybrid Parsing Strategy:

  • Known sites (weather.cma.cn, weather.com.cn): Dedicated parsers extract structured JSON → parseMode: "structured"
  • Unknown sites: ReadPage extracts main content (readabilityMode: article), returns raw text with extraction hint → parseMode: "raw", agent (LLM) interprets directly
Output Field Description
parseMode "structured" (parsed JSON) or "raw" (text for agent)
weather Weather condition (sunny, cloudy, rain, etc.)
temperature Temperature range
windSpeed Wind speed/level
windDirection Wind direction

Environment Configuration

Pre-check: ALIYUN_IQS_API_KEY Required

echo $ALIYUN_IQS_API_KEY | head -c 4

If output is empty, the API Key is not configured.

How to obtain ALIYUN_IQS_API_KEY: Please refer to Aliyun IQS Documentation

Configure environment variable (choose one):

Option 1: Temporary (current terminal session only)

export ALIYUN_IQS_API_KEY="your-api-key-here"

Option 2: Permanent (recommended)

Add to ~/.zshrc or ~/.bashrc:

export ALIYUN_IQS_API_KEY="your-api-key-here"

Run source ~/.zshrc or source ~/.bashrc to apply.

Alternative: Place API Key in ~/.alibabacloud/iqs/env file:

ALIYUN_IQS_API_KEY=your-api-key-here

Workflow

User Input (city name)
        │
        ▼
┌─────────────────────────┐
│ Step 1: UnifiedSearch    │  Search: "{city} 天气预报 未来7天"
│ (Web Search)            │  Priority: weather.cma.cn > weather.com.cn
└──────────┬──────────────┘
           │ Best weather URL
           ▼
┌─────────────────────────┐
│ Step 2: ReadPageBasic    │  Known site → readabilityMode: normal
│ (Page Reading)          │  Unknown site → readabilityMode: article
└──────────┬──────────────┘
           │ Page content
           ▼
     Known site?
      ╱        ╲
    YES          NO
     │            │
     ▼            ▼
  Parser       Return rawText
  Router       + hint for agent
     │         (parseMode: raw)
     ▼
  Structured JSON
  (parseMode: structured)

Usage

Prerequisites

  • Node.js >= 18 (native fetch support required)
  • No additional npm dependencies needed

Execute Query

node scripts/weather.mjs \x3Ccity>

Examples:

node scripts/weather.mjs 北京
node scripts/weather.mjs 上海
node scripts/weather.mjs 杭州
node scripts/weather.mjs Tokyo

Output Format

Structured mode (known sites — parsed successfully):

{
  "success": true,
  "data": {
    "city": "北京",
    "parseMode": "structured",
    "queryTime": "2026-03-26T10:00:00.000Z",
    "forecastDays": 7,
    "forecast": [
      {
        "date": "3月26日",
        "weather": "晴",
        "temperature": "5°C ~ 18°C",
        "windDirection": "北风",
        "windSpeed": "3-4级"
      }
    ],
    "source": "https://weather.cma.cn/..."
  }
}

Raw mode (unknown sites — agent interprets the text):

{
  "success": true,
  "data": {
    "city": "北京",
    "parseMode": "raw",
    "hint": "以下是北京天气网页的正文内容,请从中提取未来7天的天气预报信息...",
    "rawText": "北京天气预报\
今天 晴 18°C/5°C ...",
    "evolveHint": "[持续进化] 当前站点 \"example.com\" 没有匹配的解析器...",
    "source": "https://example.com/weather/beijing"
  }
}

IQS APIs Used

API Endpoint Purpose Documentation
UnifiedSearch cloud-iqs.aliyuncs.com/search/unified Web search for weather pages Doc
ReadPageScrape cloud-iqs.aliyuncs.com/readpage/scrape Read and parse weather webpage Doc

Search Priority Sites (with dedicated parsers):

  1. weather.cma.cn (China Meteorological Administration) — parseCmaWeather → readabilityMode: normal
  2. baidu.weather.com.cn / sq.weather.com.cn (China Weather Network mobile) — parseBaiduWeatherComCn → readabilityMode: normal
  3. weather.com.cn (China Weather Network, all other subdomains) — parseWeatherComCn → readabilityMode: normal
  4. Other sites — no parser, return raw text → readabilityMode: article (cleaner body extraction)

Error Handling

Error Code Description Solution
CREDENTIALS_MISSING API Key not configured Set ALIYUN_IQS_API_KEY environment variable
NO_RESULTS No weather results found Check city name is correct
QUERY_FAILED API call failed Check network, verify credentials
PARSE_FAILED Failed to parse weather data from webpage The target site's page structure may have changed; update the corresponding parser or add a new one (see Extending section)

Best Practices

  1. Use Chinese city names for domestic weather queries for better accuracy
  2. Node.js >= 18 required - native fetch API is used, no npm install needed
  3. Cache awareness - ReadPage uses maxAge not set, always fetches latest data
  4. Extensible parsers - Each weather site has its own parser; add new sites by registering in PARSER_REGISTRY

Continuous Evolution

This skill is designed to self-improve over time. When the script encounters an unknown site format (no matching parser), it returns parseMode: "raw" with an evolveHint field.

Agent behavior when parseMode is "raw":

  1. First: Answer the user — Extract weather info from rawText using LLM understanding and respond to the user immediately.
  2. Then: Evolve — Read the evolveHint and analyze the rawText format pattern, then write a new parser function and register it in PARSER_REGISTRY (see Extending section below). This ensures that next time the same site format is hit, it goes through structured mode directly.
First query for unknown site:
  search → readpage → no parser match → raw mode → agent answers user
                                                  → agent writes new parser ← evolveHint

Subsequent queries for same site:
  search → readpage → parser match → structured mode → direct JSON output

Key: The skill gets smarter with every new city searched. Each raw-mode encounter is an opportunity to add a new parser, progressively covering more site formats.


Extending: Add a New Weather Site Parser

The script uses a Parser Registry pattern. Each weather site has its own dedicated parser function, and the router automatically dispatches based on URL. To add support for a new site, follow these 3 steps:

Step 1: Write a Parser Function

Add a new parser function in scripts/weather.mjs. It must accept (content, city) and return the standard format:

function parseMyNewSite(content, city) {
  const forecast = [];

  // Parse the text content from ReadPage for this specific site
  // Extract: date, weather, temperature, windDirection, windSpeed
  // ...your parsing logic here...

  return {
    city,
    queryTime: new Date().toISOString(),
    forecastDays: Math.min(forecast.length, 7),
    forecast: forecast.slice(0, 7),
    raw: forecast.length === 0 ? content.substring(0, 2000) : undefined,
  };
}

Return format for each forecast item:

Field Type Example
date string "04/07 星期二"
weather string "晴转多云"
temperature string "5°C ~ 18°C"
windDirection string "北风"
windSpeed string "3-4级"

Step 2: Register in PARSER_REGISTRY

Add your parser to the registry array at the top of weather.mjs. Order matters — higher position = higher priority:

const PARSER_REGISTRY = [
  { pattern: 'weather.cma.cn',          parser: parseCmaWeather },
  { pattern: 'baidu.weather.com.cn',    parser: parseBaiduWeatherComCn },
  { pattern: 'sq.weather.com.cn',       parser: parseBaiduWeatherComCn },
  { pattern: 'weather.com.cn',          parser: parseWeatherComCn },
  { pattern: 'mynewsite.com',           parser: parseMyNewSite },    // ← Add here
];

Step 3: Add to Search Priority (optional)

If you want the new site to be prioritized in search results, add it to PREFERRED_WEATHER_SITES:

const PREFERRED_WEATHER_SITES = [
  'weather.cma.cn',
  'weather.com.cn',
  'mynewsite.com',           // ← Add here
];

How the Router Works

parseWeatherData(content, city, url)
  │
  ├─ URL contains "weather.cma.cn"?          → parseCmaWeather(content, city)
  ├─ URL contains "baidu.weather.com.cn"?    → parseBaiduWeatherComCn(content, city)
  ├─ URL contains "sq.weather.com.cn"?       → parseBaiduWeatherComCn(content, city)
  ├─ URL contains "weather.com.cn"?          → parseWeatherComCn(content, city)
  ├─ URL contains "mynewsite.com"?           → parseMyNewSite(content, city)
  │
  └─ No match or result \x3C 3 days?           → return rawText + hint (agent interprets)

Tip: Use node -e "..." with the ReadPage API to fetch and inspect the raw text format of a new site before writing the parser. See existing parsers (parseCmaWeather, parseWeatherComCn) as reference implementations.

安全使用建议
This skill implements a plausible Alibaba Cloud IQS-based weather lookup and requires an ALIYUN_IQS_API_KEY (the script reads process.env and ~/.alibabacloud/iqs/env), but the registry metadata does not declare that env var — confirm the key requirement before installing. Review the bundled scripts/weather.mjs yourself: the code calls cloud-iqs.aliyuncs.com and contains site-specific parsers. Pay special attention to the "evolve" behavior: the skill encourages producing new parser code and registering it in the shipped file; do not automatically accept or run code-generation that rewrites files without manual review. If you will provide the API key, consider running the skill in a constrained environment (container or isolated account) and only enable autonomous invocation if you trust the publisher. If you need higher confidence, ask the publisher for a provenance/source repository and updated metadata declaring ALIYUN_IQS_API_KEY, or request that the evolve/self-modification capability be removed or only exposed as a manual developer instruction.
功能分析
Type: OpenClaw Skill Name: alibabacloud-iqs-weather-query Version: 0.0.1-beta.1 The skill bundle implements a 'Continuous Evolution' feature in SKILL.md and scripts/weather.mjs that instructs the AI agent to modify its own source code. Specifically, if a weather site is not recognized, the agent is prompted via an 'evolveHint' to write a new parser function and register it in the PARSER_REGISTRY. This creates a high risk of code injection and remote code execution (RCE) because the agent's code-writing behavior is triggered by untrusted content fetched from external websites. While the stated purpose is benign (improving weather data extraction), the mechanism of self-modifying code based on external input is a significant security vulnerability.
能力评估
Purpose & Capability
The name/description match the included script: it queries Alibaba Cloud IQS (UnifiedSearch + ReadPage) to return weather data. That capability reasonably requires an ALIYUN_IQS_API_KEY and access to the IQS endpoints. However, the registry metadata claims "Required env vars: none" while SKILL.md and the script both require/read ALIYUN_IQS_API_KEY (and may read ~/.alibabacloud/iqs/env). This mismatch is inconsistent and should be clarified.
Instruction Scope
SKILL.md and the script stay mostly within weather-query scope (search, read, parse). However the bundle explicitly includes an "evolveHint" that asks the agent to analyze rawText and produce a new parser function and register it in scripts/weather.mjs. That guidance effectively instructs the agent to create or modify code within the skill bundle (or at least to propose code to be inserted). This expands the skill's runtime authority and could lead to the agent being asked to write/execute code beyond simple queries. The instructions also reference reading the user's home config file (~/.alibabacloud/iqs/env) — which is relevant for an API key but is an additional filesystem access to be aware of.
Install Mechanism
No install spec is provided (no downloads or package installs). The skill includes a Node.js script (requires Node.js >= 18). There is no external install URL or archive; risk from install mechanism is low. The presence of an included .mjs script means code will run locally when invoked.
Credentials
The script only needs the ALIYUN_IQS_API_KEY (from process.env or ~/.alibabacloud/iqs/env) to call Alibaba IQS endpoints, which is proportionate to the stated purpose. The discrepancy is that the registry metadata lists no required env vars while SKILL.md and scripts do require an API key — this omission is a red flag for sloppy metadata or accidental under-declaration; verify the key requirement before use. No other credentials or unrelated environment variables are referenced.
Persistence & Privilege
The skill does not request always:true and does not declare any system-level persistence. However the skill's 'self-improve' guidance encourages adding parser functions into scripts/weather.mjs (i.e., modifying the skill's files). While editing its own parser registry could be legitimate for maintenance, it effectively allows evolution of executable code and should be treated as elevated behavior: only allow if you trust the source and review proposed changes before applying them.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alibabacloud-iqs-weather-query
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alibabacloud-iqs-weather-query 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1-beta.1
alibabacloud-iqs-weather-query 0.0.1-beta.1 - Initial beta release providing 7-day weather forecast queries using Alibaba Cloud IQS web search and page reading. - Supports both structured output (with dedicated parsers for major Chinese weather sites) and raw extraction mode for other sources. - Designed for easy extension: new site parsers can be added and auto-registered for continuous skill improvement. - No npm dependencies required; works with Node.js >= 18 using native fetch. - Includes detailed setup instructions, API error handling, and best practices for accuracy and evolution. - Returns clear output, including data fields like weather, temperature, wind speed/direction, and structured/parse modes.
元数据
Slug alibabacloud-iqs-weather-query
版本 0.0.1-beta.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Alibabacloud Iqs Weather Query 是什么?

7-day weather forecast query powered by Alibaba Cloud IQS web search and page reading. Triggers: "weather forecast", "7-day weather", "weekly weather", "weat... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 84 次。

如何安装 Alibabacloud Iqs Weather Query?

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

Alibabacloud Iqs Weather Query 是免费的吗?

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

Alibabacloud Iqs Weather Query 支持哪些平台?

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

谁开发了 Alibabacloud Iqs Weather Query?

由 alibabacloud-skills-team(@sdk-team)开发并维护,当前版本 v0.0.1-beta.1。

💬 留言讨论