Comprehensive TypeScript style guide based on Google's internal standards, designed for AI agents and LLMs. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
Writing new TypeScript code
Organizing modules and imports
Designing type annotations and interfaces
Creating classes and functions
Reviewing code for style consistency
Refactoring existing TypeScript code
Rule Categories by Priority
Priority
Category
Impact
Prefix
1
Module Organization
CRITICAL
module-
2
Type Safety
CRITICAL
types-
3
Class Design
HIGH
class-
4
Function Patterns
HIGH
func-
5
Control Flow
MEDIUM-HIGH
control-
6
Error Handling
MEDIUM
error-
7
Naming & Style
MEDIUM
naming-
8
Literals & Coercion
LOW-MEDIUM
literal-
Quick Reference
1. Module Organization (CRITICAL)
module-named-exports - Use named exports over default exports
Read individual reference files for detailed explanations and code examples:
Section definitions - Category structure and impact levels
Rule template - Template for adding new rules
Reference Files
File
Description
AGENTS.md
Complete compiled guide with all rules
references/_sections.md
Category definitions and ordering
assets/templates/_template.md
Template for new rules
metadata.json
Version and reference information
1---2name: ts-google3description: Google TypeScript Best Practices4---5# Google TypeScript Best Practices67Comprehensive TypeScript style guide based on Google's internal standards, designed for AI agents and LLMs. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.89## When to Apply1011Reference these guidelines when:12- Writing new TypeScript code13- Organizing modules and imports14- Designing type annotations and interfaces15- Creating classes and functions16- Reviewing code for style consistency17- Refactoring existing TypeScript code1819## Rule Categories by Priority2021| Priority | Category | Impact | Prefix |22|----------|----------|--------|--------|23| 1 | Module Organization | CRITICAL | `module-` |24| 2 | Type Safety | CRITICAL | `types-` |25| 3 | Class Design | HIGH | `class-` |26| 4 | Function Patterns | HIGH | `func-` |27| 5 | Control Flow | MEDIUM-HIGH | `control-` |28| 6 | Error Handling | MEDIUM | `error-` |29| 7 | Naming & Style | MEDIUM | `naming-` |30| 8 | Literals & Coercion | LOW-MEDIUM | `literal-` |3132## Quick Reference3334### 1. Module Organization (CRITICAL)3536- [`module-named-exports`](references/module-named-exports.md) - Use named exports over default exports37- [`module-no-mutable-exports`](references/module-no-mutable-exports.md) - Avoid mutable exports38- [`module-es6-modules`](references/module-es6-modules.md) - Use ES6 modules exclusively39- [`module-no-namespaces`](references/module-no-namespaces.md) - Avoid TypeScript namespaces40- [`module-import-paths`](references/module-import-paths.md) - Use relative paths for project imports41- [`module-import-type`](references/module-import-type.md) - Use import type for type-only imports42- [`module-export-api-surface`](references/module-export-api-surface.md) - Minimize exported API surface4344### 2. Type Safety (CRITICAL)4546- [`types-no-any`](references/types-no-any.md) - Never use the any type47- [`types-prefer-interfaces`](references/types-prefer-interfaces.md) - Prefer interfaces over type aliases for objects48- [`types-explicit-structural`](references/types-explicit-structural.md) - Explicitly annotate structural types49- [`types-nullable-patterns`](references/types-nullable-patterns.md) - Handle nullable types correctly50- [`types-array-syntax`](references/types-array-syntax.md) - Use consistent array type syntax51- [`types-no-wrapper-types`](references/types-no-wrapper-types.md) - Never use wrapper object types52- [`types-prefer-map-set`](references/types-prefer-map-set.md) - Prefer Map and Set over index signatures53- [`types-no-empty-object`](references/types-no-empty-object.md) - Avoid empty object type5455### 3. Class Design (HIGH)5657- [`class-parameter-properties`](references/class-parameter-properties.md) - Use parameter properties for constructor assignment58- [`class-readonly-properties`](references/class-readonly-properties.md) - Mark properties readonly when never reassigned59- [`class-no-private-fields`](references/class-no-private-fields.md) - Use TypeScript private over private fields60- [`class-no-static-containers`](references/class-no-static-containers.md) - Avoid container classes with only static members61- [`class-constructor-parens`](references/class-constructor-parens.md) - Always use parentheses in constructor calls62- [`class-no-prototype-manipulation`](references/class-no-prototype-manipulation.md) - Never manipulate prototypes directly6364### 4. Function Patterns (HIGH)6566- [`func-declarations-over-expressions`](references/func-declarations-over-expressions.md) - Prefer function declarations over expressions67- [`func-arrow-concise-bodies`](references/func-arrow-concise-bodies.md) - Use concise arrow function bodies appropriately68- [`func-avoid-this-rebinding`](references/func-avoid-this-rebinding.md) - Avoid rebinding this69- [`func-rest-parameters`](references/func-rest-parameters.md) - Use rest parameters over arguments70- [`func-generator-syntax`](references/func-generator-syntax.md) - Use correct generator function syntax71- [`func-default-parameters`](references/func-default-parameters.md) - Use default parameters sparingly7273### 5. Control Flow (MEDIUM-HIGH)7475- [`control-always-use-braces`](references/control-always-use-braces.md) - Always use braces for control structures76- [`control-triple-equals`](references/control-triple-equals.md) - Always use triple equals77- [`control-for-of-iteration`](references/control-for-of-iteration.md) - Prefer for-of over for-in for arrays78- [`control-switch-default`](references/control-switch-default.md) - Always include default case in switch79- [`control-no-assignment-in-condition`](references/control-no-assignment-in-condition.md) - Avoid assignment in conditional expressions8081### 6. Error Handling (MEDIUM)8283- [`error-throw-errors`](references/error-throw-errors.md) - Always throw Error instances84- [`error-catch-unknown`](references/error-catch-unknown.md) - Type catch clause variables as unknown85- [`error-empty-catch-comments`](references/error-empty-catch-comments.md) - Document empty catch blocks86- [`error-avoid-assertions`](references/error-avoid-assertions.md) - Avoid type and non-null assertions8788### 7. Naming & Style (MEDIUM)8990- [`naming-identifier-styles`](references/naming-identifier-styles.md) - Use correct identifier naming styles91- [`naming-descriptive-names`](references/naming-descriptive-names.md) - Use descriptive names92- [`naming-no-decorative-underscores`](references/naming-no-decorative-underscores.md) - Avoid decorative underscores93- [`naming-no-interface-prefix`](references/naming-no-interface-prefix.md) - No I prefix for interfaces94- [`naming-constants`](references/naming-constants.md) - Use CONSTANT_CASE for true constants9596### 8. Literals & Coercion (LOW-MEDIUM)9798- [`literal-single-quotes`](references/literal-single-quotes.md) - Use single quotes for strings99- [`literal-number-formats`](references/literal-number-formats.md) - Use correct number literal formats100- [`literal-explicit-coercion`](references/literal-explicit-coercion.md) - Use explicit type coercion101- [`literal-array-constructor`](references/literal-array-constructor.md) - Avoid Array constructor102103## How to Use104105Read individual reference files for detailed explanations and code examples:106107- [Section definitions](references/_sections.md) - Category structure and impact levels108- [Rule template](assets/templates/_template.md) - Template for adding new rules109110## Reference Files111112| File | Description |113|------|-------------|114| [AGENTS.md](AGENTS.md) | Complete compiled guide with all rules |115| [references/_sections.md](references/_sections.md) | Category definitions and ordering |116| [assets/templates/_template.md](assets/templates/_template.md) | Template for new rules |117| [metadata.json](metadata.json) | Version and reference information |
Run npx skillmds@latest add comeonoliver/ts-google in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Google TypeScript Best Practices It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
ComeOnOliver (@comeonoliver) published this skill. Their other Agent Skills are listed on their SkillMD profile.