nodejs

A guide to Node.js, the runtime used to run JavaScript outside a web browser. It covers modules, asynchronous work, streams, errors, security, and process behavior.

In plain words
What is it for?
Use it for Node.js servers, command-line tools, scripts, package configuration, streams, and process-lifecycle code.
Why use it?
It helps prevent code from blocking the event loop, mishandling files or network work, or using modules and errors inconsistently.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/xobotyi/cc-foundry/nodejs
Any agent
npx skills add xobotyi/cc-foundry --skill nodejs
Clone the repo
git clone --depth 1 https://github.com/xobotyi/cc-foundry

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,763 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.02763
Opus 5 $0.00023 $0.01381
Sonnet 5 $0.00009 $0.00553
Haiku 4.5 $0.00005 $0.00276

Measured 2d ago against content hash 2e7d9914c67a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

nodejs scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Strips warnings and disclaimersmediumAnti-refusal

Omitting safety caveats hides risk from the user and is a common jailbreak preamble.

- Don't lecture or quote the rule — state what's wrong and how to fix it.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- **Never block the event loop.** No sync I/O in servers (`readFileSync`, `execSync`, `crypto.pbkdf2Sync`,
plugins/javascript/skills/nodejs/SKILL.md · 201 lines

How it starts

The opening of the file, as written. The whole thing — 201 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Node.js

Respect the event loop. Every blocking operation is a scalability bug.

Node.js rewards async-first, stream-oriented code. If your Node.js code fights the event loop, it's wrong.

References

  • Module system — [${CLAUDE_SKILL_DIR}/references/modules.md]: ESM/CJS comparison tables, file extension rules, conditional exports patterns
  • Event loop — [${CLAUDE_SKILL_DIR}/references/event-loop.md]: Phase order, execution priority, blocking operations table, worker pool
  • Streams — [${CLAUDE_SKILL_DIR}/references/streams.md]: Stream types table, pipeline patterns, backpressure details
  • Error handling — [${CLAUDE_SKILL_DIR}/references/errors.md]: Error categories table, global handlers, centralized error handling
  • Security — [${CLAUDE_SKILL_DIR}/references/security.md]: Supply chain threats table, HTTP security headers, process hardening

Module System

  • Use ESM. Set "type": "module" in package.json. Use .mjs/.cjs only when mixing module systems within one package.
  • Use node: prefix for all built-in imports: import fs from 'node:fs'. Prevents package name collision attacks and is unambiguous.
  • Import process explicitly. import process from 'node:process'. Never rely on the process global — explicit imports make dependencies visible.
  • Define "exports" in package.json for libraries. Encapsulates internals — only paths listed in "exports" are importable by consumers.
  • Imports at module top. No dynamic import() for statically-known dependencies.
  • Use import.meta.dirname/import.meta.filename instead of __dirname/__filename.
  • Use import.meta.resolve() instead of require.resolve() in ESM.
  • Always set "type" explicitly in package.json, even in CJS packages — future-proofs the package and helps tooling.
  • Use conditional exports for dual CJS/ESM packages. Order: types > import > require > default. Always include "default" as fallback.
  • Place "types" first in conditional exports when publishing TypeScript declarations.
  • Use # imports ("imports" in package.json) for clean internal paths without ../../../. Supports conditional resolution for platform-specific implementations.
  • Keep "main" alongside "exports" only for backward compatibility with old Node.js or bundlers. Never use "main" alone for new packages.
  • JSON imports in ESM require with { type: 'json' } attribute.
  • Use createRequire() from node:module only when you must require() in ESM (e.g., native addons).
  • CJS interop: default import from CJS always works. Named imports work if CJS uses static export patterns; otherwise destructure the default.
  • require() can load synchronous ESM (no top-level await). For ESM with top-level await, use dynamic import().
  • Self-referencing: a package can import its own exports by name when "exports" is defined.

Read the full file on GitHub · 201 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 201 lines · 45 tokens per session scan B 2e7d9914c67a

Subscribe to this mod's changes

nodejs is a skill published in the GitHub repository xobotyi/cc-foundry (20 stars, last pushed 2d ago), licensed MIT. It adds 45 tokens to every session and 2,763 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 2 findings (strips warnings and disclaimers, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

general-video

Author or edit a custom HyperFrames composition when no specialized workflow fits, or when BRIEF.md sets flow: companion. Use for longer or multi-scene pieces, brand and sizzle reels, montages, static loops, static title cards, footage remixes, and freeform builds. Use motion-graphics instead for a short unnarrated…

heygen-com/hyperframes · 92 tokens

use-agent-browser-for-airi

Test AIRI display-model imports with agent-browser across stage-tamagotchi Electron, stage-web, and stage-pocket mobile web layouts. Use when uploading and verifying contributor-supplied Live2D ZIP, VRM, or MMD ZIP/PMX/PMD files through AIRI's model selector, including onboarding bypass, format-specific import…

moeru-ai/airi · 87 tokens

opencli-sitemap-author

Use when creating or maintaining OpenCLI site sitemaps: agent-facing navigation, page-state, action, workflow, API-reference, pitfall, and fallback knowledge for a website. Use after browser exploration discovers durable site context, when a sitemap is stale, or when promoting local site knowledge into the repo.

jackwener/OpenCLI · 67 tokens

debug-optimize-lcp

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…

ChromeDevTools/chrome-devtools-mcp · 99 tokens

pinchtab-mcp

Use this skill when a task requires browser automation through PinchTab's MCP server connected to a remote browser instance. Covers navigation, element interaction, data extraction, form filling, multi-step flows, and session management via MCP tools.

pinchtab/pinchtab · 52 tokens

mintlify-preview

Run the public Mintlify product docs site locally for live preview. Use when previewing or iterating on docs under docs/ (.mdx/.md pages, docs.json nav), or when the user says "start the docs", "run mintlify", "preview the docs site".

latitude-dev/latitude-llm · 69 tokens