Advisor Electron Angular Native
Battle-tested agent for code, review, mode, tailored. Includes structured workflows, validation checks, and reusable patterns for web tools.
Advisor Electron Angular Native
Reviews Electron desktop applications with Angular renderers and native OS integrations for security, performance, and code quality.
When to Use This Agent
Choose this agent when you need to:
- Architect or review Electron apps pairing Node.js main process with Angular renderer
- Audit IPC patterns, native shell/AppleScript integrations, and cross-process security
- Diagnose memory leaks, re-renders, and RxJS subscription issues in desktop contexts
Consider alternatives when:
- Your desktop app uses Tauri or NW.js with a different process model
- The renderer uses React or Vue rather than Angular
Quick Start
Configuration
name: advisor-electron-angular-native type: agent category: web-tools
Example Invocation
claude agent:invoke advisor-electron-angular-native "Review IPC handler in main/ipc-bridge.ts for security"
Example Output
Code Review: main/ipc-bridge.ts
================================
HIGH: [Security] Raw file path exposed without sanitization (line 42)
Fix: Validate path against allowed directories
HIGH: [Error] Missing try/catch around exiftool spawn (line 78)
Fix: Wrap with timeout and exit code validation
MEDIUM: [Perf] Synchronous fs.readFileSync blocks main (line 31)
Fix: Replace with fs.promises.readFile
Architecture: Main/Renderer separation PASS | IPC validation FAIL
Core Concepts
Electron Process Model
| Aspect | Details |
|---|---|
| Main Process | Node.js runtime managing windows, IPC routing, native integrations, and system tray |
| Renderer Process | Angular app in Chromium with restricted Node.js access via context isolation |
| Preload Scripts | Bridge layer exposing safe APIs through contextBridge.exposeInMainWorld |
| Native Layer | OS-specific integrations (AppleScript, shell, exiftool) wrapped in typed services |
| IPC Protocol | Structured message passing via ipcMain.handle / ipcRenderer.invoke |
Electron + Angular Architecture
+-------------------+ +-------------------+ +------------------+
| Angular |<--->| Preload Bridge |<--->| Electron Main |
| Renderer | | (contextBridge) | | Process |
+-------------------+ +-------------------+ +------------------+
| |
| RxJS / Change Detection | child_process
v v
+-------------------+ +------------------+
| UI Components | | Native Layer |
| Services/Guards | | AppleScript/CLI |
+-------------------+ +------------------+
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| review_scope | string | "full" | Scope: "main", "renderer", "native", or "full" |
| security_level | string | "strict" | Depth: "basic" or "strict" with context isolation checks |
| angular_version | string | "17" | Angular version for framework-specific recommendations |
| native_platform | string | "darwin" | Target OS: "darwin", "win32", or "linux" |
| ipc_rate_limit | number | 100 | Max recommended IPC calls/sec before throttling warnings |
Best Practices
-
Enforce Context Isolation - Never disable
contextIsolationor enablenodeIntegration. Expose only minimum APIs throughcontextBridge.exposeInMainWorldand validate every renderer argument as untrusted input. -
Manage RxJS Subscriptions with Lifecycle Hooks - Desktop windows persist for hours, making subscription leaks severe. Use
takeUntil(this.destroy$)or the async pipe exclusively, and audit long-running services during extended sessions. -
Wrap Native Commands in Typed Services - Shell commands and CLI invocations should be encapsulated in service classes with TypeScript interfaces, timeout parameters, exit code validation, and stderr capture.
-
Debounce High-Frequency IPC - Renderer events like resize or file watcher updates can flood the IPC channel. Apply throttling at the renderer side and rate limiting at the main process handler level.
-
Implement Graceful Shutdown - Register
before-quitandwill-quithandlers to terminate child processes, clean temp files, and save in-progress work. Test shutdown with pending native operations.
Common Issues
-
Missing await in IPC Handlers - Forgetting
awaitinsideipcMain.handlereturns undefined silently. The renderer receives no error, making this a hidden data loss bug. Lint for missing await in all async handlers. -
Angular Zone and Native Events - Native callbacks execute outside Angular's Zone, causing missed change detection. Wrap callbacks with
this.ngZone.run(() => ...)to ensure view refreshes. -
Unreleased Child Processes - Spawned CLI processes not killed on window close accumulate over time. Track all ChildProcess references and terminate them during shutdown.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
API Endpoint Builder
Agent that scaffolds complete REST API endpoints with controller, service, route, types, and tests. Supports Express, Fastify, and NestJS.
Documentation Auto-Generator
Agent that reads your codebase and generates comprehensive documentation including API docs, architecture guides, and setup instructions.
Ai Ethics Advisor Partner
All-in-one agent covering ethics, responsible, development, specialist. Includes structured workflows, validation checks, and reusable patterns for ai specialists.