← Back to Skills Marketplace
lijian-github-20190615

alibabacloud-iqs-weather-query

by lijian-github-20190615 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
66
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install iqs-weather
Description
7-day weather forecast query powered by Alibaba Cloud IQS web search and page reading. Triggers: "weather forecast", "7-day weather", "weekly weather", "weat...
README (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.

Usage Guidance
This skill appears to implement weather lookup via Alibaba IQS and will call cloud-iqs.aliyuncs.com endpoints — that is expected. But before installing or running it: 1) be aware the SKILL.md and script require ALIYUN_IQS_API_KEY (and may read ~/.alibabacloud/iqs/env), yet the registry metadata does not declare that—ask the publisher to declare required env vars and config paths. 2) Inspect scripts/weather.mjs yourself (it is included) to confirm there are no unexpected behaviors. 3) Consider providing the API key with least privilege and keep it separate from high‑privilege credentials; prefer temporary keys when possible. 4) Decide whether you are comfortable allowing the agent to modify local skill files — the skill’s "evolve" instructions encourage creating/parsing new parser code, which could lead to file writes. 5) If you don't trust the unknown publisher, run the script in an isolated environment (container/VM) or decline. If you want, ask the author to update the registry metadata to explicitly list ALIYUN_IQS_API_KEY and the optional config file path.
Capability Analysis
Type: OpenClaw Skill Name: iqs-weather Version: 1.0.0 The skill contains instructions in SKILL.md and scripts/weather.mjs (via the 'evolveHint' field) that direct the AI agent to perform self-modification of the source code. It explicitly asks the agent to write new parser functions and register them into the PARSER_REGISTRY within scripts/weather.mjs when encountering unknown websites. While framed as a 'Continuous Evolution' feature for weather parsing, this capability introduces a high risk of code injection if the agent processes malicious content from external websites. The script also accesses the user's home directory (~/.alibabacloud/iqs/env) to retrieve API keys.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
Name/description (7‑day forecast via Alibaba IQS) match the code and instructions. However, the package metadata declares no required env vars or config paths while both SKILL.md and scripts/weather.mjs require an ALIYUN_IQS_API_KEY and optionally read ~/.alibabacloud/iqs/env. That's an incoherence in declared requirements.
Instruction Scope
SKILL.md and the script limit operations to calling Alibaba IQS search/readpage endpoints and parsing pages, which is appropriate. But the skill's "evolveHint" explicitly instructs the agent/developer to modify scripts/weather.mjs to add new parsers (i.e., edit the skill's code). That encourages the agent to produce code changes on disk and broadens runtime scope beyond simple queries.
Install Mechanism
No install spec and no external downloads; the skill is an instruction + included Node.js script. There is no evidence of third‑party packages being pulled or obfuscated installers.
Credentials
The script and SKILL.md require ALIYUN_IQS_API_KEY (and offer storing it in ~/.alibabacloud/iqs/env), which is proportionate to using Alibaba IQS. However, the registry metadata does not declare this required credential or the config path—this mismatch reduces transparency. The skill reads a file in the user's home directory which was not declared in required config paths.
Persistence & Privilege
always:false and no elevated platform privileges. Still, the guidance to add new parsers to scripts/weather.mjs implies modifying files bundled with the skill; if the agent is allowed to write files, that increases blast radius. The skill itself does not explicitly perform persistent installation or set always:true.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install iqs-weather
  3. After installation, invoke the skill by name or use /iqs-weather
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
7-day weather forecast query powered by Alibaba Cloud IQS web search and page reading. Triggers: "weather forecast", "7-day weather", "weekly weather", "weather in [city]", "will it rain", "temperature forecast"
Metadata
Slug iqs-weather
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 66 downloads so far.

How do I install alibabacloud-iqs-weather-query?

Run "/install iqs-weather" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is alibabacloud-iqs-weather-query free?

Yes, alibabacloud-iqs-weather-query is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does alibabacloud-iqs-weather-query support?

alibabacloud-iqs-weather-query is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created alibabacloud-iqs-weather-query?

It is built and maintained by lijian-github-20190615 (@lijian-github-20190615); the current version is v1.0.0.

💬 Comments