Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ax

БесплатноЗапускает вложенные скриптыНе проверен

AI-era curl for agent web fetching, structure discovery, and deterministic structured extraction with token-budgeted output.

akillnessот akillness★ 63 звезды на GitHub

Об этом скилле

ax — The AI-Era Curl for Web Scraping & Extraction

Version 1.0.0
Yusuke Bebé & Contributors
AI-driven fetch, discover, extract framework


Summary

ax is a command-line tool purpose-built for AI agents to fetch web pages, discover their structure, and extract structured data — replacing the classic curl → parse → regex loop with one deterministic, token-efficient command.

When to Use ax

  • You need an agent to fetch a page and extract structured data
  • You want page discovery (--outline) without dumping raw HTML
  • You're extracting multi-field rows with CSS selectors (--row, --table)
  • You need token-shaped output (capped, with budget control)
  • You're building a repeatable web-scraping agent task
  • You're tired of curl | grep | awk pipeline in agent code

When NOT to Use ax

  • The target site requires client-side JavaScript rendering (use Playwright or Puppeteer instead)
  • You need real-time browser automation or multi-step interactions
  • The content is behind authentication not solvable with headers (use direct API instead)
  • You need headless browser for visual testing

Quick Start

Install ax

# System-wide install (via shell script)
curl -fsSL https://ax.yusuke.run/install -o ax-install.sh && less ax-install.sh && sh ax-install.sh

# Or via Homebrew (macOS/Linux)
brew install yusukebe/tap/ax

# Or via npm (if Node.js available)
npm install -g ax-cli

Basic Usage

# Fetch and show full response
ax https://api.example.com/users

# Discover page structure
ax https://example.com --outline

# Extract rows with custom selectors
ax https://example.com '.item' --row 'title=a, href=a@href'

# Read docs as markdown
ax https://docs.example.com --md --budget 800

# Extract table to JSON
ax https://example.com 'table' --table --json

Integrate into Agent Workflow

# Run with agent context (shows optimized flags for LLMs)
ax agent-context

# Use in agentic script
ITEMS=$(ax https://shop.example.com '.product' \
  --row 'name=h2, price=.price' \
  --where 'price < 100' \
  --json)

Core Concepts

1. Fetch Mode — Live Data with Full Context

Command: ax <url>

Returns JSON-structured response: { status, ok, ms, headers, body }. Never silent.

  • Every request is live (no cache by default)
  • Empty bodies still produce full report
  • JSON responses are automatically parsed
  • Use --body for classic curl-like stdout pipe
  • 100ms+ latency typical; use trusted CA certificates (SSL_CERT_FILE) for private/local TLS endpoints
ax https://api.github.com/repos/yusukebe/ax
# Output:
# {
#   "status": 200,
#   "ok": true,
#   "ms": 142,
#   "headers": { "content-type": "application/json", ... },
#   "body": { "name": "ax", "stars": 450, ... }
# }

2. Parse Mode — Cached HTML Discovery

Flags: --outline, --locate, --md

When you fetch a URL, the HTML is cached locally (~2 minutes) for fast subsequent probes.

  • --outline: Shows repeating DOM structures (no raw markup in output)
  • --locate 'text': Finds the CSS selector holding a given text
  • --md: Renders HTML as readable markdown
  • Each cache hit is announced on stderr
  • --fresh forces refetch; --no-cache disables disk cache entirely
ax https://news.example.com --outline
# Output:
# main
#   article (×12)
#     h2.headline (×1)
#     p.summary (×1)
#     a.read-more (×1)

3. Extract Mode — Structured Data Rows

Flags: --row, --table, --where

Pulls multi-field rows in a single command; filters with safe expression language.

# Custom row format
ax https://shop.example.com '.item' \
  --row 'name=h2, price=.price, rating=.stars' \
  --where 'price > 50'

# Table extraction (auto-detects <table>)
ax https://data.example.com --table --json

# Output format: TSV by default (header once), --json for JSON array
  • --row 'field1=selector, field2=selector@attr': Define fields and CSS selectors
  • @attr: Extract attribute (e.g., a@href); default is .textContent
  • --where 'expr': Filter rows; safe expression language (no code execution)
  • --json: JSON output instead of TSV
  • --limit 50: Cap result rows (default 50)

4. Token Budgeting — AI Context Optimization

Flag: --budget <tokens>

Results are shaped for LLM context windows:

  • Output capped at ~50 rows by default (announced on stderr)
  • --budget 800 limits output to ~800 estimated tokens
  • Results always include row count / truncation note
  • TSV format is token-efficient; JSON is more flexible for structured parsing
ax https://catalog.example.com '.product' \
  --row 'name=h2, price=.price' \
  --budget 500
# If 200 rows match, shows first ~40 to fit token budget
# stderr: "Truncated to 40 of 200 rows (token budget: 500)"

Usage Patterns for Agents

Pattern 1: Page Discovery (Zero Code, All Questions)

Agent doesn't know the page structure → use --outline to let agent ask:

ax
Полный SKILL.md на GitHub

Установить ax в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash
Read
Write
Edit
Glob
Grep
WebFetch

Вложенные файлы

README.mdreferences/agent-patterns.mdreferences/cli-flags.mdreferences/installation.mdscripts/scaffold-integration.shscripts/setup.sh

FAQ

Что делает скилл ax?

AI-era curl for agent web fetching, structure discovery, and deterministic structured extraction with token-budgeted output.

Как установить скилл ax?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ax запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить ax с