typescript-standards
Skill1 starsChanged 5 months agoMITView on GitHub
Cross-cutting language standards for TypeScript (tsconfig.json). Applied ALONGSIDE a runtime standard — nodejs-standards (backend) or react-standards/nextjs-standards (frontend). Covers compiler config (strict), type safety, modules, typescript-eslint, language patterns. Used by the review agents on any TypeScript code. Do NOT use as the sole standard — always pair with the runtime standard.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- gerardbalaoro/skillstheir own version, first seen Nov 1, 2026
- sapientsai/panel-mcp-servertheir own version, first seen Nov 1, 2026
- alexander-zuev/agent-skillstheir own version, first seen Oct 13, 2026
- TangleML/tangle-uitheir own version, first seen Oct 8, 2026
- BTMuli/TeyvatGuidetheir own version, first seen Oct 8, 2026
- AlemTuzlak/skillstheir own version, first seen Aug 3, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- BTMuli/TeyvatGuide★ 434same name
- TangleML/tangle-ui★ 104same name
- AlemTuzlak/skills★ 45same name
- LiorCohen/sdd★ 43same name
- jackleekopij/claude-skills★ 3same name
- rkdxodud-tyk/SKILLS★ 1same name
- sapientsai/panel-mcp-server★ 1same name
- alexander-zuev/agent-skills★ 0same name
- gerardbalaoro/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- custom-standardsSkill
- agent-code-to-confirmSkill
- agent-to-confirmSkill
- claude-guideline-creationSkill
- skill-creatorSkill
- youtube-to-guidelineSkill
- youtube-transcribeSkill
- fastapi-standardsSkill
- general-standardsSkill
- go-standardsSkill
- java-standardsSkill
- nextjs-standardsSkill
- nodejs-standardsSkill
- python-standardsSkill
- react-standardsSkill
- reviewing-codebasesSkill
- rust-standardsSkill
- skill-toggleSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. 0 are common, 2 are distinctive, and 15 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 50
Target: all TypeScript source — backend (Node/NestJS), frontend (React/Next.js), libraries, tooling.
- Very specific: line 73
TS-CONFIG-5 (MUST): Commit a single source-of-truth tsconfig.json (extended per package in a monorepo via extends/project references).
- Very specific: line 83
TS-TYPE-1 (MUST NOT): Use any to bypass the type system.
- Very specific: line 86
TS-TYPE-2 (MUST NOT): Use unchecked type assertions (as Foo, as unknown as Foo) or the non-null assertion !
- Very specific: line 89
Frontend / non-NestJS backends (SHOULD): Use Zod v4 (zod@^4) for runtime boundary validation — it infers TypeScript types from schemas …
- Very specific: line 92
NestJS (SHOULD): Use class-validator + class-transformer (mandated by NODE-NEST-4 in nodejs.md) for DTO validation via decorators — do not …
- Very specific: line 95
TS-TYPE-3 (SHOULD): Prefer the satisfies operator over an annotation when you want a value checked against a type *without* widening it …
- Very specific: line 102
TS-TYPE-6 (SHOULD): Prefer unknown in catch (the useUnknownInCatchVariables default) and narrow.
- Very specific: line 105
TS-TYPE-7 (SHOULD): Use readonly / Readonly<T> / readonly T[] for data that shouldn't be mutated, and immutable parameter types …
- Very specific: line 107
TS-TYPE-8 (SHOULD NOT): Use numeric enums; prefer union string-literal types or as const objects (safer, erasable, better narrowing).
- Very specific: line 126
TS-MOD-1 (MUST): Use ES modules (import/export).
- Very specific: line 128
TS-MOD-2 (MUST): Use type-only imports/exports (import type { X }) for types, so they erase cleanly (required by verbatimModuleSyntax).
- Distinctive: line 131
TS-MOD-3 (MUST NOT): Create circular module dependencies.
- Distinctive: line 132
TS-MOD-4 (SHOULD): Prefer named exports over default exports for better refactoring, tree-shaking, and consistent import names.
- Very specific: line 144
TS-LINT-3 (MUST): Treat these as errors: no-floating-promises (every promise awaited/handled — extends NODE-ASYNC-2), no-misused-promises, …
- Very specific: line 155
TS-PAT-2 (SHOULD): Use interface for object/contract shapes that may be extended/implemented.
- Very specific: line 158
TS-PAT-3 (SHOULD): Prefer precise utility types (Pick, Omit, Partial, Record, ReturnType, template-literal types) over restating shapes.
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeScript Coding Standard (v1.0)
Status: Locked v1.0. TypeScript is a language, not a runtime, so this is a cross-cutting language standard: it is always applied alongside a runtime standard —
nodejs.md(backend; NestJS already requires this doc) or the React/Next.js standards (frontend). Those runtime standards own runtime concerns (security, logging, dependency/supply-chain, test infrastructure, framework wiring); this document owns type safety, the compiler config, and language-level patterns, and does not repeat them.On adoption this becomes
.claude/skills/typescript-standards/SKILL.md+references/*.md.
Toolchain verified current as of 2026-06-13 (via Context7 + npm): TypeScript 6.0.x, typescript-eslint 8.x (flat config),
tsx4.x. Rules are written version-agnostically; these are reference points, not pins.
How to read this document
Constraint language (RFC 2119)
- MUST / MUST NOT — hard requirement; a violation is a blocking issue.
- SHOULD / SHOULD NOT — strong recommendation; deviate only with a written
// Justification:. - MAY — optional.
Rule IDs
Stable TS-AREA-NUMBER (e.g. TS-TYPE-3). The reviewer MUST cite the rule ID. Never renumber.
Severity mapping
| This document says… | Reviewer severity | Gate |
MUST/MUST NOT affecting type soundness / security | Critical | Blocks merge |
MUST/MUST NOT elsewhere | Critical / Warning (by impact) | Blocks if it risks correctness |
SHOULD without justification | Warning | Should fix |
MAY / stylistic | Suggestion | Nice to have |
Scope & Assumptions
- Target: all TypeScript source — backend (Node/NestJS), frontend (React/Next.js), libraries, tooling.
- Pairs with a runtime standard. Apply this together with
nodejs.mdor the frontend standards; on overlap, the stricter rule wins. - Type-checking is mandatory and blocking —
tsc --noEmit(or the build's type-check) MUST pass in CI. - Custom overrides: the project's
custom-standardsskill overrides this document on conflict.
1. Compiler Configuration
- TS-CONFIG-1 (MUST): Enable
"strict": trueintsconfig.json(the master flag — turns onnoImplicitAny,strictNullChecks,strictFunctionTypes,useUnknownInCatchVariables,alwaysStrict, etc.). New projects MUST NOT disable individual strict sub-flags without a written justification. - TS-CONFIG-2 (SHOULD): Enable the extra safety flags not included in
strict:noUncheckedIndexedAccess(array/record access yieldsT | undefined),exactOptionalPropertyTypes,noImplicitOverride,noFallthroughCasesInSwitch, andnoImplicitReturns. - TS-CONFIG-3 (MUST): Type errors are build failures — CI runs a type-check (
tsc --noEmitor the framework's equivalent) and it MUST pass. Do not ship code with type errors suppressed wholesale. - TS-CONFIG-4 (SHOULD): Set a modern
target/liband explicitmodule/moduleResolution("bundler"or"nodenext"as appropriate). EnableisolatedModulesandverbatimModuleSyntaxso the code is safe for single-file transpilers (esbuild/swc/tsx). - TS-CONFIG-5 (MUST): Commit a single source-of-truth
tsconfig.json(extended per package in a monorepo viaextends/project references). Tool and editor must read the same config. - TS-CONFIG-6 (SHOULD): Extend
@tsconfig/strictestas the base ("extends": "@tsconfig/strictest/tsconfig.json"). This preset enables everything in TS-CONFIG-1 and TS-CONFIG-2 in one line and is maintained by the TypeScript team. Override individual flags only with a written// Justification:.
2. Type Safety
- TS-TYPE-1 (MUST NOT): Use
anyto bypass the type system. Preferunknownat untyped boundaries and narrow before use. An unavoidableanyMUST be localized and carry// Justification:; enable@typescript-eslint/no-explicit-any. - TS-TYPE-2 (MUST NOT): Use unchecked type assertions (
as Foo,as unknown as Foo) or the non-null assertion!to silence the compiler. Narrow with runtime checks / type guards, or validate with a schema at external boundaries.as constandsatisfiesare fine.- Frontend / non-NestJS backends (SHOULD): Use Zod v4 (
zod@^4) for runtime boundary validation — it infers TypeScript types from schemas (z.infer<typeof schema>), eliminating the need to maintain parallel type definitions. - NestJS (SHOULD): Use
class-validator+class-transformer(mandated by NODE-NEST-4 innodejs.md) for DTO validation via decorators — do not introduce a conflicting Zod layer on the same DTOs.
- Frontend / non-NestJS backends (SHOULD): Use Zod v4 (
- TS-TYPE-3 (SHOULD): Prefer the
satisfiesoperator over an annotation when you want a value checked against a type without widening it (keeps literal/precise types). - TS-TYPE-4 (MUST): Annotate the return type of exported/public functions and module boundaries; rely on inference for local variables. Don't annotate what inference gets right.
- TS-TYPE-5 (SHOULD): Model "one of N" states with discriminated unions, and make
switchhandling exhaustive via anevercheck in the default branch — so adding a variant becomes a compile error. - TS-TYPE-6 (SHOULD): Prefer
unknownincatch(theuseUnknownInCatchVariablesdefault) and narrow; MUST NOT type a caught error asany. Throw and expectErrorsubclasses, never strings/objects. - TS-TYPE-7 (SHOULD): Use
readonly/Readonly<T>/readonly T[]for data that shouldn't be mutated, and immutable parameter types (ReadonlyArray,Readonly) for inputs you don't own. - TS-TYPE-8 (SHOULD NOT): Use numeric
enums; prefer union string-literal types oras constobjects (safer, erasable, better narrowing).const enumis disallowed underisolatedModules.
// ✅ exhaustive discriminated union (TS-TYPE-5)
type Shape = { kind: "circle"; r: number } | { kind: "square"; size: number };
function area(s: Shape): number {
switch (s.kind) {
case "circle": return Math.PI * s.r ** 2;
case "square": return s.size ** 2;
default: { const _exhaustive: never = s; return _exhaustive; } // compile error if a kind is added
}
}3. Modules & Imports
- TS-MOD-1 (MUST): Use ES modules (
import/export). MUST NOT usenamespace/moduleconstructs orrequirein new code. - TS-MOD-2 (MUST): Use type-only imports/exports (
import type { X }) for types, so they erase cleanly (required byverbatimModuleSyntax). Enable@typescript-eslint/consistent-type-imports. - TS-MOD-3 (MUST NOT): Create circular module dependencies.
- TS-MOD-4 (SHOULD): Prefer named exports over default exports for better refactoring, tree-shaking, and consistent import names.
4. Linting (typescript-eslint)
- TS-LINT-1 (MUST): Lint with typescript-eslint in flat config (
eslint.config.ts) on top of the runtime standard's ESLint base, and it MUST pass in CI. Formatting is delegated to Prettier (per the runtime standard) — type-aware lint here covers correctness, not style. - TS-LINT-2 (MUST): Enable the type-checked ruleset (
recommendedTypeChecked/strictTypeChecked) so rules that need type information run. - TS-LINT-3 (MUST): Treat these as errors:
no-floating-promises(every promise awaited/handled — extendsNODE-ASYNC-2),no-misused-promises,no-explicit-any, and theno-unsafe-*family (no-unsafe-assignment/return/argument/member-access/call).
5. Language Patterns & Readability
- TS-PAT-1 (SHOULD): Naming —
camelCasefor variables/functions,PascalCasefor types, interfaces, classes, and enums-replacement unions,UPPER_SNAKE_CASEfor true constants. Don't prefix interfaces withI. - TS-PAT-2 (SHOULD): Use
interfacefor object/contract shapes that may be extended/implemented; usetypefor unions, tuples, mapped/conditional types, and function types. Be consistent within a module. - TS-PAT-3 (SHOULD): Prefer precise utility types (
Pick,Omit,Partial,Record,ReturnType, template-literal types) over restating shapes; derive types from a single source of truth rather than duplicating them. - TS-PAT-4 (SHOULD NOT): Over-engineer types — deeply nested conditional/recursive generics that hurt readability and compile time are a smell. Favor the simplest type that is sound.
Resolved Decisions (v1.0)
| # | Question | Decision | Rule |
| 1 | noUncheckedIndexedAccess + exactOptionalPropertyTypes — MUST or SHOULD? | SHOULD — high friction; TypeScript team intentionally excluded them from strict | TS-CONFIG-2 |
| 2 | Validation library | Zod v4 for frontend/non-Nest; class-validator for NestJS (per NODE-NEST-4) | TS-TYPE-2 |
| 3 | tsconfig base | Extend @tsconfig/strictest — covers all §1 flags in one preset | TS-CONFIG-6 |
| 4 | Depth | Lean — no bundled reference configs; keep standard self-contained | — |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

