# Write Safer Metabase TypeScript

TypeScript changes can lose safety when teams use broad types, casts, or unclear models. This skill guides Claude, Codex, and Claude Code toward Metabase-specific typing patterns and verification steps.

## Install

```bash
npx skillstore add metabase/typescript-write
```

## Metadata

- Status: approved
- Slug: metabase-typescript-write
- Skillstore revision: r1
- Version status: missing
- Tree hash: e9153dc017023f0616109cef248039a299a4f22aaad68ccfc5617225ddb17214
- Author: metabase
- GitHub username: metabase
- License: MIT
- Repository: https://github.com/metabase/metabase/tree/master/.claude/skills/typescript-write
- Ref: 1ffa7643651792ccb4bd3b15d924d2c97edff755
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: scripts, external\_commands, filesystem
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/metabase-typescript-write
- Manifest: https://skillstore.pages.dev/api/skills/metabase-typescript-write/manifest

## Capabilities

- Applies a strict no-any rule for new TypeScript and JavaScript changes.
- Guides type tightening with generics, utility types, and boundary typing.
- Encourages reuse of Metabase domain types and generated API types.
- Models async, null, optional, and variant states with explicit TypeScript types.
- Promotes small functions, reusable helpers, and clear component extraction.
- Requires TypeScript language server inspection and project type-checking after edits.

## Use Cases

- Refactor weak TypeScript safely: Replace casts, any types, and broad records with narrower signatures and reusable domain types.
- Model UI state precisely: Represent loading, error, empty, and success states with discriminated unions and exhaustive checks.
- Review JavaScript migration scope: Identify when touched JavaScript should become TypeScript before feature work continues.

## Prompt Templates

### Improve a simple function

```
Use the typescript-write skill to improve this function without introducing any. Keep the signature narrow and explain the type changes briefly.
```

### Refactor component props

```
Use the typescript-write skill to refactor these React props. Prefer existing Metabase types, avoid casts, and keep optional values precise.
```

### Model async state

```
Use the typescript-write skill to model this async UI state with a discriminated union. Include exhaustive handling and avoid broad string states.
```

### Plan a JavaScript migration

```
Use the typescript-write skill to assess this JavaScript file. Propose a separate TypeScript conversion plan before implementing the feature change.
```

## Limitations

- It provides coding guidance and does not run tools by itself.
- It depends on shared Metabase workflow files for command details.
- It is tailored to Metabase conventions and may not fit other repositories.
- It does not replace human review for product behavior or API contract decisions.

## Best Practices

- Start by finding existing Metabase types before defining new shapes.
- Use unknown at system boundaries and narrow it immediately with typed guards.
- Run the TypeScript language server checks and project type-check before finishing.

## Anti Patterns

- Do not use any, double casts, or broad records to silence compiler errors.
- Do not duplicate generated API types or redefine shared type guards locally.
- Do not thread undefined through many layers when it can be narrowed at the source.

## Security Audit

- Audited at: 2026-07-09T04:16:54.761\+00:00
- Summary: All static findings are false positives caused by Markdown formatting, local documentation includes, and a TypeScript code example. No prompt injection, malicious intent, command execution, network access, or unsafe runtime behavior was found in SKILL.md.

## Stats

- Views: 188
- Downloads: 14
- Favorites: 0
- Popularity score: 0
