Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Register and handle custom URL protocols (deep linking) across platforms for Electron applications
.claude/skills/a5c-ai-electron-protocol-handler-setup/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 24% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 42% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 209% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 130% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 72% | 0% |
Register and handle custom URL protocols (deep linking) for Electron applications across Windows, macOS, and Linux. This skill enables apps to respond to custom URL schemes like myapp:// for deep linking and inter-application communication.
json{ "type": "object", "properties": { "projectPath": { "type": "string", "description": "Path to the Electron project root" }, "protocols": { "type": "array", "items": { "type": "object", "properties": { "scheme": { "type": "string", "description": "Protocol scheme (e.g., 'myapp')" }, "name": { "type": "string", "description": "Human-readable name" }, "role": { "enum": ["Viewer", "Editor", "Shell", "None"], "default": "Viewer" } }, "required": ["scheme", "name"] } }, "singleInstance": { "type": "boolean", "description": "Enforce single instance with protocol relay", "default": true }, "securityOptions": { "type": "object", "properties": { "validateUrls": { "type": "boolean", "default": true }, "allowedHosts": { "type": "array", "items": { "type": "string" } }, "sanitizeParams": { "type": "boolean", "default": true } } }, "targetPlatforms": { "type": "array", "items": { "enum": ["win32", "darwin", "linux"] } } }, "required": ["projectPath", "protocols"] }
json{ "type": "object", "properties": { "success": { "type": "boolean" }, "files": { "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string" }, "description": { "type": "string" } } } }, "configuration": { "type": "object", "properties": { "electronBuilder": { "type": "object" }, "packageJson": { "type": "object" } } }, "testUrls": { "type": "array", "items": { "type": "string" } } }, "required": ["success"] }
xml<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>My App Protocol</string> <key>CFBundleURLSchemes</key> <array> <string>myapp</string> </array> </dict> </array>
json// electron-builder.yml nsis: perMachine: true include: "installer.nsh"
nsis; installer.nsh !macro customInstall WriteRegStr HKCU "Software\Classes\myapp" "" "URL:My App Protocol" WriteRegStr HKCU "Software\Classes\myapp" "URL Protocol" "" WriteRegStr HKCU "Software\Classes\myapp\shell\open\command" "" '"$INSTDIR\MyApp.exe" "%1"' !macroend
ini[Desktop Entry] Name=My App Exec=/opt/myapp/myapp %u Type=Application MimeType=x-scheme-handler/myapp;
javascript// protocol-handler.js const { app, shell } = require('electron'); const url = require('url'); class ProtocolHandler { constructor(mainWindow, options = {}) { this.mainWindow = mainWindow; this.scheme = options.scheme || 'myapp'; this.allowedHosts = options.allowedHosts || []; this.handlers = new Map(); } register() { // Set as default protocol client if (process.defaultApp) { // Development: register with path to electron app.setAsDefaultProtocolClient(this.scheme, process.execPath, [ path.resolve(process.argv[1]) ]); } else { // Production app.setAsDefaultProtocolClient(this.scheme); } } unregister() { app.removeAsDefaultProtocolClient(this.scheme); } handleUrl(protocolUrl) { if (!this.validateUrl(protocolUrl)) { console.error('Invalid protocol URL:', protocolUrl); return; } const parsed = url.parse(protocolUrl, true); const route = parsed.host || parsed.pathname?.slice(2); const params = parsed.query; // Dispatch to registered handler const handler = this.handlers.get(route); if (handler) { handler(params, parsed); } else { console.warn('No handler for route:', route); } // Focus window if (this.mainWindow) { if (this.mainWindow.isMinimized()) { this.mainWindow.restore(); } this.mainWindow.focus(); } } validateUrl(protocolUrl) { try { const parsed = url.parse(protocolUrl); // Check scheme if (parsed.protocol !== `${this.scheme}:`) { return false; } // Check allowed hosts if configured if (this.allowedHosts.length > 0 && parsed.host) { if (!this.allowedHosts.includes(parsed.host)) { return false; } } return true; } catch { return false; } } on(route, handler) { this.handlers.set(route, handler); } } module.exports = ProtocolHandler;
javascript// main.js const { app } = require('electron'); const ProtocolHandler = require('./protocol-handler'); // Single instance lock const gotTheLock = app.requestSingleInstanceLock(); if (!gotTheLock) { app.quit(); } else { let mainWindow; let protocolHandler; app.on('second-instance', (event, commandLine) => { // Someone tried to run a second instance // Handle protocol URL from command line (Windows) const url = commandLine.find(arg => arg.startsWith('myapp://')); if (url) { protocolHandler.handleUrl(url); } // Focus existing window if (mainWindow) { if (mainWindow.isMinimized()) mainWindow.restore(); mainWindow.focus(); } }); // macOS: Handle protocol URL app.on('open-url', (event, url) => { event.preventDefault(); if (protocolHandler) { protocolHandler.handleUrl(url); } }); app.whenReady().then(() => { mainWindow = createWindow(); protocolHandler = new ProtocolHandler(mainWindow, { scheme: 'myapp', allowedHosts: ['open', 'auth', 'share'] }); protocolHandler.register(); // Register route handlers protocolHandler.on('open', (params) => { mainWindow.webContents.send('protocol:open', params); }); protocolHandler.on('auth', (params) => { handleOAuthCallback(params); }); // Handle URL if app was launched with one const launchUrl = process.argv.find(arg => arg.startsWith('myapp://')); if (launchUrl) { protocolHandler.handleUrl(launchUrl); } }); }
yaml# electron-builder.yml protocols: - name: "My App Protocol" schemes: - myapp role: Viewer # macOS mac: extendInfo: CFBundleURLTypes: - CFBundleURLName: "My App Protocol" CFBundleURLSchemes: - myapp # Linux linux: mimeTypes: - x-scheme-handler/myapp desktop: MimeType: "x-scheme-handler/myapp;"
javascript// Security example validateParams(params) { const sanitized = {}; const allowedParams = ['id', 'action', 'token']; for (const [key, value] of Object.entries(params)) { if (allowedParams.includes(key)) { // Sanitize value sanitized[key] = String(value).slice(0, 1000); } } return sanitized; }
bash# Test on macOS open "myapp://open?file=test.txt" # Test on Windows start "" "myapp://open?file=test.txt" # Test on Linux xdg-open "myapp://open?file=test.txt"
electron-ipc-security-audit - Secure protocol handlinginter-app-communication process - IPC patternselectron-builder-config - Package protocol handlerselectron-architect - Architecture guidancedesktop-security-auditor - Security review| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 21,745 | 15,382 | -29% | 1 | 1 | 0% | 4,920 | 6,102 | +24% | 0 | 0 | — |
case-02 | fail→pass | 15,555 | 11,330 | -27% | 1 | 1 | 0% | 3,655 | 5,180 | +42% | 0 | 0 | — |
case-03 | pass→pass | 8,121 | 15,128 | +86% | 1 | 1 | 0% | 1,537 | 3,533 | +130% | 0 | 0 | — |
case-04 | pass→pass | 12,181 | 9,920 | -19% | 1 | 1 | 0% | 2,525 | 4,355 | +72% | 0 | 0 | — |
case-05 | pass→pass | 3,753 | 3,996 | +6% | 1 | 1 | 0% | 669 | 3,078 | +360% | 0 | 0 | — |
case-06 | pass→pass | 7,150 | 5,563 | -22% | 1 | 1 | 0% | 1,351 | 3,434 | +154% | 0 | 0 | — |
case-07 | pass→pass | 5,064 | 5,351 | +6% | 1 | 1 | 0% | 868 | 3,366 | +288% | 0 | 0 | — |
case-08 | pass→pass | 4,950 | 5,389 | +9% | 1 | 1 | 0% | 1,004 | 3,399 | +239% | 0 | 0 | — |
case-09 | pass→pass | 14,067 | 9,803 | -30% | 1 | 1 | 0% | 2,838 | 4,591 | +62% | 0 | 0 | — |
case-10 | pass→pass | 11,147 | 7,767 | -30% | 1 | 1 | 0% | 2,107 | 3,961 | +88% | 0 | 0 | — |
case-11 | fail→fail | 17,793 | 12,576 | -29% | 1 | 1 | 0% | 2,951 | 4,838 | +64% | 0 | 0 | — |
case-12 | pass→pass | 10,402 | 9,466 | -9% | 1 | 1 | 0% | 2,115 | 4,272 | +102% | 0 | 0 | — |
case-13 | pass→pass | 12,017 | 10,510 | -13% | 1 | 1 | 0% | 2,346 | 4,361 | +86% | 0 | 0 | — |
case-14 | pass→pass | 5,208 | 2,985 | -43% | 1 | 1 | 0% | 934 | 3,009 | +222% | 0 | 0 | — |
case-15 | pass→pass | 3,049 | 3,245 | +6% | 1 | 1 | 0% | 574 | 2,947 | +413% | 0 | 0 | — |
case-16 | pass→pass | 13,318 | 7,192 | -46% | 1 | 1 | 0% | 2,405 | 3,887 | +62% | 0 | 0 | — |
case-17 | fail→pass | 5,312 | 2,896 | -45% | 1 | 1 | 0% | 953 | 2,944 | +209% | 0 | 0 | — |
case-18 | pass→pass | 3,973 | 2,575 | -35% | 1 | 1 | 0% | 563 | 2,900 | +415% | 0 | 0 | — |
case-19 | pass→pass | 13,316 | 13,897 | +4% | 1 | 1 | 0% | 2,594 | 5,211 | +101% | 0 | 0 | — |
case-20 | pass→pass | 12,800 | 8,601 | -33% | 1 | 1 | 0% | 2,511 | 4,305 | +71% | 0 | 0 | — |
case-21 | pass→pass | 9,594 | 6,795 | -29% | 1 | 1 | 0% | 1,831 | 3,721 | +103% | 0 | 0 | — |
case-22 | pass→pass | 6,377 | 5,474 | -14% | 1 | 1 | 0% | 1,230 | 3,528 | +187% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.