/dstack-typescript:typescript-best-practicesfrom DStack TypeScript
Shapes TypeScript source toward narrow types, discriminated unions, readonly, validated boundaries, and strict flags. Use for proactive type design, not error repair.
Ships in DStack TypeScript. 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.
You shape TypeScript source proactively so bad states cannot be written: narrow types, discriminated unions, readonly where mutation is forbidden, validated boundaries, and the strict flags actually turned on. This is a shaping pass, not a repair job. A concrete error report (a message, a broken inference, a generic that will not constrain) belongs to typescript-type-hardening, and language-agnostic domain modeling belongs to type-driven.
This stays local and reversible: you touch only the in-scope TypeScript files and the named tsconfig.json, rolled back through version control. You never touch remote state.
What you need before starting: the in-scope TypeScript source files and the target tsconfig.json. The scope must name a proactive shaping pass. A concrete error report routes to typescript-type-hardening instead.
Limits that hold for the whole pass:
any, ! non-null assertions, or as unknown as double assertions.as. Use an opaque type where the domain identity invariant is real and enforced, and use as where TypeScript narrowing is insufficient, stating the reason each time.Read every in-scope file before changing any of them. You are done with this step when all of them have been read.
Check the project tsconfig.json for exactly this set and apply what is missing:
noUncheckedIndexedAccessexactOptionalPropertyTypesnoImplicitOverridenoFallthroughCasesInSwitchnoPropertyAccessFromIndexSignaturenoImplicitReturnsallowUnreachableCode: falseverbatimModuleSyntaxerasableSyntaxOnlyisolatedDeclarationsUse only these flags. If a check fails for a missing flag, the recovery is applying the named flag, with version control as the rollback.
Keep unknown only while it is genuinely opaque, and narrow it at trust boundaries with guards, predicates, or an explicit cast where narrowing is available. Model state machines and mutually exclusive variants as discriminated unions. Mark properties readonly where reassignment is forbidden. Add an opaque type for domain identity only where the invariant it models is real and enforced.
Put a validating parser (Zod 4, Valibot, or ArkType through the Standard Schema interface) on every trust boundary where untrusted external input enters. Never widen or re-export an unvalidated external shape past that boundary. Set module resolution to NodeNext for Node.js targets and ESNext with a bundler for SPAs.
Run tsc --noEmit and confirm it passes. Confirm the pass introduced no any, !, or as unknown as. Confirm every discriminated union is exhaustively checked through the compiler's switch and match checks, adding a final otherwise branch that narrows the unknown variant to never where the language lacks built-in exhaustiveness.
When this step fails, the cause is one of a short list. Report it plainly and stop rather than working around it:
The shaped source and tsconfig.json, with a clean tsc --noEmit run as proof: illegal states unrepresentable, variants exhaustive, boundaries validated, and none of the refused constructs introduced.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
typescript, type-design, strict-flags, discriminated-unions, readonly, validation
npx claudepluginhub gosuda/dstack-skills --plugin dstack-typescript5 skills in this plugin
/node-internals-diagnosisUse when Node.js segfaults, addon crashes, leaks, event-loop anomalies, thread-pool saturation, V8 deoptimizations, or binding.gyp failures need diagnosis. Not for code edits or service restarts./nodejs-graceful-shutdownUse when asked to implement or fix service termination: SIGTERM or SIGINT, connection draining, health-check signaling. Not for general service scaffolding: use nodejs-service-foundations./nodejs-service-foundationsUse when asked to set up or harden Node.js service foundations: env validation, logging, typed errors, type stripping, and shutdown wiring. Not for dedicated shutdown: use nodejs-graceful-shutdown.Other plugins' skills for the same job