/harness-claude:node-event-emitterfrom harness-claude
Guides use of Node.js EventEmitter for typed pub-sub communication, including listener management, memory leak prevention, async handling, and error handling.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:node-event-emitter still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Use Node.js EventEmitter for typed pub-sub communication with memory leak prevention
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.on('user:created', (user: { id: string; name: string }) => {
console.log(`User created: ${user.name}`);
});
emitter.emit('user:created', { id: '1', name: 'Alice' });
import { EventEmitter } from 'node:events';
interface AppEvents {
'user:created': [user: { id: string; name: string }];
'user:deleted': [userId: string];
error: [error: Error];
}
class AppEmitter extends EventEmitter<AppEvents> {}
const emitter = new AppEmitter();
emitter.on('user:created', (user) => {
// user is typed as { id: string; name: string }
console.log(user.name);
});
once:emitter.once('ready', () => {
console.log('System initialized');
});
const handler = (data: string) => console.log(data);
emitter.on('data', handler);
// Later: remove the specific listener
emitter.off('data', handler);
// Or remove all listeners for an event
emitter.removeAllListeners('data');
emitter.setMaxListeners(20); // Default is 10
// Or globally
EventEmitter.defaultMaxListeners = 20;
once as a Promise:import { once } from 'node:events';
const [data] = await once(emitter, 'data');
console.log(data);
'error' events:emitter.on('error', (err) => {
console.error('Emitter error:', err);
});
// Without an error listener, emitting 'error' throws and crashes the process
const ac = new AbortController();
emitter.on('data', handler, { signal: ac.signal });
// Automatically removes the listener
ac.abort();
EventEmitter is Node.js's built-in pub-sub mechanism. It is synchronous by default — emit() calls listeners in registration order and blocks until all complete.
Synchronous emission: emitter.emit('event', data) runs all listeners synchronously in the current tick. Long-running listeners block the event loop. Use setImmediate or queueMicrotask inside listeners for async work.
Memory leak warning: If more than maxListeners are registered for a single event, Node.js prints a warning. This usually indicates listeners being added in a loop without removal.
Event ordering: Listeners fire in registration order. prependListener adds to the front of the queue.
Trade-offs:
once as Promise is convenient — but only captures the first emissionhttps://nodejs.org/api/events.html
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job