nodejs-best-practices

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

Updated Mar 24, 2026
One-click install
npx skills add https://github.com/samline/forms --skill nodejs-best-practices-samline
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nodejs-best-practices
Source: https://github.com/samline/forms/tree/main/example/.agents/skills/nodejs-best-practices
Command: npx skills add https://github.com/samline/forms --skill nodejs-best-practices-samline

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the right Node.js framework, async pattern, and architecture for a project is error-prone when developers default to familiar tools instead of context-driven decisions. This Skill provides decision frameworks and principles for building Node.js applications in 2025. ## Core Features & Use Cases - Framework Selection Guidance: Decision trees and comparison tables for Hono, Fastify, Express, and NestJS based on deployment target, cold start needs, and team experience. - Architecture & Error Handling Principles: Layered structure concepts, centralized error handling, HTTP status code selection, and validation-at-boundaries strategies. - Security & Testing Checklists: Input validation, password hashing, rate limiting guidance, plus test strategy selection using node:test, Vitest, Supertest, and Playwright. - Use Case: When starting a new serverless API, use this Skill to evaluate whether Hono fits the edge deployment target, plan the layered architecture, and define the validation and error handling strategy before writing code. ## Quick Start Ask the AI to help you choose a Node.js framework and architecture for your project, describing your deployment target and performance requirements.

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 a Node.js framework for a new project?▼

Choose a Node.js framework based on deployment target and context: Hono for edge and serverless with fast cold starts, Fastify for high-performance APIs, NestJS for enterprise structure, and Express for legacy or maximum ecosystem support.

Fastify vs Express: which Node.js framework is faster?▼

Fastify is 2-3x faster than Express and offers excellent TypeScript support, making it better for performance-critical APIs. Express remains the choice for legacy codebases, learning, and access to the largest middleware ecosystem.

Can Node.js run TypeScript files directly without a build step?▼

Node.js 22+ supports running TypeScript files directly using the --experimental-strip-types flag. This works well for scripts and simple APIs, though larger projects typically still benefit from a proper build pipeline.

What validation library should I use for Node.js APIs?▼

Zod is the default choice for TypeScript-first projects with type inference. Valibot offers a smaller tree-shakeable bundle, ArkType targets performance-critical cases, and Yup fits existing React form usage.

Why does async/await not speed up CPU-intensive Node.js tasks?▼

Async patterns only help I/O-bound work like database queries and HTTP requests. CPU-bound tasks such as crypto operations or image processing block the event loop and require worker threads or offloading to separate processes.

When should I avoid using Express for a new project?▼

Avoid Express for new edge or serverless projects where cold start time matters; Hono is a better fit there. Express remains appropriate for legacy maintenance, team familiarity, and when maximum middleware ecosystem access is required.