electron-protocol-handler-setup
БесплатноБез исполняемых скриптовНе проверенRegister and handle custom URL protocols (deep linking) across platforms for Electron applications
от a5c-ai★ 1 947 звёзд на GitHubОб этом скилле
electron-protocol-handler-setup
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.
Capabilities
- Register custom protocol handlers at OS level
- Handle protocol URLs in running application
- Configure electron-builder for protocol registration
- Implement secure URL parsing and validation
- Handle protocol activation on app launch
- Support single-instance enforcement with protocol handling
- Generate platform-specific registration scripts
- Test protocol handling in development
Input Schema
{
"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"]
}
Output Schema
{
"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"]
}
Platform Registration
macOS (Info.plist)
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>My App Protocol</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
</array>
Windows (Registry)
// electron-builder.yml
nsis:
perMachine: true
include: "installer.nsh"
; 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
Linux (Desktop Entry)
[Desktop Entry]
Name=My App
Exec=/opt/myapp/myapp %u
Type=Application
MimeType=x-scheme-handler/myapp;
Implementation
Protocol Handler Class
// 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;
Установить electron-protocol-handler-setup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBashGlobGrepВложенные файлы
FAQ
Что делает скилл electron-protocol-handler-setup?
Register and handle custom URL protocols (deep linking) across platforms for Electron applications
Как установить скилл electron-protocol-handler-setup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл electron-protocol-handler-setup запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic