TypeScript best practices. Use when reading or editing any .ts or .tsx file.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# TypeScript best practices
Apply **principle-type-system-discipline** (`${CLAUDE_SKILL_DIR}/../poteto-mode/principles/principle-type-system-discipline.md`) first.
| Rule | Summary |
|------|---------|
| Discriminated unions | Model variants with a `kind` literal discriminant so impossible states can't be represented. No optional-field bags. |
| Branded types | Brand primitives with `& { readonly __brand: "X" }` so they can't be mixed up. Validate once at the boundary. |
| Constructive modeling | Build the shape so the illegal value can't be constructed. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, 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`. |
…
The line at the top of this page pins the label git:20260923.11fd787, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
GET https://markdownregistry.com/api/v1/artifacts/art_ntppumkwrew4xq56
GET https://markdownregistry.com/api/v1/resolve?ref=lucasheriques/pstack/typescript-best-practices
GET https://markdownregistry.com/api/v1/blob/08a59ab1b2e1d6c72f13fb0716abb04b005a24cf9c4a8084ed1a4836c6275a62
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
lucasheriques/pstack · .claude/skills/sync-upstream/SKILL.md · Merge the latest cursor/plugins pstack into this Claude Code port. Use for "sync upstream", "update pstack from…
lucasheriques/pstack · skills/architect/SKILL.md · Sketch types, signatures, and module structure before code, then stay in the loop while implementation fills in. Use…
lucasheriques/pstack · skills/arena/SKILL.md · Spawn N parallel candidates at the same task, pick a base, graft the strongest parts of the losers into it. Use for…
lucasheriques/pstack · skills/automate-me/SKILL.md · Use for "automate me", "create/update/refresh my -mode skill", "turn/capture my preferences or working style into a…
lucasheriques/pstack · skills/benchmark-checklist/SKILL.md · Vet a perf measurement (limiter, tuning, limits, errors, repeatability, relevance, and whether the work happened)…
lucasheriques/pstack · skills/blast-radius/SKILL.md · Find what a change could break somewhere else before it ships, beyond the diff, and prove the one fact it's safe…
lucasheriques/pstack · skills/correct/SKILL.md · Find the mistakes agents keep repeating in this repo and make each one impossible. Try architecture first, then types…
lucasheriques/pstack · skills/create-verification-skill/SKILL.md · Generate a project-local verification skill that drives your app the way a user does — any language, framework, or…
lucasheriques/pstack · skills/figure-it-out/SKILL.md · Design an auditable playbook when no narrower one fits: a large migration, an ambitious multi-part change, or work a…
lucasheriques/pstack · skills/how/SKILL.md · Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions…
cursor/plugins · harness/pstack/claude-code/skills/typescript-best-practices/SKILL.md · TypeScript best practices. Use when reading or editing any .ts or .tsx file.
michael-denyer/pstack-claude · plugins/pstack/skills/typescript-best-practices/SKILL.md · TypeScript best practices. Use when reading or editing any .ts or .tsx file.
hoangnguyen0403/agent-skills-standard · .claude/skills/typescript/typescript-best-practices/SKILL.md · Write idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes…
hoangnguyen0403/agent-skills-standard · .agents/skills/typescript/typescript-best-practices/SKILL.md · Write idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes…
aiskillstore/marketplace · skills/0xbigboss/typescript-best-practices/SKILL.md · Use when reading or writing TypeScript or JavaScript files (.ts, .tsx, .js, tsconfig.json).
j-star-films-studios/vibecode-protocol-suite · assets/.agent/skills/web-dev-standards/typescript-standards/SKILL.md · TypeScript best practices. Use when reading or editing any .ts or .tsx file.