9 nodejs rules available
Nine Claude rules match nodejs, but only the Node.js expert rule is substantive; the others (API versioning, GraphQL schema, security, microservices, event-driven architecture, monitoring) are short architecture prompts tagged nodejs as a technology. The file below covers what Claude Code needs while editing Node.js service code.
Claude Code loads persistent project instructions from CLAUDE.md files and from Markdown rules in .claude/rules/. Rules can be scoped to file paths with a paths frontmatter field, and CLAUDE.md can import other files with @path syntax. The rules in this directory are written as plain instruction prompts: in Claude Code, save them as CLAUDE.md or .claude/rules/ content; in Claude.ai or the Claude API, use the same text as project instructions or a system prompt instead.
.claude/rules/nodejs.mdStarting point, not a tested configuration for your repository. Loaded when Claude Code works with files matching paths. Review the instructions, adapt the file paths and run your project's existing checks.
--- paths: - "**/*.js" - "**/*.mjs" - "**/*.cjs" - "**/*.ts" --- # Node.js instructions for Claude Code ## Focus for this project - Validate request input with the schema library already used in the project (for example zod) and return 400 with field errors. - Return JSON errors in the project's existing error shape with the correct status code; never leak stack traces. - Run the test script in the shell and report the real output. ## Node.js conventions - Check "type" in package.json and the engines field: write ESM import syntax in "type": "module" packages and CommonJS otherwise, and only use APIs available in the declared Node.js version. - Import built-ins with the node: prefix (node:fs/promises, node:path) and never use synchronous fs calls on a request path. - Validate every request body, query string and environment variable at the boundary and fail fast on missing configuration. - Await or explicitly handle every promise; no floating promises and no unhandled rejections. ## Before you finish - Run the project's test script (node --test if no framework is configured), lint and type check and report the actual output. If you cannot run them, say so and list the exact commands instead of saying they pass. - Summarize which of the rules above affected the change. - You have shell access: run the checks yourself instead of asking the user to, unless a command needs credentials or would deploy.
Create your own Claude rules for Node.js and share with the community.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
Imports with @path can nest up to four hops deep, according to the docs. Claude Code can read AGENTS.md as project instructions without extra configuration, but by default only when there is no CLAUDE.md in the working directory or above it. The docs list this behavior for version 2.1.277 and later and describe a setting (claude-md-and-agents-md) that loads both files. If you maintain AGENTS.md for other tools, you can also import it from CLAUDE.md with @AGENTS.md.
Documentation checked 2026-11-05: Claude Code docs: Manage Claude's memory
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You ask Claude Code to add an Express or Fastify endpoint and want input validation, explicit error responses and the test suite run in the session.
Add POST /api/invites that takes an email and a role and stores an invite.
A validation schema for email and role, a handler returning 201 with the invite or 400 with field errors, a test per branch, and the actual test output.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.
Design efficient database schemas