standards-typescript
Skill0 starsChanged 4 months agoMITView on GitHub
Use this skill whenever you write, review, or design TypeScript code or APIs, including types, generics, narrowing, module structure, and naming, even when the user only asks for a small change. Follows the Google TypeScript Style Guide. Load standards-code for the language-neutral baseline.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- axrmxv/claude-configtheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- axrmxv/claude-config★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- mcpSkill
- pattern-orchestration-complexSkill
- pattern-task-breakdownSkill
- role-architectSkill
- role-code-reviewSkill
- role-data-engineerSkill
- role-developerSkill
- role-orchestratorSkill
- role-product-engineerSkill
- role-qa-engineerSkill
- role-security-auditorSkill
- role-site-reliability-engineerSkill
- role-technical-writerSkill
- standards-analysisSkill
- standards-api-designSkill
- standards-codeSkill
- standards-databaseSkill
- standards-documentationSkill
- standards-go-concurrencySkill
- standards-go-performanceSkill
- standards-goSkill
- standards-go-testingSkill
- standards-markdownSkill
- standards-observabilitySkill
- standards-pulumi-typescriptSkill
- standards-pythonSkill
- standards-securitySkill
- standards-shellSkill
- standards-skill-authoringSkill
- standards-testingSkill
- tool-storeSkill
- workflow-debuggingSkill
- workflow-pi-extensionSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
51 rules. About 0 are common, 16 are distinctive, and 35 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
Distinctive · estimate
This author's own choices. Worth a look.
35
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Golden Rule: Prefer type inference; use explicit annotations at boundaries and wherever the type is non-obvious
- Very specific: line 38
Treat acronyms as words: loadHttpUrl not loadHTTPURL
- Distinctive: line 78
Keep file structure simple and consistent.
- Very specific: line 86
Use ES module import/export.
- Very specific: line 91
Prefer concise imports: named by default, namespace for large APIs, and import type for type-only symbols.
- Distinctive: line 95
Named exports only: no default exports.
- Distinctive: line 98
No container classes with only static methods: use module-level named exports instead.
- Distinctive: line 108
No use before declaration.
- Very specific: line 110
Keep declarations simple: const by default, let when reassigned, never var.
- Very specific: line 116
Never new Array() / new Object(): use literals ([], {}).
- Distinctive: line 117
Prefer spread for shallow copy/merge.
- Very specific: line 118
Use for...of for arrays.
- Very specific: line 119
Use Object.keys/values/entries for object iteration.
- Very specific: line 127
Use TypeScript private keyword: no #private fields.
- Very specific: line 129
Use parameter properties: constructor(private readonly svc: UserService) {}.
- Very specific: line 132
Never: use the public modifier unless it's a non-readonly public parameter property.
- Distinctive: line 134
No trailing semicolons after class declarations.
- Very specific: line 136
Use TS-native class features (private, readonly, parameter properties).
- Very specific: line 145
Use rest params instead of arguments.
- Very specific: line 146
Never
bind()in event listener registration: use arrow function properties for stable uninstall references. - Very specific: line 149
Prefer function declarations for top-level APIs and arrow functions for callbacks.
- Very specific: line 155
Always use braces {} for control flow blocks (exception: single-line if on one line is acceptable).
- Very specific: line 163
Use strict equality, always throw Error objects, and prefer as assertions over angle-bracket syntax.
- Very specific: line 167
When a double assertion is unavoidable, use unknown as the intermediate:
- Distinctive: line 175
Rely on type inference: don't annotate trivially-inferred types.
- Distinctive: line 176
Annotate: when the type is non-obvious: complex async expressions, empty generics, public API return types.
- Very specific: line 182
Avoid
any: use unknown and narrow explicitly. - Very specific: line 183
Never use object (use {}, a specific type, or Record<string, unknown>).
- Very specific: line 185
Prefer unknown over any; narrow with type guards before use.
- Distinctive: line 189
Use interfaces for structural/object types.
- Distinctive: line 190
Use type aliases for unions, intersections, and mapped types.
- Very specific: line 191
Never use a class purely as a structural type: use an interface.
- Very specific: line 193
Use interface for structural object shapes and type aliases for unions/mapped/intersection types.
- Very specific: line 197
Use undefined or null contextually.
- Very specific: line 198
Prefer optional ? over explicit |undefined for parameters and fields.
- Very specific: line 200
Prefer optional ? for parameters/fields instead of explicit | undefined unions.
- Very specific: line 204
Use plain enum: const enum is banned.
- Distinctive: line 205
Use enums for small, stable domain vocabularies such as persisted identifiers, state names, and resource categories.
- Distinctive: line 207
Prefer a string union for local or ad-hoc values when it is clearer.
- Very specific: line 209
Use plain enums for stable domain values.
- Very specific: line 213
Use satisfies only when preserving inferred literal types materially improves an API.
- Very specific: line 215
Do not use satisfies, enums, as const, or type assertions as runtime validation.
- Very specific: line 217
Prefer named FooArgs interfaces for reusable functions with non-trivial parameter objects.
- Very specific: line 219
Avoid clever inferred public types such as (typeof Values)[keyof typeof Values] when an explicit enum or interface is easier to discover …
- Very specific: line 222
Use as const for simple immutable data when literal inference is useful.
- Distinctive: line 225
Prefer code that makes domain vocabulary and public contracts obvious to a reader over compact inference-heavy declarations.
- Distinctive: line 230
Never: use wrapper object instantiation.
- Very specific: line 232
Never instantiate wrapper objects (new String, new Boolean, new Number).
- Distinctive: line 266
Use JSDoc for public APIs and comments for non-obvious *why* decisions.
- Very specific: line 291
Keep this list short and strict: var, default exports, export let, #private, const enum, wrapper objects, eval/Function, debugger, any …
- Very specific: line 297
Only use framework-provided decorators (e.g., Angular @Component, Polymer @property).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeScript Standards
Provides: Idiomatic TypeScript patterns, type system usage, imports/exports, naming conventions, JSDoc rules, formatting, and high-signal disallowed features. Based on the Google TypeScript Style Guide.
Primary references: Google TS Style Guide and TS Handbook.
Quick Reference
Golden Rule: Prefer type inference; use explicit annotations at boundaries and wherever the type is non-obvious
Style principles (priority order):
| Principle | Key question |
| Correctness | Does the type system catch bugs at compile time? |
| Clarity | Can a reader understand the intent? |
| Simplicity | Is this the simplest type-safe approach? |
| Consistency | Does this match surrounding code? |
Do (✅):
constby default;letif reassigned; nevervar- Named exports only; no default exports
import type {Foo}for type-only importsunknownoverany; narrow explicitly with type guardsprivatekeyword for private class members (not#private)readonlyon non-reassigned properties===/!==; exception:== nullchecks both null+undefinedas Foofor type assertions (not<Foo>)throw new Error(...)only; never throw strings/literalscatch (e: unknown)and asserte instanceof Errorbefore useinterfacefor structural types; avoidclassfor pure data shapes- Treat acronyms as words:
loadHttpUrlnotloadHTTPURL
Don't (❌):
var,new Array(),new Object()- Default exports
export let(mutable named exports)#privatefieldsany(preferunknown)const enumwith,eval,Function(...string)- Wrapper object instantiation (
new String(),new Boolean(),new Number()) debuggerin productionparseInt/parseFloatwithout radix validation: useNumber()+isNaN- Unary
+for string-to-number coercion
Key commands:
npx tsc --noEmit # type-check without emitting
npx eslint --ext .ts . # lint TypeScript files
npx prettier --check . # check formatting
npx prettier --write . # auto-formatRecommended tsconfig flags: strict, noUncheckedIndexedAccess.
Source File Structure
File order (blank line between each section):
- Copyright/license comment (if applicable)
@fileoverviewJSDoc (if applicable)- Imports
- Implementation
- UTF-8 encoding; use actual Unicode characters (not escape sequences) for printable chars (e.g.,
const pi = 'π', not'\u03C0').
Keep file structure simple and consistent; avoid boilerplate comments/examples unless they add non-obvious value.
Imports & Exports
Imports
- Use ES module
import/export; neverrequire(), CommonJS patterns,namespace, or/// <reference>. - Named imports for frequently used symbols; namespace imports (
import * as foo) for large APIs where many symbols are used. - Relative paths for project-internal code (
./foo,../bar); module paths for packages. import type {Foo}for type-only imports: erased at compile time, avoids circular deps.
Prefer concise imports: named by default, namespace for large APIs, and import type for type-only symbols.
Exports
- Named exports only: no default exports.
export constnotexport let(mutable named exports are banned).export type {Foo}for type re-exports.- No container classes with only static methods: use module-level named exports instead.
Named exports only. Avoid default exports, mutable exports, and static-only container classes.
Variables
constby default;letif the binding is reassigned; nevervar.- One declaration per line.
- No use before declaration.
Keep declarations simple: const by default, let when reassigned, never var.
Arrays & Objects
- Never
new Array()/new Object(): use literals ([],{}). - Prefer spread for shallow copy/merge.
- Use
for...offor arrays. - Use
Object.keys/values/entriesfor object iteration.
Classes
- Use TypeScript
privatekeyword: no#privatefields. - Mark non-reassigned properties
readonly. - Use parameter properties:
constructor(private readonly svc: UserService) {}. - Initialize fields at declaration, not in the constructor body.
- Getters must be pure: no side effects, no observable state changes.
- Never use the
publicmodifier unless it's a non-readonly public parameter property. - No
prototypemanipulation. - No trailing semicolons after class declarations; blank lines between method declarations.
Use TS-native class features (private, readonly, parameter properties); avoid #private and prototype manipulation.
Functions
- Prefer function declarations for named top-level functions.
- Prefer arrow functions for callbacks and inline functions; never named function expressions (use arrow instead).
- Arrow function body:
{ }block when return value is unused; concise body when return value is used. - Use rest params instead of
arguments; spread instead ofFunction.apply. - Never
bind()in event listener registration: use arrow function properties for stable uninstall references. - Never use
thisoutside class methods, constructors, or arrow functions.
Prefer function declarations for top-level APIs and arrow functions for callbacks. Avoid bind() in event registration.
Control Flow
- Always use braces
{}for control flow blocks (exception: single-lineifon one line is acceptable). ===/!==; use== nullonly to check bothnullandundefinedtogether.switchmust have adefaultcase (last); no fallthrough in non-empty cases.throw new Error(...): never throw strings or plain objects; onlyErrorsubclasses.catch (e: unknown): asserte instanceof Errorbefore accessing properties.- Empty catch blocks require an explanatory comment.
- Type assertions:
as Foonot<Foo>.
Use strict equality, always throw Error objects, and prefer as assertions over angle-bracket syntax.
Double Assertions
When a double assertion is unavoidable, use unknown as the intermediate:
Type System
Inference & Annotations
- Rely on type inference: don't annotate trivially-inferred types.
- Annotate when the type is non-obvious: complex async expressions, empty generics, public API return types.
Rely on inference for obvious locals; annotate non-obvious boundaries and public API returns.
unknown vs any
- Avoid
any: useunknownand narrow explicitly. - Never use
object(use{}, a specific type, orRecord<string, unknown>).
Prefer unknown over any; narrow with type guards before use.
Interfaces vs Types
- Use interfaces for structural/object types.
- Use type aliases for unions, intersections, and mapped types.
- Never use a
classpurely as a structural type: use an interface.
Use interface for structural object shapes and type aliases for unions/mapped/intersection types.
Null & Optional
- Use
undefinedornullcontextually; never add|nullor|undefinedto type aliases. - Prefer optional
?over explicit|undefinedfor parameters and fields.
Prefer optional ? for parameters/fields instead of explicit | undefined unions.
Enums
- Use plain
enum:const enumis banned. - Use enums for small, stable domain vocabularies such as persisted identifiers, state names, and resource categories.
- Prefer a string union for local or ad-hoc values when it is clearer.
Use plain enums for stable domain values; avoid const enum.
Readability-first type design
- Use
satisfiesonly when preserving inferred literal types materially improves an API. Prefer explicit interfaces or annotations when they are clearer. - Do not use
satisfies, enums,as const, or type assertions as runtime validation. Parse and validate configuration, API input, and external data. - Prefer named
FooArgsinterfaces for reusable functions with non-trivial parameter objects. - Avoid clever inferred public types such as
(typeof Values)[keyof typeof Values]when an explicit enum or interface is easier to discover and understand. - Use
as constfor simple immutable data when literal inference is useful; do not use it as a default object-declaration pattern.
Prefer code that makes domain vocabulary and public contracts obvious to a reader over compact inference-heavy declarations.
Wrapper Objects
- Never use wrapper object instantiation.
Never instantiate wrapper objects (new String, new Boolean, new Number); use primitives.
Naming
| Identifier | Convention | Examples |
| Class, Interface, Type, Enum | UpperCamelCase | UserService, HttpClient, Direction |
| Variable, Parameter, Function, Method, Property | lowerCamelCase | userId, getUser, isActive |
| Module-level constant, Enum value | CONSTANT_CASE | MAX_RETRIES, DEFAULT_TIMEOUT |
| Module alias | lowerCamelCase | import * as httpClient from '...' |
Rules:
- Identifiers: ASCII letters, digits, underscores only in constants/test names; rare
$(only when required by framework). - No
_prefix/suffix for private members; TypeScriptprivatehandles visibility. - No
Iprefix for interfaces (UserServicenotIUserService). - No
opt_prefix for optional parameters. - Treat acronyms as words:
loadHttpUrlnotloadHTTPURL;xmlParsernotXMLParser. Exception: platform APIs that define their own casing (XMLHttpRequest). - Local constants:
lowerCamelCase, notCONSTANT_CASE(only module-level constants useCONSTANT_CASE).
Key naming rules: no I prefix for interfaces, acronyms as words (httpUrl), and CONSTANT_CASE only for module-level constants.
Comments & JSDoc
/** */JSDoc for all public API symbols (classes, interfaces, functions, enums, properties)./** @fileoverview ... */for file-level documentation.@paramand@returnonly when they add information not in the type signature.//for implementation notes;/* */is not used for JSDoc-style comments.- Comment why, not what: code should be self-documenting for the "what".
Use JSDoc for public APIs and comments for non-obvious why decisions.
Formatting
Formatting is enforced by Prettier (and optionally clang-format). Do not hand-format code that tools will reformat.
| Rule | Value |
| Indentation | 2 spaces; no tabs |
| Quotes | Single '; template literals for interpolation/multiline |
| Semicolons | Required at end of statements (no ASI reliance) |
| Line length | 80-column soft limit |
| Trailing commas | In multi-line arrays, objects, and parameter lists |
| Blank lines in blocks | None at start/end of blocks |
Let Prettier enforce formatting; avoid hand-formatting conventions beyond configured tools.
Disallowed Features
Hard bans: never use these:
Keep this list short and strict: var, default exports, export let, #private, const enum, wrapper objects, eval/Function, debugger, any (except strict interop), and for...in over arrays.
Decorators
- Only use framework-provided decorators (e.g., Angular
@Component, Polymer@property). - Do not define new decorators in application code: the decorator proposal has been unstable.
// ✅ Framework decorator: acceptable
@Component({selector: 'app-root', template: '<h1>Hello</h1>'})
class AppComponent {}
// ❌ Custom application decorator
function log(target: any, key: string, descriptor: PropertyDescriptor) { ... }Skill Loading Triggers
| Situation | Load skills |
| Writing any TypeScript code | standards-typescript + standards-code |
| TypeScript API / module design | standards-typescript + role-architect |
| Writing TypeScript tests | standards-typescript + standards-testing |
| Auth, secrets, user input handling | standards-security |
| Implementing features/fixes (TDD) | role-developer |
| TS PR review | role-code-review |
Verification Checklist
npx tsc --noEmitpasses with no errorsnpx eslint --ext .ts .passesnpx prettier --check .passes- Strict mode is enabled in
tsconfig - No
var, default exports,export let,#private,const enum, or wrapper object constructors unknownis used instead ofanyunless interop absolutely requires otherwise- Type-only imports use
import type - Public APIs include JSDoc; comments explain why, not what
- Error handling uses
catch (e: unknown)and throwsErrorobjects - Arrays/objects use idiomatic iteration (
for...of,Object.entries/keys/values) - Naming conventions are respected (no
Iprefix, acronyms as words)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

