electron-dev-restart

electron-dev-restart is a skill for Claude Code, Codex from jiushiwon/wg-skills. It costs 138 tokens per session (2,256 once invoked), scanned A, original, Apache-2.0.

A diagnostic guide for Electron development when changes to the main process or preload code are not visible in the running app. Electron's hot reload can update the interface but does not reload those processes.

In plain words
What is it for?
Use it to verify rebuilt output, check whether new strings or methods are present, fully stop Electron, restart it, and investigate missing IPC handlers or preload methods.
Why use it?
It prevents wasted debugging when the code is correct but the app is still running an older process, and it provides checks to distinguish stale code from an actual logic error.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to verify rebuilt output, check whether new strings or methods are present, fully stop Electron, restart it, and investigate missing IPC handlers or preload methods.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jiushiwon/wg-skills/electron-dev-restart
Install

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.

Any agent
npx skills add jiushiwon/wg-skills --skill electron-dev-restart
Clone the repo
git clone --depth 1 https://github.com/jiushiwon/wg-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for electron-dev-restart

README.md
[![agentmods](https://agentmods.dev/badge/skills/jiushiwon/wg-skills/electron-dev-restart/github.svg)](https://agentmods.dev/skills/jiushiwon/wg-skills/electron-dev-restart)
Your own site
<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.

agentmods 80×15 button for electron-dev-restart

Your own site · 80×15
<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>
Per session 138 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,256 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 24d ago against content hash 9ae8122af4ce, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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)。
frontend/electron/electron-dev-restart/SKILL.md · 159 lines

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

Read the full file on GitHub · 159 lines

Files

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.

Changes

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.

  1. 24d ago Changed 9ae8122af4ce
  2. 2mo ago First seen · 159 lines · 138 tokens per session scan A a70b597f7ab5

Subscribe to this mod's changes

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.

Related

electron-dev-restart compared with skills from other repositories

electron-dev-restart next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
electron-dev-restartjiushiwon/wg-skillsSkill1547d agoApache-2.0A138Claude Code, Codex
systematic-debuggingopen-metadata/OpenMetadataSkill16ktodayApache-2.0A37Claude Code
log-error-digestzebbern/claude-code-guideSkill4.7ktodayMITA71Claude Code, Codex
observability-audit-sessionsIBM/mcp-context-forgeSkill4.9ktodayApache-2.0A64Claude Code, Codex
cwv-optimizeradobe/skillsSkill342todayApache-2.0A112Claude Code
ci-fixersipyourdrink-ltd/bernsteinSkill1.2ktodayApache-2.0A15Claude Code, Codex
diagnosing-missing-recordingsPostHog/posthogSkill41ktodaynoneA76Claude Code, Codex