Skip to content
Development
Skill

/node-patterns

Use when writing Node.js/TypeScript backend code — Express, Fastify, or NestJS services, APIs, workers. Builder playbook: project layout, async discipline, typed config, error taxonomy, DI boundaries, testing shape. Complements typescript-reviewer (this prevents, the reviewer

From plugin
hydraia
852 skills27 agents17 commands6 hooks

Claude Code

$ npx -y skills add jdanigo/hydraia --skill node-patterns --agent claude-code

SKILL.md

node-patterns.SKILL.md
name: node-patterns
description: Use when writing Node.js/TypeScript backend code — Express, Fastify, or NestJS services, APIs, workers. Builder playbook: project layout, async discipline, typed config, error taxonomy, DI boundaries, testing shape. Complements typescript-reviewer (this prevents, the reviewer catches).

Node/TypeScript Backend Patterns

Project layout

  • Feature folders over layer folders: `src/orders/{orders.router,orders.service,orders.repo,orders.test}.ts` beats `src/{routes,services,repos}/orders.ts` scattered three places.
  • One composition root (`src/app.ts`) wires everything; entry (`src/main.ts`) only boots. Handlers stay thin — parse/validate → service call → shape response.

Async discipline

  • No floating promises: every promise is awaited, returned, or explicitly `void`-ed with a comment. Unhandled rejection = crash in modern Node.
  • Propagate `AbortSignal` through request-scoped work (fetch, DB timeouts); cancel on client disconnect for expensive handlers.
  • No sync I/O (`readFileSync`, `execSync`) on request paths — boot time only.
  • Concurrency with intent: `Promise.all` for independent work, `for…of await` when order matters, a limiter (`p-limit`) when fan-out is unbounded.

Config

  • Typed and validated at boot (zod or equivalent): missing/invalid env kills the process at startup with a clear message — never `process.env.X!` scattered through the codebase.
  • One `config.ts` exports the parsed object; nothing else reads `process.env`.

Errors

  • Central error taxonomy: `AppError` subtypes with status + code (`NotFound`, `Validation`, `Conflict`, `Upstream`). Handlers throw domain errors; ONE error middleware maps them to responses (problem+json shape).
  • Never `catch (e) {}` — swallow nothing; wrap-and-rethrow with context or let it propagate.

DI boundaries

  • NestJS: providers with explicit scopes; beware request-scoped bleeding into singletons.
  • Express/Fastify: manual factories — services take dependencies as constructor/args, never import singletons directly. Makes the testing shape below possible.

ESM/CJS pitfalls

  • Pick ONE module system per package and align `"type"`, `tsconfig` `module`, and tooling. Mixed default/named interop errors are config bugs, not code bugs.
  • `__dirname` does not exist in ESM — `import.meta.url` + `fileURLToPath`.

Testing shape

  • vitest/jest for units (services with faked repos), supertest against the composed app for HTTP behavior (status, body, headers — not internals).
  • Test files co-located with the feature. Integration tests own their fixtures.

Logging

  • Structured (pino), request-correlated (request-id middleware); never `console.log` in request paths. Log the error object, not `err.message` alone (stack + cause matter).
Read more
@jdanigo
Ships withhydraia

An agentic development harness for Claude Code. **One command runs the entire feature pipeline** — it collaborates with you on the design, then builds autonomously: plan, execute, double-review, and verify.

852 skills27 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
8
Star history of jdanigo/hydraia on GitHub, a chart by star-history.com

Other skills on hydraia.

hydraia

hydraia

Use whenever the user asks to build, add, implement, or change a feature or functionality — or brings a user story or ticket to…

@jdanigo@jdanigoInstall Skill
adr

adr

Use when a design decision is made that is expensive to reverse, affects multiple components, or rejects a plausible alternative…

@jdanigo@jdanigoInstall Skill
agency-tier-ui

agency-tier-ui

Teaches the AI to design like a high-end agency. Defines the exact fonts, spacing, shadows, card structures, and animations that…

@jdanigo@jdanigoInstall Skill
api-design

api-design

Use when designing or reviewing an API surface — REST, GraphQL, or gRPC. Contract-first methodology: the contract artifact…

@jdanigo@jdanigoInstall Skill
banner-design

banner-design

Design banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with…

@jdanigo@jdanigoInstall Skill
brainstorming

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior.…

@jdanigo@jdanigoInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about node-patterns.

Which coding agents can use node-patterns?
node-patterns installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.