/odin-typescript:typescript-type-hardeningfrom ODIN TypeScript
Fixes TypeScript type errors, failing inference, and type mechanism issues (generics, infer, mapped, branded types). Applies targeted repairs with tsc baseline verification.
Ships in ODIN 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.
| Field | Bound contract |
|---|---|
| Trigger | TS type errors, eliminating any, designing complex generics, branded or opaque types, inference problems, utility-type design, overloads, builder-pattern typing. A concrete problem description is required, not a proactive shaping pass. |
| Authority | Reversible local: write only named TypeScript source and type-test files; rollback via VCS. Does not create or modify tsconfig.json. |
| Side effect | Edits TypeScript source and type tests; runs tsc. |
| Done | Zero new errors versus the recorded baseline and zero new any by a defined detection rule (a compiler-level check such as noImplicitAny diagnostics or an AST scan, not a three-pattern textual grep), with all consuming call sites compiling. |
tsconfig.json path (required; must already exist).Run tsc --noEmit and record the exact baseline error list. Capture the full error output before any edit. If the baseline already has errors unrelated to the target, isolate the target file or files with a scoped tsc --noEmit run and record both the full baseline and the scoped baseline. Done when: the exact baseline error list is recorded.
Classify each item into one named mechanism class and apply the narrowest matching mechanism. Classify each error or requested improvement as: missing annotation, incorrect narrowing, any elimination, generic design, conditional or infer extraction, mapped or template-literal transform, branded or opaque type, utility-type derivation, function overload, builder-pattern typing, array or index access, or deep inference. For each class, apply the narrowest matching mechanism, never widening to suppress:
any elimination: add explicit type annotations. Replace any with unknown then narrow via type guards, discriminated unions, or assertion functions. Never widen to object or {} as a substitute.typeof or in or instanceof guards, assertion functions, or control-flow analysis. Ensure exhaustiveness with never checks in switch or default.extends). Use defaults only when the consumer should not need to supply them. Prefer const type parameters (TS 5.0+) for literal inference.T extends U ? X : Y for branching. Use infer R inside extends clauses to extract from arrays, promises, function return types, and tuple positions. Chain infer for nested extraction.{ [K in keyof T]: ... } for structural transforms. Use template literal types with Uppercase or Lowercase or Capitalize or Uncapitalize intrinsic helpers for string-key remapping.declare const __brand: unique symbol; type Branded<T, B> = T & { readonly [__brand]: B }. Provide constructor and type-guard helpers. Never expose the raw intersected type.Partial, Required, Pick, Omit, Record, Readonly, ReturnType, Parameters, InstanceType, Awaited). Compose them. For recursive structures, use conditional types with infer and recursive references.Builder<Step>) with branded step types or literal type parameters so each method returns a builder constrained to valid next steps.T[number] for element types. Use as const assertions or satisfies for readonly tuple inference. Use variadic tuple types ([...T, U]) for push or prepend operations.Done when: every classified item has its mechanism applied.
After each edit, re-run tsc --noEmit on the changed files and revert any edit that adds errors outside the baseline. Run tsc --noEmit scoped to the changed files after each individual edit. If the edit introduces errors outside the recorded baseline, revert it and apply a narrower fix. Done when: no new errors appear outside the baseline after every edit.
Write positive and negative type tests for every mechanism applied. Write or update type-test files that demonstrate: the any that was eliminated (before and after), the generic that now constrains correctly, the branded type that rejects unbranded values, or the utility type that derives the expected shape. Use // @ts-expect-error for negative tests proving type rejection. Done when: positive and // @ts-expect-error negative tests exist for each mechanism applied.
Run the full-project pass and prove Done. Run tsc --noEmit on the full project. Confirm zero new errors compared to the recorded baseline. Confirm zero new any by a defined detection rule: a compiler-level check such as noImplicitAny diagnostics, or an AST scan for : any, as any, and <any> patterns. A three-pattern textual grep is not sufficient; use the compiler's own diagnostics or a tool that parses the AST. Verify all consuming call sites that consumed the changed types still compile; if a call site breaks, update it to match the new contract rather than weakening the type. Done when: the full-project pass shows zero new errors versus baseline, zero new any by the defined detection rule, and all consuming call sites compile.
tsconfig.json; that is the job of typescript-best-practices or the project setup.Modified source files, type-test files (positive and // @ts-expect-error negative), and a terminal report with baseline count, final count, any eliminated, mechanisms applied, and both tsc run statuses (scoped per-edit and full-project final), in that order.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odin-typescript15 skills in this plugin
/eslint-to-biome-migrationUse when migrating a JavaScript or TypeScript project from ESLint, Prettier, Standard, or mixed legacy lint configuration to Biome 2.5./fastify-inject-testingUse when asked to test Fastify applications without network sockets. Not for building the app: use fastify-schema-first-service./fastify-production-hardeningUse when asked to prepare a Fastify service for production load and exposure. Not for building the app: use fastify-schema-first-service./fastify-schema-first-serviceUse when building or extending a Fastify application: routes, plugins, hooks, database wiring. Not for testing: use fastify-inject-testing. Not for hardening: use fastify-production-hardening./multi-tenant-architectureUse when a request concerns multi-tenant scaffolding, tenant isolation, domain wiring, or SaaS architecture on Cloudflare or Vercel. Not for single-tenant apps: use scaffold-nextjs./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.Other plugins' skills for the same job