agentleFS
mae616mae616/ai-template/.claude/skills/agent-browser/SKILL.md

agent-browser

Skill9 starsChanged 3 months agoMITView on GitHub

Agent Browser(Headlessブラウザ自動化CLI)を使ったUI検証・E2Eテスト・スクリーンショット取得の判断軸。アクセシビリティツリーベースの要素選択を優先し、壊れにくいテスト設計を目指す。

  • Installs packages

188 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use time-skill, dep-refs and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Recepay6358Skill

    time-skill

    Display the current time in Pakistan Standard Time (PKT, UTC+5). Use when the user asks for the current time, Pakistan time, or PKT.

    Also in 6 projects that use this

  • betacatslingSkill

    dep-refs

    Use when needs to inspect TypeScript export references in the z-code workspace, list exports from a file, verify whether an export is unused before deletion, investigate who imports a symbol during refactors, or combine pnpm knip unused-export results with pnpm dep:refs symbol-level reference tracing.

    Also in 5 projects that use this

  • betacatslingSkill

    feature-boundary-planner

    Map a ZCode behavior change to current UI surfaces, state owners, protocol commands, persistence, and validation. Use for impact analysis, product-boundary planning, or an implementation handoff grounded in the checked-out source.

    Also in 5 projects that use this

  • nicepkgSkill

    community-led-growth

    Expert in community-led growth (CLG) - leveraging user communities to drive acquisition, retention, and expansion. Covers building developer communities, user groups, ambassador programs, and turning customers into advocates. Knows the difference between community as a feature vs community as a growth engine, and how to measure community ROI. Use when "community-led, CLG, ambassador program, champion program, user community, developer community, word of mouth, user group, " mentioned.

    Also in 5 projects that use this

  • nicepkgSkill

    ph-community-outreach

    Engage Reddit, Indie Hackers, Hacker News and other communities for Product Hunt launches. Use this skill to identify relevant communities, craft appropriate posts, and drive cross-platform engagement without appearing spammy.

    Also in 5 projects that use this

  • Recepay6358Skill

    weather-svg-creator

    Creates an SVG weather card showing the current temperature for Dubai. Writes the SVG to orchestration-workflow/weather.svg and updates orchestration-workflow/output.md.

    Also in 6 projects that use this

  • +3 more from nicepkg

The file

Files
SKILL.md

Agent Browser Skill

参照(公式)

  • GitHub
  • インストール: npm install -g agent-browser && agent-browser install

発火条件

  • doc/input/rdd.md に Agent Browser や E2Eテスト UI検証 が記載されている場合、このSkillの方針をデフォルト採用する。
  • 記載がなくても、ユーザーの依頼がブラウザ自動化/UI確認/スクリーンショット比較/E2Eテストに該当するなら適用する。

このSkillの基本方針

  • 基本方針: AIエージェント向けHeadlessブラウザCLI。UI検証・E2Eテスト・視覚的確認に使う。
  • 要素選択: アクセシビリティツリー(@e1 等)やセマンティックロケータ(role/label)を優先。CSSセレクタは最終手段。
  • テスト設計: 壊れにくいテストを書く。実装詳細(class名/id)に依存しない。
  • パフォーマンス: グローバルインストール(npm i -g)を推奨。npx 経由はNode.jsフォールバックで遅い。

思想(判断ルール)

  1. アクセシビリティファースト: 要素はrole/label/textで特定する。CSSセレクタ依存はリファクタに弱い。
  2. 最小スコープ: テストはユーザー操作単位で小さく。ページ全体の網羅より重要フローの確認を優先。
  3. スクリーンショットは証拠: 視覚的な確認が必要な場面では積極的に撮る。差分検証でリグレッションを防ぐ。
  4. 待機は明示的に: 暗黙の sleep を避け、要素の出現/状態変化を待つ。

主要コマンド(よく使うもの)

ページ操作

agent-browser open <url>              # ページを開く
agent-browser goto <url>              # 別URLへ遷移
agent-browser screenshot [file]       # スクリーンショット取得
agent-browser pdf [file]              # PDF保存

要素操作

agent-browser click <selector>        # クリック
agent-browser fill <selector> <text>  # 入力欄にテキスト入力
agent-browser press <key>             # キー押下(Enter等)
agent-browser scroll <direction>      # スクロール

要素選択の優先順位

# 1. セマンティックロケータ(推奨)
agent-browser click "role=button[name='Submit']"
agent-browser fill "role=textbox[name='Email']" "test@example.com"

# 2. アクセシビリティツリー参照
agent-browser click @e1               # ツリー上のID

# 3. テキストマッチ
agent-browser click "text=ログイン"

# 4. CSSセレクタ(最終手段)
agent-browser click "#submit-btn"

情報取得

agent-browser text [selector]         # テキスト取得
agent-browser title                   # ページタイトル
agent-browser url                     # 現在のURL
agent-browser count <selector>        # 要素数

デバイス・環境設定

agent-browser --viewport 375x812      # モバイルビューポート
agent-browser --device "iPhone 15"    # デバイスエミュレーション
agent-browser --color-scheme dark     # ダークモード

dev限定E2Eフックの標準装備

ゲーム/アニメーション系など「発生タイミングが不確定」な演出は、devビルド限定でwindowフックを装備すると検証が安定する:

  • 決定的シード: URLパラメータで乱数シードを指定できるようにする(範囲外はフォールバック)
  • pause/resume: 演出の任意の瞬間を凍結してスクリーンショット検証できるようにする
  • fps計測: startFps/endFps 等でrAFのdtを収集し、純粋関数で平均/最低fpsを算出する

狙い: 「発生を待って撮る」のではなく「決定的に発生させ、凍結して撮る」。非機能要件(fps下限)もE2Eで実測アサートできる。

出力フォーマット(必ずこの順)

  1. 推奨方針(1〜3行)
  2. 理由(テスト安定性 / 保守性 / ユーザー視点)
  3. 設計案(テスト対象フロー / 要素選択戦略 / スクリーンショット計画 / 環境設定)
  4. チェックリスト(実装前に確認)
  5. 落とし穴(避けるべき)
  6. 次アクション(小さく試す順)

チェックリスト

  • agent-browser がグローバルインストール済みか(agent-browser --version)
  • Chromiumがインストール済みか(agent-browser install)
  • 要素選択はアクセシビリティベースか(CSSセレクタに逃げていないか)
  • テストはユーザー操作の単位で分割されているか
  • 暗黙の sleep ではなく明示的な待機条件を使っているか
  • スクリーンショットの保存先・命名規則は決まっているか

よくある落とし穴

  • npx agent-browser で毎回起動すると遅い(グローバルインストール推奨)
  • CSSクラス名に依存したセレクタがリファクタで全壊する
  • sleep(3000) のような固定待機はCI環境で不安定になる
  • スクリーンショット差分がフォントレンダリングの差で誤検知する(閾値設定が必要)
  • Headless環境でのビューポートサイズ未指定でレイアウトが実機と異なる
  • agent-browser eval はCLI側で結果をJSONエンコードして返す。ページ内スクリプトでJSON.stringifyして返すと二重エンコードになり、受け側のJSON.parse一回では文字列のままでプロパティ参照が全部undefinedになる(無言で壊れる)。ページ側は素のオブジェクトを返すこと

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.