jpskill.com
📦 その他 コミュニティ

actionbook-scraper

Actionbookの検証済みセレクターを使って、ウェブスクレイパーのスクリプトを自動生成・検証し、エラーを自動修正することで、効率的なデータ収集を支援するSkill。

📜 元の英語説明(参考)

Generate and verify web scraper scripts using Actionbook's verified selectors. Auto-validates generated scripts and fixes errors.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Actionbookの検証済みセレクターを使って、ウェブスクレイパーのスクリプトを自動生成・検証し、エラーを自動修正することで、効率的なデータ収集を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o actionbook-scraper.zip https://jpskill.com/download/15676.zip && unzip -o actionbook-scraper.zip && rm actionbook-scraper.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15676.zip -OutFile "$d\actionbook-scraper.zip"; Expand-Archive "$d\actionbook-scraper.zip" -DestinationPath $d -Force; ri "$d\actionbook-scraper.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して actionbook-scraper.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → actionbook-scraper フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Actionbook Scraper Skill

⚠️ 重要: 二段階検証

生成されたすべてのスクリプトは、以下の両方のチェックに合格する必要があります。

チェック 検証内容 失敗例
パート 1: スクリプトの実行 エラーなし、タイムアウトなし Selector not found
パート 2: データの正確性 コンテンツが期待どおり 名前ではなく "Click to expand" を抽出
┌─────────────────────────────────────────────────────┐
│   1. スクリプトの生成                                │
│          ↓                                          │
│   2. スクリプトの実行                                │
│          ↓                                          │
│   3. パート 1 のチェック: スクリプトはエラーなしで実行されるか?      │
│          ↓                                          │
│   4. パート 2 のチェック: データの内容は正しいか?         │
│      - 空ではない                                    │
│      - プレースホルダーテキスト ("Loading...") ではない          │
│      - UI テキスト ("Click to expand") ではない              │
│      - フィールドが正しくマッピングされている                      │
│          ↓                                          │
│      ┌───┴───┐                                      │
│   両方合格  どちらかが失敗                           │
│      │           │                                  │
│      │           ↓                                  │
│      │       Actionbook のデータの問題か?           │
│      │           │                                  │
│      │       ┌───┴───┐                              │
│      │      はい      いいえ                             │
│      │       │       │                              │
│      │       ↓       ↓                              │
│      │    .actionbook-issues.log にログを記録   スクリプトを修正                       │
│      │       │       │                              │
│      │       └───┬───┘                              │
│      │           ↓                                  │
│      │       再試行 (最大 3 回)                         │
│      ↓                                              │
│   スクリプトを出力                                     │
└─────────────────────────────────────────────────────┘

デフォルトの出力形式

/actionbook-scraper:generate <url>

デフォルト = agent-browser スクリプト (bash コマンド)

agent-browser open "https://example.com"
agent-browser scroll down 2000
agent-browser get text ".selector"
agent-browser close

--standalone フラグ付きの場合

/actionbook-scraper:generate <url> --standalone

出力 = Playwright JavaScript コード


検証要件

二段階検証

生成されたすべてのスクリプトは、以下の両方のチェックに合格する必要があります。

チェック 検証内容 失敗時のアクション
1. スクリプトの実行 エラーなし、タイムアウトなし 構文/セレクターのエラーを修正
2. データの正確性 コンテンツが期待されるフィールドと一致 抽出ロジックを修正

パート 1: スクリプト実行チェック

  • ランタイムエラーがないこと
  • タイムアウトエラーがないこと
  • ブラウザが正しく閉じること

パート 2: データ内容チェック (重要)

抽出されたデータが期待される構造と一致することを確認します。

期待されるもの: 会社名、説明、ウェブサイト、設立年
実際:   "Click to expand", "Loading...", 空の文字列

→ 失敗: データ内容が正しくないため、抽出ロジックを修正する必要があります

データ検証ルール:

ルール 失敗例 修正
フィールドが空ではないこと name: "" セレクターが正しい要素をターゲットにしているか確認
プレースホルダーテキストがないこと name: "Loading..." 動的なコンテンツの読み込みを待つ処理を追加
UI テキストがないこと name: "Click to expand" 展開後に抽出する (ボタンのテキストではない)
正しいデータ型 year: "View Details" 間違ったセレクター、フィールドマッピングを修正
合理的な数 期待値 ~100、取得数 3 スクロール/ページネーションの処理を追加

agent-browser スクリプトの場合

  1. 生成されたコマンドを実行します
  2. スクリプトがエラーなしで実行されることを確認します
  3. データの内容が正しいことを確認します:
    • フィールドが期待される構造と一致する
    • 値が実際のデータであり、UI テキストではない
    • 数が合理的である
  4. 失敗した場合:
    • 何が間違っているかを分析します (スクリプトエラーかデータエラーか)
    • セレクター、待機ロジック、または抽出を修正します
    • 再実行します
  5. 成功した場合:
    • 検証済みのスクリプトを出力します
    • フィールド検証付きのデータプレビューを表示します

Playwright スクリプトの場合 (--standalone)

  1. スクリプトを一時ファイルに書き込みます
  2. node script.js で実行します
  3. スクリプトがエラーなしで実行されることを確認します
  4. 出力データが正しいことを確認します:
    • JSON 構造が期待されるフィールドと一致する
    • 値に実際のデータが含まれている
    • 数が期待される範囲と一致する
  5. 失敗した場合:
    • エラーの種類を分析します
    • スクリプトを修正します
    • 再実行します
  6. 成功した場合:
    • 検証済みのスクリプトを出力します

アーキテクチャ概要

/generate <url>              → 出力: agent-browser bash コマンド
/generate <url> --standalone → 出力: Playwright .js ファイル
┌─────────────────────────────────────────────────────────────┐
│                   /generate <url>                           │
│                                                             │
│   1. Actionbook を検索 → セレクターを取得                      │
│   2. 出力を生成:                                       │
│                                                             │
│      --standalone なし    │    --standalone あり         │
│      ─────────────────────   │    ──────────────────        │
│      agent-browser コマンド  │    Playwright .js コード       │
│                              │                              │
│      ```bash                 │    ```javascript             │
│      agent-browser open ...  │    const { chromium } = ...  │
│      agent-browser get ...   │    await page.goto(...)      │
│      agent-browser close     │    ```                       │
│      ```                     │                              │
└─────────────────────────────────────────────────────────────┘

ツールの優先順位

| 操作 | 主要ツール | フォールバック | 注記 | |-----------|------------

(原文はここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Actionbook Scraper Skill

⚠️ CRITICAL: Two-Part Verification

Every generated script MUST pass BOTH checks:

Check What to Verify Failure Example
Part 1: Script Runs No errors, no timeouts Selector not found
Part 2: Data Correct Content matches expected Extracted "Click to expand" instead of name
┌─────────────────────────────────────────────────────┐
│   1. Generate Script                                │
│          ↓                                          │
│   2. Execute Script                                 │
│          ↓                                          │
│   3. Check Part 1: Script runs without errors?      │
│          ↓                                          │
│   4. Check Part 2: Data content is correct?         │
│      - Not empty                                    │
│      - Not placeholder text ("Loading...")          │
│      - Not UI text ("Click to expand")              │
│      - Fields mapped correctly                      │
│          ↓                                          │
│      ┌───┴───┐                                      │
│   BOTH Pass  Either Fails                           │
│      │           │                                  │
│      │           ↓                                  │
│      │       Is it Actionbook data issue?           │
│      │           │                                  │
│      │       ┌───┴───┐                              │
│      │      Yes      No                             │
│      │       │       │                              │
│      │       ↓       ↓                              │
│      │    Log to   Fix script                       │
│      │    .actionbook-issues.log                    │
│      │       │       │                              │
│      │       └───┬───┘                              │
│      │           ↓                                  │
│      │       Retry (max 3x)                         │
│      ↓                                              │
│   Output Script                                     │
└─────────────────────────────────────────────────────┘

Default Output Format

/actionbook-scraper:generate <url>

DEFAULT = agent-browser script (bash commands)

agent-browser open "https://example.com"
agent-browser scroll down 2000
agent-browser get text ".selector"
agent-browser close

With --standalone Flag

/actionbook-scraper:generate <url> --standalone

Output = Playwright JavaScript code


Verification Requirements

Two-Part Verification

Every generated script must pass BOTH checks:

Check What to Verify Failure Action
1. Script Runs No errors, no timeouts Fix syntax/selector errors
2. Data Correct Content matches expected fields Fix extraction logic

Part 1: Script Execution Check

  • No runtime errors
  • No timeout errors
  • Browser closes properly

Part 2: Data Content Check (CRITICAL)

Verify extracted data matches the expected structure:

Expected: Company name, description, website, year founded
Actual:   "Click to expand", "Loading...", empty strings

→ FAIL: Data content incorrect, need to fix extraction logic

Data validation rules:

Rule Example Failure Fix
Fields not empty name: "" Check selector targets correct element
No placeholder text name: "Loading..." Add wait for dynamic content
No UI text name: "Click to expand" Extract after expanding, not button text
Correct data type year: "View Details" Wrong selector, fix field mapping
Reasonable count Expected ~100, got 3 Add scroll/pagination handling

For agent-browser Scripts

  1. Execute the generated commands
  2. Check script runs without errors
  3. Check data content is correct:
    • Fields match expected structure
    • Values are actual data, not UI text
    • Count is reasonable
  4. If failed:
    • Analyze what's wrong (script error vs data error)
    • Fix selector, wait logic, or extraction
    • Re-execute
  5. If success:
    • Output the verified script
    • Show data preview with field validation

For Playwright Scripts (--standalone)

  1. Write script to temp file
  2. Run with node script.js
  3. Check script runs without errors
  4. Check output data is correct:
    • JSON structure matches expected fields
    • Values contain actual data
    • Count matches expected range
  5. If failed:
    • Analyze error type
    • Fix script
    • Re-run
  6. If success:
    • Output the verified script

Architecture Overview

/generate <url>              → OUTPUT: agent-browser bash commands
/generate <url> --standalone → OUTPUT: Playwright .js file
┌─────────────────────────────────────────────────────────────┐
│                   /generate <url>                           │
│                                                             │
│   1. Search Actionbook → get selectors                      │
│   2. Generate OUTPUT:                                       │
│                                                             │
│      WITHOUT --standalone    │    WITH --standalone         │
│      ─────────────────────   │    ──────────────────        │
│      agent-browser commands  │    Playwright .js code       │
│                              │                              │
│      ```bash                 │    ```javascript             │
│      agent-browser open ...  │    const { chromium } = ...  │
│      agent-browser get ...   │    await page.goto(...)      │
│      agent-browser close     │    ```                       │
│      ```                     │                              │
└─────────────────────────────────────────────────────────────┘

Tool Priority

Operation Primary Tool Fallback Notes
Find selectors for URL search_actions None Search by domain/keywords
Get full selector details get_action_by_id None Use action_id from search
List available sources list_sources search_sources Browse all indexed sites
Generate agent-browser script Agent (sonnet) - Default mode for /generate
Generate Playwright script Agent (sonnet) - Use --standalone flag
Structure analysis Agent (haiku) - Parse Actionbook response
Request new website agent-browser Manual Submit to actionbook.dev (ONLY command that executes agent-browser)

Workflow Rules

CRITICAL: Generate → Verify → Fix

Every generated script MUST be verified by executing it.

Step Action
1 Generate script with Actionbook selectors
2 Execute script to verify it works
3 If failed: analyze error, fix script, go to step 2
4 If success: output verified script + data preview

Verification Process

For agent-browser scripts:

# Execute each command
agent-browser open "https://example.com"
agent-browser wait --load networkidle
agent-browser get text ".selector"
# Check if data is returned
# If error → fix and retry
agent-browser close

For Playwright scripts (--standalone):

# Write to temp file and execute
node /tmp/scraper.js
# Check if output file has data
# If error → fix and retry

Critical Rules

  1. ALWAYS verify generated scripts - Execute and check BOTH parts
  2. Part 1: Script must run - No errors, no timeouts
  3. Part 2: Data must be correct - Not empty, not UI text, fields mapped correctly
  4. Fix errors automatically - Don't output broken scripts or wrong data
  5. Use Actionbook MCP tools first - Never guess selectors
  6. Include scroll handling for lazy-loaded pages
  7. Include expand/collapse logic for card-based layouts
  8. Always close browser - Include agent-browser close
  9. Retry up to 3 times - If still failing, report the specific issue

Common Data Errors to Catch

Error Example Fix
Extracted button text name: "Click to expand" Extract content after expanding
Extracted placeholder desc: "Loading..." Add wait for dynamic content
Empty fields name: "" Fix selector
Wrong field mapping year: "San Francisco" Fix selector for each field
Too few items Expected 100, got 3 Add scroll/pagination

Record Actionbook Data Issues

If Actionbook selectors are wrong or outdated, record to local file:

.actionbook-issues.log

When to record:

  • Selector doesn't exist on page
  • Selector returns wrong element
  • Page structure has changed
  • Missing selectors for key elements

Log format:

[YYYY-MM-DD HH:MM] URL: {url}
Action ID: {action_id}
Issue Type: {selector_error | outdated | missing}
Details: {description}
Selector: {selector}
Expected: {what it should select}
Actual: {what it actually selects or error}
---

Selector Priority

When Actionbook provides multiple selectors, prefer in this order:

  1. data-testid - Most stable, designed for automation
  2. aria-label - Accessibility-based, semantic
  3. css - Class-based selectors
  4. xpath - Last resort, most fragile

Commands

Command Description Agent
/actionbook-scraper:analyze <url> Analyze page structure and show available selectors structure-analyzer
/actionbook-scraper:generate <url> Generate agent-browser scraper script code-generator
/actionbook-scraper:generate <url> --standalone Generate Playwright/Puppeteer script code-generator
/actionbook-scraper:list-sources List websites with Actionbook data -
/actionbook-scraper:request-website <url> Request new website to be indexed (uses agent-browser) website-requester

Data Flow

Analyze Command

1. User: /actionbook-scraper:analyze https://example.com/page
2. Extract domain from URL → "example.com"
3. search_actions("example page") → [action_ids]
4. For best match: get_action_by_id(action_id) → full selector data
5. Structure-analyzer agent formats and presents findings

Generate Command (Default: agent-browser script)

User: /actionbook-scraper:generate https://example.com/page

Step 1: Search Actionbook
  search_actions("example.com page") → action_ids

Step 2: Get selectors
  get_action_by_id(best_match) → selectors

Step 3: Generate agent-browser script
  ```bash
  agent-browser open "https://example.com/page"
  agent-browser wait --load networkidle
  agent-browser scroll down 2000
  agent-browser get text ".item-container"
  agent-browser close

Step 4: VERIFY script (REQUIRED) Execute the commands and check if data is extracted If failed → analyze error → fix script → retry (max 3x)

Step 5: Return verified script + data preview


**Example Output:**
````markdown
## Verified Scraper (agent-browser)

**Status**: ✅ Verified (extracted 50 items)

Run these commands to scrape:

```bash
agent-browser open "https://example.com/page"
agent-browser wait --load networkidle
agent-browser scroll down 2000
agent-browser get text ".item-container"
agent-browser close

Data Preview

[
  {"name": "Item 1", "description": "..."},
  {"name": "Item 2", "description": "..."},
  // ... showing first 3 items
]

### Generate Command (--standalone: Playwright script)

```
User: /actionbook-scraper:generate https://example.com/page --standalone

Step 1: Search Actionbook for selectors
Step 2: Get full selector data
Step 3: Generate Playwright/Puppeteer script
Step 4: VERIFY script (REQUIRED)
  Write to temp file → node /tmp/scraper.js → check output
  If failed → analyze error → fix script → retry (max 3x)
Step 5: Return verified script + data preview
```

**Example Output:**
````markdown
## Verified Scraper (Playwright)

**Status**: ✅ Verified (extracted 50 items)

```javascript
const { chromium } = require('playwright');
// ... generated code with Actionbook selectors
```

Usage:
```bash
npm install playwright
node scraper.js
```

### Data Preview
```json
[
  {"name": "Item 1", "description": "..."},
  // ... first 3 items
]
```

Request Website Command

1. User: /actionbook-scraper:request-website https://newsite.com/page
2. Launch website-requester agent (uses agent-browser)
3. Agent workflow:
   a. agent-browser open "https://actionbook.dev/request-website"
   b. agent-browser snapshot -i (discover form selectors)
   c. agent-browser type <url-field> "https://newsite.com/page"
   d. agent-browser type <email-field> (optional)
   e. agent-browser type <usecase-field> (optional)
   f. agent-browser click <submit-button>
   g. agent-browser snapshot -i (verify submission)
   h. agent-browser close
4. Output: Confirmation of submission

Selector Data Structure

Actionbook returns selector data in this format:

{
  "url": "https://example.com/page",
  "title": "Page Title",
  "content": "## Selector Reference\n\n| Element | CSS | XPath | Type |\n..."
}

Common Selector Patterns

Card-based layouts:

Container: .card-list, .grid-container
Card item: .card, .list-item
Card name: .card__title, .card-name
Card description: .card__description
Expand button: .card__expand, button.expand

Detail extraction (dt/dd pattern):

// Common pattern for key-value pairs
const items = container.querySelectorAll('.info-item');
items.forEach(item => {
  const label = item.querySelector('dt').textContent;
  const value = item.querySelector('dd').textContent;
});

Table layouts:

Table: table, .data-table
Header: thead th, .table-header
Row: tbody tr, .table-row
Cell: td, .table-cell

Page Type Detection

Indicator Page Type Template
Scroll to load more Dynamic/Infinite playwright-js (with scroll)
Click to expand Card-based playwright-js (with click)
Pagination links Paginated playwright-js (with pagination)
Static content Static puppeteer or playwright
SPA framework detected SPA playwright-js (network idle)

Output Formats

Analysis Output

## Page Analysis: {url}

### Matched Action
- **Action ID**: {action_id}
- **Confidence**: HIGH | MEDIUM | LOW

### Available Selectors

| Element | Selector | Type | Methods |
|---------|----------|------|---------|
| {name} | {selector} | {type} | {methods} |

### Page Structure
- **Type**: {static|dynamic|spa}
- **Data Pattern**: {cards|table|list}
- **Lazy Loading**: {yes|no}
- **Expand/Collapse**: {yes|no}

### Recommendations
- Suggested template: {template}
- Special handling needed: {notes}

Generated Code Output

## Generated Scraper

**Target URL**: {url}
**Template**: {template}
**Expected Output**: {description}

### Dependencies
```bash
npm install playwright

Code

{generated_code}

Usage

node scraper.js

Output

Results saved to {output_file}


## Templates Reference

| Template | Flag | Output | Run With |
|----------|------|--------|----------|
| **agent-browser** | (default) | CLI commands | `agent-browser` CLI |
| playwright-js | --standalone | .js file | `node scraper.js` |
| playwright-python | --standalone --template playwright-python | .py file | `python scraper.py` |
| puppeteer | --standalone --template puppeteer | .js file | `node scraper.js` |

## Error Handling

| Error | Cause | Solution |
|-------|-------|----------|
| No actions found | URL not indexed | Use `/actionbook-scraper:request-website` to request indexing |
| Selectors not working | Page updated | Report to Actionbook, try alternative selectors |
| Timeout | Slow page load | Increase timeout, add retry logic |
| Empty data | Dynamic content | Add scroll/wait handling |
| Form submission failed | Network/page issue | Retry or submit manually at actionbook.dev |

## agent-browser Usage

For the `request-website` command, the plugin uses **agent-browser CLI** to automate form submission.

### agent-browser Commands

```bash
# Open a URL
agent-browser open "https://actionbook.dev/request-website"

# Get page snapshot (discover selectors)
agent-browser snapshot -i

# Type into form field
agent-browser type "input[name='url']" "https://example.com"

# Click button
agent-browser click "button[type='submit']"

# Close browser (ALWAYS do this)
agent-browser close

Selector Discovery

If form selectors are unknown, use snapshot to discover them:

agent-browser open "https://actionbook.dev/request-website"
agent-browser snapshot -i  # Returns page structure with selectors

Always Close Browser

Critical: Always run agent-browser close at the end of any agent-browser session, even if errors occur.

Rate Limiting

  • Actionbook MCP: No rate limit for local usage
  • Target websites: Respect robots.txt and add delays between requests
  • Recommended: 1-2 second delay between page requests

Examples

Example 1: Generate agent-browser Script (Default)

/actionbook-scraper:generate https://firstround.com/companies

Output: agent-browser commands
```bash
agent-browser open "https://firstround.com/companies"
agent-browser scroll down 2000
agent-browser get text ".company-list-card-small"
agent-browser close

User runs these commands to scrape.


### Example 2: Generate Playwright Script

/actionbook-scraper:generate https://firstround.com/companies --standalone

Output: Playwright JavaScript code

const { chromium } = require('playwright');
// ... full script

User runs: node scraper.js


### Example 3: Analyze Page Structure

/actionbook-scraper:analyze https://example.com/products

Output: Analysis showing:

  • Available selectors
  • Page structure
  • Recommended approach

Example 4: Request New Website

/actionbook-scraper:request-website https://newsite.com/data

Action: Submits form to actionbook.dev (this command DOES execute agent-browser)

Best Practices

  1. Always analyze before generating - Understand the page structure first
  2. Check list-sources - Verify the site is indexed before attempting
  3. Review generated code - Verify selectors match expected elements
  4. Add appropriate delays - Be respectful to target servers
  5. Handle edge cases - Empty states, loading states, errors
  6. Test incrementally - Run on small subset before full scrape