nodejs
/nodejs
Wspiera pracę z Node.js: asynchroniczna pętla zdarzeń, strumienie, worker threads, operacje na buforach i ESM, przy budowie skalowalnych usług backendowych, narzędzi CLI i serwerów sieciowych.
- Autor
- G1Joshi ↗
- Repozytorium
- Agent-Skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 01.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 3
Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Wspiera pracę z Node.js: asynchroniczna pętla zdarzeń, strumienie, worker threads, operacje na buforach i ESM, przy budowie skalowalnych usług backendowych, narzędzi CLI i serwerów sieciowych.
Oryginalny opis (EN)
Expert Node.js assistance covering asynchronous event loop, streams, worker threads, buffer manipulation, and ESM. Use when building scalable backend services, CLI utilities, or network servers.
Jak działa
- When to Use
- Quick Start
- Core Concepts
- Common Patterns
- Best Practices
- Troubleshooting
- References
Podgląd SKILL.md
---
name: nodejs
description: Expert Node.js assistance covering asynchronous event loop, streams, worker threads, buffer manipulation, and ESM. Use when building scalable backend services, CLI utilities, or network servers.
---
# Node.js
Node.js is a cross-platform asynchronous event-driven JavaScript runtime, featuring a built-in Test Runner, native WebSocket client, and modern ESM module execution.
## When to Use
- **Scalable Asynchronous Microservices**: Building event-driven I/O-intensive web APIs on Node.js 22 LTS.
- **Real-Time Data Streaming & WebSockets**: Processing streaming data using native `node:stream` and `Transform` streams.
- **CLI Development & Build Tooling**: Building developer tools, linters, and deployment automations with npm.
- **Worker Threads & CPU-Bound Offloading**: Offloading cryptographic hashing, compression, and image manipulation.
## Quick Start
```javascript
// Native Test Runner (No Jest needed)
import { test, assert } from "node:test";
test("synchronous passing test", (t) => {
assert.strictEqual(1, 1);
});
// Native WebSocket
const ws = new WebSocket("ws://example.com/socket");
ws.onopen = () => console.log("Connected");
```
## Core Concepts
### Modern Native HTTP Server & Fetch
Zero-dependency HTTP server utilizing Node.js modern standard APIs:
```javascript
import { createServer } from "node:http";
const server = createServer(async (req, res) => {
const url = new URL(req.url, `http://${req.headers.host}`);
if (url.pathname === "/api/health" && req.method === "GET") {
res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify({ status: "ok", nodeVersion: process.version }));
return;
}
res.writeHead(404, { "Content-Type": "application/json" });
res.end(JSON.stringify({ error: "Route not found" }));
});
server.listen(3000, () => {
console.log("Node.js server listening on http://localhost:3000");
});
```
### Stream Pipelines with node:stream/promises
Safe, backpressure-managed file and network streaming:
```javascript
import { createReadStream, createWriteStream } from "node:fs";
import { pipeline } from "node:stream/promises";
import { createGzip } from "node:zlib";
async function compressFile(sourcePath, destPath) {
try {
await pipeline(
createReadStream(sourcePath),
createGzip(),
createWriteStream(destPath),
);
console.log(`Successfully compressed ${sourcePath} -> ${destPath}`);
} catch (err) {
console.error("Pipeline compression failed:", err);
}
}
```
### Native Test Runner with node:test
Fast, zero-dependency testing built directly into the runtime:
```javascript
import test, { describe, it } from "node:test";
import assert from "node:assert/strict";
describe("User Authentication", () => {
it("validates password minimum length", () => {
const password = "supersecretpass";
assert.ok(password.length >= 8, "Password must be >= 8 chars");
});
it("verifies async promise resolution", async () => {
const token = await Promise.resolve("jwt-token-xyz");
assert.equal(token, "jwt-token-xyz");
});
});
```
## Common Patterns
### High-Throughput Stream Pipeline with Backpressure
**Problem**: Reading large files directly into memory with `fs.readFile` causes OOM crashes under load.
**Solution**:
Use `stream.pipeline` for automatic backpressure management:
```javascript
import { pipeline } from "node:stream/promises";
import fs from "node:fs";
import zlib from "node:zlib";
async function compressLogFile(inputPath, outputPath) {
await pipeline(
fs.createReadStream(inputPath),
zlib.createGzip(),
fs.createWriteStream(outputPath),
);
console.log("Compression pipeline completed successfully.");
}
```
## Best Practices
**Do**:
- Target Node.js 22 LTS or newer with native fetch, web streams, and native test runner.
- Use the `node:` protocol prefix (`import fs from 'node:fs'`) for all built-in modules.
- Use `node:stream/promises` and `pipeline` to handle stream backpressure and error propagation.
- Handle uncaught exceptions (`process.on('uncaughtException')`) and trigger graceful shutdown.
**Don't**:
- Block the single-threaded Event Loop with heavy synchronous calls (`fs.readFileSync`, long regex).
- Use CommonJS (`require()`) in greenfield applications; adopt ECMAScript Modules (`"type": "module"`).
- Ignore unhandled promise rejections; configure `--unhandled-rejections=strict`.
## Troubleshooting
| Error | Cause | Solution |
| :------------------------------------------------------------------------- | :---------------------------------------------------- | :------------------------------------------------------------------------------------------ |
| `ERR_REQUIRE_ESM: Must use import to load ES Module` | Using `require()` on a modern ESM-only package. | Use `import` or dynamic `await import('...')` in CommonJS. |
| `MaxListenersExceededWarning: Possible EventEmitter memory leak` | Adding event listeners in loop without removing them. | Remove listeners with `emitter.off()` or increase limit using `emitter.setMaxListeners(n)`. |
| `FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed` | Node.js process exceeded default 1.4GB memory limit. | Start with expanded heap: `node --max-old-space-size=4096 app.js`. |
## References
- [Node.js Documentation](https://nodejs.org/docs/latest/api/)
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · G1Joshi/Agent-Skills | 100 | MIT |
| ericrisco/rsc-harness | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| dkbnull/hello-skill | 96 | MIT |
| clawic/skills | 90 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 1c9bc7f64a1b (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 90performant-nodejs
Pomaga budować wydajne aplikacje Node.js z wątkami roboczymi, ESM, obserwowalnością i architekturą heksagonalną. - 91node
Wspiera tworzenie aplikacji w Node.js: pętla zdarzeń, moduły CommonJS i ESM, moduły podstawowe, wzorce asynchroniczne, diagnostyka, obsługa błędów i integracja z TypeScript. - 90nodejs-patterns
Wdraża wzorce Node.js: strumienie z kontrolą przepływu, typowane emitery zdarzeń, wątki robocze, kontenery DI i klasyfikację błędów. - 100javascript-ops
Obejmuje wzorce JavaScript i Node.js: programowanie asynchroniczne, moduły, wnętrza środowiska uruchomieniowego, V8, worker threads, strumienie, event emitter, prototypy i domknięcia. - 100nodejs-development
Pomaga tworzyć usługi backendowe Node.js: API, routing, workery, narzędzia CLI, strumienie, przepływy asynchroniczne i czasu rzeczywistego, logowanie, testy, skalowanie i wdrożenie. - 100nodejs-expert
Wspiera pracę z backendem Node.js: Express, wzorce async, strumienie, optymalizacja wydajności, operacje na systemie plików i żądania HTTP, w praktyce produkcyjnej.