Command Palette

Search for a command to run...

Назад к скиллам
скилл № 58374

JavaScript

Writes, debugs, and reviews JavaScript: async and the event loop, coercion, closures, dates, Unicode, regex, and modern ES2023+ APIs. Use when JS throws…

БесплатноБез исполняемых скриптов
clawicот clawic★ 23 звезды на GitHub

Установить JavaScript в Claude Code и Claude Desktop

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

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

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

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

User preferences and memory live in ~/Clawic/data/javascript/ (see setup.md on first use, memory-template.md for the file format). If you have data at an old location (~/javascript/ or ~/clawic/javascript/), move it to ~/Clawic/data/javascript/, and say in one line that you moved it and from where.

Configuration

User-dependent variables. Defaults apply until the user states a preference; store them in ~/Clawic/data/javascript/config.yaml.

Variable Type Default Effect
runtime_target node | browser | both node Selects which platform file applies by default (node.md vs browser.md) and which floor gates advice
node_floor number (Node major) from package.json engines, else 22 Gates every recommendation against the feature-floor table in modern.md; flags any API above the floor
module_system esm | cjs | dual esm Switches module guidance and import/export examples in modern.md; dual activates the dual-package hazard checks
browser_floor text (e.g. "Safari 16+", "last 2 years") none When set, gates syntax and API advice for browser-targeted code the way node_floor gates Node

Preference areas to record as the user reveals them:

  • tooling — package manager, bundler, test runner, lint/format stack — affects which commands and config examples are offered
  • conventions — style (semicolons, functional vs imperative iteration), error-handling shape (exceptions vs result values) — affects generated code and review verdicts
  • platform — Deno/Bun/edge runtimes, TypeScript presence, monorepo layout — affects which floors and module advice apply
  • safety posture — how proactively to flag legacy patterns (var, ==, callback APIs) in review vs only on request

When To Use

  • Debugging JavaScript: wrong values, NaN, TypeErrors, ordering surprises, async bugs, timezone shifts
  • Writing or reviewing JS (Node or browser) for correctness and modern idioms
  • Choosing data structures (Object/Map/Array/Set), copy semantics, iteration strategy, or error-handling shape
  • Deciding whether an ES2020+ feature is safe for the target runtime
  • Diagnosing memory growth, leaks, slow code, or an unresponsive event loop
  • Not for TypeScript type-system design or framework internals — this is the core language

Quick Reference

Situation Go to
TypeError/ReferenceError, NaN appearing, value undefined after await, works-in-dev-only, heisenbug debug.md
Promise/await bug, rejection handling, cancellation, concurrency limits, races async.md
Throwing, catching, custom errors, cause chains, global error hooks, serializing errors errors.md
== surprise, truthiness, implicit conversion, ?? vs || coercion.md
Array/Object/Map/Set choice, copying, sorting, iteration traps collections.md
ES2020+ syntax semantics, feature floors, modules (ESM/CJS), classes, generators/iterators modern.md
Memory grows, listener/timer leaks, WeakMap/WeakRef, heap snapshots memory-leaks.md
Slow code, jank, benchmarks, GC pressure, workers performance.md
Regex wrong matches, stateful lastIndex, catastrophic backtracking, Unicode flags regex.md
JSON precision loss, Date/Map round-trips, reviver/replacer, canonicalization json.md
Env vars, process exit, signals, streams, Buffer, child processes node.md
DOM events, storage, script loading, fetch response handling browser.md
Anything else (numbers, dates, strings, this, timers) Sections below

Core Rules

  1. === always; the only defensible == is the idiom x == null — it matches both null and undefined in one check. Never expand it to two comparisons.
  2. Float equality is a band, not ===: Math.abs(a - b) <= Number.EPSILON * Math.max(1, Math.abs(a), Math.abs(b)). Worked: 0.1 + 0.2 - 0.3 ≈ 5.6e-17, inside the band (EPSILON ≈ 2.2e-16). Money never touches floats: integer minor units.
  3. Every promise gets a handler attached synchronously — a rejection with no handler when the microtask queue drains crashes Node (default since Node >=15) and fires unhandledrejection in browsers.
  4. Mutation is opt-in: default to toSorted/toReversed/with and spread; structuredClone only when depth is real. Runtime floors for all of these: modern.md.
  5. Durations from performance.now() (monotonic); wall-clock timestamps from Date.now(). Never subtract two Date.now() calls for benchmarks — NTP can step it backwards mid-measurement.
  6. Sequential vs parallel is a decision you write down: for...of + await = sequential; Promise.all(arr.map(f)) = parallel, fail-fast, and it does NOT cancel the losers.
  7. .length counts UTF-16 code units, not characters: "😀".length === 2. Slice user-visible text with Intl.Segmenter, never by index.
  8. Check the feature-floor table in modern.md before shipping ES2023+ APIs — one toSorted call breaks Node 18 at runtime, not at bui
Полный SKILL.md на GitHub

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

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

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _meta.json
  • async.md
  • browser.md
  • coercion.md
  • collections.md
  • debug.md
  • errors.md
  • json.md
  • memory-leaks.md
  • memory-template.md
  • modern.md
  • node.md
  • performance.md
  • regex.md
  • setup.md

FAQ

Что делает скилл JavaScript?

Writes, debugs, and reviews JavaScript: async and the event loop, coercion, closures, dates, Unicode, regex, and modern ES2023+ APIs. Use when JS throws TypeError or "undefined is not a function", a promise never settles or a rejection goes unhandled, NaN or [object Object] appears, dates shift by a day, sorting or equality misbehaves, memory grows, a regex hangs, JSON loses precision, a Node process won't exit or ignores signals, or fetch doesn't reject on a 404; also when choosing data structures, handling errors, profiling slow code, or checking whether a feature is safe for a target Node or browser version. Covers Node and browser runtime edges. Not for TypeScript type-system design or framework internals.

Как установить скилл JavaScript?

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

Скилл JavaScript запускает скрипты?

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

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

Сравнить JavaScript с