/tsh-stack-nodejs:configuring-typescript-for-nodejsfrom TSH Stack: Node.js
Configures TypeScript for Node.js server projects: tsconfig baseline, version pinning, and decorator-metadata settings for NestJS and TypeORM. Use when starting a Node service, editing tsconfig, or diagnosing emitDecoratorMetadata issues.
Ships in TSH Stack: Node.js. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
TSH's recommended TypeScript setup for code that runs on Node: which version
to pin, the tsconfig.json baseline for a Node-resolved runtime, and the
decorator and class-field settings NestJS, TypeORM, and class-validator depend
on.
This skill is about configuration. How to model types — unions, branded
types, unknown over any — is out of its scope. Browser-targeted code is out of
scope too: a bundler-resolved frontend needs a different baseline, so a repo with
both compiles them as separate configs.
tsconfig.json for a new Node service, or reviewing an existing onetarget, module, and moduleResolution for a deployed Node majorRead the target repository's tsconfig.json (and anything it extends),
package.json, and build tooling before proposing anything. Local conventions
outrank this skill's defaults. Apply this guidance where the repository is
silent, and record a deliberate deviation rather than silently mixing conventions.
The baseline below is a recommendation for new projects, not a verdict on
existing ones. A working tsconfig.json that differs from it is not a defect.
In an existing repo, propose the smallest staged change that serves the task at
hand and read
adopting-in-a-brownfield-project.md
before proposing anything wider.
Framework requirements outrank this skill. NestJS and TypeORM constrain decorator and class-field settings in ways that override general recommendations; where a framework skill and this one disagree, the framework skill wins for the files it owns.
| Severity | Rule |
|---|---|
| MUST | Treat this baseline as a recommendation for new projects. In an existing repo, propose the smallest staged change and record the remaining gap — never rewrite a working tsconfig.json wholesale to match this skill. |
| MUST | Enable strict. A project that cannot turn it on wholesale enables the individual flags progressively and records the remaining gap — never ships strict: false as a permanent state. |
| MUST | Pin an exact TypeScript version in devDependencies (no ^). TypeScript does not follow semver — patch and minor releases add errors to previously compiling code. |
| MUST | Set module and moduleResolution to node16/nodenext (or node20 on a current Node). Never leave the legacy node/node10 resolver in a new project — it predates package.json exports and silently resolves the wrong entry point. |
| MUST | Set useDefineForClassFields explicitly in any project using decorators, and false for NestJS, TypeORM, and class-validator codebases. Left implicit, it flips with target and silently overwrites injected fields. |
| NEVER | Enable verbatimModuleSyntax in a project relying on emitDecoratorMetadata without verifying at runtime first — it elides type-only imports the metadata emit still needs. The failure is a runtime undefined, not a compile error. |
| NEVER | Enable erasableSyntaxOnly in a decorator-DI project without first converting every constructor parameter property to an explicit field assignment. It bans the idiomatic NestJS DI style outright. |
| MUST | Type-check in CI as its own step. A build that only transpiles (SWC, esbuild, tsx, Babel) does not check types; without a separate tsc --noEmit, type errors reach production. |
| MUST | Run the application — not just tsc --noEmit — after changing any emit-affecting option (target, useDefineForClassFields, verbatimModuleSyntax, experimentalDecorators). A green type-check cannot see this class of failure. |
| MUST | Treat a @ts-expect-error as debt: it carries a comment explaining the cause and the condition for removal. Prefer it over @ts-ignore, which silently rots when the error disappears. |
| Reference | Load when | Covers |
|---|---|---|
| Compiler options for Node.js | Writing or reviewing a Node tsconfig.json | The baseline config, strictness ladder, target/module/moduleResolution for a deployed Node, types, emit and output layout, transpile-only runners |
| Decorators and metadata | Decorators, DI, or runtime reflection are involved | Legacy vs standard decorators, emitDecoratorMetadata, useDefineForClassFields, verbatimModuleSyntax, erasableSyntaxOnly, framework baselines, diagnosing undefined injections |
| Version and upgrades | Choosing, justifying, or raising the TypeScript version | Version policy, what each recent major added, the upgrade procedure, per-major breaking changes, CommonJS to ESM |
| Adopting in a brownfield project | The repo already has a working config that differs from the baseline | Staged adoption order, ratcheting, per-flag sequencing, recording a deviation, when to leave a config alone |
Step 1 — Read the ground truth. Open tsconfig.json and every config it
extends, the typescript entry in package.json, the engines field or CI image
that fixes the Node version, and the build and test runners. Note the current
version, strictness, target, module, moduleResolution, and whether
decorators are in use before proposing anything.
Step 2 — Decide greenfield or brownfield. A new project takes the baseline as
written. An existing project gets the smallest staged change — read
adopting-in-a-brownfield-project.md
first.
Step 3 — Load the relevant references. Read
compiler-options-for-nodejs.md
before editing any tsconfig.json, and
decorators-and-metadata.md before
touching a project that uses decorators. Those two account for most of the ways a
"harmless" config change breaks a running service.
Step 4 — Establish the version baseline. Confirm the TypeScript version is
pinned exactly and supported by the frameworks in peerDependencies. If the
change requires a newer version, treat the upgrade as its own step with its own
verification, not as a side effect.
Step 5 — Apply the smallest change. Prefer the narrowest edit that achieves the goal. Whenever a proposed flag alters emit, say so explicitly in the same breath as proposing it.
Step 6 — Verify. Run tsc --noEmit and the test suite. For any
emit-affecting flag, also start the application and exercise a DI-heavy path: a
passing type-check does not prove the runtime still wires up.
implementing-nestjs-api — ships in this
same plugin, so it is always available alongside this skill. It owns the NestJS
module, CQRS, TypeORM, and REST guidance that sits on top of the compiler
configuration here.tsh-product-engineering — TSH's discipline-level implementation and review
workflows, independent of language. Optional; treat it as a bonus, never a
prerequisite.This skill does not configure browser or bundler builds, and does not cover type modelling, linting, or formatting.
What SKILL.md sets; muted values are Claude Code's defaults
Trigger on: setting up tsconfig.json for a Node service, module or moduleResolution nodenext questions, experimentalDecorators or emitDecoratorMetadata problems, useDefineForClassFields breaking dependency injection or TypeORM entities, CommonJS to ESM questions forced by a resolution change, or an upgrade of the pinned TypeScript version in a backend repo.
Three short reads, in order
npx claudepluginhub thesoftwarehouse/agentic-collections --plugin tsh-stack-nodejs3 skills in this plugin
/implementing-nestjs-apiGuides implementation and review of NestJS 11 REST APIs with TypeScript, @nestjs/cqrs, TypeORM 0.3, and @nestjs/platform-express. Use when bootstrapping a service, organizing vertical feature slices, adding CQRS behavior, implementing a REST API change, or reviewing a NestJS change — a command or query handler, module, TypeORM repository, or DTO — for framework, CQRS, persistence and testability risks./modelling-types-for-nodejsHow to express a type in a Node.js/TypeScript backend so the compiler catches the bug instead of the runtime: discriminated unions that make illegal states unrepresentable, branded ids, const-object unions over enums, satisfies, unknown over any, and validating every boundary into a schema-derived type. Use when deciding how to model a DTO, entity, command or event payload, choosing union versus enum or interface versus type, or reviewing backend code for any, unsafe casts, or types that lie.Other plugins' skills for the same job