NodeJS Project

Language: nodejs October 10, 2025

Instruction file for NodeJS with pnpm

---
description: "NodeJS development standards and best practices"
applyTo: "**/*.js, **/*.ts"
---

# Code Generation Guidelines

## Coding standards

- Use TypeScript with ES2022 features and Node.js (22+) ESM modules
- Use Node.js built-in modules and avoid external dependencies where possible
- Ask the user if you require any additional dependencies before adding them
- Always use async/await for asynchronous code, and use 'node:util' promisify function to avoid callbacks
- Keep the code simple and maintainable
- Use descriptive variable and function names
- Do not add comments unless absolutely necessary, the code should be self-explanatory
- Never use `null`, always use `undefined` for optional values
- Prefer functions over classes

## Building

- This repository is using pnpm for package management.
- To install new packages, use `pnpm add <package-name>`.
- To run scripts, use `pnpm run <script-name>`.

## Testing

- Use Vitest for testing
- Write tests for all new features and bug fixes
- Ensure tests cover edge cases and error handling
- NEVER change the original code to make it easier to test, instead, write tests that cover the original code as it is

## User interactions

- Ask questions if you are unsure about the implementation details, design choices, or need clarification on the requirements
- Always answer in the same language as the question, but use english for the generated content like code, comments or docs
- You can change directories within this repository without asking.
- You can run scripts using `pnpm run <script-name>` without asking.

nodejs typescript javascript pnpm