api-learner

A workflow for discovering how a website communicates with its servers, then documenting those requests for direct command-line use. It replaces repeated browser actions with curl calls, which send web requests from a terminal.

In plain words
What is it for?
Use it to capture browser network traffic, generate API notes, and repeat tasks such as searching or adding items to a cart with fresh cookies.
Why use it?
It helps when heavy, JavaScript-based websites time out in a browser or when the same browser task must be repeated. It does not cover first-time discovery, CAPTCHA flows, payments, or tasks that require seeing the page.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/davidtoby/agent-skills/api-learner
Any agent
npx skills add davidtoby/agent-skills --skill api-learner
Clone the repo
git clone --depth 1 https://github.com/davidtoby/agent-skills

Made for: Claude Code, Codex.

Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 862 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00022 $0.00862
Opus 5 $0.00011 $0.00431
Sonnet 5 $0.00004 $0.00172
Haiku 4.5 $0.00002 $0.00086

Measured 2d ago against content hash 4a6050a35598, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

api-learner scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo -u OpenClaw /opt/OpenClaw/scripts/capture-api.js --port 9222 --duration 300

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

description: "Workflow for learning site APIs via traffic capture and replacing browser automation with direct curl calls."
skills/.archive/umbrella-curation-2026-04-29/openclaw-imports/api-learner/SKILL.md · 86 lines

How it starts

The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API Learner — Browser-to-API Migration

Instead of fighting browser timeouts on heavy sites, you can use learned API patterns to make direct curl calls. This is faster, more reliable, and avoids CDP timeout issues.

When to Suggest API Capture

Suggest this to the operator when:

  • A site repeatedly causes browser timeouts (heavy SPAs, JS-heavy storefronts)
  • You're doing the same browser task repeatedly (search → add to cart → repeat)
  • The browser tool fails with "timed out after 20000ms" on a site you use often

Do NOT use API skills for:

  • First visits to a new site (need to discover the workflow first)
  • CAPTCHA or bot-detection flows
  • Checkout / payment flows (the operator handles these manually)
  • Sites where you need to see visual layout (e.g., comparing product images)

How API Learning Works

  1. The operator starts a capture on the relevant VNC browser port
  2. Normal browsing happens — manually or via the browser tool
  3. Capture script records all XHR/Fetch API calls passively
  4. Generator analyzes the traffic and produces a SKILL.md with endpoint docs
  5. You use curl with fresh cookies instead of the browser tool

Using a Generated API Skill

Once an API skill exists (e.g., api-example), follow this pattern:

Step 1: Extract fresh cookies

COOKIES=$(/opt/OpenClaw/scripts/extract-cookies.js --domain <domain> --port <cdp-port>)

The VNC browser must be open and logged into the site. Cookies come from the live browser session.

Step 2: Make API calls

Use curl with the cookie header:

curl -s 'https://www.example.com/api/search?q=spinach' \
  -H "Cookie: $COOKIES" | python3 -m json.tool

Step 3: Handle failures

  • 401/403: Cookies expired. Re-extract and retry.
  • Changed responses: API may have been updated. Tell the operator to re-capture.
  • Unexpected errors: Fall back to the browser tool. Report to the operator.

Starting a New Capture (For the Operator)

To capture traffic from a site:

# Capture from Mise's browser (port 9222) for 5 minutes
sudo -u OpenClaw /opt/OpenClaw/scripts/capture-api.js --port 9222 --duration 300

# Capture from Headhunter's browser (port 9223) for 5 minutes
sudo -u OpenClaw /opt/OpenClaw/scripts/capture-api.js --port 9223 --duration 300

Read the full file on GitHub · 86 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 86 lines · 22 tokens per session scan B 4a6050a35598

Subscribe to this mod's changes

api-learner is a skill published in the GitHub repository davidtoby/agent-skills (10 stars, last pushed 28d ago), licensed MIT. It adds 22 tokens to every session and 862 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

chip-seq

ChIP-seq peak calling and downstream interpretation with MACS3, signal track export, annotation, motif analysis, and differential binding review.

zongtingwei/Bioclaw_Skills_Hub · 32 tokens

web-skills-protocol

Auto-discover and use Web Skills Protocol (WSP) skills when interacting with websites. Use this skill whenever the user asks you to interact with, use, or perform actions on a website or web service — such as searching a site, placing an order, deploying an app, or calling a web API. Before scraping HTML or guessing…

0xtresser/Web-Skills-Protocol · 141 tokens

dingtalk_channel_connect

Use a headed browser to automatically complete DingTalk channel integration for QwenPaw. Applicable when the user mentions DingTalk, developer console, Client ID, Client Secret, bot, Stream mode, binding or configuring a channel. Supports pausing when a login page is detected and resuming after the user logs in.

agentscope-ai/QwenPaw · 69 tokens

browser_cdp

Use this skill when the user explicitly wants to connect to a running Chrome browser, scan local CDP ports, specify a cdpport, or share a single browser across multiple agents/tools. By default browser opens no debugging port; pass an explicit cdpport only when the user wants another local tool to attach.

agentscope-ai/QwenPaw · 70 tokens

browser_cdp

当用户明确希望连接到已运行的 Chrome 浏览器、扫描本地 CDP 端口、显式指定 cdpport,或让多个 agent / 工具共享同一个浏览器时,使用本 skill。browser 默认不开放调试端口;仅当用户明确希望其他本地工具附加时才显式传入 cdpport。.

agentscope-ai/QwenPaw · 85 tokens

browser_visible

当用户需要控制 browser 的浏览器启动方式时,使用本 skill。browser 默认由 Playwright 直接管理、不开放调试端口(需让其他本地工具附加时显式传 cdpport);headed 控制是否显示窗口,privatemode 保留用于兼容、不再改变默认行为,browserargs 传入额外的 Chromium 启动参数,executablepath 指定自定义浏览器可执行文件路径。.

agentscope-ai/QwenPaw · 108 tokens