# nodejs-best-practices

This skill guides Node.js framework, async, architecture, and security choices from project context. Use it when planning or reviewing a Node.js codebase.

- skill · `type=skill` · Claude Code · 501 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/nodejs-best-practices
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/nodejs-best-practices

## What it does

The skill is a decision guide for Node.js work rather than a set of snippets to repeat. It maps project needs to framework choices: Hono for edge and serverless deployments, Fastify for high-performance APIs, NestJS for a structured team codebase, Express for legacy systems, and Next.js API Routes or tRPC for full-stack work. It also compares ESM with CommonJS and Node.js with Bun or Deno. Node.js 22+ TypeScript execution via `--experimental-strip-types` is covered.

Its architecture guidance separates HTTP handling, business services, and data access. Other sections cover error propagation, boundary validation, async patterns, event-loop blocking, security checks, and test planning. The security material includes parameterized queries, password hashing, JWT verification, CORS, environment secrets, and dependency audits. Testing examples use `node:test`, Vitest, Supertest, and Playwright. The configured tools are `Read`, `Write`, `Edit`, `Glob`, and `Grep`. For a new edge project, this guide rejects Express and points to Hono instead.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --skill development/nodejs-best-practices
```

2. **Skills CLI (Vercel)**
```bash
npx skills add davila7/claude-code-templates --skill nodejs-best-practices -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/nodejs-best-practices/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/nodejs-best-practices/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/nodejs-best-practices/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/nodejs-best-practices/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davila7/claude-code-templates nodejs-best-practices
```

2. **Manually: put the files in place**
- File: `.github/skills/nodejs-best-practices/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/development/nodejs-best-practices
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/nodejs-best-practices/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/nodejs-best-practices

## When to use it
- choose a Node.js framework for a deployment target
- split business logic from routes and database access
- match async control flow to sequential or parallel work
- validate requests, uploads, API responses, and environment values
- plan security checks and tests for critical paths

## Example prompts
- Choose a framework for this serverless API and explain the trade-offs.
- Review this Node.js project for layer boundaries, input validation, and error handling.
- Pick between `async/await`, `Promise.all`, and `Promise.allSettled` for these operations.

## Similar
- [mcp-builder](https://affpapa.org/en/nevibecode/skills/mcp-builder.md) — skill · 130949 installs
- [claude-api](https://affpapa.org/en/nevibecode/skills/claude-api.md) — skill · 74198 installs
- [lark-im](https://affpapa.org/en/nevibecode/skills/lark-im.md) — skill · 472900 installs
- [lark-event](https://affpapa.org/en/nevibecode/skills/lark-event.md) — skill · 466800 installs
- [caveman-discover](https://affpapa.org/en/nevibecode/skills/caveman-discover.md) — skill · 104400 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 495 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
