google-typescript-style

Applies Google's TypeScript style guide rules when writing or reviewing TypeScript code.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/chughtapan/google-guide-skills --skill google-typescript-style-chughtapan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: google-typescript-style
Source: https://github.com/chughtapan/google-guide-skills/tree/main/skills/google-typescript-style
Command: npx skills add https://github.com/chughtapan/google-guide-skills --skill google-typescript-style-chughtapan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TypeScript codebases drift into inconsistent patterns for imports, exports, naming, type usage, and error handling, making code harder to review and maintain. This Skill encodes Google's TypeScript Style Guide so an agent can write and review TypeScript against a single authoritative set of conventions. ## Core Features & Use Cases - Module and import conventions: Enforces named exports, ES6 module syntax, relative import paths, and bans namespaces, default exports, and mutable exports. - Type-system guidance: Covers type inference, interfaces over type aliases, unknown over any, avoiding {} and wrapper types, and safe handling of type and non-nullability assertions. - Code quality rules: Covers const/let usage, readonly properties, accessor rules, switch statement defaults, strict equality, throwing only Error subclasses, and JSDoc documentation of top-level exports. - Use Case: While reviewing a pull request that adds a new TypeScript service, the agent flags a default export, a var declaration, and an as Foo assertion on an object literal, and suggests the compliant alternatives. ## Quick Start Review this TypeScript file using the google-typescript-style skill and list every violation of Google's TypeScript style conventions.

Frequently Asked Questions about google-typescript-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply Google's TypeScript style guide to my code?

Load this Skill and ask the agent to write or review TypeScript code. It enforces rules on imports, exports, naming, types, error handling, and documentation drawn directly from Google's published TypeScript Style Guide.

What TypeScript style rules does Google enforce for imports and exports?

Google requires named exports only, bans default exports and mutable exports, and requires ES6 module syntax instead of namespaces or require(). Relative imports are preferred within the same project, and import type is used for type-only symbols.

Should I use any or unknown in TypeScript under Google's style guide?

Prefer unknown over any because unknown prevents dereferencing arbitrary properties and forces type narrowing with guards. The guide recommends avoiding any entirely, or documenting why a lint suppression is justified.

Does this style guide apply to plain JavaScript files?

No, this Skill is scoped to TypeScript only. For plain JavaScript code, use the google-javascript-style skill instead, as stated in the Skill's own description.

When are type assertions allowed in Google-style TypeScript?

Type assertions and non-nullability assertions are discouraged because they bypass runtime checks. They are acceptable only with an obvious or commented justification, and object literals should use type annotations instead of as-casts.