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★ 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. Noanyannotations, noas any/as unknown as, no untyped parameters or returns that inferany, no implicitly-anydestructures or array/object literals. - Stop untyped values at the boundary. Use canonical types, typed wrappers, or
unknownwith validation or narrowing. Check library defaults and inferred types: a passing type-check does not guarantee thatanyhasn't propagated into your code. For example, capture untypedJSON.parseand response.json()results asunknown; 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>, orMap; index signatures still constrain values, and changing their spelling toRecord<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
unknownover loose typing and narrow before use — anunknownvalue forces a guard at the point of use. satisfiesfor object literals that must conform without widening (config objects, lookup maps, discriminated literals) — better than: T(widens) oras 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
undefinedeven when the inferred type omits it. Use an iteration form that preserves the key/value relationship, and only assertkeyofwhen 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-castsrule accepts any preceding comment — state the actual reason the cast is safe. NEVER write the legacy// Unjustified type cast. FIXMEplaceholder; 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 accessSomeType["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>(): Tmust not disguise an unchecked assertion about external data. Returnunknownand validate, or accept a validator that establishesT. A factory such asfunction empty<T>(): T[] { return []; }is valid; judge the implementation, not how oftenTappears in the signature
Установить 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), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic