Communitygithub.com

Dev Browser スキル

ページの状態を保持しながらブラウザを自動操作します。Webサイトの閲覧、フォーム入力、スクリーンショット取得、データ抽出、Webアプリのテスト、ブラウザワークフローの自動化などに使用します。

Dev Browser スキル とは?

このスキルは、AIエージェント(Claude Code、Cursor、Codexなど)がブラウザを自動操作するための強力なツールです。ページの状態をスクリプト実行間で維持するため、複雑なワークフローを小さなステップに分割して実行できます。ユーザーの既存ブラウザに接続する拡張機能モードと、新しいChromiumブラウザを起動するスタンドアロンモードの2つの動作モードを提供します。AIエージェントは、`getAISnapshot()`によるARIAアクセシビリティツリーの取得や`selectSnapshotRef()`による要素の操作を通じて、ページ構造を理解し操作できます。スクリーンショットによる視覚的フィードバックや、大規模なデータ抽出のためのネットワークリクエストのインターセプトと再生にも対応しています。エラーが発生してもページ状態は保持されるため、デバッグが容易です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/AgentSkillOS/data/skill_seeds/dev-browser

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Dev Browser スキル は何をしますか?

スクリプト実行間でページ状態を維持するブラウザ自動化。小さく焦点を絞ったスクリプトを書き、タスクを段階的に達成します。ワークフローの一部が確立し、繰り返し作業がある場合は、1回の実行でその繰り返し作業を行うスクリプトを作成できます。

アプローチの選択

  • ローカル/ソースが入手可能なサイト: まずソースコードを読んで、セレクタを直接記述します。
  • 未知のページレイアウト: getAISnapshot() を使用して要素を発見し、selectSnapshotRef() で操作します。
  • 視覚的フィードバック: スクリーンショットを撮って、ユーザーが見ているものを確認します。

セットアップ

2つのモードが利用可能です。どちらを使用すべきか不明な場合はユーザーに確認してください。

スタンドアロンモード(デフォルト)

新しいChromiumブラウザを起動して、新しい自動化セッションを開始します。

./skills/dev-browser/server.sh &

ユーザーが要求した場合は --headless フラグを追加してください。スクリプトを実行する前に、Ready メッセージが表示されるのを待ってください。

拡張機能モード

ユーザーの既存のChromeブラウザに接続します。以下の場合に使用します:

  • ユーザーが既にサイトにログインしており、ローカル開発ではない認証済みの操作をあなたに行わせたい場合。
  • ユーザーが拡張機能の使用を依頼した場合。

重要: コアフローは同じです。ユーザーのブラウザ内に名前付きページを作成します。

リレーサーバーを起動:

cd skills/dev-browser && npm i && npm run start-extension &

コンソールで Waiting for extension to connect... の後に Extension connected が表示されるのを待ちます。これにより、クライアントが接続し、ブラウザが制御可能になったことがわかります。 ワークフロー:

  1. 通常モードと同様に、スクリプトは client.page("name") を呼び出して新しいページを作成したり、既存のページに接続したりします。
  2. 自動化はユーザーの実際のブラウザセッション上で実行されます。

拡張機能がまだ接続されていない場合は、ユーザーに拡張機能を起動して有効にするよう伝えてください。ダウンロードリンク: https://github.com/SawyerHood/dev-browser/releases

スクリプトの作成

すべてのスクリプトは skills/dev-browser/ ディレクトリから実行してください。 @/ インポートエイリアスを使用するには、このディレクトリの設定が必要です。

ヒアドキュメントを使用して、スクリプトをインラインで実行します:

cd skills/dev-browser && npx tsx <<'EOF'
import { connect, waitForPageLoad } from "@/client.js";

const client = await connect();
// カスタムビューポートサイズでページを作成(オプション)
const page = await client.page("example", { viewport: { width: 1920, height: 1080 } });

await page.goto("https://example.com");
await waitForPageLoad(page);

console.log({ title: await page.title(), url: page.url() });
await client.disconnect();
EOF

スクリプトが再利用を必要とする場合、複雑な場合、またはユーザーが明示的に要求した場合にのみ tmp/ ファイルに書き込んでください。

主要な原則

  1. 小さなスクリプト: 各スクリプトは1つのこと(ナビゲート、クリック、入力、確認)を行います。
  2. 状態の評価: 最後に状態をログ/返却して、次のステップを決定します。
  3. 説明的なページ名: "checkout"、"login" のように、"main" のような名前は避けます。
  4. 切断して終了: await client.disconnect() - ページはサーバー上に保持されます。
  5. evaluate内ではプレーンなJS: page.evaluate() はブラウザ内で実行されます - TypeScript構文は使用できません。

ワークフローループ

複雑なタスクには次のパターンに従ってください:

  1. スクリプトを作成して1つのアクションを実行します。
  2. 実行して出力を確認します。
  3. 評価 - 動作しましたか?現在の状態は?
  4. 決定 - タスクは完了しましたか?それとも別のスクリプトが必要ですか?
  5. 繰り返し - タスクが完了するまで。

ブラウザコンテキスト内ではTypeScript不可

page.evaluate() に渡されたコードはブラウザ内で実行されますが、ブラウザはTypeScriptを理解しません:

// ✅ 正しい: プレーンなJavaScript
const text = await page.evaluate(() => {
  return document.body.innerText;
});

// ❌ 間違い: TypeScript構文は実行時に失敗します
const text = await page.evaluate(() => {
  const el: HTMLElement = document.body; // 型アノテーションはブラウザで失敗!
  return el.innerText;
});

データのスクレイピング

大規模なデータセットをスクレイピングするには、DOMをスクロールする代わりにネットワークリクエストをインターセプトして再生します。リクエストキャプチャ、スキーマ発見、ページネーションされたAPIの再生に関する完全なガイドは references/scraping.md を参照してください。

クライアントAPI

const client = await connect();

// 名前付きページを取得または作成(viewportは新しいページにのみ適用)
const page = await client.page("name");
const pageWithSize = await client.page("name", { viewport: { width: 1920, height: 1080 } });

const pages = await client.list(); // すべてのページ名を一覧表示
await client.close("name"); // ページを閉じる
await client.disconnect(); // 切断(ページは保持される)

// ARIAスナップショットメソッド
const snapshot = await client.getAISnapshot("name"); // アクセシビリティツリーを取得
const element = await client.selectSnapshotRef("name", "e5"); // 参照で要素を取得

page オブジェクトは標準のPlaywright Pageです。

待機

import { waitForPageLoad } from "@/client.js";

await waitForPageLoad(page); // ナビゲーション後
await page.waitForSelector(".results"); // 特定の要素を待機
await page.waitForURL("**/success"); // 特定のURLを待機

ページ状態の検査

スクリーンショット

await page.screenshot({ path: "tmp/screenshot.png" });
await page.screenshot({ path: "tmp/full.png", fullPage: true });

ARIAスナップショット(要素の発見)

getAISnapshot() を使用してページ要素を発見します。YAML形式のアクセシビリティツリーを返します:

- banner:
  - link "Hacker News" [ref=e1]
  - navigation:
    - link "new" [ref=e2]
- main:
  - list:
    - listitem:
      - link "Article Title" [ref=e8]
      - link "328 comments" [ref=e9]
- contentinfo:
  - textbox [ref=e10]
    - /placeholder: "Search"

refの解釈:

  • [ref=eN] - 操作用の要素参照(可視でクリック可能な要素のみ)
  • [checked]、[disabled]、[expanded] - 要素の状態
  • [level=N] - 見出しレベル
  • /url:、/placeholder: - 要素のプロパティ

refとの相互作用:

const snapshot = await client.getAISnapshot("hackernews");
console.log(snapshot); // 必要なrefを見つける

const element = await client.selectSnapshotRef("hackernews", "e2");
await element.click();

エラー回復

ページ状態はエラー後も保持されます。以下の方法でデバッグしてください:

cd skills/dev-browser && npx tsx <<'EOF'
import { connect } from "@/client.js";

const client = await connect();
const page = await client.page("hackernews");

await page.screenshot({ path: "tmp/debug.png" });
console.log({
  url: page.url(),
  title: await page.title(),
  bodyText: await page.textContent("body").then((t) => t?.slice(0, 200)),
});

await client.disconnect();
EOF

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

David-Li0406/meta-skill-evloving

Create technical diagrams using Mermaid syntax for architecture, sequences, ERDs, flowcharts, and state machines. Use for visualizing system design, data flows, and processes. Triggers: diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw.

David-Li0406/meta-skill-evloving

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

David-Li0406/meta-skill-evloving

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

関連スキル