Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add jiushiwon/wg-skills --skill electron-dev-restartgit clone --depth 1 https://github.com/jiushiwon/wg-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/jiushiwon/wg-skills/electron-dev-restart)<a href="https://agentmods.dev/skills/jiushiwon/wg-skills/electron-dev-restart"><img src="https://agentmods.dev/badge/skills/jiushiwon/wg-skills/electron-dev-restart/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/jiushiwon/wg-skills/electron-dev-restart"><img src="https://agentmods.dev/badge/skills/jiushiwon/wg-skills/electron-dev-restart.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00138 | $0.02256 |
| Opus 5.5 | $0.00055 | $0.00902 |
| Sonnet 5.5 | $0.00028 | $0.00451 |
| Haiku 4.5 | $0.00014 | $0.00226 |
Grade A, and why
electron-dev-restart scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 24d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
这一步只验证编译、不启动服务——**禁止在沙箱里启动 GUI**(会被 SIGTERM 或前置代理吃 curl)。 How it starts
The opening of the file, as written. The whole thing — 159 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Electron Dev 主进程无 HMR 必须重启
Overview
electron-vite dev 只对渲染端(src/renderer/*)做 HMR,主进程(electron/main/*)
和 preload(electron/preload/*)完全没有 HMR——dev 模式只是「每次启动 Electron 时
跑一次最新源码」,运行中的 Electron 进程里的代码永远是启动那一刻的版本。
后果:
- 改
ipcMain.handle('xxx')→ 运行中 GUI 上点按钮调ipcRenderer.invoke('xxx')仍报 No handler registered - 改
sshPtyOpen = sshConnect之类别名 → 仍报 api.xxx is not a function - 改 session id 反解兜底 → 运行中仍按原始逻辑报错
- 用户反复点按钮,以为"还没生效",其实是主进程代码根本没动
铁律:改 electron/main/* 或 electron/preload/* 后,必须彻底退出当前 Electron 进程并重启。
何时使用
- 用户反馈"我连了 X 次都没生效" + 主进程有相关改动
out/main/index.js里能看到新加的字符串,但用户 GUI 报 "No handler registered"- 用户反馈
api.xxx is not a function,但 preload 源码里有这个方法 git grep能查到新代码,运行时表现却像旧代码- electron-vite 控制台没报错但行为不变
第一步:先验证"新代码到底有没有进运行中的 Electron"
产物会随 main rebuild 自动更新,但运行中的 Electron 不会——这是关键:
# 检查产物里的字符串
grep -c "new-channel-name" out/main/index.js
grep -c "new-method-name" out/preload/index.js
| 产物里 | 运行中 | 根因 |
|---|---|---|
| 有 | 无 | 用户没退出重启(最大可能) |
| 无 | 无 | npm run build 没真跑成 / 改错文件 / 改了没保存 |
| 有 | 有 | 这条 skill 不适用,去查代码本身逻辑 |
第二步:怎么"真正"重启 Electron
Windows / Git Bash 下杀干净(2026-09-13 实测)
# 唯一可靠写法(绕开 MSYS 把 /F /T 当路径转换)
MSYS_NO_PATHCONV=1 taskkill /F /T /PID <pid>
MSYS_NO_PATHCONV=1必加——否则/F/T被 MSYS 当路径转换,报"无效参数"/T必加(杀进程树):pnpm/uvicorn 会 fork 子进程,只杀父进程端口不释放- 杀完必须轮询等端口真正释放再起新进程
推荐:用项目自带 start.bat 一键重启
cmd /c start.bat stop # 杀旧 electron
cmd /c start.bat # 重新启动(dev 自动 compile + 启动 Electron)
典型 start.bat 应有这些子命令:
dev(前台 tee)/ 默认(后台)/stop(杀进程)/status(查运行态)/-h- 启动用
nohup ... > logs/x.log 2>&1 &+echo $! > logs/x.pid - 失败时
tail -20 日志排查
参考实现:games/lobby/server/restart.sh、humeng-uniapp-note/restart.sh、super-shell/start.bat、vibecoding-portal/restart.sh。
第三步:构建不跑也是坑
dev 模式下修改源码后,electron-vite 默认会自动 rebuild——但只在主进程真正启动那一刻。 如果想"代码改了、不重启、跑构建、确认产物里有",用:
C:/nvm4w/nodejs/node.exe node_modules/electron-vite/bin/electron-vite.js build 2>&1 | tail -10
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 24d ago Changed 9ae8122af4ce
- 2mo ago First seen · 159 lines · 138 tokens per session scan A a70b597f7ab5
electron-dev-restart is a skill published in the GitHub repository jiushiwon/wg-skills (154 stars, last pushed 7d ago), licensed Apache-2.0. It adds 138 tokens to every session and 2,256 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-30.
electron-dev-restart compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| electron-dev-restartjiushiwon/wg-skills | Skill | 154 | 7d ago | Apache-2.0 | A | 138 | Claude Code, Codex |
| systematic-debuggingopen-metadata/OpenMetadata | Skill | 16k | today | Apache-2.0 | A | 37 | Claude Code |
| log-error-digestzebbern/claude-code-guide | Skill | 4.7k | today | MIT | A | 71 | Claude Code, Codex |
| observability-audit-sessionsIBM/mcp-context-forge | Skill | 4.9k | today | Apache-2.0 | A | 64 | Claude Code, Codex |
| cwv-optimizeradobe/skills | Skill | 342 | today | Apache-2.0 | A | 112 | Claude Code |
| ci-fixersipyourdrink-ltd/bernstein | Skill | 1.2k | today | Apache-2.0 | A | 15 | Claude Code, Codex |
| diagnosing-missing-recordingsPostHog/posthog | Skill | 41k | today | none | A | 76 | Claude Code, Codex |