This skill should be used when the user asks about "Electron", "WebContentsView", "BrowserView", "preload script", "contextIsolation", "IPC", or needs to work with Electron-specific functionality in XSky.
Provides Electron integration for XSky, enabling browser automation with WebContentsView and secure preload scripts. Claude uses this when you mention Electron, WebContentsView, BrowserView, preload scripts, contextIsolation, IPC, or need to work with Electron-specific functionality.
/plugin marketplace add anujkumar001111/xsky-agent/plugin install anujkumar001111-xsky-dev-team@anujkumar001111/xsky-agentThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill provides knowledge for Electron integration in XSky.
packages/ai-agent-electron/ - Electron adapter package
ai-agent-electron/src/
├── browser.ts # BrowserAgent implementation
├── file.ts # FileAgent for Electron
├── index.ts # Package exports
├── preload.ts # Preload script template
└── mcp/
└── index.ts # MCP client for Electron
import { BrowserAgent } from "@xsky/ai-agent-electron";
const browserAgent = new BrowserAgent(
detailView, // WebContentsView instance
mcpClient, // Optional MCP client
customPrompt, // Optional system prompt
{
useContextIsolation: true,
preloadPath: path.join(__dirname, 'preload.js')
}
);
interface BrowserAgentSecurityOptions {
useContextIsolation?: boolean; // Recommended for production
preloadPath?: string; // Required when contextIsolation true
}
Create preload.js:
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('xskyAgent', {
executeScript: async (fnString, args) => {
// Safe script execution via IPC
return await ipcRenderer.invoke('xsky:execute-script', fnString, args);
}
});
import { WebContentsView } from 'electron';
const view = new WebContentsView({
webPreferences: {
contextIsolation: true,
nodeIntegration: false,
sandbox: true,
preload: path.join(__dirname, 'preload.js')
}
});
mainWindow.contentView.addChildView(view);
view.setBounds({ x: 0, y: 0, width: 800, height: 600 });
With contextIsolation (secure):
// Uses preload API
await window.xskyAgent.executeScript(fn.toString(), args);
Without contextIsolation (legacy):
// Direct executeJavaScript
await webContents.executeJavaScript(code, true);
protected async screenshot(ctx: AgentContext) {
const image = await this.detailView.webContents.capturePage();
return {
imageBase64: image.toDataURL(),
imageType: "image/jpeg"
};
}
BrowserAgent includes PDF extraction:
// Automatically detects PDF pages
// Uses pdf.js for content extraction
const content = await agent.extract_page_content(ctx);
// Returns: { title, page_url, page_content, total_pages, content_type: 'pdf' }
| File | Purpose |
|---|---|
packages/ai-agent-electron/src/browser.ts | BrowserAgent |
packages/ai-agent-electron/src/file.ts | FileAgent |
packages/ai-agent-electron/src/preload.ts | Preload template |
packages/ai-agent-electron/src/mcp/stdio.ts | MCP STDIO client |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.