Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/thesethrose/devrules/typescript5git clone --depth 1 https://github.com/TheSethRose/DevRulesWhat 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 | $0.00000 | $0.00932 |
| Opus 5 | $0.00000 | $0.00466 |
| Sonnet 5 | $0.00000 | $0.00186 |
| Haiku 4.5 | $0.00000 | $0.00093 |
Grade A, and why
TypeScript5 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TypeScript Best Practices
tsconfig.json Configuration
- Enable
strictmode (or individual strict flags likestrictNullChecks,noImplicitAny,strictFunctionTypes, etc.). This is the most crucial step for leveraging TypeScript's safety features. - Configure
targetandmoduleappropriately for your runtime environment (e.g.,ES2022or higher for modern Node/browsers, appropriate module system likeNodeNextorESNext). - Set up
baseUrlandpathsfor non-relative module resolution if needed, especially in larger projects or monorepos. - Understand compiler options related to JSX (
jsx,jsxFactory, etc.) if using React/JSX. - Configure declaration file generation (
declaration,declarationMap,outDir) if building a library.
Type System & Definitions
- Avoid
any. Useunknownwhen the type is truly unknown and perform type checking/narrowing before use. - Use explicit types for function parameters, return values, and variable declarations where inference is not sufficient or clear.
- Prefer specific types over overly broad ones (e.g.,
stringoverany,"success" | "error"overstring). - Use
interfacefor defining the shape of objects or implementing classes. - Use
typefor creating aliases for unions, intersections, tuples, primitives, and using utility types. - Leverage built-in Utility Types (
Partial,Required,Readonly,Pick,Omit,Record, etc.) to manipulate existing types effectively. - Use Generics (
<T>) to create reusable components, functions, and types that can work over a variety of types. - Use
readonlymodifiers for properties that should not be reassigned after object creation. - Utilize Discriminated Unions (tagged unions) with literal types to create type-safe state machines or variant types.
Type Narrowing & Guards
- Rely on TypeScript's control flow analysis for automatic type narrowing (e.g., within
ifchecks,switchstatements,instanceofchecks). - Use
typeofchecks for primitives. - Use
instanceofchecks for classes. - Use the
inoperator to check for property existence. - Create custom Type Guard functions (
value is Type) for complex validation logic.
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.
- yesterday First seen · 62 lines · 932 tokens per session scan A 304d45225e9d
TypeScript5 is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 932 tokens. 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-30.
Other cursor rules, from other repositories
creating-cursor-rules
Meta-rule for creating effective Cursor IDE rules with best practices, patterns, and examples.
prpm-json-best-practices
Best practices for structuring prpm.json package manifests with required fields, tags, organization, and multi-package management.
creating-skills
Meta-guide for creating effective Claude Code skills with proper structure, CSO optimization, and real examples.
beanstalk-deploy
Robust deployment patterns for Elastic Beanstalk with GitHub Actions, Pulumi, and edge case handling.
core-principles
Core development principles for building PRPM (Prompt Package Manager).
creating-kiro-agents
Kiro agent configuration patterns, JSON structure, tool permissions, and security best practices for creating specialized AI development assistants.