Skill: gxcun17/skywork-search (version 1.0.8)

--- name: Skywork Search description: Skywork Search (skywork) - Search the web for real-time information using the Skywork Search API. Use this skill whenever the user needs up-to-date information from the internet — for example, researching a topic, looking up recent events, finding facts or statistics, gathering material for a document or presentation, or answering questions that require current data. Also trigger when the user says things like "search for" / "搜索" / "検索" / "검색", "look up" / "查询" / "調べる" / "조회하다", "find information about" / "查找关于……的信息" / "……に関する情報を探す" / "…에 대한 정보를 찾다", "what's the latest on" / "……最新进展" / "……の最新情報" / "…의 최신 소식", or any request that implies needing information beyond your training data. metadata: openclaw: requires: bins: - python3 env: - SKYWORK_API_KEY primaryEnv: SKYWORK_API_KEY --- # Web Search Skill Search the web for real-time information via the Skywork search API. This skill lets you run up to 3 queries in a single invocation and returns structured results with source URLs and content snippets. ## When to use - The user asks you to research a topic or find current information - You need up-to-date facts, statistics, or news to answer a question - Another task (writing a report, creating a PPT, drafting a document) needs web research as a preliminary step - The user explicitly asks to search or look something up ## Prerequisites ### API Key Configuration (Required First) This skill requires a **SKYWORK_API_KEY** to be configured before use. If you don't have an API key yet, please visit: **https://skywork.ai** For detailed setup instructions, see: [references/apikey-fetch.md](references/apikey-fetch.md) ## How to use Run the bundled script from this skill's `scripts/` directory: ```bash python3 <skill-path>/scripts/web_search.py "query1" ["query2"] ["query3"] ``` - Pass 1–3 search queries as positional arguments - Results are saved to individual text files in a temporary directory - The script prints the file paths to stdout so you can read them ## Crafting good queries Search quality depends heavily on query phrasing. A few tips: - **Be specific**: "Tesla Q4 2025 revenue" works better than "Tesla financials" - **Use natural language**: The API handles full questions well — "What is the current population of Tokyo?" is fine - **Split broad topics**: If the user wants a comprehensive overview, break it into 2–3 focused queries rather than one vague one - **Include time context** when relevant: "best Python web frameworks 2026" rather than just "best Python web frameworks" ## Reading results After running the script, read the output files. Each file contains: ``` query: <the original query> [result-1] <source URL> <content snippet> [result-2] <source URL> <content snippet> ... ``` Synthesize the results into a clear answer for the user. Always cite sources when presenting factual information — include the URLs from the results so the user can verify. ## Example workflow User asks: "What are the latest developments in quantum computing?" 1. Run the search with focused queries: ```bash python3 <skill-path>/scripts/web_search.py \ "quantum computing breakthroughs 2026" \ "quantum computing industry news latest" ``` 2. Read the result files 3. Synthesize findings into a clear, sourced summary for the user ## Limitations - Maximum 3 queries per invocation (the script caps it) - Each query has a 30-second timeout - Results depend on the Skywork search API availability

path: scripts/skywork_auth.py
content: import os
from typing import Optional


def get_skywork_api_key() -> Optional[str]:
    """
    Returns skywork api key.
    """
    [REDACTED_SECRET]"SKYWORK_API_KEY", "")
    if not [REDACTED_SECRET]"SKYWORK_API_KEY is not set.")
        return None
    return api_key

path: scripts/constant.py
content: SKYWORK_GATEWAY_URL = "https://api-tools.skywork.ai/theme-gateway"
POD_TYPE = ""


path: scripts/web_search.py
content: #!/usr/bin/env python3
"""
web_search.py - Call Skywork web search API and print results.

Usage:
    python web_search.py "query1" ["query2" ...]

Accepts 1-3 search queries. Results are saved to individual text files
in a temporary directory and paths are printed to stdout.
"""

import argparse
import json
import os
import re
import sys
import tempfile
import urllib.request

# Add scripts directory to path for skywork_auth import
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from constant import POD_TYPE, SKYWORK_GATEWAY_URL
from skywork_auth import get_skywork_api_key


def search(query: str) -> str:
    """Call web_search API and return formatted text of results."""
    url = f"{SKYWORK_GATEWAY_URL}/web_search"
    [REDACTED_SECRET])
    if not [REDACTED_SECRET]"[error] SKYWORK_API_KEY is required", file=sys.stderr)
        sys.exit(1)
    payload = {"query": query, "source_platform": "skyclaw" if POD_TYPE == "skyclaw" else ""}
    body = json.dumps(payload).encode("utf-8")
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {api_key}",
    }
    req = urllib.request.Request(
        url,
        data=body,
        method="POST",
        headers=headers,
    )
    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            raw = resp.read().decode("utf-8")
    except urllib.error.URLError as e:
        print(f"[ERROR] web_search failed for query '{query}': {e}", file=sys.stderr)
        sys.exit(1)

    try:
        data = json.loads(raw)
    except json.JSONDecodeError:
        return raw

    results = data.get("search_res", [])
    if not results:
        return "(no results)"

    lines = []
    for i, item in enumerate(results, 1):
        content = (item.get("content") or "").strip()
        source_url = item.get("url", "")
        lines.append(f"[result-{i}] {source_url}\n{content}")
    return "\n\n".join(lines)


def safe_filename(value: str) -> str:
    cleaned = re.sub(r"[^\w.-]+", "_", value, flags=re.UNICODE).strip("._-")
    if not cleaned:
        return "query"
    return cleaned[:80]


def main():
    parser = argparse.ArgumentParser(description="Search the web via Skywork API")
    parser.add_argument("queries", nargs="+", help="One or more search queries (max 3)")
    args = parser.parse_args()

    queries = args.queries[:3]
    out_dir = tempfile.mkdtemp(prefix="web_search_")

    for q in queries:
        print(f"[query] {q} ...", file=sys.stderr, flush=True)
        raw = search(q)
        out_path = os.path.join(out_dir, f"{safe_filename(q)}_result.txt")
        with open(out_path, "w", encoding="utf-8") as f:
            f.write(f"query: {q}\n\n{raw}")
        print(f"Saved: {out_path}", flush=True)


if __name__ == "__main__":
    main()


path: references/apikey-fetch.md
content: # Skywork API Key Setup Guide

## SKYWORK_API_KEY Not Configured

When the `SKYWORK_API_KEY` environment variable is not set, follow these steps:

### 1. Get API Key

Visit the Skywork website and sign in to your account:

**https://skywork.ai**

- Log in with your Skywork account
- Open account / Settings / API Key (**https://skywork.ai/?openApiKeySetting=1**)
- Create or copy your **API key**

If your organization uses a separate console or test environment, use the URL and credentials your team provides.

### 2. Configure OpenClaw

Edit the OpenClaw configuration file: `~/.openclaw/openclaw.json`

In current OpenClaw, Skywork skills store the key under `skills.entries.<Skill Name>.apiKey` (not under `env`).
OpenClaw will inject this value into the skill's `SKYWORK_API_KEY` environment when `primaryEnv` matches.
Add or merge the following structure (adjust the skill name to match the installed skill):

```json
{
  "skills": {
    "entries": {
      "Skywork Search": {
        "enabled": true,
        "apiKey": "your_actual_skywork_api_key_here"
      }
    }
  }
}
```

Replace `"your_actual_skywork_api_key_here"` with your real key.

For multiple Skywork skills, repeat the same `apiKey` field on each skill entry.

### 3. Configure Claude Code

If you are using Claude Code, use one of these lightweight options:

**Option A — shell environment**

Export the API key before running the skill:

```bash
export SKYWORK_API_KEY="your_actual_skywork_api_key_here"
```

To persist it across sessions, add the same line to `~/.zshrc` or `~/.bashrc`, then reload the shell.

**Option B — Claude Code settings**

Add the variable to `~/.claude/settings.json`:

```json
{
  "env": {
    "SKYWORK_API_KEY": "your_actual_skywork_api_key_here"
  }
}
```

Use the method that best matches how you run Claude Code.

### 4. Verify Configuration

```bash
# Check that the environment variable is available
echo "$SKYWORK_API_KEY"
```

For OpenClaw, you can also validate the config file:

```bash
cat ~/.openclaw/openclaw.json | python3 -m json.tool
```

### 5. Restart OpenClaw

```bash
openclaw gateway restart
```

## Troubleshooting

- Ensure `~/.openclaw/openclaw.json` exists and is valid JSON
- Ensure `SKYWORK_API_KEY` is available in Claude Code through your shell or `~/.claude/settings.json`
- Confirm the API key is active and not expired
- Check Skywork account status, membership, or quota if requests fail with auth or benefit errors
- Restart OpenClaw after configuration changes

**Recommended**: Use the setup method that matches your runtime. OpenClaw should use the OpenClaw config file; Claude Code can use either the shell environment or `~/.claude/settings.json`.


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)