No slash command · from web-tasuke
Prefer undefined over null in TypeScript/JavaScript. Use == null for nullish checks. Use when writing or reviewing code that handles absent values.
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.
nullよりundefinedを優先して使うTypeScript/JavaScriptにおいてundefinedとnullが両方あるのは単なる歴史的経緯による混乱なので、
なるべくundefinedだけを使うようにしてください。
既存のAPIでnullに意味がある場合は許容されます。
例えばReactのコンポーネントが返却するnullは何も描画しないことを表します。
そのように様々な既存のライブラリで、
nullが自然に発生する箇所ではnullのまま扱っても構いません。
undefinedに変換するのは必須ではありません。
「選択の余地がある場合にundefinedを優先する」というポリシーであり、
nullを逐一排除するものではありません。
== null / != null を使うNullish valueであるundefinedやnullとの比較には、
基本的には、
厳密等価演算子(=== undefined, !== undefined, === null, !== null)ではなく、
抽象等価演算子 (== null, != null) を使ってください。
== nullはundefinedとnullの両方にマッチするため、
どちらか一方のチェック漏れを防げます。
これらを厳密に分ける必要はほぼないはずです。 厳密に分けているインターフェイスはあまり良くないのですが、 既存のインターフェイスがそうであれば仕方がありません。
ESLintのeqeqeqルールがalwaysに設定されていると== nullが警告されますが、
現代の一般的なESLint設定ではsmartオプションが有効になっており、
nullとの比較に==/!=を使うケースは許容されるため基本的に問題ありません。
// 良い例
if (value == null) {
/* value is null or undefined */
}
if (value != null) {
/* value is neither null nor undefined */
}
// 避ける例
if (value === null || value === undefined) {
/* 冗長 */
}
if (value !== null && value !== undefined) {
/* 冗長 */
}
if (value === null) {
/* undefined を見落とす可能性がある */
}
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
17 skills in this plugin
/any-typeAvoid using any type in TypeScript. Use unknown, generics, or proper type definitions instead. Use when writing or reviewing TypeScript type annotations./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.npx claudepluginhub ncaq/konoka --plugin web-tasuke