Borrowing it
Nothing to install: this file belongs to robconery/kolea. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/robconery/kolea/main/.claude/skills/typescript-best-practices/SKILL.mdgit clone --depth 1 https://github.com/robconery/koleaWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/robconery/kolea/typescript-best-practices)<a href="https://agentmods.dev/skills/robconery/kolea/typescript-best-practices"><img src="https://agentmods.dev/badge/skills/robconery/kolea/typescript-best-practices/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/robconery/kolea/typescript-best-practices"><img src="https://agentmods.dev/badge/skills/robconery/kolea/typescript-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00168 | $0.01700 |
| Opus 5.5 | $0.00067 | $0.00680 |
| Sonnet 5.5 | $0.00034 | $0.00340 |
| Haiku 4.5 | $0.00017 | $0.00170 |
Grade A, and why
typescript-best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
2 near-identical copies found in the catalogue:
- typescript-best-practices — 100% identical, 0 lines differ
- typescript-best-practices — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 123 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TypeScript Best Practices & Idioms
How to write TypeScript that the compiler can actually protect: model
illegal states out of existence, prefer narrow types over any, make
invariants explicit, and keep runtime behavior (serialization, equality,
errors) predictable.
🎯 Why: Design for Change
The goal of writing software is to be able to change it safely. Strict
types, discriminated unions, branded types, and Result errors turn the
compiler into a change-detector: when a shape moves, every caller lights
up. any and loose types are change-hiders — they make the next edit
look safe while it isn't. Idiomatic TS exists to keep the next refactor
mechanical instead of archaeological.
This skill is about idioms and conventions. For OO design pressure use
solid-principles and design-principles; for named patterns use
gof-patterns. This skill does not re-explain those.
How to use this skill
- Match the symptom in the decision guide to a rule.
- Open
references/idioms.mdfor that rule's full rationale, a bad example, the idiomatic refactor, and when not to apply it. - Copy the closest file from
templates/and adapt it. The templates already encode the conventions below (strict types,toString/toJSON, exhaustiveness) so you start compliant instead of retrofitting. - Apply the smallest change that removes real pain. Strictness is earned
by demonstrated bugs, not applied as ceremony — but the defaults here
(strict tsconfig, no
any, no floating promises) are non-negotiable because their failure mode is silent.
Project rule: every class has toString() and toJSON()
This is a hard convention in this codebase, not a suggestion.
toJSON()— returns a plain, serializable object.JSON.stringifycalls it automatically, so logs, API responses, and persistence get a stable, intentional shape instead of leaking private fields, class internals, orundefined. Never return the instance itself.toString()— returns a short human-readable identifier for logs, error messages, and template literals (`order ${order}`). It is for humans;toJSON()is for machines. They are not interchangeable.
What ships with it
10 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/idioms.md 12 KB
- references/tostring-tojson.md 4.9 KB
- templates/app-error.ts 2.7 KB runs code
- templates/branded-type.ts 1.6 KB runs code
- templates/discriminated-union.ts 2.0 KB runs code
- templates/entity.ts 2.9 KB runs code
- templates/result.ts 2.2 KB runs code
- templates/tsconfig.json 1.5 KB
- templates/type-guards.ts 2.3 KB runs code
- templates/value-object.ts 2.7 KB runs code
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 123 lines · 168 tokens per session scan A 41185480f765
typescript-best-practices is a skill published in the GitHub repository robconery/kolea (11 stars, last pushed 28d ago), licensed MIT. It adds 168 tokens to every session and 1,700 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
supermemory
Supermemory is a state-of-the-art memory and context infrastructure for AI agents. Use this skill when building applications that need persistent memory, user personalization, long-term context retention, or semantic search across knowledge bases. It provides Memory API for learned user context, User Profiles for…
better-t-stack
Create or extend an end-to-end type-safe TypeScript project with Better-T-Stack (create-better-t-stack). Use when the user wants to start, scaffold or bootstrap an app, API, fullstack project or monorepo with any of Next.js, TanStack Router or Start, React Router, Nuxt, Svelte, Solid, Astro, React Native, Hono…
drizzle-orm
Use when modeling data or querying with Drizzle ORM in TypeScript — pgTable schema in .ts, type-safe select/insert/relational queries, drizzle-kit migrations. NOT Prisma Client or schema.prisma (that is prisma-orm), NOT ORM-agnostic migration strategy (that is db-migrations), NOT Postgres engine tuning or EXPLAIN…
add-export
Add a new subpath export to the @cyanheads/mcp-ts-core package. Use when creating a new public API surface that consumers import from a dedicated subpath (e.g., @cyanheads/mcp-ts-core/newutil).
novu-framework-integration
Build code-first notification workflows with @novu/framework. Use when defining workflows in TypeScript (Zod / JSON Schema / Class Validator), composing channel steps (email, SMS, push, chat, in-app) with action steps (delay, digest, custom), exposing Step Controls for non-technical teammates, rendering…
typescript-best-practices
TypeScript best practices. Use when reading or editing any .ts or .tsx file.