Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

typescript-review

БесплатноБез исполняемых скриптовНе проверен

Reviewing TypeScript code - what to flag, and what the compiler and linter already flag for you USE WHEN: you are reviewing, critiquing or auditing existing…

claude-dev-suiteот claude-dev-suite★ 51 звезда на GitHub

Об этом скилле

Reviewing TypeScript

A reviewer's leverage is what the toolchain cannot say. Every check below describes a defect that survives tsc --strict and a default typescript-eslint run.

TypeScript has a second trap Go does not: the compiler's strictness is a setting. Half of what follows depends on tsconfig.json, so read it before you comment - see the config-dependent section.

The snippets are fragments cut down to the defect, not runnable programs.

Already covered - do not spend review on it

Defect Reported by
Unused local, unused parameter noUnusedLocals / noUnusedParameters, @typescript-eslint/no-unused-vars
Explicit any in a signature @typescript-eslint/no-explicit-any (recommended)
== where === belongs eqeqeq
A promise created and never used @typescript-eslint/no-floating-promises - type-aware only, so absent unless the project enables type-checked linting
await on a non-thenable @typescript-eslint/await-thenable (type-aware)
Unreachable code after return allowUnreachableCode: false
Missing return on some path noImplicitReturns
Implicit any parameter noImplicitAny (part of strict)

Check whether type-aware linting is on before assuming the promise rules ran: they need parserOptions.project, and many repos never enable it. If they are off, floating promises are worth reviewing by hand - that is a config finding plus a code finding, not one comment.

The table above dates; the tools do not. Verify a default set with mcp__documentation__fetch_docs on technology eslint — topics rules, typescript-eslint — and typescript/tsconfig for the compiler settings. Those entries point at the indexes the tool authors maintain, so they follow the version the project actually pins rather than the one this skill was written against.

The checks that earn their place

A type assertion that launders a lie

const user = JSON.parse(body) as User;   // no validation happened
const el = document.getElementById('x') as HTMLInputElement;  // may be null

When you see it: as T on a value crossing a trust boundary - a parsed payload, a DOM lookup, a fetch result, a database row.

Ask: what checked that this is actually a User? An assertion changes the type and nothing else; every downstream strict guarantee is now resting on it. The fix is a validator (zod, a type guard) or accepting unknown and narrowing.

no-explicit-any does not fire here - the code never says any, it says something worse: a specific type that is not true.

A type predicate that is not checked

function isUser(x: unknown): x is User {
  return typeof x === 'object' && x !== null;   // does not check a single field
}

When you see it: any function returning x is T.

Ask: does the body actually establish T? The compiler takes the predicate on faith - it verifies the return type is boolean, never that the check is sound. A wrong predicate is an assertion with extra steps, and it silently poisons every narrowed branch.

A non-null assertion standing in for a real check

const cfg = map.get(key)!;   // `!` says "trust me"; the map may not have it

When you see it: ! after an indexed access, a Map.get, a find, or an optional property.

Ask: what guarantees presence here? If it is an invariant, an explicit throw documents it and fails loudly; ! fails as undefined propagating into something far away. Distinguish the two cases: ! right after a has() check on the same key is fine, ! on a lookup whose key came from input is not.

Optional chaining that swallows the interesting case

const total = order?.items?.reduce(sum, 0) ?? 0;   // a missing order reads as 0

When you see it: ?. on a value the surrounding logic assumes exists, especially followed by ?? 0, ?? [] or ?? ''.

Ask: is absence genuinely equivalent to empty? A zero total for a missing order is not a safer answer than an error - it is a wrong answer that no longer looks wrong. ?. is right when absence is a real, expected state.

catch (e) narrowed by assumption

try { } catch (e) {
  logger.error(e.message);   // e is `unknown`; and anything can be thrown
}

When you see it: property access on a catch binding.

Ask: is this reachable with a non-Error throw? A rejected promise carrying a string, a throw from a library, a DOMException. Under useUnknownInCatchVariables (on with strict since 4.4) the compiler stops the direct access - but an as Error right after it is the same defect wearing a hat, and that compiles.

An await that was never written inside a callback

items.forEach(async (item) => {
  await save(item);          // forEach ignores the returned promise
});
done();                      // runs before any save finishes

When you see it: an async callback handed t

Полный SKILL.md на GitHub

Установить typescript-review в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob

FAQ

Что делает скилл typescript-review?

Reviewing TypeScript code - what to flag, and what the compiler and linter already flag for you USE WHEN: you are reviewing, critiquing or auditing existing TypeScript or TSX code - a "code review", a "review" of a .ts/.tsx file, a diff, a PR or a pull request; deciding what to comment on in TypeScript; avoiding false positives on typed JavaScript DO NOT USE FOR: writing, explaining or learning TypeScript - use `languages/typescript`; anything `tsc` under `strict` or a default typescript-eslint run already reports (this skill lists those so you can stay silent about them); React-specific review - pair with the React skills; lint rule configuration - use `quality/typescript-eslint`

Как установить скилл typescript-review?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл typescript-review запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить typescript-review с