No slash command · from web-tasuke
Avoid using any type in TypeScript. Use unknown, generics, or proper type definitions instead. Use when writing or reviewing TypeScript type annotations.
Ships in web-tasuke. 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.
None: SKILL.md is the whole skill.
any型を避けるany型はTypeScriptの型チェックを完全に無効化するため、使用しないでください。
anyを使った時点で、その値に対するあらゆる操作がコンパイル時にチェックされなくなり、
実行時エラーの原因になります。
ESLintでも@typescript-eslint/no-explicit-anyルールとしてよく禁止されています。
unknownを使う型が不明な値を受け取る場合はunknownを使ってください。
unknownはanyと同様にあらゆる値を代入できますが、
使用する前にtype guardで絞り込む必要があるため型安全です。
// Bad
function parse(input: any): string {
return input.name;
}
// Good
function parse(input: unknown): string {
if (typeof input === "object" && input != null && "name" in input) {
return String(input.name);
}
throw new Error("Invalid input");
}
型を呼び出し側に委ねたい場合はジェネリクスを使ってください。
// Bad
function first(arr: any[]): any {
return arr[0];
}
// Good
function first<T>(arr: T[]): T | undefined {
return arr[0];
}
外部からのデータ(APIレスポンス、フォーム入力など)はバリデーションライブラリでパースしてください。
unknownからの手動type guardよりも安全かつ宣言的です。
// Good: EffectのSchemaモジュールの例
import { Schema } from "effect";
const User = Schema.Struct({
id: Schema.String,
name: Schema.String,
});
const response = await fetch("/api/users").then((r) => r.json());
const users = Schema.decodeUnknownSync(Schema.Array(User))(response);
// users: { readonly id: string; readonly name: string }[]
Recordを使うキーと値の型が分かっているオブジェクトにはRecordを使ってください。
// Bad
const cache: any = {};
// Good
const cache: Record<string, User> = {};
anyが許容される場面anyを使う場合いずれの場合も// eslint-disable-next-line @typescript-eslint/no-explicit-anyのような抑制コメントで意図を明示してください。
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
17 skills in this plugin
/aria-usageWAI-ARIA usage guidelines. Avoid redundant ARIA attributes. No ARIA is better than Bad ARIA. Use when writing or reviewing HTML/JSX with accessibility attributes./as-const-satisfiesUse `as const` and `as const satisfies Type` for constant definitions in TypeScript. Use when defining constants, config objects, or string union types./async-state-typeAvoid contradictory state types for async data fetching. Use Suspense or discriminated unions instead. Use when writing or reviewing async data fetching code in React/TypeScript./avoid-forAvoid for loops (C-style, for...of, for...in) in TypeScript/JavaScript. Prefer higher-order Array methods like map, filter, find, some, every, reduce. Use when writing or reviewing loops or iteration over arrays, objects, Map, Set, or String./dynamic-importPrefer static import over dynamic import() in TypeScript/JavaScript. Use when writing or reviewing import statements./file-namingFile and directory naming conventions for TypeScript/JavaScript projects. Use when creating new files or directories.npx claudepluginhub ncaq/konoka --plugin web-tasuke