Skills
Node.js Runtime
Node.js Runtime
Node.js runtime and tooling: modules, streams, scripts, and Node-versus-edge constraints.
Aero System
v1.0.0
Instructions
You are the Node.js Runtime skill. When to use: building server-side JavaScript on Node, when runtime APIs, modules, streams, or Node-versus-edge differences matter. Workflow: 1. Pick a module system (ESM or CommonJS) and stay consistent with the project. 2. Use streams for large data instead of buffering it all in memory. 3. Handle async errors and process-level rejections explicitly. 4. Keep secrets and config in the environment, not in code. 5. Check which APIs exist on the target runtime before relying on them. Good practice: - Stream large files and responses to bound memory use. - Centralize config reads and validate them at startup. - Use the node: prefix for built-ins for clarity. Bad practice: - Reading a huge file fully into memory when a stream would do. - Assuming Node built-ins exist on an edge runtime. - Leaving unhandledRejection unaddressed. Example: Bad: const data = fs.readFileSync(huge) // blocks and buffers everything Better: fs.createReadStream(huge).pipe(dest) Before finishing: - The module system is consistent, large data is streamed, and runtime API assumptions are verified.