/dstack-typescript:typescript-type-hardeningfrom DStack TypeScript
Repairs concrete TypeScript type errors: generics, infer, mapped and branded types, any elimination. Runs tsc as proof; never edits tsconfig.
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 repair a concrete TypeScript type problem: an error message, an any to eliminate, a generic that will not constrain, a branded type to design, an inference chain that breaks. A proactive shaping pass with no error report belongs to typescript-best-practices, and creating or fixing tsconfig.json strict flags belongs there too. This skill never creates or modifies tsconfig.json.
This stays local and reversible: you edit only the named TypeScript source and type-test files, rolled back through version control. You run tsc as the proof. You never touch remote state.
What you need before starting:
tsconfig.json path. Required, and it must already exist. If it is missing, stop and report it. Creating it is the job of typescript-best-practices or the project setup.Run tsc --noEmit and capture the full error output before any edit. If the baseline already carries errors unrelated to your target, run a scoped tsc --noEmit over the target files as well, and keep both lists. You are done when the exact baseline is recorded, because every later claim of "no new errors" is measured against it. When the baseline is dirty with unrelated errors, Done is relative to the scoped baseline, and you report the pre-existing errors separately.
Classify each error or requested improvement into one of these mechanism classes, then apply the narrowest fix in that class. Never widen a type to silence an error (never fall back to object or {} as a stand-in, never loosen a constraint to make the message go away).
any elimination: add explicit annotations. Replace any with unknown, then narrow with guards, discriminated unions, or assertion functions.typeof / in / instanceof guards, assertion functions, or control flow, with never checks for exhaustiveness in switch or default branches.extends constraints. Use defaults only when the consumer should not supply them. Prefer const type parameters (TS 5.0+) for literal inference.T extends U ? X : Y. Extract with infer R inside extends clauses (arrays, promises, return types, tuple positions), chaining infer for nested extraction.{ [K in keyof T]: ... }. Remap string keys with template literals plus Uppercase, Lowercase, Capitalize, or Uncapitalize.declare const __brand: unique symbol and type Branded<T, B> = T & { readonly [__brand]: B }. Provide constructor and guard helpers, and never expose the raw intersection.Partial, Required, Pick, Omit, Record, Readonly, ReturnType, Parameters, InstanceType, and Awaited. For recursive structures, use conditional types with infer and recursive references.Builder<Step>) with branded step types or literal parameters so each method returns a builder limited to valid next steps.T[number]. Use as const or satisfies for readonly tuple inference and variadic tuples ([...T, U]) for push or prepend.After each individual edit, re-run tsc --noEmit scoped to the changed files. If the edit adds errors outside the recorded baseline, revert it and try a narrower fix.
For every mechanism you applied, write or update type-test files with a positive case (the accepted shape now compiles: the narrowed type, the constraining generic, the branded value admitted, the derived utility shape) and a negative case with // @ts-expect-error proving the rejected shape fails (the any source, the unbranded value, the wrong generic argument).
Run tsc --noEmit on the full project. Confirm zero new errors against the recorded baseline, confirm all consuming call sites of the changed types still compile (updating call sites to the new contract rather than weakening the type), and confirm zero new any by a defined detection rule: compiler-level diagnostics such as noImplicitAny output, or an AST scan for : any, as any, and <any>. A three-pattern textual grep is not sufficient; use the compiler or a real parser.
Report in this order: baseline count, final count, any eliminated, mechanisms applied, scoped per-edit run status, full-project run status. When the work cannot proceed, say so directly:
Modified source files, type-test files with positive and // @ts-expect-error negative cases, and a terminal report ordered baseline count, final count, any eliminated, mechanisms applied, and both tsc statuses (scoped per edit, then full project).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
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./typescript-best-practicesUse when TypeScript needs shaping toward narrow types, unions, exhaustive variants, and strict flags. Not for error repair: use typescript-type-hardening. Not for non-TS domains: use type-driven.Other plugins' skills for the same job