| name | ts-conventions |
| description | ALWAYS use this skill BEFORE writing or modifying ANY TypeScript code (.ts, .tsx files), even for simple scripts. Enforces Google TypeScript Style Guide conventions (GOOGLE- prefix), validates naming, type system usage, module organization, and more against ts-guidelines.txt. This skill is MANDATORY for all TypeScript development. |
| license | CC-BY-3.0 |
| metadata | {"author":"veeso","version":"1.0.0","tags":["typescript","conventions","linting","google"]} |
TypeScript Development
This skill automatically enforces TypeScript coding standards and best practices when creating or modifying TypeScript code.
Guidelines
Conventions use the GOOGLE- prefix, derived from the Google TypeScript Style Guide. The full guidelines are in ts-guidelines.txt.
Rules are identified by their section anchor from the upstream guide (e.g., section with anchor identifiers becomes GOOGLE-IDENTIFIERS). These identifiers are for referencing rules in discussion only.
Custom conventions maintained by this repository use the X- prefix and live in custom-guidelines.txt. They extend the Google guidelines and take precedence where the two conflict.
NEVER write convention identifiers as code comments (e.g., // GOOGLE-IDENTIFIERS ...). Apply the conventions silently; do not annotate code with the rule that motivated it.
Instructions
CRITICAL: This skill MUST be invoked for ANY TypeScript code operation, including:
- Creating new .ts or .tsx files (even simple examples)
- Modifying existing TypeScript files (any change, no matter how small)
- Reviewing TypeScript code
- Refactoring TypeScript code
Process:
- Read ts-guidelines.txt and custom-guidelines.txt to understand all compliance requirements
- Before writing/modifying ANY TypeScript code, ensure edits conform to the guidelines
- Use
const and let; never use var (GOOGLE-VARIABLES)
- Use TypeScript's type system fully: prefer interfaces for object shapes, use type aliases for unions/intersections (GOOGLE-INTERFACES-VS-TYPE-ALIASES)
- Follow Google naming conventions: camelCase for variables/functions/methods, PascalCase for classes/interfaces/types/enums, CONSTANT_CASE for global constants (GOOGLE-IDENTIFIERS)
- Do NOT use
any; prefer unknown when the type is truly unknown (GOOGLE-ANY)
- Use readonly where possible; avoid mutation (GOOGLE-TYPE-ASSERTIONS)
- Do NOT use TypeScript namespaces (
namespace/module); use ES modules (GOOGLE-NAMESPACES-VS-MODULES)
- Do NOT use decorators except in frameworks that require them (GOOGLE-DECORATORS)
- Do NOT use
@ts-ignore; use @ts-expect-error with explanation if suppression is needed
- Prefer optional chaining (
?.) and nullish coalescing (??) over explicit null checks
- ALWAYS annotate explicit return types on functions and methods (X-EXPLICIT-RETURN-TYPES); only inline anonymous callbacks and fully left-hand-typed expressions are exempt
- Comments must ALWAYS be written in American English, unless the user explicitly requests a different language
No exceptions: Even for trivial code, guidelines must be followed.