typescript-conventionslisted
Install: claude install-skill andr-ca/agentharness
# TypeScript Conventions
This file is self-contained for day-to-day use. Deeper reference (needs
the full harness checkout): `languages/typescript/CONVENTIONS.md` (full
examples including generics and import grouping) and
`frameworks/react/CONVENTIONS.md` (React/JSX-specific additions).
## Naming
- `camelCase` — functions, variables, method names.
`PascalCase` — classes, interfaces, type aliases, enum names.
`UPPER_SNAKE_CASE` — module-level constants.
- Enum members: `PascalCase`.
- Generic type params: `T`/`U` for simple one-liners; descriptive names
(`TEntity`, `TResponse`) for complex or nested generics.
## Imports & module structure
Group: external packages → internal modules → type-only imports.
Separate each group with a blank line. Prefer `import type` for
type-only imports (helps tools that strip types without full parsing).
```typescript
import fs from 'fs';
import express from 'express';
import { UserRepository } from './repositories/UserRepository';
import type { User } from './types';
```
## Private members: `#` over `_prefix`
Prefer native `#` private fields (ES2022+/TS 3.8+) in new code — real
runtime privacy, not a convention that's still readable via `["_name"]`.
Don't rewrite working `_prefix` code on sight; it's not deprecated.
```typescript
class TokenStore {
#tokens: Map<string, string> = new Map(); // true runtime privacy
#rotate(): void { /* ... */ }
}
```
## Null vs. Undefined
Pick based on what *absence means*, then apply it c