From mcollina-skills-1
Provides best practices for Node.js TypeScript development including type stripping, async patterns, error handling, streams, testing, and performance. Activate for Node 22+ native TypeScript, type stripping configuration, or robust Node.js patterns.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mcollina-skills-1:nodeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill whenever you are dealing with Node.js code to obtain domain-specific knowledge for building robust, performant, and maintainable Node.js applications.
rules/assets/graceful-server.test.tsrules/assets/graceful-server.tsrules/async-patterns.mdrules/caching.mdrules/environment.mdrules/error-handling.mdrules/flaky-tests.mdrules/graceful-shutdown.mdrules/logging.mdrules/modules.mdrules/node-modules-exploration.mdrules/performance.mdrules/profiling.mdrules/streams.mdrules/stuck-processes-and-tests.mdrules/testing.mdrules/typescript.mdtile.jsonUse this skill whenever you are dealing with Node.js code to obtain domain-specific knowledge for building robust, performant, and maintainable Node.js applications.
When writing TypeScript for Node.js, use type stripping (Node.js 22.6+) instead of build tools like ts-node or tsx. Type stripping runs TypeScript directly by removing type annotations at runtime without transpilation.
Key requirements for type stripping compatibility:
import type for type-only imports.ts extensions in importsMinimal example — a valid type-stripped TypeScript file:
// greet.ts
import type { IncomingMessage } from 'node:http';
const greet = (name: string): string => `Hello, ${name}!`;
console.log(greet('world'));
Run directly with:
node greet.ts
See rules/typescript.md for complete configuration and examples.
For multi-step processes, follow these high-level sequences before consulting the relevant rule file:
Graceful shutdown: Register signal handlers (SIGTERM/SIGINT) → stop accepting new work → drain in-flight requests → close external connections (DB, cache) → exit with appropriate code. See rules/graceful-shutdown.md.
Error handling: Define a shared error base class → classify errors (operational vs programmer) → add async boundary handlers (process.on('unhandledRejection')) → propagate typed errors through the call stack → log with context before responding or crashing. See rules/error-handling.md.
Diagnosing flaky tests: Isolate the test with --test-only → check for shared state or timer dependencies → inspect async teardown order → add retry logic as a temporary diagnostic step → fix root cause. See rules/flaky-tests.md.
Diagnosing stuck processes/tests (node --test hangs, "process did not exit", CI timeout, open handles): isolate file/test → run with explicit timeout/reporter → inspect handles via why-is-node-running (SIGUSR1) → patch deterministic teardown in resource-creation scope → rerun isolated + full suite until stable. See rules/stuck-processes-and-tests.md.
Profiling a slow path: Reproduce under realistic load → capture a CPU profile with --cpu-prof → identify hot functions → check for stream backpressure or unnecessary serialisation → validate improvement with a benchmark. See rules/profiling.md and rules/performance.md.
When the task mentions CSV, ETL, ingestion pipelines, large file processing, backpressure, repeated lookups, or deduplicating concurrent async calls, explicitly apply this checklist:
await pipeline(...) from node:stream/promises (prefer this over chained .pipe() in guidance/code).async function* transform when data is being transformed in-stream.lru-cache for bounded in-memory reuse in a single process.async-cache-dedupe for async request deduplication / stale-while-revalidate behavior.pipeline() or explicitly via drain).For CSV/ETL-style prompts, prefer an answer structure like:
createReadStream(input)async function* parser/transformasync-cache-dedupe or lru-cache)await pipeline(...) to a writable destinationLink relevant rules directly in explanations so models can retrieve details:
Read individual rule files for detailed explanations and code examples:
npx claudepluginhub mcollina/skillsNode.js runtime conventions, APIs, and ecosystem patterns. Invoke whenever task involves any interaction with Node.js runtime — server code, CLI tools, scripts, module system, streams, process lifecycle, or package configuration.
Guides Node.js architecture decisions: framework selection (Hono, Fastify, Express, NestJS), runtime choice (Node, Bun, Deno), async patterns, security, and layered structure.
Covers JavaScript/Node.js async patterns, module systems (ESM/CJS/dual), event loop internals, streams, worker threads, and ES2024+ features.