.agent/skills/nodejs-expert/SKILL.md
Node.js runtime and ecosystem expert with deep knowledge of async patterns, module systems, performance optimization, filesystem operations, process management, and networking. Use this skill for event loop debugging, memory leaks, promise handling, module resolution, and HTTP server issues.
npx skillsauth add ripgraphics/authorsinfo nodejs-expertInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an advanced Node.js expert with deep, practical knowledge of runtime debugging, async patterns, module system intricacies, and performance optimization.
node -v && npm -v
# Package manager detection
(test -f pnpm-lock.yaml && echo "pnpm") || (test -f yarn.lock && echo "yarn") || echo "npm"
# Module type
node -e "const pkg=require('./package.json');console.log(pkg.type||'commonjs')"
# Framework detection
node -e "const p=require('./package.json');const d={...p.dependencies,...p.devDependencies}||{};console.log(['express','fastify','koa','next'].find(f=>d[f])||'vanilla')"
Common errors:
Solutions:
// Always handle rejections
try {
await someAsyncOperation();
} catch (error) {
logger.error('Operation failed:', error);
}
// Use Promise.allSettled instead of Promise.all
const results = await Promise.allSettled([op1(), op2(), op3()]);
results.forEach((result, index) => {
if (result.status === 'rejected') {
console.error(`Operation ${index} failed:`, result.reason);
}
});
Diagnostics:
node --unhandled-rejections=strict app.js
node --trace-warnings app.js
Common errors:
Solutions:
// package.json for ESM
{
"type": "module",
"exports": {
".": "./src/index.js"
}
}
// Dynamic imports in CommonJS
const esmModule = await import('esm-only-package');
Symptoms:
Solutions:
// Async file operations
const data = await fs.promises.readFile('large-file.txt');
// Memory monitoring
function monitorMemory() {
const used = process.memoryUsage();
console.log(`Heap: ${Math.round(used.heapUsed / 1024 / 1024)} MB`);
}
Diagnostics:
node --prof app.js
node --inspect app.js
node --max-old-space-size=4096 app.js
Error handling:
async function safeReadFile(filePath) {
try {
await fs.promises.access(filePath, fs.constants.R_OK);
return await fs.promises.readFile(filePath, 'utf8');
} catch (error) {
if (error.code === 'ENOENT') throw new Error(`File not found`);
if (error.code === 'EACCES') throw new Error(`Permission denied`);
throw error;
}
}
Stream backpressure:
const { pipeline } = require('stream/promises');
await pipeline(
fs.createReadStream('input.txt'),
transformStream,
fs.createWriteStream('output.txt')
);
Graceful shutdown:
['SIGTERM', 'SIGINT'].forEach(signal => {
process.on(signal, async () => {
console.log('Shutting down...');
await server.close();
process.exit(0);
});
});
Production configuration:
const server = http.createServer(handler);
server.timeout = 30000;
server.keepAliveTimeout = 65000;
server.maxConnections = 1000;
server.on('clientError', (err, socket) => {
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
});
| Problem | Cause | Fix | |---------|-------|-----| | Unhandled Promise | Missing catch | Add try/catch or .catch() | | Event loop blocking | Sync operations | Use async versions | | Module resolution | ESM/CJS conflict | Dynamic imports | | Memory leak | Missing cleanup | Remove listeners, clear timers | | EMFILE error | Too many open files | Use streaming, increase ulimit |
tools
Webpack build optimization expert with deep knowledge of configuration patterns, bundle analysis, code splitting, module federation, performance optimization, and plugin/loader ecosystem. Use PROACTIVELY for any Webpack bundling issues including complex optimizations, build performance, custom plugins/loaders, and modern architecture patterns. If a specialized expert is a better fit, I will recommend switching and stop.
development
Web application security expert. OWASP Top 10, XSS, SQLi, CSRF, SSRF, authentication bypass, IDOR. Use for web app security testing.
testing
Vitest testing framework expert for Vite integration, Jest migration, browser mode testing, and performance optimization
tools
Vite build optimization expert with deep knowledge of ESM-first development, HMR optimization, plugin ecosystem, production builds, library mode, and SSR configuration. Use PROACTIVELY for any Vite bundling issues including dev server performance, build optimization, plugin development, and modern ESM patterns. If a specialized expert is a better fit, I will recommend switching and stop.