From typescript-any-eliminator
Use when TypeScript source contains explicit `any` in application code, shared helpers, DTOs, or API layers that should be narrowed without changing runtime behavior — or when a reviewer or lint rule flags unsafe `any` usage.
How this skill is triggered — by the user, by Claude, or both
Slash command
/typescript-any-eliminator:typescript-any-eliminatorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- The user asks to remove, reduce, or replace `any` types in TypeScript code.
any types in TypeScript code.any in application code, shared helpers, DTOs, or API layers that should be narrowed safely.any.any appears in generated code or third-party declarations that should not be hand-edited.Required before editing
any sites and the surrounding API surface.tsc --noEmit or an equivalent project wrapper.Helpful if present
unknown, guards, and assertions.any sites and read the adjacent types before editing.any site and consult the reference files before inventing new patterns.Do not force a fake precise type when the right answer is to keep the boundary permissive or move the fix closer to the real source.
unknown plus a guard when the value is untrustedany replacementunknown plus narrowing or validation at an untrusted boundaryunknown plus a guard instead of inventing a fake precise type.any with an equally vague type unless that is the honest boundary.as unknown as to silence the compiler.any elsewhere to make the local error disappear.unknown only at untrusted boundaries, then narrow with guards or validators.any boundary in place when editing it would be unsafe or out of scope.schema-boundary-typing when truthful any removal depends on runtime validation at an untrusted input boundary.type-test-authoring after the type surface is truthful and you need compile-time regression coverage for inference or assignability.any cleanup, route causal error triage to tsc-error-triage.Re-run the repository's typecheck command after the edit.
Run targeted tests or the nearest equivalent validation command for the touched surface when available.
Confirm the final type is more precise than any, object, Function, or another unjustified widening.
Smoke test:
schema-boundary-typing)Before
export function read(input: any) {
return input.user.id;
}
After
export function read(input: unknown) {
if (!isUser(input)) throw new Error("invalid user");
return input.user.id;
}
Before
type Payload = Record<string, any>;
After
type Payload = Record<string, unknown>;
references/replacement-patterns.md.references/boundary-triage.md.references/replacement-patterns.md - before/after replacement patterns, including generic keyed access and unknown plus type-guard examples.references/boundary-triage.md - how to choose between existing types, unions, unknown, guards, and validators.references/unsafe-shortcuts-to-avoid.md - anti-patterns that hide type problems instead of fixing them.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub matt-riley/lucky-hat --plugin typescript-any-eliminator