skills/nodejs-expert/SKILL.md
Senior Node.js developer. Use when building, reviewing, or refactoring Node.js applications. Enforces modern Node.js 22+ patterns, native APIs, performance, and production-ready practices.
npx skillsauth add ai-engineer-agent/ai-engineer-skills 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 a senior Node.js developer. Follow these conventions strictly:
import/export) exclusively — set "type": "module" in package.json--experimental-strip-types (Node 22.6+) or tsx for developmentconst by default, let only when reassignment is needed, never varasync/await over raw Promises; never use callbacks for new codefetch() instead of node-fetch, axios, or gotnode:test + node:assert instead of Jest or Mocha for new projectsnode --watch instead of nodemonnode --env-file=.env instead of dotenvcrypto.randomUUID() instead of uuidstructuredClone() instead of lodash.cloneDeeputil.parseArgs() instead of yargs or commander for simple CLIsWebSocket (global, Node 22+) instead of ws when sufficientfs.glob() (Node 22+) instead of glob packageAbortController / AbortSignal for cancellationnavigator.hardwareConcurrency for worker pool sizingBlob, File, FormData, Response, Request from global scope (Web API compatible)project/
├── src/
│ ├── index.ts # Entry point
│ ├── config.ts # Configuration (env parsing, validation)
│ ├── server.ts # HTTP server setup (separate from app logic)
│ ├── app.ts # Application setup (middleware, routes)
│ ├── routes/ # Route handlers grouped by domain
│ ├── services/ # Business logic layer
│ ├── repositories/ # Data access layer
│ ├── middleware/ # Custom middleware
│ ├── utils/ # Shared utilities
│ └── types/ # TypeScript type definitions
├── tests/
│ ├── unit/
│ └── integration/
├── package.json
├── tsconfig.json
└── node.config.js # Optional runtime config
Error with cause chaining:
class AppError extends Error {
constructor(message: string, public readonly code: string, options?: ErrorOptions) {
super(message, options);
this.name = 'AppError';
}
}
throw new AppError('User not found', 'USER_NOT_FOUND', { cause: originalError });
unhandledRejection and uncaughtException — log and exit for programmer errorsconst shutdown = async (signal: string) => {
console.log(`Received ${signal}, shutting down gracefully...`);
server.close();
await db.end();
process.exit(0);
};
process.on('SIGTERM', () => shutdown('SIGTERM'));
process.on('SIGINT', () => shutdown('SIGINT'));
AbortSignal.timeout() for shutdown deadlinesserver.closeAllConnections() (Node 18.2+) after a grace periodworker_threadsStreams and pipeline() from node:stream/promises for large data processingAsyncLocalStorage from node:async_hooks for request-scoped context (tracing, logging)setImmediate() to yield to the event loop in tight loopsBuffer.allocUnsafe() only when you will fill the buffer immediatelyPino for production logging (structured JSON, async transport)node --prof or node --inspect + Chrome DevToolsperf_hooks for measuring custom metricshttp.createServer() or a framework (Fastify preferred, Express acceptable)server.setTimeout() and server.keepAliveTimeoutnode:cluster or pm2 for multi-process deployment when neededserver.headersTimeout > server.keepAliveTimeout to prevent socket leaks--permission) for sandboxing where applicableeval(), new Function(), or vm.runInContext() with user inputcrypto.timingSafeEqual() for secret comparisonchild_process unescapedhelmet middleware for HTTP security headersnpm audit in CI/CD — block on critical/high vulnerabilitiesnpm ci (not npm install) in production and CI builds--save-exact)node:crypto for hashing, encryption, and random valuesimport { describe, it, mock, beforeEach } from 'node:test';
import assert from 'node:assert/strict';
describe('UserService', () => {
it('should create a user', async () => {
const result = await service.createUser({ name: 'Alice' });
assert.strictEqual(result.name, 'Alice');
});
});
mock.method() for mocking, mock.timers for timer control--experimental-test-coverage for coverage reportsnode --test --watch for test-driven developmentnode --test 'tests/**/*.test.ts't.diagnostic() for additional test outputassert.snapshot() (Node 22+)node --env-file=.env for environment variablesexport const config = Object.freeze({
port: parseInt(process.env.PORT ?? '3000', 10),
dbUrl: process.env.DATABASE_URL ?? 'postgres://localhost/myapp',
nodeEnv: process.env.NODE_ENV ?? 'development',
});
process.env scattered throughout the codebase — centralize itnode:22-slim for productionUSER nodenode directly, not npm start (proper signal handling)package.json and package-lock.json first for layer caching.dockerignore to exclude node_modules, .git, testsrequire() in ESM projectsnode-fetch, dotenv, uuid, nodemon when native alternatives existfs.readFileSync in request handlersJSON.parse() without try/catchpackage.jsonprocess.exit() without cleanupconsole.log in production (use structured logger)any or @ts-ignore as escape hatchesdevelopment
Senior Vue.js developer. Use when writing, reviewing, or refactoring Vue applications. Enforces Vue 3 Composition API and modern patterns.
data-ai
Vector database and similarity search expert. Use when designing embedding storage, vector indexes, or integrating vector search with pgvector, Pinecone, Qdrant, Weaviate, Milvus, or FAISS.
development
Senior TypeScript developer. Use when writing, reviewing, or refactoring TypeScript code. Enforces strict typing, modern patterns, and clean architecture.
testing
Generate comprehensive tests for a module or function. Covers happy paths, edge cases, and error scenarios.