Skip to content
Skills Library
Programming · Building & coding

typescript-forms

/typescript-forms

Katara's TypeScript forms, practiced until every move is exact. Use for typescript-best-practices, /typescript-best-practices, "TypeScript best practices", and whenever reading or editing any .ts or .tsx file. Discriminated unions, branded types, constructive modeling, unknown over any, schemas before guards, no as casts, exhaustiveness, satisfies, and boundary validation.

Repository
team-avatar ↗
Licence
MIT
Last repository change
25.10.2026

Assessment and security

91/ 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.
Content26 / 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
0
URLs in SKILL.md
0
Deprecation

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

Licence

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

What it does and when to use it

Katara's TypeScript forms, practiced until every move is exact. Use for typescript-best-practices, /typescript-best-practices, "TypeScript best practices", and whenever reading or editing any .ts or .tsx file. Discriminated unions, branded types, constructive modeling, unknown over any, schemas before guards, no as casts, exhaustiveness, satisfies, and boundary validation.

Triggers from the description

TypeScript best practices
Original author description

Katara's TypeScript forms, practiced until every move is exact. Use for typescript-best-practices, /typescript-best-practices, "TypeScript best practices", and whenever reading or editing any .ts or .tsx file. Discriminated unions, branded types, constructive modeling, unknown over any, schemas before guards, no as casts, exhaustiveness, satisfies, and boundary validation.

How it works

SKILL.md has no level-two headings · 28 lines, 478 words

SKILL.md preview
---
name: typescript-forms
description: Katara's TypeScript forms, practiced until every move is exact. Use for typescript-best-practices, /typescript-best-practices, "TypeScript best practices", and whenever reading or editing any .ts or .tsx file. Discriminated unions, branded types, constructive modeling, unknown over any, schemas before guards, no as casts, exhaustiveness, satisfies, and boundary validation.
paths: ["**/*.ts", "**/*.tsx"]
---

# Katara's TypeScript forms

A waterbender drills each form until her hands cannot get it wrong. Then, in a real fight, the form holds without thought. Types are forms for code. Shape them so the wrong move cannot be made, and the compiler holds the line when you are not looking.

Apply Type System Discipline (Earth in `four-elements`) first.

| Form | Summary |
|------|---------|
| Discriminated unions | Model variants with a `kind` literal discriminant so impossible states cannot be represented. No optional-field bags. |
| Branded types | Brand primitives with `& { readonly __brand: "X" }` so they cannot be mixed up. Validate once at the boundary. |
| Constructive modeling | Build the shape so the illegal value cannot be constructed. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, and not a wish for refinement types. |
| Simplest total type | Keep `T[]` while every operation on it stays total. Strengthen to `NonEmpty<T>` only where the loose type forces `!`, a cast, or a "should never happen" throw. |
| `unknown` over `any` | External data is `unknown`. |
| Schemas before guards | Before hand-writing a property-by-property type guard, use the repository's runtime schema library and infer the type from the schema, such as `z.infer`. |
| No `as` casts | Every `as` is a runtime crash waiting to happen. Cast only after validation. |
| Narrowing hierarchy | Discriminant switch, then the `in` operator, then `typeof` or `instanceof`, then a user-defined type guard, and `as` last. |
| Type guards | A guard must verify its claim. A lying guard is worse than `as`, because the bug hides behind a name that says it is safe. Name them `isX` or `hasX`. |
| Exhaustiveness | Inline `const _exhaustive: never = x;` in default arms so the compiler errors when a new variant is added. |
| `satisfies` over `as` | Validates the value without widening literal types. |
| Boundary validation | Parse where data crosses in, into a named domain type. `Record<string, unknown>` (however spelled) stops at that parse. Trust the types inside. See Boundary Discipline (Earth in `four-elements`). |
| Schema-derived types | Reach for `Pick`, `Omit`, `Parameters`, `ReturnType`, `Awaited`, and `typeof` before declaring a new interface. |
| Object args | Pass objects, not positional arguments, so argument order documents itself. Skip this on hot paths (per-frame render, tokenizers, parsers). |
| Real tests | Do not mock what you can run. Prefer the framework's real test primitives with leak and disposable checks, and verify UI in a running build. Mock only what you cannot run locally. See `push-and-pull`. |
| Structured telemetry | Prefer structured logger diagnostics with enough context to debug from an id. No `console.log` in shipped code. |

Examples for every form: [references/patterns.md](references/patterns.md).
Files in this package (2)
  • SKILL.md 3 KB
  • references/patterns.md 9 KB

Versions

The database has no other skills named typescript-forms.

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

Downloads in the last 30 days: 0 · ranking

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

Similar skills

  • 91typescript-best-practices
    TypeScript idioms and type-safety patterns: discriminated unions, branded types, narrowing, boundary validation. Use when reading, writing, or reviewing any .ts or .tsx file.
  • 91typescript-best-practices
    TypeScript best practices. Use when reading or editing any .ts or .tsx file, or for /typescript-best-practices.
  • 87typescript-best-practices
    TypeScript best practices. Use when reading or editing any .ts or .tsx file.
  • 87typescript-best-practices
    TypeScript best practices. Use when reading or editing any .ts or .tsx file.
  • 87typescript-best-practices
    TypeScript best practices. Use when reading or editing any .ts or .tsx file.
  • 82typescript-best-practices
    TypeScript best practices. Use when reading or editing any .ts or .tsx file.

Feedback and reports

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