add-nodebridge-handler
Use this skill when adding a new NodeBridge handler to src/nodeBridge.ts, including updating types in src/nodeBridge.types.ts and optionally testing with scripts/test-nodebridge.ts
Best use case
add-nodebridge-handler is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use this skill when adding a new NodeBridge handler to src/nodeBridge.ts, including updating types in src/nodeBridge.types.ts and optionally testing with scripts/test-nodebridge.ts
Teams using add-nodebridge-handler should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/add-nodebridge-handler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How add-nodebridge-handler Compares
| Feature / Agent | add-nodebridge-handler | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use this skill when adding a new NodeBridge handler to src/nodeBridge.ts, including updating types in src/nodeBridge.types.ts and optionally testing with scripts/test-nodebridge.ts
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Add NodeBridge Handler
## Overview
This skill guides the process of adding a new message handler to the NodeBridge system, which enables communication between the UI layer and the Node.js backend.
## Steps
### 1. Add Handler Implementation in `src/nodeBridge.ts`
Locate the `registerHandlers()` method in the `NodeHandlerRegistry` class and add your handler:
```typescript
this.messageBus.registerHandler('category.handlerName', async (data) => {
const { cwd, ...otherParams } = data;
const context = await this.getContext(cwd);
// Implementation logic here
return {
success: true,
data: {
// Return data
},
};
});
```
**Handler Naming Convention:**
- Use dot notation: `category.action` (e.g., `git.status`, `session.send`, `utils.getPaths`)
- Categories: `config`, `git`, `mcp`, `models`, `outputStyles`, `project`, `projects`, `providers`, `session`, `sessions`, `slashCommand`, `status`, `utils`
**Common Patterns:**
- Always get context via `await this.getContext(cwd)`
- Return `{ success: true, data: {...} }` for success
- Return `{ success: false, error: 'message' }` for errors
- Wrap in try/catch for error handling
### 2. Add Type Definitions in `src/nodeBridge.types.ts`
Add input and output types near the relevant section:
```typescript
// ============================================================================
// Category Handlers
// ============================================================================
type CategoryHandlerNameInput = {
cwd: string;
// other required params
optionalParam?: string;
};
type CategoryHandlerNameOutput = {
success: boolean;
error?: string;
data?: {
// return data shape
};
};
```
Then add to the `HandlerMap` type:
```typescript
export type HandlerMap = {
// ... existing handlers
// Category handlers
'category.handlerName': {
input: CategoryHandlerNameInput;
output: CategoryHandlerNameOutput;
};
};
```
### 3. (Optional) Add to Test Script
Update `scripts/test-nodebridge.ts` HANDLERS object if the handler should be easily testable:
```typescript
const HANDLERS: Record<string, string> = {
// ... existing handlers
'category.handlerName': 'Description of what this handler does',
};
```
### 4. Test the Handler
Run the test script:
```bash
bun scripts/test-nodebridge.ts category.handlerName --cwd=/path/to/dir --param=value
```
Or with JSON data:
```bash
bun scripts/test-nodebridge.ts category.handlerName --data='{"cwd":"/path","param":"value"}'
```
## Example: Complete Handler Addition
### nodeBridge.ts
```typescript
this.messageBus.registerHandler('utils.example', async (data) => {
const { cwd, name } = data;
try {
const context = await this.getContext(cwd);
// Do something with context and params
const result = await someOperation(name);
return {
success: true,
data: {
result,
},
};
} catch (error: any) {
return {
success: false,
error: error.message || 'Failed to execute example',
};
}
});
```
### nodeBridge.types.ts
```typescript
type UtilsExampleInput = {
cwd: string;
name: string;
};
type UtilsExampleOutput = {
success: boolean;
error?: string;
data?: {
result: string;
};
};
// In HandlerMap:
'utils.example': {
input: UtilsExampleInput;
output: UtilsExampleOutput;
};
```
## Notes
- Handlers are async functions that receive `data` parameter
- Use `this.getContext(cwd)` to get the Context instance (cached per cwd)
- Context provides access to: `config`, `paths`, `mcpManager`, `productName`, `version`, etc.
- For long-running operations, consider using abort controllers (see `git.clone` pattern)
- For operations that emit progress, use `this.messageBus.emitEvent()` (see `git.commit.output` pattern)Related Skills
globalexceptionhandler-class
Structure of GlobalExceptionHandler class.
create-event-handlers
Sets up RabbitMQ event publishers and consumers following ModuleImplementationGuide.md Section 9. RabbitMQ only (no Azure Service Bus). Creates publishers with DomainEvent (tenantId preferred), consumers with handlers, naming {domain}.{entity}.{action}, required fields (id, type, version, timestamp, tenantId, source, data). Use when adding event-driven communication, async workflows, or integrating via events.
api-handler
StepLeague API route pattern using withApiHandler wrapper. Use when creating or modifying any API route in the /api directory. Keywords: API, route, endpoint, handler, auth, POST, GET, PUT, DELETE, validation.
bgo
Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.
mcp-create-declarative-agent
Skill converted from mcp-create-declarative-agent.prompt.md
MCP Architecture Expert
Design and implement Model Context Protocol servers for standardized AI-to-data integration with resources, tools, prompts, and security best practices
mathem-shopping
Automatiserar att logga in på Mathem.se, söka och lägga till varor från en lista eller recept, hantera ersättningar enligt policy och reservera leveranstid, men lämnar varukorgen redo för manuell checkout.
math-modeling
本技能应在用户要求"数学建模"、"建模比赛"、"数模论文"、"数学建模竞赛"、"建模分析"、"建模求解"或提及数学建模相关任务时使用。适用于全国大学生数学建模竞赛(CUMCM)、美国大学生数学建模竞赛(MCM/ICM)等各类数学建模比赛。
matchms
Mass spectrometry analysis. Process mzML/MGF/MSP, spectral similarity (cosine, modified cosine), metadata harmonization, compound ID, for metabolomics and MS data processing.
managing-traefik
Manages Traefik reverse proxy for local development. Use when routing domains to local services, configuring CORS, checking service health, or debugging connectivity issues.
managing-skills
Install, find, update, and manage agent skills. Use when the user wants to add a new skill, search for skills that do something, check if skills are up to date, or update existing skills. Triggers on: install skill, add skill, get skill, find skill, search skill, update skill, check skills, list skills.
manage-agents
Create, modify, and manage Claude Code subagents with specialized expertise. Use when you need to "work with agents", "create an agent", "modify an agent", "set up a specialist", "I need an agent for [task]", or "agent to handle [domain]". Covers agent file format, YAML frontmatter, system prompts, tool restrictions, MCP integration, model selection, and testing.