Electron Agent Rules

A framework for building desktop applications with Chromium, Node.js, and web technologies.

On this page

Overview

Electron's CLAUDE.md explains its multi-repository build and patch process, garbage-collected C++ objects, and release maintenance. Several familiar commands are forbidden because the repository has safer or cheaper alternatives.

Documents

├── 
├── .claude
│   └── skills
│       ├── electron-chromium-upgrade
│       │   └── 
│       └── electron-node-upgrade
│           └── 
└── docs
    └── 

Patterns in this file

01 / Behavioral framing

Use the result CI has already produced

For patch conflicts on an existing PR, the guide first checks the failed Apply Patches run for an exported resolution. A local three-way sync is the fallback when the artifact is absent.

Source excerpt starting at line 141.
If asked to fix a patch conflict on a branch that already has an open PR, check the PR's failed **Apply Patches** CI run for an `update-patches.patch` artifact before running `e sync` locally. CI has already performed the 3-way merge and exported the resolved patch diff — applying it is much faster than a full local sync.

02 / Hard prohibitions

Give a prohibition a concrete replacement

The file bans npx because it may fetch and execute an uninstalled package. It offers a direct node_modules binary or Yarn invocation instead, applying the same restriction to commands and authored scripts.

Source excerpt starting at line 5.
**Never use `npx`.** It is considered dangerous because it can silently fetch and execute arbitrary packages from the registry. Always run binaries through one of these safer mechanisms instead:

03 / Architecture as narrative

Explain ownership constraints in the garbage collector

The C++ guidance distinguishes heap edges, roots, and native stack locals. It connects tracing omissions to use-after-free and explains why destructors cannot inspect other managed objects.

Source excerpt starting at line 228.
- Destructors must not access other GC managed objects: sweeping has no object  destruction order or timing guarantee.

04 / Scope layering

Apply release labels only to users with write access

Only contributors with write access receive labeling guidance. It separates ordinary backports from security fixes and derives active branches from label metadata rather than a copied list.

Source excerpt starting at line 195.
When the user has write access to `electron/electron`, add these labels when creating PRs:

05 / Router files

Select upgrade skills from the active branch

Chromium and Node.js upgrades have separate named skills and branch triggers. The branch is the concrete signal for which specialized workflow to load.

Source excerpt starting at line 183.
When working on the `roller/chromium/main` branch to upgrade Chromium activate the "Electron Chromium Upgrade" skill.

Ideas for your repo

  1. Check whether CI already produced the expensive local operation's result.
  2. Pair forbidden commands with approved alternatives and a reason.
  3. Explain ownership and destruction-order assumptions near memory rules.
  4. State which release actions require repository permissions.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in Electron. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works