electron-drive-skill
できること
このツールを使うと、Electronアプリを操作できます。クリック、文字入力、スクリーンショットの撮影、アプリ内でのコード実行ができ、動作をテストできます。
使う場面
- ✓アプリの画面で見た目の変更が正しく反映されているか確かめたいとき。
- ✓最終版のプログラムでのみ起きるバグを再現したいとき。
- ✓ユーザーがアプリを初めて開いたときに最初に見る画面をテストしたいとき。
スキルのリンク
https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/electron-drive-skill/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“設定画面の「保存」ボタンをテストして。”
毎週5つの新しいスキル。1分で読めます。
仕組み
ツールは、アプリを隔離された環境で起動します。その後、「ここをクリック」「これを入力」といった命令を出して、アプリを操作し、すべてが期待どおりに動くかを確認できます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Driving the Electron app
Overview
scripts/drive.mjs launches the project's Electron app under Playwright in a
background daemon and keeps it running between commands, so each action
(click, type, snapshot, screenshot, eval) is one fast shell call. Every launch
uses a scratch profile, so the agent can check a UI change or reproduce a bug
in the real app, not only in unit tests, without touching the user's data.
When to Use This Skill
- Use when you need to verify a UI change in the running Electron app.
- Use when reproducing a renderer or startup bug, or a failure that only shows up in the production build (for example a stricter CSP).
- Use when checking first-run, onboarding or settings screens.
- Use when exercising a feature end to end, including IPC through the preload bridge or code in the main process.
- Do not use it for web apps without Electron, or for multi-window flows (see Limitations).
How It Works
Step 1: Check prerequisites
scripts/drive.mjs, in this skill's directory, finds the project by the
nearest package.json, so run it from anywhere inside the project. Set DR
to its absolute path.
It needs electron and playwright-core (1.49 or later) installed in the
project. If start says either is missing, tell the user rather than
installing it yourself. Launch settings come from drive.config.json at the
project root (see Step 4); with no file, it runs electron ..
Step 2: Start, look, act, stop
DR=<this skill's directory>/scripts/drive.mjs
$DR start # last build, profile 'default'; prints status
$DR snapshot # accessibility tree: find what to click, by role and name
$DR click 'role=button[name="Get started"]'
$DR fill 'role=textbox[name="Email"]' 'test@example.com'
$DR wait 'text=Welcome'
$DR screenshot # prints a PNG path; Read it to see the window
$DR logs --lines 80 # main and renderer console, plus the config's logFile
$DR stop # ALWAYS, before finishing
- Start options:
--build: run the config'sbuildcommand first. Needed after any source change if the app runs from a build, because the build is otherwise stale;startprints its age.--fresh: wipe the scratch profile, which gives you the app's first-run state.--profile <name>: a separate scratch profile.--dev: see Step 5.
- Targets are Playwright selectors. Prefer
role=button[name="…"]fromsnapshotoutput, thentext=…, then CSS. --ends the flags. Put it before text that starts with dashes:$DR fill 'role=textbox[name="Args"]' -- --verbose.- Other commands:
select <target> <value|label>,press <key>,status,screenshot --selector <css>.$DR helplists everything.
Step 3: Run code in the app
eval <js> runs in the renderer, main <js> in the main process
(electron and process are in scope, require is not). Use a bare
expression, or a body with return. - reads the code from stdin, which
avoids quoting entirely. The result comes back as JSON, so return plain data:
a DOM node or a function comes back as undefined or {}.
To exercise IPC, call whatever the app's preload exposes through eval. That
goes through the real preload bridge, as the app's own renderer code does.
Step 4: Configure the launch (optional)
drive.config.json at the project root; every field is optional:
{
"build": "npm run build",
"args": ["."],
"env": { "APP_DATA_DIR": "{profile}/data" },
"logFile": "logs/main.log",
"dev": {
"args": ["."],
"env": { "ELECTRON_RENDERER_URL": "http://localhost:5173" },
"url": "http://localhost:5173"
}
}
args: what Electron is launched with: an app directory whosepackage.jsonmainis the built entry point, or the entry file itself.env: added to the app's environment.{profile}becomes the scratch profile directory (inenvvalues only, not inargs). This is how data kept outsideuserDatais redirected:APP_DATA_DIRis only an example name, and it has an effect only if the app reads it. Check the app's source for the variable it actually uses.logFile: a log file relative to the profile directory, shown bylogs.
If a project has no config and start fails or launches the wrong thing,
work out these values from the project's package.json and build setup,
then suggest a drive.config.json to the user.
…
よくある質問
「scratch profile(使い捨てプロファイル)」とは何ですか?
アプリが動く一時的で隔離された環境のことです。これにより、テストが普段のデータや設定に影響しないようになります。
ツールはどこをクリックするか、何を入力するかをどうやって判断しますか?
「セレクタ」と呼ばれる、ボタンや入力欄などの画面上の要素を指定する仕組みを使います。ウェブブラウザがウェブページ上の要素を見つける方法と似ています。
どんな種類のアプリでもテストできますか?
いいえ。このツールはElectronで作られたアプリ専用です。通常のウェブアプリや、複数ウィンドウにまたがる操作には対応していません。
詳細
作者による元の説明
Launch the project's Electron app on a scratch profile and drive it: click, type, screenshot, run renderer or main-process code, read logs. Use to verify UI changes end to end.
人気
- GitHubのスター
- 48k
- ランキング
- #6273
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
00-andruia-consultant
48kエージェントがAIプロジェクトの立ち上げや改善を支援します。コードを分析し、ツールを提案し、スペイン語で行動計画を作成します。
007
48kエージェントがセキュリティ監査と脅威モデリングを行えるようにします。攻撃や脆弱性からプロジェクトを守るのに役立ちます。
10-andruia-skill-smith
48kエージェントがAIツールの作成や改善を支援します。ツールの動作を定義し、ドキュメントを書き、構造を検証します。
20-andruia-niche-intelligence
48kエージェントが特定の業界に関する要約を作成できるようにします。信頼できる情報源を使って、プロジェクトの背景、ルール、利用パターン、リスクを把握するのに役立ちます。
似ているスキル
test-driven-development
311k機能や修正を作る前に、まず失敗するテストを書き、それが失敗するのを確認してから、合格させる最小のコードを書くようエージェントに教えます。
verification-before-completion
311kタスク、修正、ビルドが完了した、または合格したと主張する前に、実際のチェックを実行し、その出力を読むようエージェントに教えます。
migrate-to-shoehorn
310kテストファイル内の危険な型キャストを、shoehornライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。