Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Nodejs Pro

ASecurity

Production-grade Node.js guidance — event loop, modules, tooling, debugging, and deployment best practices.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentsjavascriptrustgojavabashnodenodejsdebugginggitapi

Works with

cliapi

Security Analysis

A96/100
mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill nodejs-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nodejs Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Nodejs Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-nodejs-pro/badge)](https://www.skillsdirectory.com/skills/aicodedecode-nodejs-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: nodejs-pro
description: Production-grade Node.js guidance — event loop, modules, tooling, debugging, and deployment best practices.
category: development
---

## Overview

Node.js is a server-side JavaScript runtime built on the V8 engine. Its non-blocking, single-threaded event loop makes it strong for I/O-heavy workloads — APIs, proxies, realtime services, and CLIs. This skill covers how to write, debug, and ship Node.js applications that behave well under load, with attention to the sharp edges (module systems, versioning, native addons, memory) that cause real production incidents.

## When to use

- Building an API, backend service, CLI, or realtime app on Node.js.
- Debugging event-loop lag, memory leaks, or unexplained latency.
- Choosing between ESM and CommonJS, npm/pnpm/yarn, or version managers.
- Preparing a Node service for production (logging, signals, health checks).
- Migrating an older Node codebase or upgrading major versions.
- Diagnosing high memory usage or garbage-collection pauses in a running service.
- Deciding how to scale a Node service (clustering, workers, or horizontal replicas).

## Core concepts

- **Event loop, not threads.** JavaScript runs on one thread; async I/O is handled off-thread by libuv. Never block the loop with synchronous CPU work — offload to worker threads, child processes, or a queue. A blocked loop = rising latency for every request.
- **Module systems.** ESM (`import`/`export`) is the modern standard; CommonJS (`require`) is legacy but still widespread. A package can't cleanly mix both. Set `"type": "module"` in package.json for ESM-first projects, and check dependencies' formats before upgrading.
- **LTS and version management.** Node releases twice a year; only even-numbered lines become LTS. Pin your runtime with a version manager (nvm, fnm, or volta) plus an `.nvmrc` / `volta` block in package.json. Never run production on an odd-numbered or EOL release.
- **Streams and backpressure.** Streams (`fs.createReadStream`, HTTP bodies) move large data without buffering it all in memory. Respect backpressure — if a writable's `write()` returns false, pause until `drain`. Ignoring it is the classic way to OOM a service.
- **Worker threads vs child processes.** Worker threads share memory and suit CPU-bound JS work (crypto, parsing, image transforms). Child processes suit isolated or non-JS work. For most cases, prefer a job queue (BullMQ, SQS) over in-process scaling.
- **Error surfaces.** Unhandled promise rejections and uncaught exceptions crash modern Node by default — which is correct behavior. Log, alert, and let the process manager restart. Swallowing them guarantees corrupted state.
- **Native addons and N-API.** Compiled addons tie you to an ABI; prefer pure-JS or prebuilt binaries. When rebuilding is needed, know your build tools (node-gyp, prebuildify) and test on the exact target image.
- **The `diagnostics_channel` and AsyncLocalStorage.** `async_hooks`-based context propagation lets you carry request IDs through async boundaries without passing them manually — the foundation of correlated logging and tracing.
- **Cluster module.** One process per CPU core behind a shared port, with the OS or Node distributing connections. Useful for single-machine scaling, but a container orchestrator running one process per container is usually simpler and more robust.
- **Memory model.** V8 heap (JS objects) vs external memory (Buffers, native). `--max-old-space-size` caps the heap; large Buffers live outside it. Monitor both — a leak in either kills the process.

## Practical workflow

1. **Set up the runtime.** Install an LTS version via a manager:
   ```bash
   fnm install --lts && fnm use lts-latest   # or: nvm install --lts
   node --version && npm --version
   echo "lts/*" > .nvmrc
   ```
2. **Scaffold with sane defaults.** Use ESM (`"type": "module"`), strict linting, and a lockfile committed to git:
   ```bash
   npm init -y && npm pkg set type=module
   npm install -D eslint prettier
   ```
   - Choose one package manager per repo (npm, pnpm, or yarn) and enforce it — mixed lockfiles cause phantom dependency bugs.
   - Enable `engines` in package.json so installs fail fast on the wrong Node version.
3. **Structure the app.** Keep a single entry point (`src/index.js`), separate route handlers from business logic, centralize configuration via validated environment variables, and keep one shared logger (pino or similar) used everywhere.
   - Validate env at startup and crash with a clear message on missing/invalid values — don't discover it on the first request.
4. **Handle shutdown.** Listen for `SIGTERM`/`SIGINT`, stop accepting connections, drain in-flight requests, then exit:
   ```js
   process.on("SIGTERM", async () => {
     server.close();
     await db.disconnect();
     process.exit(0);
   });
   ```
   - Give the orchestrator a matching `terminationGracePeriodSeconds` so it doesn't SIGKILL mid-drain.
5. **Debug performance.** Profile before guessing: `node --inspect` for DevTools, `--cpu-prof` for flame graphs, `--heap-prof` for memory. Watch `process.memoryUsage()` and event-loop delay (`perf_hooks.monitorEventLoopDelay`) as production health signals.
   - Take heap snapshots before and after load to distinguish leaks from normal growth.
6. **Load-test realistically.** Use autocannon/k6 against staging with production-like payloads; watch event-loop lag and GC pauses under sustained load, not just throughput.
7. **Harden the process.** Global handlers that log and exit:
   ```js
   process.on("unhandledRejection", (err) => { logger.fatal({ err }, "unhandled rejection"); process.exit(1); });
   process.on("uncaughtException", (err) => { logger.fatal({ err }, "uncaught exception"); process.exit(1); });
   ```
8. **Ship it.** Run with a process manager or container orchestrator that restarts on crash, set memory limits (`--max-old-space-size`), expose a `/health` endpoint, and never log secrets.
   - Ship with `--enable-source-maps` if you transpile, so production stack traces are readable.

## Common pitfalls

- **Blocking the event loop** with `JSON.parse` of huge payloads, regex on untrusted input, or sync crypto — measure first, offload to workers.
- **Unhandled promise rejections** silently killing workers in older versions or crashing without useful context — add a global handler that logs with stack + request id.
- **Mixed ESM/CJS** causing `ERR_REQUIRE_ESM` or dual-package hazards — audit with `node --check` and lock the dependency tree.
- **Forgetting to pin versions** — `"^x.y"` ranges plus a missing lockfile = non-reproducible builds and surprise breakages.
- **Logging without correlation IDs** — in async code, attach a request id (AsyncLocalStorage) or traces are unusable.
- **Leaking timers/listeners** — intervals and event subscriptions that are never cleared grow memory until the process dies.
- **Running dev-only flags in prod** (`--inspect`, watch mode) or shipping `node_modules` with devDependencies bloating images.
- **No graceful shutdown** — deploys SIGKILL in-flight requests; handle SIGTERM and drain.
- **Trusting `NODE_ENV` to be set** — default it explicitly in your entry point; libraries change behavior based on it.
- **Ignoring DNS caching behavior** — Node's default DNS lookup can surprise under load balancers; understand `verbatim`/`dns.setDefaultResultOrder` for your topology.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →