Logo von Electron Native Lib Extraction

Electron Native Lib Extraction

Community
Innei
electron-native-lib-extraction

Verwenden Sie diesen Skill, wenn Sie eine native Electron-Modulintegration innerhalb einer App (N-API-Addon, Build-Skripte, Packaging-Konfiguration und Release-CI) in eine eigenständige, mit Quellcode veröffentlichte npm-Bibliothek auslagern oder eine solche Bibliothek von Grund auf erstellen. Behandelt Fallstricke bei ABI und Installationsskripten, die Semantik von node-gyp-Rebuilds, die Tiefe des macOS-rpath, Ausschlüsse beim Packaging mit electron-builder, bewährte Vorgehensweisen für zusammengesetzte GitHub Actions und die Migration zurück in die Quell-App für den Eigengebrauch.

Add to TypingMind

Übersicht

HerausgeberInnei
RepositorySKILL
Skill-Nameelectron-native-lib-extraction
Sterne
81
Forks
2
Mitgelieferte Dateien
Nur Anweisungen
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • In sich abgeschlossen

    Alles, was das Modell braucht, steht in den Anweisungen — keine zusätzlichen Dateien zum Synchronisieren.

  • Open Source

    Von Innei auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Electron Native Lib Extraction in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/Innei/SKILL/tree/main/skills/infrastructure/electron-native-lib-extraction
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Innei/SKILL.git /tmp/SKILL
mkdir -p .claude/skills
cp -r /tmp/SKILL/skills/infrastructure/electron-native-lib-extraction .claude/skills/electron-native-lib-extraction
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Electron Native Lib Extraction in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Electron Native Lib Extraction automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Electron Native Lib Extraction nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

electron-native-lib-extraction

An Electron app that grew a native module (N-API addon linking a system framework, e.g. Sparkle) accumulates four coupled layers: the addon source, the Electron-ABI build orchestration, the electron-builder packaging config, and the release CI. Extracting them into a reusable npm package is mostly mechanical — but most of the failure modes are invisible until a consumer installs the package or CI runs a real release. This skill encodes the extraction order and the traps. Reference implementation: https://github.com/Innei/electron-sparkle-updater (Sparkle.framework bridge + appcast release toolchain, extracted from the Kansoku desktop app).

When to use

  • In scope: source-distributed native npm packages for Electron (consumer compiles at build time), macOS framework linking, electron-builder integration fragments, composite GitHub Actions for release pipelines, migrating the source app onto the extracted library.
  • Out of scope: prebuilt binary distribution (prebuildify/node-gyp-build), Windows native bridges, ASAR internals beyond asarUnpack.

Inputs: the app's working native integration; a free npm name (npm view <name> → 404 = free); the consumer's Electron version (drives ABI flags).

Workflow

text
[1] Carve the package        addon + scripts verbatim, params for app values
[2] Neutralize npm install   no-op install script, real build = explicit CLI
[3] Runtime loader           null-degrading, path contract for dev/packaged
[4] Rebuild CLI              node-gyp resolved from OWN deps, never npx
[5] Packager fragments       asarUnpack narrow, vendor excluded, sign hook
[6] Release CI as an Action  env-routed inputs, EXIT-trap secrets
[7] Dogfood migration        app consumes the lib; packaged-layout assertion

[1] Carve

Copy the addon source and fetch scripts verbatim (keep their load-bearing comments — they move with the code). Everything app-specific (repo slug, feed URL, tag prefix, arch) becomes a parameter. Remove hardcoded ARCHS from binding.gyp; let node-gyp's --arch drive it. Parameterize in a separate, reviewable step after the verbatim copy.

[2] Neutralize npm install

npm auto-runs node-gyp rebuild for ANY package containing a binding.gyp, against the host Node ABI — the wrong target for Electron, and a build the consumer never asked for. Ship "install": "node -e \"\"" and put the real build behind an explicit CLI command. Do not set gypfile: true at the package root. Document why, prominently — the no-op looks like a bug.

[3] Runtime loader

The loader never throws: non-target-platform → null before any path work; load/shape failure → null + log. Two path contracts, both derived from the package's own import.meta.url:

  • dev: <packageRoot>/native/build/Release/<addon>.node
  • packaged: <resourcesPath>/app.asar.unpacked/node_modules/<pkg>/native/build/Release/<addon>.node

Provide an addonPath override as the escape hatch for exotic layouts. Import electron only lazily inside the one convenience wrapper, so the core stays loadable (and testable) in plain Node.

[4] Rebuild CLI

<pkg> rebuild --electron-version X --arch arm64|x64|universal:

  • node-gyp must be a runtime dependency, and the CLI must spawn its bin script resolved via createRequire(import.meta.url) from the package's own install — npx node-gyp silently network-fetches an unpinned version when the package sits in a consumer's node_modules.
  • node-gyp rebuild = clean → configure → build, and clean is rm -rf build/. Any intermediate stashed for a later step (universal lipo) must live OUTSIDE build/ or the second arch pass destroys it.
  • Electron ABI: --dist-url=https://electronjs.org/headers.
  • Auto-detect the consumer's Electron version from their node_modules when the flag is omitted.

[5] Packager fragments

Export a config-fragment function, not documentation alone. The traps:

  • electron-builder packs the ENTIRE production dependency. The vendored framework (fetched by your build) gets a useless second copy inside app.asar unless excluded: files: ["!**/node_modules/<pkg>/native/vendor/**"].
  • asarUnpack must be narrow: **/node_modules/<pkg>/native/build/Release/*.node, not native/build/** (which unpacks Makefiles and object files).
  • macOS rpath depth is layout-relative. An @loader_path/../../…/Frameworks entry copied from the app counts from the addon's OLD location; inside node_modules/<pkg>/native/build/Release the addon sits deeper — recount to Contents/Frameworks (8 ups for this layout) and verify with otool -l <addon>.node | grep -A2 LC_RPATH. Electron's own @executable_path/../Frameworks LC_RPATH can mask a dead entry — the framework loading is not proof your rpath is right.
  • Ship the afterPack ad-hoc signing hook as an export; consumers wrap it in a 3-line file (electron-builder takes a file path). Sign once before dmg and zip are packaged so both embed a valid CodeDirectory.
  • prepublishOnly: build — dist/ is gitignored; without the guard a clean checkout publishes a tarball with no JS and npm omits the dir silently.
  • require() of your ESM package from a consumer's .cjs hook needs Node ≥ 20.19 / ≥ 22.12 — set engines to match what your samples assume.

[6] Release CI as a composite Action

  • Composite inputs.*.default cannot reference other inputs — derive composed defaults inside the step body with ${VAR:-default}.
  • Never interpolate ${{ inputs.* }} inside run: bodies (script-injection surface). Route every input through the step's env: block, reference as "$VAR".
  • Secrets that touch disk (signing keys): RAM disk + trap cleanup EXIT with || true guards INSIDE the trap only — set -e skips inline cleanup when the signing tool fails mid-step.
  • An action step that runs npx <pkg> executes at the caller's workspace ROOT. In a pnpm workspace the bin only exists in the subpackage's node_modules/.bin, so npx silently falls back to a registry fetch of an unpinned version. Caller-side fix: add the package to ROOT devDependencies.
  • Pin external tool downloads by version + sha256, verified before extract.

[7] Dogfood migration

Switch the source app to the library and delete the local copy. The one assertion that cannot be skipped: run the app's REAL packaging and inspect the artifact — pnpm's symlinked node_modules is a layout the loader contract never saw in the lib's own repo:

  1. addon at app.asar.unpacked/node_modules/<pkg>/native/build/Release/
  2. framework at Contents/Frameworks/, a real directory
  3. codesign --verify --deep --strict passes
  4. npx asar list app.asar | grep vendor comes back empty

If 1 fails, the addonPath override is the fix — record the observed layout. Keep behavior parity explicit: tag prefixes, throttle values, notification text, and placeholder-injection anchors must survive the migration byte-for-byte (grep the old constants against the new wiring).

Common pitfalls

SymptomCauseFix
Install builds the addon against the wrong ABI, wastes minutesnpm auto-runs node-gyp for any package with binding.gypno-op install script; explicit rebuild CLI owns the real build
Consumer's rebuild fetches node-gyp from the registry, or fails offlinenode-gyp in devDependencies + npx node-gypmove to dependencies; spawn its bin via createRequire resolution
--arch universal always fails at lipointermediate stored under build/; second arch pass's clean removes itstash intermediates outside build/
Framework loads in the packaged app but the rpath entry is deadups-count copied from the app's shallower addon location; Electron's own LC_RPATH masks itrecount ups for the node_modules layout; verify with otool -l
Consumer's app.asar carries a full copy of the vendored frameworkelectron-builder packs the whole dependencyfiles exclusion for native/vendor/**
Published tarball has no dist/dist gitignored; npm omits missing dirs silentlyprepublishOnly build script
afterPack wrapper throws ERR_REQUIRE_ESM on some Node 20.xrequire(esm) unflagged only ≥ 20.19engines.node >= 20.19, noted beside the sample
Action step executes an unpinned registry version of your CLInpx at workspace root can't see the subpackage binpackage in caller's ROOT devDependencies
Signing key survives on the runner after a failed releaseset -e aborts before inline scrubtrap cleanup EXIT, || true only inside the trap
Old delta-base archives re-uploaded as the new release's assetsglobbing the archive dir after delta bases were fetched into itrecord own artifact names BEFORE fetching bases; publish only those
Version comparison treats every release as newer after migrationtag prefix not threaded into the generalized compareprefix is a required parameter; grep every call site
Appcast items 404 after a delta rebuildgenerator stamps ALL items with the current run's download URLre-point old enclosures to their own tags (URLs are not signed; safe)

Rules

  • Extraction is verbatim-first: byte-identical copies, then parameterize in a separate reviewable step.
  • The library never throws where the app can degrade — null contracts on every load path.
  • One source of truth per pinned value (framework version, placeholder string): shell script or exported constant, never both.
  • Real-artifact verification beats unit tests for packaging claims: otool, codesign, asar list, file-exists on the actual .app.

Verification

  • npm pack --dry-run from a CLEAN clone lists dist/, bin/, native sources, scripts — nothing more, nothing missing.
  • Rebuild CLI produces the addon end-to-end on the target Electron version; otool -l shows the recounted rpath entry.
  • Consumer-side packaging assertions 1–4 (step [7]) all pass on the real .app artifact.
  • Action YAML: no ${{ inputs.* }} inside any run: body; secret cleanup runs on the failure path.
  • Behavior-parity greps: old constants (URLs, prefixes, notification strings) resolve to identical values in the new wiring.

Häufig gestellte Fragen

Was macht der KI-Skill Electron Native Lib Extraction?

Verwenden Sie diesen Skill, wenn Sie eine native Electron-Modulintegration innerhalb einer App (N-API-Addon, Build-Skripte, Packaging-Konfiguration und Release-CI) in eine eigenständige, mit Quellcode veröffentlichte npm-Bibliothek auslagern oder eine solche Bibliothek von Grund auf erstellen. Behandelt Fallstricke bei ABI und Installationsskripten, die Semantik von node-gyp-Rebuilds, die Tiefe des macOS-rpath, Ausschlüsse beim Packaging mit electron-builder, bewährte Vorgehensweisen für zusammengesetzte GitHub Actions und die Migration zurück in die Quell-App für den Eigengebrauch.

Warum Electron Native Lib Extraction in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Electron Native Lib Extraction besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Electron Native Lib Extraction in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/Innei/SKILL/tree/main/skills/infrastructure/electron-native-lib-extraction ein. TypingMind liest die Datei SKILL.md und installiert den Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Electron Native Lib Extraction nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Electron Native Lib Extraction verwenden?

So viele Sie möchten. In TypingMind können Sie Electron Native Lib Extraction mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Electron Native Lib Extraction kostenlos?

Der Skill wird von Innei auf GitHub veröffentlicht. Prüfen Sie im Repository, ob dort Lizenzbedingungen angegeben sind. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇