Skip to content
Skills Library
Programming · Review & audit

trove-typescript

/trove-typescript

TypeScript type-system discipline for any .ts/.tsx file: make illegal states unrepresentable, validate at boundaries, avoid as/any. Use when reading or editing TypeScript that isn't covered by a framework-specific skill. Defers to trove-react / trove-react-best-practices on .tsx component work.

Repository
trove ↗
Licence
MIT
Last repository change
08.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
2
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 08.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • SKILL.md zawiera komentarze HTML (2). Nie widać ich w podglądzie Markdown, a model je czyta.

What it does and when to use it

TypeScript type-system discipline for any .ts/.tsx file: make illegal states unrepresentable, validate at boundaries, avoid as/any. Use when reading or editing TypeScript that isn't covered by a framework-specific skill. Defers to trove-react / trove-react-best-practices on .tsx component work.

Original author description

TypeScript type-system discipline for any .ts/.tsx file: make illegal states unrepresentable, validate at boundaries, avoid as/any. Use when reading or editing TypeScript that isn't covered by a framework-specific skill. Defers to trove-react / trove-react-best-practices on .tsx component work.

How it works

  1. Session Init
  2. Core rules
  3. The canonical example
  4. Boundaries
  5. AI Gotchas
Original SKILL.md headings · 56 lines, 409 words
SKILL.md preview
---
name: trove-typescript
description: "TypeScript type-system discipline for any .ts/.tsx file: make illegal states unrepresentable, validate at boundaries, avoid as/any. Use when reading or editing TypeScript that isn't covered by a framework-specific skill. Defers to trove-react / trove-react-best-practices on .tsx component work."
paths:
  - "**/*.ts"
  - "**/*.tsx"
---
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
<!-- Regenerate: bun run build:skills -->

## Session Init

This skill ships Trove conventions. Prefer existing project patterns over generic best practices when they conflict.

If a sibling skill in this plugin matches the request more directly, defer to it. See `AGENTS.md` (or `docs/routing.md` in the marketplace) for the per-plugin routing index.

# TypeScript Type-System Discipline

The type checker is a proof assistant. Model the domain so wrong states don't compile. On `.tsx`, defer to `trove-react` / `trove-react-best-practices` for component patterns; this skill owns the plain type discipline underneath them.

## Core rules

| Rule | Do | Not |
|---|---|---|
| Illegal states | Discriminated union with a `kind`/`status` tag | `boolean` + optional field pairs |
| Identity | Branded primitives (`string & { readonly __brand: 'UserId' }`) | bare `string` for ids |
| External data | `unknown` + parse at the boundary | `any` |
| Casts | `satisfies` to check shape while keeping literals | `as SomeType` |
| Exhaustiveness | `const _exhaustive: never = x` in the default branch | unhandled union members |
| Type guards | Guards that actually narrow and are verified | `x as Foo` inside the guard |
| Derive | Types derived from a schema (Zod/valibot `infer`) | hand-kept parallel types |

## The canonical example

```ts
// BAD — admits the meaningless { completed: true, completedAt: undefined }
type Task = { completed: boolean; completedAt?: Date };

// GOOD — the bad state cannot be constructed
type Task =
  | { status: 'open' }
  | { status: 'done'; completedAt: Date };
```

## Boundaries

Validate once, at the edge (network, config, user input). Past the boundary, trust your domain types and keep logic pure. "Parse, don't validate": a parser returns a more precise type or fails; it doesn't just check and discard what it learned.

```ts
function parseUser(raw: unknown): User {
  return UserSchema.parse(raw); // unknown -> User, or throws at the boundary
}
```

See [references/patterns.md](references/patterns.md) for the full pattern set with worked examples.

## AI Gotchas

- **`as` to silence an error** hides the bug you'll debug next week. Reach for narrowing or `satisfies` first.
- **`any` on external data** erases the boundary. Use `unknown` and parse.
- **Non-exhaustive `switch`** over a union compiles today and breaks when a variant is added. Add the `never` guard.
- **Parallel hand-maintained types** drift. Derive from the schema.
Files in this package (2)
  • SKILL.md 3 KB
  • references/patterns.md 3 KB

Versions

The database has no other skills named trove-typescript.

Identical content appears in 3 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 2f11465ecd71 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.