browser-testing-with-devtools
ウェブブラウザ上で動作するものを開発・デバッグする際に、DOMの検証、エラー捕捉、ネットワーク分析、パフォーマンス測定、視覚的な出力確認などをChrome DevToolsを使って効率的に行うことを支援するSkill。
📜 元の英語説明(参考)
Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data via Chrome DevTools MCP.
🇯🇵 日本人クリエイター向け解説
ウェブブラウザ上で動作するものを開発・デバッグする際に、DOMの検証、エラー捕捉、ネットワーク分析、パフォーマンス測定、視覚的な出力確認などをChrome DevToolsを使って効率的に行うことを支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o browser-testing-with-devtools.zip https://jpskill.com/download/9572.zip && unzip -o browser-testing-with-devtools.zip && rm browser-testing-with-devtools.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9572.zip -OutFile "$d\browser-testing-with-devtools.zip"; Expand-Archive "$d\browser-testing-with-devtools.zip" -DestinationPath $d -Force; ri "$d\browser-testing-with-devtools.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
browser-testing-with-devtools.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
browser-testing-with-devtoolsフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
DevTools を使用したブラウザテスト
概要
Chrome DevTools MCP を使用して、エージェントにブラウザの視覚情報を提供します。これにより、静的なコード解析とライブブラウザの実行との間のギャップを埋めます。エージェントは、ユーザーが見るものを見て、DOM を検査し、コンソールログを読み取り、ネットワークリクエストを分析し、パフォーマンスデータをキャプチャできます。実行時に何が起こっているかを推測する代わりに、それを検証します。
使用する場面
- ブラウザでレンダリングされるものを構築または変更する場合
- UI の問題(レイアウト、スタイル、インタラクション)をデバッグする場合
- コンソールエラーまたは警告を診断する場合
- ネットワークリクエストと API レスポンスを分析する場合
- パフォーマンスをプロファイリングする場合(Core Web Vitals、ペイントタイミング、レイアウトシフト)
- 修正が実際にブラウザで機能することを検証する場合
- エージェントを介した自動 UI テスト
使用しない場面: バックエンドのみの変更、CLI ツール、またはブラウザで実行されないコード。
Chrome DevTools MCP のセットアップ
インストール
# Chrome DevTools MCP サーバーを Claude Code の設定に追加します
# プロジェクトの .mcp.json または Claude Code の設定で:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["@anthropic/chrome-devtools-mcp@latest"]
}
}
}
利用可能なツール
Chrome DevTools MCP は、次の機能を提供します。
| ツール | 何をするか | いつ使用するか |
|---|---|---|
| Screenshot | 現在のページの状態をキャプチャします | 視覚的な検証、前後の比較 |
| DOM Inspection | ライブ DOM ツリーを読み取ります | コンポーネントのレンダリングの検証、構造の確認 |
| Console Logs | コンソール出力(log、warn、error)を取得します | エラーの診断、ロギングの検証 |
| Network Monitor | ネットワークリクエストとレスポンスをキャプチャします | API 呼び出しの検証、ペイロードの確認 |
| Performance Trace | パフォーマンスタイミングデータを記録します | ロード時間のプロファイリング、ボトルネックの特定 |
| Element Styles | 要素の計算されたスタイルを読み取ります | CSS の問題のデバッグ、スタイリングの検証 |
| Accessibility Tree | アクセシビリティツリーを読み取ります | スクリーンリーダーのエクスペリエンスの検証 |
| JavaScript Execution | ページコンテキストで JavaScript を実行します | インタラクティブなデバッグ、状態の検査 |
DevTools デバッグワークフロー
UI バグの場合
1. 再現
└── ページに移動し、バグをトリガーします
└── スクリーンショットを撮って、視覚的な状態を確認します
2. 検査
├── コンソールでエラーまたは警告を確認します
├── 問題のある DOM 要素を検査します
├── 計算されたスタイルを読み取ります
└── アクセシビリティツリーを確認します
3. 診断
├── 実際の DOM と予想される構造を比較します
├── 実際のスタイルと予想されるスタイルを比較します
├── 正しいデータがコンポーネントに到達しているか確認します
└── 根本原因を特定します(HTML? CSS? JS? データ?)
4. 修正
└── ソースコードで修正を実装します
5. 検証
├── ページをリロードします
├── スクリーンショットを撮ります(ステップ 1 と比較します)
├── コンソールがクリーンであることを確認します
└── 自動テストを実行します
ネットワークの問題の場合
1. キャプチャ
└── ネットワークモニターを開き、アクションをトリガーします
2. 分析
├── リクエストの URL、メソッド、およびヘッダーを確認します
├── リクエストのペイロードが期待どおりであることを検証します
├── レスポンスのステータスコードを確認します
├── レスポンスの本文を検査します
└── タイミングを確認します(遅いですか?タイムアウトしていますか?)
3. 診断
├── 4xx → クライアントが間違ったデータまたは間違った URL を送信しています
├── 5xx → サーバーエラー(サーバーログを確認します)
├── CORS → オリジンヘッダーとサーバー構成を確認します
├── タイムアウト → サーバーの応答時間/ペイロードサイズを確認します
└── リクエストが見つからない → コードが実際に送信しているか確認します
4. 修正と検証
└── 問題を修正し、アクションを再生し、レスポンスを確認します
パフォーマンスの問題の場合
1. ベースライン
└── 現在の動作のパフォーマンストレースを記録します
2. 特定
├── Largest Contentful Paint (LCP) を確認します
├── Cumulative Layout Shift (CLS) を確認します
├── Interaction to Next Paint (INP) を確認します
├── 長いタスク(> 50ms)を特定します
└── 不要な再レンダリングがないか確認します
3. 修正
└── 特定のボトルネックに対処します
4. 測定
└── 別のトレースを記録し、ベースラインと比較します
複雑な UI バグのテスト計画の作成
複雑な UI の問題については、エージェントがブラウザで実行できる構造化されたテスト計画を作成します。
## テスト計画: タスク完了アニメーションのバグ
### セットアップ
1. http://localhost:3000/tasks に移動します
2. 少なくとも 3 つのタスクが存在することを確認します
### 手順
1. 最初のタスクのチェックボックスをクリックします
- 期待される結果: タスクに打ち消し線のアニメーションが表示され、「完了」セクションに移動します
- 確認: コンソールにエラーがないはずです
- 確認: ネットワークに PATCH /api/tasks/:id with { status: "completed" } が表示されるはずです
2. 3 秒以内に元に戻すをクリックします
- 期待される結果: タスクが逆アニメーションでアクティブリストに戻ります
- 確認: コンソールにエラーがないはずです
- 確認: ネットワークに PATCH /api/tasks/:id with { status: "pending" } が表示されるはずです
3. 同じタスクをすばやく 5 回切り替えます
- 期待される結果: 視覚的なグリッチがなく、最終状態が一貫していること
- 確認: コンソールエラーがなく、ネットワークリクエストが重複していないこと
- 確認: DOM にタスクのインスタンスが 1 つだけ表示されること
### 検証
- [ ] すべての手順がコンソールエラーなしで完了しました
- [ ] ネットワークリクエストが正しく、重複していません
- [ ] 視覚的な状態が期待される動作と一致します
- [ ] アクセシビリティ: タスクの状態の変更がスクリーンリーダーに通知されます
スクリーンショットベースの検証
スクリーンショットを使用して、視覚的な回帰テストを行います。
1. 「前」のスクリーンショットを撮ります
2. コードを変更します
3. ページをリロードします
4. 「後」のスクリーンショットを撮ります
5. 比較: 変更は正しいように見えますか?
これは、特に次の場合に役立ちます。
- CSS の変更(レイアウト、間隔、色)
- さまざまなビューポートサイズのレスポンシブデザイン
- ローディング状態とトランジション
- 空の状態とエラー状態
コンソール分析のパターン
何を探すべきか
ERROR レベル:
├── 未処理の例外 → コードのバグ
├── 失敗したネットワークリクエスト → API または CORS の問題
├── React/Vue の警告 → コンポーネントの問題
└── セキュリティ警告 → CSP、混合コンテンツ
WARN レベル:
├── 非推奨の警告 → 将来の互換性の問題
├── パフォーマンスの警告 → 潜在的なボトルネック
└ 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Browser Testing with DevTools
Overview
Use Chrome DevTools MCP to give your agent eyes into the browser. This bridges the gap between static code analysis and live browser execution — the agent can see what the user sees, inspect the DOM, read console logs, analyze network requests, and capture performance data. Instead of guessing what's happening at runtime, verify it.
When to Use
- Building or modifying anything that renders in a browser
- Debugging UI issues (layout, styling, interaction)
- Diagnosing console errors or warnings
- Analyzing network requests and API responses
- Profiling performance (Core Web Vitals, paint timing, layout shifts)
- Verifying that a fix actually works in the browser
- Automated UI testing through the agent
When NOT to use: Backend-only changes, CLI tools, or code that doesn't run in a browser.
Setting Up Chrome DevTools MCP
Installation
# Add Chrome DevTools MCP server to your Claude Code config
# In your project's .mcp.json or Claude Code settings:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["@anthropic/chrome-devtools-mcp@latest"]
}
}
}
Available Tools
Chrome DevTools MCP provides these capabilities:
| Tool | What It Does | When to Use |
|---|---|---|
| Screenshot | Captures the current page state | Visual verification, before/after comparisons |
| DOM Inspection | Reads the live DOM tree | Verify component rendering, check structure |
| Console Logs | Retrieves console output (log, warn, error) | Diagnose errors, verify logging |
| Network Monitor | Captures network requests and responses | Verify API calls, check payloads |
| Performance Trace | Records performance timing data | Profile load time, identify bottlenecks |
| Element Styles | Reads computed styles for elements | Debug CSS issues, verify styling |
| Accessibility Tree | Reads the accessibility tree | Verify screen reader experience |
| JavaScript Execution | Runs JavaScript in the page context | Interactive debugging, state inspection |
The DevTools Debugging Workflow
For UI Bugs
1. REPRODUCE
└── Navigate to the page, trigger the bug
└── Take a screenshot to confirm visual state
2. INSPECT
├── Check console for errors or warnings
├── Inspect the DOM element in question
├── Read computed styles
└── Check the accessibility tree
3. DIAGNOSE
├── Compare actual DOM vs expected structure
├── Compare actual styles vs expected styles
├── Check if the right data is reaching the component
└── Identify the root cause (HTML? CSS? JS? Data?)
4. FIX
└── Implement the fix in source code
5. VERIFY
├── Reload the page
├── Take a screenshot (compare with Step 1)
├── Confirm console is clean
└── Run automated tests
For Network Issues
1. CAPTURE
└── Open network monitor, trigger the action
2. ANALYZE
├── Check request URL, method, and headers
├── Verify request payload matches expectations
├── Check response status code
├── Inspect response body
└── Check timing (is it slow? is it timing out?)
3. DIAGNOSE
├── 4xx → Client is sending wrong data or wrong URL
├── 5xx → Server error (check server logs)
├── CORS → Check origin headers and server config
├── Timeout → Check server response time / payload size
└── Missing request → Check if the code is actually sending it
4. FIX & VERIFY
└── Fix the issue, replay the action, confirm the response
For Performance Issues
1. BASELINE
└── Record a performance trace of the current behavior
2. IDENTIFY
├── Check Largest Contentful Paint (LCP)
├── Check Cumulative Layout Shift (CLS)
├── Check Interaction to Next Paint (INP)
├── Identify long tasks (> 50ms)
└── Check for unnecessary re-renders
3. FIX
└── Address the specific bottleneck
4. MEASURE
└── Record another trace, compare with baseline
Writing Test Plans for Complex UI Bugs
For complex UI issues, write a structured test plan the agent can follow in the browser:
## Test Plan: Task completion animation bug
### Setup
1. Navigate to http://localhost:3000/tasks
2. Ensure at least 3 tasks exist
### Steps
1. Click the checkbox on the first task
- Expected: Task shows strikethrough animation, moves to "completed" section
- Check: Console should have no errors
- Check: Network should show PATCH /api/tasks/:id with { status: "completed" }
2. Click undo within 3 seconds
- Expected: Task returns to active list with reverse animation
- Check: Console should have no errors
- Check: Network should show PATCH /api/tasks/:id with { status: "pending" }
3. Rapidly toggle the same task 5 times
- Expected: No visual glitches, final state is consistent
- Check: No console errors, no duplicate network requests
- Check: DOM should show exactly one instance of the task
### Verification
- [ ] All steps completed without console errors
- [ ] Network requests are correct and not duplicated
- [ ] Visual state matches expected behavior
- [ ] Accessibility: task status changes are announced to screen readers
Screenshot-Based Verification
Use screenshots for visual regression testing:
1. Take a "before" screenshot
2. Make the code change
3. Reload the page
4. Take an "after" screenshot
5. Compare: does the change look correct?
This is especially valuable for:
- CSS changes (layout, spacing, colors)
- Responsive design at different viewport sizes
- Loading states and transitions
- Empty states and error states
Console Analysis Patterns
What to Look For
ERROR level:
├── Uncaught exceptions → Bug in code
├── Failed network requests → API or CORS issue
├── React/Vue warnings → Component issues
└── Security warnings → CSP, mixed content
WARN level:
├── Deprecation warnings → Future compatibility issues
├── Performance warnings → Potential bottleneck
└── Accessibility warnings → a11y issues
LOG level:
└── Debug output → Verify application state and flow
Clean Console Standard
A production-quality page should have zero console errors and warnings. If the console isn't clean, fix the warnings before shipping.
Accessibility Verification with DevTools
1. Read the accessibility tree
└── Confirm all interactive elements have accessible names
2. Check heading hierarchy
└── h1 → h2 → h3 (no skipped levels)
3. Check focus order
└── Tab through the page, verify logical sequence
4. Check color contrast
└── Verify text meets 4.5:1 minimum ratio
5. Check dynamic content
└── Verify ARIA live regions announce changes
Common Rationalizations
| Rationalization | Reality |
|---|---|
| "It looks right in my mental model" | Runtime behavior regularly differs from what code suggests. Verify with actual browser state. |
| "Console warnings are fine" | Warnings become errors. Clean consoles catch bugs early. |
| "I'll check the browser manually later" | DevTools MCP lets the agent verify now, in the same session, automatically. |
| "Performance profiling is overkill" | A 1-second performance trace catches issues that hours of code review miss. |
| "The DOM must be correct if the tests pass" | Unit tests don't test CSS, layout, or real browser rendering. DevTools does. |
Red Flags
- Shipping UI changes without viewing them in a browser
- Console errors ignored as "known issues"
- Network failures not investigated
- Performance never measured, only assumed
- Accessibility tree never inspected
- Screenshots never compared before/after changes
Verification
After any browser-facing change:
- [ ] Page loads without console errors or warnings
- [ ] Network requests return expected status codes and data
- [ ] Visual output matches the spec (screenshot verification)
- [ ] Accessibility tree shows correct structure and labels
- [ ] Performance metrics are within acceptable ranges
- [ ] All DevTools findings are addressed before marking complete