fiddle
CLAUDE.md7.8k starsChanged 5 days agoMITView on GitHub
Run from the repo root. The full guide, with a template spec, is in packages/app/e2e/README.md.
- Reads credentials
We split this CLAUDE.md into the rules it gives an agent
11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Tokens: every colour, radius, shadow and duration in component styles comes from a --lu-* token.
- Very specific: line 11
Strings: every user-visible string comes from the i18n catalog, in sentence case.
- Very specific: line 12
IPC: only through EIPC-generated bindings.
- Very specific: line 16
CSP: add a Trusted Types policy name in src/main/csp.ts before calling trustedTypes.createPolicy.
- Distinctive: line 18
Tests: no Playwright or WebDriver.
- Very specific: line 19
Installs: run yarn install only through flock /tmp/fiddle-2027-yarn.lock yarn install, because several agents share this checkout.
- Distinctive: line 26
Run from the repo root.
- Distinctive: line 46
Run it outside the Bash sandbox (on macOS, in the Terminal panel: Electron can't start in the sandbox).
- Very specific: line 49
Explore: Start with yarn driver launch, then run snapshot, click button Settings, type, press Enter, screenshot or logs, and finish with …
- Very specific: line 61
Release builds: Test-only code is guarded by TEST_BUILD and compiled out.
- Very specific: line 76
Run it outside the Bash sandbox.
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Electron Fiddle
- Design: "Lucent", in
docs/design/:lucent-handover.htmlis the design system reference: principles, materials, layout, components and specimens.lucent-tokens.cssholds the tokens, verbatim.
Rules
- Prefer the simple option. Over-engineering is the main risk. If a simple option works, use it.
- Tokens: every colour, radius, shadow and duration in component styles comes from a
--lu-*token. No literals. - Strings: every user-visible string comes from the i18n catalog, in sentence case. Edit
packages/app/src/i18n/locales/<locale>/<ns>.json, give every English key adescription, then runyarn generate. - IPC: only through EIPC-generated bindings. Never expose
ipcRenderer. Errors areFiddleErrors with a stablecode, thrown and caught normally. - State: main owns all state (
AppandWindowstores through theStateHub). Renderers render and request changes. - Fiddle logic:
packages/app/src/fiddle/must not importelectron, so it runs under plain Node in tests. - Persistence:
createJsonStore()for every JSON file, andwriteAtomic()for any other file main replaces. - CSP: add a Trusted Types policy name in
src/main/csp.tsbefore callingtrustedTypes.createPolicy. - Dev tooling: new dev-only commands are marked
devOnlyinsrc/shared/commands.tsand go in the Develop menu. - Tests: no Playwright or WebDriver. End-to-end tests use the in-house driver.
- Installs: run
yarn installonly throughflock /tmp/fiddle-2027-yarn.lock yarn install, because several agents share this checkout. - Git: pull before you start changing code, and pull with rebase before you commit. Commit when asked.
- Stage your own files by name. Several agents share this checkout, so leave their changes out.
originuses SSH, which the Bash sandbox blocks. Fetchhttps://github.com/electron/fiddle.git maininstead, then rebase ontoFETCH_HEAD.
Commands
Run from the repo root.
yarn start: dev run. Forge serves the renderer from the Vite dev server with hot reload.yarn start:xvfb: headless dev run for agents. It builds main, preload and renderer in development mode, then starts Electron underxvfb-run, loadingapp://mainexactly like a packaged build. Extra arguments go to Electron.FIDDLE_DEV_SCREENSHOT=/tmp/x.png FIDDLE_DEV_QUIT=1 yarn start:xvfbsaves a screenshot of the first window, then quits.FIDDLE_DEV_MENU_DUMP=1logs the application menu and the context menus' templates.- Logs are prefixed
[fiddle]. - In this container, run it outside the Bash sandbox, because Xvfb can't start inside it.
yarn generate: EIPC bindings and compiled i18n catalogs. It's offline and idempotent, and start, typecheck, lint, test, package and make all run it.yarn typecheck(tsc -b),yarn lint,yarn format.yarn test: every Vitest project (core,app:node,app:jsdom). For one project:yarn vitest run --project app:node.yarn test --coverageadds a line-coverage report.yarn package,yarn make: Forge 8, output inpackages/app/out/.yarn fiddle <command>: the headless CLI against the dev build. See "Headless CLI" below.yarn test:e2e,yarn driver <command>: end-to-end tests and the interactive driver. See "E2E" below.
E2E
The full guide, with a template spec, is in packages/app/e2e/README.md.
- Run.
yarn test:e2ebuilds the test build once (packages/app/out/test-build, Vite modetest), then runs everypackages/app/e2e/*.e2e.tsin parallel forks. Each spec file gets its own app, temp dir and fixture server.- Run it outside the Bash sandbox (on macOS, in the Terminal panel: Electron can't start in the sandbox).
yarn test:e2e smokeruns one file.FIDDLE_E2E_SKIP_BUILD=1reuses the last build, andFIDDLE_E2E_VERBOSE=1echoes the app's output.FIDDLE_E2E_WORKERS=<n>sets the parallelism. On macOS the app runs in the background and never takes focus.FIDDLE_E2E_FOREGROUND=1shows the windows in front.
- Explore. Start with
yarn driver launch, then runsnapshot,click button Settings,type,press Enter,screenshotorlogs, and finish withyarn driver quit. Every command prints JSON, and the app stays up between commands. The full list is in the header ofpackages/app/tools/driver.ts. - Write a spec.
const app = useApp(), frome2e/harness.ts:- Find elements by role and name, for example
app().click(role('button', 'Run')). Queries auto-wait, so never sleep. runCommand(id)runs a command,stores()reads state, andqueueDialog()answers the next native dialog.- A key the page doesn't handle never reaches the native menu, so shortcuts under test go through the renderer's keybinding dispatcher.
- Find elements by role and name, for example
- Test mode (
src/main/test-mode.ts) is on only in test builds launched withFIDDLE_TEST_MODE=1, which the launcher sets. Every feature must use:getEndpoints()for every network URL (src/shared/endpoints.ts). In test mode these point at the fixture server ine2e/fixtures/, and any non-loopback request fails the test.getCacheRoot()for thecorecache.isTestMode()to skip what tests must not trigger: updates, Sentry, first-run prompts and the tour.- Native dialogs through Electron's
dialogmodule, so the driver can script them. shell, protocol, recent-document, notification andMenu.popupcalls through Electron as usual. Test mode records and stubs them.win.show()andwin.focus()for windows, neverapp.focus()orwebContents.focus(), which would pull the app in front of whoever runs the tests on macOS.
- Release builds. Test-only code is guarded by
TEST_BUILDand compiled out.node tools/release-check-asar.mjsverifies that afteryarn package, and afteryarn test:e2ealso that the test build still has every marker.
Dev differences
These apply only to unpackaged runs, and the first two only to yarn start. yarn start:xvfb loads app://main like a packaged build.
- The renderer comes from the Vite dev server (
http://localhost:<port>) instead ofapp://main. The EIPC validator accepts that origin only whenis_packaged is false. - The CSP is added to dev-server responses by
webRequest(src/main/csp.ts). It allows React Refresh's inline preamble and the hot-reload websocket. - On macOS, every unpackaged run (
yarn start,yarn fiddle, the driver and e2e) uses Chromium's mock keychain (--use-mock-keychain), so it never triggers a Keychain prompt. Its GitHub token is then only obfuscated and lives incredentials/github-devinstead of the installed app'scredentials/github, and the first-launch import can't read the old app's token.
Headless CLI
The code is packages/app/src/main/cli/. To add a command, add a descriptor in descriptors.ts, its help strings (mainCli keys cmd<Command> and arg<Field>) and a handler in commands.ts.
- Run.
yarn fiddle <command> [--json]builds main in development mode, then runselectron <app> --headless <command>in your directory.yarn fiddle --helpand<command> --helplist the commands and their options.FIDDLE_CLI_SKIP_BUILD=1reuses the last build, andFIDDLE_CLI_VERBOSE=1shows main's logs on stderr. Runyarn generatefirst if the catalogs changed.- Run it outside the Bash sandbox. Headless mode needs no display, but a fiddle that opens windows does: use
xvfb-run -a yarn fiddle run ..., withFIDDLE_DEV_ELECTRON_FLAGS=--no-sandboxas root.
- Run it outside the Bash sandbox. Headless mode needs no display, but a fiddle that opens windows does: use
- Trust.
run,bisect,packageandmakeon a remote fiddle (a gist, orelectron:<tag>/<path>) need--trustor a "y" at the TTY prompt. Without a TTY they fail withuntrustedbefore anything runs. - Token.
GITHUB_TOKENis the only token the CLI uses.
Where things are
Paths are under packages/app/ unless noted.
src/main/: the main process.index.tsis the entry,services.tscreates the services,state-hub.tsowns the stores,app-commands.tshas the command handlers.src/renderer/: the React renderer.src/ui/: the Lucent component library.src/shared/: types shared by both sides: stores, commands and endpoints.src/ipc/fiddle.eipc: the IPC schema. The bindings insrc/ipc/generated/are committed.src/fiddle/: fiddle logic, plain Node.src/i18n/: catalogs and tooling.e2e/andtools/: end-to-end specs, the driver and the build tooling.packages/core/: thefiddle-coreport.
In this repositoryOne other file it gives its agents.
- verifySkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

