ts-code-style-conventions
Installation
SKILL.md
TypeScript Code Style Conventions
Overview
This developer's personal TypeScript style, independent of framework — applies equally to a NestJS service, an Angular component, or a plain library module. Layer this under any stack-specific skill (nestjs-personal-conventions, angular-personal-conventions); it governs naming and structure, not architecture.
Quick Reference
| Concern | Rule |
|---|---|
| Interface/type naming | No Interface suffix, no meaningless filler words (Data, Info) |
| Field ordering | Required fields first, optional (field?: T) last — in interfaces, types, and DTO/class fields |
Non-null assertion (!) |
Forbidden outside the one documented DTO-validation exception (see nestjs-personal-conventions) |
| Class member ordering | Inputs → outputs → fields (public→protected→private) → constructor → methods (public→protected→private) |
| Method parameters | 3+ params → one named object, destructured |
| Blank lines in a method body | Separate logical groups (guard clauses, data prep, calls, result handling) |
let + later reassignment |
Extract to a function that returns the value; assign a const from its call |
| Magic numbers | Named constant or arithmetic from obvious base units, never an opaque literal |
| Module growing past one file | Split by kind — see the table below |