TypeScript/JavaScript with Metabase Standards

VerifiedSafe

Strict typing rules, no `any` policy, and TypeScript best practices for developing or refactoring code.

Sby Skills Guide Bot
DevelopmentIntermediate
8/29/2026
Claude Code
#typescript#type-safety#refactoring#code-standards#javascript

Recommended for

Automated summary

Guides writing and refactoring TypeScript/JavaScript code according to Metabase coding standards, enforcing a strict ban on `any` and a strong emphasis on tightening types.

Strengths

  • Explicit, checkable rule: no new `any`, with mandatory verification via `bun run type-check-pure`
  • Actionable modeling advice: `satisfies`, narrowed `unknown`, generics, `Partial`/`Pick`/`Record` before reaching for casts
  • Requires a real justification comment for unavoidable casts and forbids the legacy FIXME placeholder
  • Reuses canonical `metabase-types/api` types and centralizes type guards in a dedicated folder

Limitations

  • Heavily tied to the Metabase codebase (paths, bun commands, internal lint rules)
  • Assumes access to the referenced shared files (`@./../_shared/...`) to be fully applicable
  • Does not cover testing, formatting style, or architecture beyond typing
When to use it

Use it when writing or refactoring TypeScript/TSX inside a Metabase project and you need to guarantee no `any` and precise types.

When not to use it

Avoid it on a non-Metabase TypeScript project, where conventions, paths, and verification commands differ.

Security analysis

Safe
Quality score85/100

The skill is a pure coding-standards/style guide for TypeScript/JavaScript. It declares no tools, contains no shell commands, network calls, file mutations, or secret handling. The only executable instruction is running a project type-check (`bun run type-check-pure`), which is a benign, standard verification step. The `@./../_shared/*.md` includes just reference sibling documentation and introduce no execution surface.

No concerns found

How this analysis is made

Examples

Refactor sans any
Refactor this React component to remove the `as any` cast and the implicit any parameters, then run bun run type-check-pure to verify.
Modéliser une union discriminée
Model this component's loading/success/error states as a discriminated union and exhaust it with ts-pattern's .exhaustive().
Réutiliser les types API
Replace these locally re-declared field types with the canonical ones from metabase-types/api and key the map by FieldId.

name: typescript-write description: Write TypeScript and JavaScript code following Metabase coding standards and best practices. Use when developing or refactoring TypeScript/JavaScript code.

TypeScript/JavaScript Development Skill

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

No any — hard rule

  • New code must not introduce 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.
  • Untyped third-party / boundary values must be typed at the boundary (a declared type, unknown + type guard, or a small typed wrapper) — never let any propagate inward.
  • 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.
  • 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.
  • 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.

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).
  • Use generics to allow TypeScript to infer correct types when creating functions and components that need to be reusable and type-safe. Don't hesitate to introduce complex generics if they allow to derive types automatically instead of manual narrowing.
  • Model the actual data contract; keep types narrow. Optional field?: T for a key that may be absent, field: T | undefined only when the key is always present but the value may be undefined, | null for explicit API nulls. Prefer domain unions over broad string / number / loose Record.
  • Refer to API implementation when defining or refining types to ensure they match the actual data structure. When considering a type cast, first consider if the type should be refined to match the actual data structure.
  • Discriminated unions for variant state, with exhaustive checks. Model "one of N shapes" as a union with a literal discriminant rather than a bag of optional fields, and exhaust it with ts-pattern's .exhaustive() so adding a variant becomes a compile error:
    import { match } from "ts-pattern";
    
    const result = match(status)
      .with({ type: "loading" }, () => <Spinner />)
      .with({ type: "error", error: P.select() }, (error) => <Error message={error.message} />)
      .with({ type: "success", data: P.select() }, (data) => <Content data={data} />)
      .exhaustive(); // Compile-time guarantee all cases handled
    
  • Derive union types from constants (as const + typeof/keyof) so the type and the values can't drift.
  • readonly / immutability where mutation isn't intended — component props, shared constants, exported config. Prefer readonly T[] / ReadonlyArray<T> for inputs you don't mutate.
  • Type async and error states explicitly (a discriminated union or the data-layer's typed result) — never leave loading/error/empty implicit.

Null and undefined

  • Narrow at the source. If a value is optional only in a corner case, don't thread undefined through every layer — guard at the producer.
  • Sensible defaults for optional values. Use ?. and ?? at the consumer.
  • Lists should be filtered before being used in a map or other iteration.
  • Avoid non-strict null comparisons (X != null) when X can never be null — use a strict check or narrow the type. Use checkNotNull where necessary.
  • Check actual nullability against API implementation. Find the API endpoint implementation and check if the field can actually be null.

Naming

  • Names describe the entity, not the mechanism. A name must reflect what the value holds.
  • Align sibling concepts: keep verb conventions consistent across a related API.
  • No names that encode implementation history rather than current meaning. Suffixes like Base, New, Old, Initial need a real semantic distinction, otherwise drop them.
  • Avoid cryptic identifiers (v, n, $n) for domain values; short names are fine only in tiny conventional contexts (loop index i, coordinates x/y, generic params T/K/V).

Code structure and organization

  • Prioritize reusability over duplication. The codebase already has many utility functions — leverage them. If you introduce duplicated logic, extract it to a shared utility.
  • Generic helpers do not belong in feature folders. Promote to a shared utility.
  • Keep functions small and single-purpose. A 100+ line function is hard to review — split into focused named helpers, each with one responsibility and a minimal dependency surface. When necessary, cover with unit tests.
  • Extract distinct complex JSX into named components. Choose same-file vs separate-file by reuse, coupling, testability, and readability.

Comments

  • No comments by default. Well-named identifiers carry the what.
  • Comments should be concise. Add a short, concise comment only when the why is non-obvious: a workaround, a hidden invariant, a subtle ordering constraint, a clever reduction. Never document the actual implementation, focus on the intent and the why.

Verify before done

  • Run the project type-check when finished (see the shared TypeScript commands above).

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/typescript-javascript-with-metabase-standards-mte1lg3r/download' --output '.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r/SKILL.md.part' && mv '.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r/SKILL.md.part' '.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r/SKILL.md' && test -s '.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/typescript-write' && cp -R '.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r' '.claude/skills/typescript-write'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r'

openskills read 'typescript-javascript-with-metabase-standards-mte1lg3r'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/typescript-javascript-with-metabase-standards-mte1lg3r/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills