node
Provides domain-specific best practices for Node.js development with TypeScript, covering type stripping, async patterns, error handling, streams, modules, testing, performance, caching, logging, and more. Use when setting up Node.js projects with native TypeScript support, configuring type stripping (--experimental-strip-types), writing Node 22+ TypeScript without a build step, or when the user mentions 'native TypeScript in Node', 'strip types', 'Node 22 TypeScript', '.ts files without compilation', 'ts-node alternative', or needs guidance on error handling, graceful shutdown, flaky tests, profiling, or environment configuration in Node.js. Helps configure tsconfig.json for type stripping, set up package.json scripts, handle module resolution and import extensions, and apply robust patterns across the full Node.js stack.
NPX Install
npx skill4agent add mcollina/skills nodeTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →When to use
TypeScript with Type Stripping
- Use for type-only imports
import type - Use const objects instead of enums
- Avoid namespaces and parameter properties
- Use extensions in imports
.ts
// greet.ts
import type { IncomingMessage } from 'node:http';
const greet = (name: string): string => `Hello, ${name}!`;
console.log(greet('world'));node greet.tsCommon Workflows
process.on('unhandledRejection')--test-only--cpu-profHigh-priority activation checklist (streams + caching)
- Use from
await pipeline(...)(prefer this over chainednode:stream/promisesin guidance/code)..pipe() - Include at least one explicit transform when data is being transformed in-stream.
async function* - Choose a cache strategy when repeated work appears:
- for bounded in-memory reuse in a single process.
lru-cache - for async request deduplication / stale-while-revalidate behavior.
async-cache-dedupe
- Show where backpressure is handled (implicitly via or explicitly via
pipeline()).drain
Integrated example pattern (CSV/ETL)
createReadStream(input)- parser/transform
async function* - optional cached enrichment lookup (or
async-cache-dedupe)lru-cache - to a writable destination
await pipeline(...)
- rules/streams.md
- rules/caching.md
How to use
- rules/error-handling.md - Error handling patterns in Node.js
- rules/async-patterns.md - Async/await and Promise patterns
- rules/streams.md - Working with Node.js streams
- rules/modules.md - ES Modules and CommonJS patterns
- rules/testing.md - Testing strategies for Node.js applications
- rules/flaky-tests.md - Identifying and diagnosing flaky tests with node:test
- rules/node-modules-exploration.md - Navigating and analyzing node_modules directories
- rules/performance.md - Performance optimization techniques
- rules/caching.md - Caching patterns and libraries
- rules/profiling.md - Profiling and benchmarking tools
- rules/logging.md - Logging and debugging patterns
- rules/environment.md - Environment configuration and secrets management
- rules/graceful-shutdown.md - Graceful shutdown and signal handling
- rules/typescript.md - TypeScript configuration and type stripping in Node.js