typescript
TypeScript and JavaScript conventions
These are the language rules for every piece of TS/JS in a codebase, independent of where it runs - browser, Node, bundler script, service worker, browser extension. A framework adds its own layer on top (angular-conventions for Angular); this skill is purely the language. Baseline is TypeScript 5+.
The single organizing idea: the compiler is the cheapest test you have. Configure it to be strict, describe your data so it can check the data, and never quietly disable it.
The concrete tooling and the rule-by-rule style live in references/typescript-style.md - the tsconfig (@tsconfig/strictest), the ESLint flat config (typescript-eslint strictTypeChecked + stylisticTypeChecked), Prettier, .editorconfig, and the naming / interface-vs-type / import / class-member rules those tools enforce. This SKILL.md owns the conceptual model below; where the two overlap, the reference is authoritative on the concrete rule. Above both, a project's own config (its .editorconfig, eslint.config.mjs, .prettierrc, tsconfig.json) and its docs/PROJECT-CODE-STYLE.md are higher priority - follow the project where it diverges.
Make the compiler strict, then stricter
strict: true is non-negotiable - it is the floor, not the goal. On top of it, turn on the flags that catch the bugs strict alone misses:
noUncheckedIndexedAccess-arr[i]andrecord[key]becomeT | undefined, which is the truth. This is the single highest-value extra flag.exactOptionalPropertyTypes-x?: Tstops silently acceptingx: undefined, so an optional property and a present-but-undefined one are no longer conflated.noImplicitOverride- an override must sayoverride, so a renamed base method surfaces as an error instead of a silent shadow.noFallthroughCasesInSwitchandnoImplicitReturns- close the two control-flow holes where a path returns nothing or falls through unintentionally.
Keep these in one shared base tsconfig and have each project extends it. A per-project config that redefines the flags drifts; one that inherits them cannot.