nodejs
Skill1 starsChanged 4 months agoMITView on GitHub
Node.js runtime-specific expertise — what blocks the single-threaded event loop and what to do instead, async correctness (sequential `await` in a loop vs `Promise.all`, unhandled rejections, errors that never propagate out of a callback), streams and backpressure for large payloads, ESM vs CommonJS interop, configuration and secrets through the environment, graceful shutdown on SIGTERM, and Node-specific security pitfalls (path traversal, `child_process`, unvalidated dynamic `require`). Use when `package.json` declares an `engines.node` or Node scripts, when code imports `node:` builtins (`fs`, `http`, `path`, `crypto`, `child_process`, `worker_threads`), when a Dockerfile runs a `node` image, or when the work targets a Node server runtime (Express/Fastify/Nest/Next route handlers), including when asked directly (Thai or English) to เขียนหรือตรวจโค้ด Node.js ให้ถูกต้องและไม่บล็อก event loop. Not a replacement for backend-dev's framework-agnostic route/validation/business-logic work — this is the runtime layer underneath it.
- Reads credentials
9 other projects use a version of this.
Adopted by
Most recently taken up by
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- weiweimhy/agent-skillstheir own version, first seen Jul 1, 2026
- TheDecipherist/claude-code-mastery-project-starter-kittheir own version, first seen Jun 26, 2026
- joabgonzalez/ai-agents-skillstheir own version, first seen Jun 8, 2026
- michelve/hugin-v0their own version, first seen Mar 29, 2026
- crustacean-dev/stack-guardrailstheir own version, first seen Mar 24, 2026
Used with
Projects with it also use tailwindcss, vue and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
akornmeierSkilltailwindcss
Guide for implementing Tailwind CSS - a utility-first CSS framework for rapid UI development. Use when styling applications with responsive design, dark mode, custom themes, or building design systems with Tailwind's utility classes.
Also in 3 projects that use this
JetBrainsSkillvue
Vue 3 Composition API, script setup macros, reactivity system, and built-in components. Use when writing Vue SFCs, defineProps/defineEmits/defineModel, watchers, or using Transition/Teleport/Suspense/KeepAlive.
Also in 3 projects that use this
ElasticSkillaccessibility
Accessibility guidance for Kibana. Use this skill when working with or reviewing EUI components, resolving a11y-related (@elastic/eui) ESLint issues, and ensuring proper use of ARIA attributes, focus management, keyboard interactions, and accessible naming conventions.
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- TheDecipherist/claude-code-mastery-project-starter-kit★ 338same name
- joabgonzalez/ai-agents-skills★ 9same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- rogue-dev-studio/ai-agents-rogue★ 2same name
- michelve/hugin-cowork★ 1same name
- conjure-3301/skills★ 0same name
- crustacean-dev/stack-guardrails★ 0same name
- michelve/hugin-v0★ 0same name
- weiweimhy/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agent-flowSkill
- dev-testingSkill
- dry-and-corSkill
- electronSkill
- firebaseSkill
- flutterSkill
- google-authSkill
- html-cssSkill
- mysqlSkill
- postgresSkill
- reactSkill
- sqliteSkill
- stack-briefingSkill
- supabaseSkill
- tailwindSkill
- tursoSkill
- typescriptSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 3 are distinctive, and 17 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
17
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 17
Check package.json for engines.node, type, or scripts running node.
- Very specific: line 39
Use Promise.all when the calls are independent, and a bounded concurrency helper (p-limit, or chunked Promise.all) when N is large enough …
- Very specific: line 47
Every promise is awaited, returned, or explicitly .catch()ed.
- Distinctive: line 66
Read/write large files and proxied HTTP bodies as streams — buffering a file into a string to send it holds the whole thing in memory per …
- Very specific: line 69
Use pipeline (from node:stream/promises) rather than .pipe() chains: .pipe() doesn't forward errors or destroy the upstream on failure, …
- Very specific: line 101
Never commit .env; ship .env.example with keys and empty values.
- Very specific: line 106
Don't process.exit() from inside request handling — it drops in-flight responses and pending writes.
- Very specific: line 108
Keep the process stateless where a scheduler may run several replicas: an in-memory cache, session store, or setInterval cron in the app …
- Very specific: line 114
Never interpolate user input into exec/execSync — use execFile/spawn with an argument array, and prefer a library over shelling out at all.
- Very specific: line 120
Never require/import() a module path derived from user input, and don't eval/new Function on request data.
- Very specific: line 122
Use crypto.randomUUID()/crypto.randomBytes for tokens — Math.random is not a CSPRNG.
- Very specific: line 124
Run the app as a non-root user in the container, pin dependency versions via the committed lockfile, and treat a postinstall script in a …
- Very specific: line 141
Don't call a …Sync API, hash a password, or parse a huge payload inside a request handler — that stalls every other connection.
- Very specific: line 143
Don't leave a floating promise, and don't pass an async callback to something that ignores the returned promise.
- Very specific: line 145
Don't rely on uncaughtException/unhandledRejection handlers to keep a broken process alive.
- Very specific: line 147
Don't buffer a whole file or proxied response into memory, and don't chain .pipe() where pipeline would propagate the error.
- Distinctive: line 149
Don't mix ESM and CJS ad hoc, or omit file extensions in ESM imports.
- Very specific: line 150
Don't read process.env deep in application code, and don't commit .env.
- Distinctive: line 151
Don't build a shell command or a filesystem path out of raw user input.
- Very specific: line 152
Don't write the framework's routes, validation, or business logic here — that's backend-dev.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Node.js
backend-dev's runtime-specific expertise layer: that agent is
framework-agnostic and matches whatever HTTP framework the project already
uses — this skill is the Node knowledge underneath it, the part that stays
true whether the framework is Express, Fastify, Nest, Hono, or a Next.js
route handler. Language-level typing rules are skills/typescript/SKILL.md;
database specifics belong to the matching engine skill.
Step 1 — Confirm the runtime is actually Node
Check package.json for engines.node, type, or scripts running node;
imports of node: builtins; a node base image in a Dockerfile; or a
server file under a Node framework. If the runtime is Deno, Bun, or an edge
runtime (Cloudflare Workers, Vercel Edge, Supabase Edge Functions), most of
the event-loop and async rules still hold but the builtin/API surface does
not — check that runtime's supported APIs before using fs,
child_process, or native modules at all.
Step 2 — The event loop is single-threaded
One thread runs all JavaScript, so any synchronous work delays every pending request, not just the one being served.
- No
fs.readFileSync,crypto.pbkdf2Sync,execSync, or aJSON.parseof a multi-megabyte body inside a request path — the async form exists for exactly this reason. Sync calls are fine at startup, before the server accepts traffic. - CPU-bound work (image processing, hashing a password, parsing a huge CSV,
a tight loop over 10⁶ rows) doesn't become non-blocking by being wrapped
in a promise — a promise around synchronous code still blocks. Move it to
worker_threads, a child process, or a job queue. awaitinside aforloop over N items is N sequential round trips. UsePromise.allwhen the calls are independent, and a bounded concurrency helper (p-limit, or chunkedPromise.all) when N is large enough to flood the database pool or the upstream API.- Long synchronous loops also starve timers and health checks — the symptom is a service that "randomly" fails liveness probes under load.
Step 3 — Async correctness
- Every promise is awaited, returned, or explicitly
.catch()ed. A floating promise loses its error and finishes after the response is already sent. asynccallbacks passed to APIs that ignore return values —array.forEach(async …), an EventEmitter listener, most middleware signatures that don't awaitnext— swallow both the result and the rejection. Usefor … ofwithawait, orPromise.all(map(…)).- Errors thrown inside a
setTimeout/setInterval/emitter.oncallback don't reach the surroundingtry/catch— that stack frame is gone. Handle inside the callback. process.on('unhandledRejection')and'uncaughtException'are last-resort logging plus a controlled exit, not an error-handling strategy — a process that continues after an uncaught exception is in an undefined state.Promise.allrejects on the first failure and abandons the rest; usePromise.allSettledwhen every result matters, and remember neither one cancels the in-flight work.
Step 4 — Streams and backpressure
- Read/write large files and proxied HTTP bodies as streams — buffering a file into a string to send it holds the whole thing in memory per concurrent request, which is how a service OOMs under mild load.
- Use
pipeline(fromnode:stream/promises) rather than.pipe()chains:.pipe()doesn't forward errors or destroy the upstream on failure, which leaks file descriptors and sockets. - Respect backpressure — a producer that ignores a
falsefromwrite()grows the internal buffer without bound.pipelinehandles this for you; hand-rolled loops usually don't. - Cap request body size at the framework/proxy layer; an unbounded JSON body parser is a denial-of-service surface, not just a memory concern.
Step 5 — Modules: ESM vs CommonJS
"type": "module"makes.jsfiles ESM: norequire, no__dirname, nomodule.exports. Useimport,import.meta.url+fileURLToPath/import.meta.dirname, and named exports..cjs/.mjsoverride the package-level setting per file.- ESM import specifiers need the file extension (
./util.js, not./util) — a missing extension is the most common "works in ts-node, breaks after build" failure. - A CJS file can't
require()an ESM-only package; use dynamicimport()(which is async) or stay on a version of the dependency that still ships CJS. Don't convert the whole project's module system to fix one import without saying so. - Match whatever the repo already uses (
stack-briefing) — mixing systems in one package is how dual-package hazards and duplicated singletons appear.
Step 6 — Config, secrets, and process lifecycle
- Config comes from the environment, validated once at startup into a typed
config object — not
process.env.FOOread ad hoc deep inside a handler where a typo silently becomesundefined. Fail fast at boot when a required variable is missing. - Never commit
.env; ship.env.examplewith keys and empty values. Env wiring, secret storage, and deploy config aredevops-dev's lane. - Handle
SIGTERM/SIGINT: stop accepting new connections, finish in-flight requests with a timeout, close the database pool, then exit. A container killed mid-transaction leaves half-written state and connection leaks. - Don't
process.exit()from inside request handling — it drops in-flight responses and pending writes. - Keep the process stateless where a scheduler may run several replicas: an
in-memory cache, session store, or
setIntervalcron in the app process behaves differently at one instance versus three.
Step 7 — Node-specific security
- Never interpolate user input into
exec/execSync— useexecFile/spawnwith an argument array, and prefer a library over shelling out at all. - Any path built from user input must be resolved and checked to still sit
inside the intended root (
path.resolvethen a prefix check) —../in a filename is the whole path-traversal class. - Never
require/import()a module path derived from user input, and don'teval/new Functionon request data. - Use
crypto.randomUUID()/crypto.randomBytesfor tokens —Math.randomis not a CSPRNG. Compare secrets withcrypto.timingSafeEqual. - Run the app as a non-root user in the container, pin dependency versions
via the committed lockfile, and treat a
postinstallscript in a new dependency as something to look at before installing.
Step 8 — Self-check before reporting done
Confirm nothing synchronous or CPU-heavy runs inside a request path, and
that every await-in-a-loop is either intentional ordering or converted to
bounded parallelism. Confirm every promise is awaited or explicitly handled,
and no async function was passed where its rejection would be dropped.
Confirm large payloads stream through pipeline rather than buffering, that
required env vars are validated at startup, and that SIGTERM closes the
server and the pool. Then run the change through
skills/dev-testing/SKILL.md — response, log, and database delta together.
What not to do
- Don't call a
…SyncAPI, hash a password, or parse a huge payload inside a request handler — that stalls every other connection. - Don't leave a floating promise, and don't pass an
asynccallback to something that ignores the returned promise. - Don't rely on
uncaughtException/unhandledRejectionhandlers to keep a broken process alive. - Don't buffer a whole file or proxied response into memory, and don't chain
.pipe()wherepipelinewould propagate the error. - Don't mix ESM and CJS ad hoc, or omit file extensions in ESM imports.
- Don't read
process.envdeep in application code, and don't commit.env. - Don't build a shell command or a filesystem path out of raw user input.
- Don't write the framework's routes, validation, or business logic here —
that's
backend-dev; this skill is the runtime knowledge it applies.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

