Skip to content
Skillpedia
Websites & UI (frontend)75k · #2950

no-explicit-any

What it does

This skill reviews TypeScript files for the 'any' type, which turns off type checking. It is for developers who want their TypeScript to catch more mistakes early.

When to use it

  • ✓When you ask the agent to review a TypeScript file for type safety problems.
  • ✓When your linter shows warnings about the 'any' type and you want them fixed properly.
  • ✓When a function handles data from outside your app and you want that data checked before use.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/no-explicit-any/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/no-explicit-any/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Can you go through my TypeScript files and replace the 'any' types with safer ones?”

5 new skills a week. 1 minute to read.

How it works

The agent finds every place where 'any' is used, including implicit and asserted cases. It suggests replacements such as 'unknown', generics, or validation, and shows the checks needed where each value is used.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Avoid the any type — use unknown, generics, or type guards instead

The any type is a local opt-out that becomes a global problem: a function returning any propagates unchecked types to every caller, silently undermining the type system across the entire codebase. Replacing any with unknown forces type narrowing at the point of use, turning latent runtime errors into compile-time failures where they are cheapest to fix.

Quick Reference

  • any disables all type checking for a value and cascades to callers
  • unknown is the safe alternative — it requires a type check before use
  • Use generics to express "I accept any type, but it stays consistent"
  • At API boundaries, validate with Zod rather than asserting with as Type

Check

Scan this TypeScript file for uses of the any type (explicit annotations, implicit any from missing types, and type assertions to any). Report each location and suggest a safer alternative.

Fix

Replace the any types in this code with unknown (for values of unknown shape), appropriate generics (for type-consistent operations), or Zod validation (for external data). Show the narrowing or generic constraint needed at each usage site.

Explain

Explain why the any type undermines TypeScript's guarantees, how unknown differs from any, and when a type assertion (as Type) is acceptable versus dangerous.

Code Review

Review all type annotations, function signatures, and external data handling in this file. Flag every explicit or implicit any, any type assertion that lacks a preceding type guard, and any return types inferred as any from untyped dependencies.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/no-explicit-any

FAQ

What is the difference between 'any' and 'unknown'?

'any' turns off checks completely, while 'unknown' requires a type check before the value can be used.

Is it ever fine to use a type assertion?

The skill says an assertion can be acceptable in some cases, but it can be dangerous when used to hide real problems.

Why validate data at the edges of the app?

The skill recommends checking external data with a validation library such as Zod instead of asserting its type.

Details

Original description by the author

Use when reviewing TypeScript files for type safety regressions, during code review of functions that handle external data, or when the codebase has ESLint warnings for @typescript-eslint/no-explicit-any.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#2950
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills