Command Palette

Search for a command to run...

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

typescript-write

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

Write or modify TypeScript and JavaScript code, including tests and test helpers, following Metabase coding standards. Use before editing any TS/TSX/JS/JSX…

metabaseот metabase★ 50 742 звезды на GitHub

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

TypeScript/JavaScript Development Skill

Before frontend edits, including test-only changes, read frontend/AGENTS.md, docs/developers-guide/frontend.md, and the shared references below. For new or edited tests, follow Test authoring.

@./../_shared/development-workflow.md @./../_shared/typescript-commands.md @./../_shared/react-redux-patterns.md

No any — hard rule

  • New, moved, or otherwise edited code must not contain any, explicit or implicit. No any annotations, no as any / as unknown as, no untyped parameters or returns that infer any, no implicitly-any destructures or array/object literals.
  • Stop untyped values at the boundary. Use canonical types, typed wrappers, or unknown with validation or narrowing. Check library defaults and inferred types: a passing type-check does not guarantee that any hasn't propagated into your code. For example, capture untyped JSON.parse and response .json() results as unknown; narrow or validate before accessing fields or passing to typed callers.
  • Type the captured value, not only its eventual result. A return annotation doesn't change the inferred types of parameters or destructured bindings. Capture untyped data as unknown, then narrow or validate before destructuring or accessing fields.
  • Mandatory type verification. Before finishing a TS/TSX change, run bun run type-check-pure. If TypeScript LSP tools are available, also inspect changed symbols with hover and go-to-definition; otherwise skip LSP check.

Type tightening

  • Avoid type casts and loose unknown — fix the signature instead.
  • If a function only needs one field of a wide object, accept that field — not the wide object. The cast often disappears once the signature is right.
  • Reach for Partial<T>, Pick<T, K>, Record<K, V>, and generics before reaching for a cast.
  • Match dictionary keys to the data. Use a finite key union when the keys are known. Open dictionaries can use an index signature, Record<string, T>, or Map; index signatures still constrain values, and changing their spelling to Record<string, T> does not make missing-key access safe.
  • Prefer making props/components generic (<T>) when a value flows through unchanged and the caller knows the type.
  • Prefer unknown over loose typing and narrow before use — an unknown value forces a guard at the point of use.
  • satisfies for object literals that must conform without widening (config objects, lookup maps, discriminated literals) — better than : T (widens) or as T (unsafe).
  • Avoid non-null assertions (!). Prefer a guard, early return, or ?.. Use ! only when non-nullness is provably true and localized, with a comment.
  • Guard indexed lookups that may miss. Arrays and dictionaries can return undefined even when the inferred type omits it. Use an iteration form that preserves the key/value relationship, and only assert keyof when the runtime keys are known to belong to the declared type.
  • No redundant runtime coercion — don't wrap already-typed values in Number() / String() / Boolean().
  • Type guards belong in frontend/src/metabase-types/guards/. Do not redefine them locally.
  • A cast you can't avoid needs a real justification comment. The metabase/no-unjustified-type-casts rule accepts any preceding comment — state the actual reason the cast is safe. NEVER write the legacy // Unjustified type cast. FIXME placeholder; it exists only on casts that predated the rule, and copying it sneaks an unjustified cast past the linter. If you can't articulate why the cast is correct, the cast is wrong — fix the types.
  • Keep unavoidable assertions local. Isolate a repeated or complex assertion behind a helper when that makes its invariant easier to enforce. Test nontrivial runtime assumptions that justify it; a trivial assertion does not automatically need a new helper or test. Do not weaken a public signature just to silence implementation errors.

Type modeling

  • Reuse existing types; don't re-declare them. Use canonical IDs and domain entity types from metabase-types/api (FieldId, TableId, ConcreteTableId, SchemaName, …) and key data structures by them (new Map<ConcreteTableId, …>()). Don't duplicate generated/API types — compose or derive (Pick, Omit, indexed access SomeType["field"], ReturnType). Search for the canonical declaration before introducing a local domain shape. If a type isn't exported directly, derive it from the owning function, endpoint, or hook rather than recreating its shape.
  • Generics must make promises the implementation can keep. A caller-selected get<T>(): T must not disguise an unchecked assertion about external data. Return unknown and validate, or accept a validator that establishes T. A factory such as function empty<T>(): T[] { return []; } is valid; judge the implementation, not how often T appears in the signature
Полный SKILL.md на GitHub

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

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

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

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

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

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

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

FAQ

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

Write or modify TypeScript and JavaScript code, including tests and test helpers, following Metabase coding standards. Use before editing any TS/TSX/JS/JSX file.

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

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

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

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

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

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