nodejs-best-practices

Guides Node.js architecture decisions covering framework selection, async patterns, security, and testing.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/RobinMillford/GopherNotebook --skill nodejs-best-practices-robinmillford
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodejs-best-practices
Source: https://github.com/RobinMillford/GopherNotebook/tree/main/.claude/skills/nodejs-best-practices
Command: npx skills add https://github.com/RobinMillford/GopherNotebook --skill nodejs-best-practices-robinmillford

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Node.js developers often default to familiar frameworks and patterns without considering whether they fit the project's deployment target, performance needs, or team context. This Skill provides decision-making frameworks for choosing frameworks, runtimes, async patterns, and security practices based on actual project requirements. ## Core Features & Use Cases - Framework Selection Guidance: Decision trees comparing Hono, Fastify, Express, and NestJS based on deployment target, cold start needs, and team experience. - Architecture & Error Handling Principles: Layered structure patterns (controller/service/repository), centralized error handling, and HTTP status code selection guidance. - Security & Validation Checklists: Input validation boundaries, library selection (Zod, Valibot, ArkType), and a security checklist covering hashing, JWT, rate limiting, and CORS. - Use Case: When starting a new serverless API, use this Skill to evaluate whether Hono fits the edge deployment target, plan the validation strategy with Zod, and structure error responses before writing code. ## Quick Start Ask the AI to help you choose a Node.js framework and architecture for your new API project based on your deployment target and team experience.

Frequently Asked Questions about nodejs-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Hono, Fastify, and Express for a Node.js API?

Choose Hono for edge and serverless deployments needing fast cold starts, Fastify for high-performance APIs, and Express for legacy projects or maximum ecosystem compatibility. Consider deployment target, cold start requirements, and team familiarity before deciding.

What validation library should I use for Node.js TypeScript projects?

Zod is the default choice for TypeScript-first projects with type inference. Valibot offers a smaller bundle size through tree-shaking, ArkType targets performance-critical scenarios, and Yup fits existing React Form integrations.

When should I use Promise.all versus Promise.allSettled in Node.js?

Use Promise.all for parallel independent operations where all must succeed, and Promise.allSettled when some operations can fail without affecting others. Use async/await for sequential operations and Promise.race for timeouts.

Does Node.js support running TypeScript files directly?

Node.js 22 and later supports running TypeScript files directly using the --experimental-strip-types flag, removing the build step for simple projects. This works well for scripts and simple APIs but may not suit complex build pipelines.

Why should I avoid sync methods like fs.readFileSync in production Node.js code?

Sync methods block the event loop, preventing Node.js from handling other requests while the operation completes. Use async alternatives for I/O operations and offload CPU-intensive work like crypto or image processing to worker threads.

What are the limitations of a principles-based best practices guide?

This guide teaches decision-making rather than providing copy-paste code, so you must adapt principles to your specific context. It does not replace environment-specific validation, testing, or expert review for production systems.