skillfed

nodejs-best-practices

This skill guides you through principled decisions for Node.js development—from picking the right framework (Express, Fastify, NestJS, Hono) based on your deployment target and performance needs, to structuring layered architectures and handling errors consistently. It covers async patterns, validation strategies, security fundamentals, and testing priorities, emphasizing context-aware choices over one-size-fits-all solutions.

nodejs-best-practices teaches framework selection and architectural thinking for Node.js development, not memorized patterns.

AI-generated summary based on this skill's SKILL.md

8,011 1,512 MIT updated by vudovn

Install

vudovn/ag-kit/nodejs-best-practices · repository language: TypeScript

git clone https://github.com/vudovn/ag-kit
cp -r ag-kit/.agents/skills/nodejs-best-practices ~/.claude/skills/nodejs-best-practices
npx skillfed install vudovn/ag-kit/nodejs-best-practices

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I choose between Express, Fastify, and NestJS?

nodejs-best-practices guides you through framework selection by matching your project context to each option's strengths. Express offers simplicity and ecosystem maturity for most APIs; Fastify prioritizes raw throughput and low overhead for performance-critical services; NestJS provides opinionated structure and TypeScript-first design for larger teams. The skill emphasizes context-aware choices—consider your deployment target, team size, and performance requirements rather than adopting any framework by default.

What async patterns should I use in Node.js?

nodejs-best-practices teaches you when to use async/await versus Promise.all and other patterns. Async/await excels for sequential operations and readability; Promise.all handles concurrent work efficiently. The skill covers the event loop fundamentals so you understand trade-offs: Promise.all parallelizes independent tasks, while await serializes them. Choosing the right pattern depends on whether operations are dependent or independent, and on your error-handling strategy.

What is a nodejs security checklist I should follow?

nodejs-best-practices provides security principles and a practical checklist for backend development. Key areas include input validation at API boundaries, dependency scanning, secure headers, rate limiting, and secrets management. The skill emphasizes that security is architectural—validation belongs at entry points, error messages should not leak internals, and dependencies need regular audits. A checklist approach ensures you don't skip critical layers as your application grows.

How should I structure a growing Node.js application?

nodejs-best-practices advocates layered architecture to keep concerns separated as complexity grows. Typical layers include routes/controllers (HTTP handling), services (business logic), data access (database queries), and utilities. This structure makes testing easier, lets teams work in parallel, and simplifies refactoring. The skill helps you decide which layers your project needs and how to enforce boundaries—avoiding the common anti-pattern of mixing HTTP logic with business rules.

How do I implement centralized error handling and validation?

nodejs-best-practices teaches you to treat error handling and validation as architectural concerns, not scattered logic. Centralized validation at API boundaries (using libraries like Zod or Joi) prevents invalid data from reaching your business logic. Error handling middleware catches exceptions, logs them consistently, and returns appropriate HTTP responses. The skill shows how this strategy reduces bugs, improves observability, and makes your codebase predictable for new team members.

What Node.js anti-patterns should I avoid?

nodejs-best-practices identifies common pitfalls: mixing async patterns without understanding the event loop, skipping input validation, hardcoding secrets, treating error handling as an afterthought, and building monolithic structures that resist testing. The skill emphasizes that anti-patterns often emerge from context-unaware decisions—using the wrong framework, ignoring security at design time, or deferring architecture until the codebase is unmaintainable. Awareness of these traps helps you make principled choices upfront.

SKILL.md

rendered from the published skill — quoted content, verbatim

Node.js Best Practices

> Principles and decision-making for modern Node.js development. > Learn to THINK, not memorize code patterns.


⚠️ How to Use This Skill

This skill teaches decision-making principles, not fixed code to copy.

  • ASK user for preferences when unclear
  • Choose framework/pattern based on CONTEXT
  • Don't default to same solution every time

1. Framework Selection

Decision Tree

``` What are you building? │ ├── Edge/Serverless (Cloudflare, Vercel) │ └── Hono (zero-dependency, ultra-fast cold starts) │ ├── High Performance API │ └── Fastify (~5x req/sec of Express in Fastify's own hello-world benchmark; benchmark your own workload) │ ├── Enterprise/Team familiarity │ └── NestJS (structured, DI, decorators) │ ├── Legacy/Stable/Maximum ecosystem │

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
.agents/skills/nodejs-best-practices/SKILL.md

Related skills

Tags

decision-framework architectural-patterns runtime-selection async-concurrency api-validation security-mindset framework-comparison error-strategy performance-tradeoffs testing-strategy