nodejs-best-practices

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

Updated Aug 19, 2026
One-click install
npx skills add https://github.com/nperepichka/Antigravity --skill nodejs-best-practices-nperepichka
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nodejs-best-practices
Source: https://github.com/nperepichka/Antigravity/tree/main/config/skills/nodejs-best-practices
Command: npx skills add https://github.com/nperepichka/Antigravity --skill nodejs-best-practices-nperepichka

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 and comparison tables for Hono, Fastify, Express, and NestJS based on deployment target, cold start needs, and ecosystem maturity. - Architecture & Async Principles: Layered structure concepts (controller/service/repository), event loop awareness, and guidance on when to use Promise.all, allSettled, or worker threads. - Security & Validation Checklists: Input validation boundaries, library selection (Zod, Valibot, ArkType), HTTP status code selection, and a security mindset checklist. - Use Case: When starting a new serverless API, use this Skill to evaluate whether Hono fits the edge deployment target, plan validation at boundaries, and define an error handling strategy before writing code. ## Quick Start Ask the agent to help choose a Node.js framework and architecture for a new high-performance API deployed to a serverless platform.

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 based on deployment target and context: Hono for edge and serverless with fast cold starts, Fastify for high-performance APIs, NestJS for enterprise teams needing structure, and Express for legacy or maximum ecosystem support. Ask about cold start sensitivity and team experience first.

Fastify vs Express: which should I use for a REST API?▼

Fastify delivers 2-3x better performance than Express and has excellent TypeScript support, making it preferable for new performance-sensitive APIs. Express remains a good choice for legacy codebases, learning, or when you need the largest middleware ecosystem.

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

Node.js 22 and later supports running TypeScript files directly using the --experimental-strip-types flag. This works well for scripts and simple APIs, removing the need for a separate compilation step in small projects.

What validation library should I use with TypeScript in Node.js?▼

Zod is the default choice for TypeScript-first projects with type inference. Valibot offers a smaller tree-shakeable bundle, ArkType targets performance-critical paths, and Yup fits teams already using it with React forms.

Why does my Node.js server slow down under CPU-heavy tasks?▼

CPU-bound work like cryptography, image processing, or complex calculations blocks the event loop, and async/await does not help. Offload such work to worker threads or external services, and never use synchronous methods like fs.readFileSync in production.

When should I avoid a layered architecture in Node.js?▼

Skip the controller/service/repository layering for small scripts and prototypes where a single file is sufficient. Apply the layered structure only when the project is expected to grow, since it improves testability and lets you swap databases without touching business logic.