
js-google
JavaScript style and best practices based on Google's official JavaScript Style Guide. This skill should be used when writing, reviewing, or refactoring JavaScript code to ensure consistent style and prevent common bugs. Triggers on tasks involving JavaScript, ES6, modules, JSDoc, naming conventions, or code formatting.
JavaScript style and best practices based on Google's official JavaScript Style Guide. This skill should be used when writing, reviewing, or refactoring JavaScript code to ensure consistent style and prevent common bugs. Triggers on tasks involving JavaScript, ES6, modules, JSDoc, naming conventions, or code formatting.
Google JavaScript Best Practices
Comprehensive JavaScript style and best practices guide based on Google's official JavaScript Style Guide, designed for AI agents and LLMs. Contains 47 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Writing new JavaScript or ES6+ code
- Structuring modules and managing imports/exports
- Adding JSDoc type annotations and documentation
- Reviewing code for naming and style consistency
- Refactoring existing JavaScript code
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Module System & Imports | CRITICAL | module- |
| 2 | Language Features | CRITICAL | lang- |
| 3 | Type Safety & JSDoc | HIGH | type- |
| 4 | Naming Conventions | HIGH | naming- |
| 5 | Control Flow & Error Handling | MEDIUM-HIGH | control- |
| 6 | Functions & Parameters | MEDIUM | func- |
| 7 | Objects & Arrays | MEDIUM | data- |
| 8 | Formatting & Style | LOW | format- |
Quick Reference
1. Module System & Imports (CRITICAL)
module-avoid-circular-dependencies- Prevent loading failures from circular importsmodule-file-extension-in-imports- Include .js extension in import pathsmodule-named-exports-over-default- Prefer named exports for consistencymodule-no-duplicate-imports- Import from same file only oncemodule-no-import-aliasing- Keep original export namesmodule-source-file-structure- Follow standard file structure order
2. Language Features (CRITICAL)
lang-const-over-let-over-var- Use const by default, never varlang-es6-classes-over-prototypes- Use class syntax over prototype manipulationlang-explicit-semicolons- Always use explicit semicolonslang-no-eval- Never use eval or Function constructorlang-no-modify-builtins- Never modify built-in prototypeslang-no-non-standard-features- Use only standard ECMAScript featureslang-no-primitive-wrappers- Never use primitive wrapper objectslang-no-with-statement- Never use the with statement
3. Type Safety & JSDoc (HIGH)
type-cast-with-parentheses- Use parentheses for type caststype-enum-annotations- Annotate enums with static literal valuestype-explicit-nullability- Use explicit nullability modifierstype-jsdoc-required-for-exports- Require JSDoc for exported functionstype-template-parameters- Always specify template parameterstype-typedef-for-complex-types- Use typedef for complex object types
4. Naming Conventions (HIGH)
naming-constant-case-for-constants- Use CONSTANT_CASE for immutable valuesnaming-descriptive-over-brief- Prefer descriptive names over brevitynaming-file-naming-conventions- Use lowercase with dashes or underscoresnaming-lowercamelcase-for-methods- Use lowerCamelCase for methods and variablesnaming-no-dollar-prefix- Avoid dollar sign prefix in identifiersnaming-uppercamelcase-for-classes- Use UpperCamelCase for classes
5. Control Flow & Error Handling (MEDIUM-HIGH)
control-comment-empty-catch- Document empty catch blockscontrol-for-of-over-for-in- Prefer for-of over for-incontrol-strict-equality- Use strict equality except for null checkscontrol-switch-default-last- Always include default case in switchcontrol-throw-error-objects- Always throw Error objects
6. Functions & Parameters (MEDIUM)
func-arrow-functions-for-nested- Prefer arrow functions for nested functionsfunc-arrow-parentheses- Always use parentheses around arrow paramsfunc-default-parameters- Use default parameters instead of conditionalsfunc-rest-parameters-over-arguments- Use rest parameters over argumentsfunc-spread-over-apply- Use spread operator instead of apply
7. Objects & Arrays (MEDIUM)
data-array-literals-over-constructor- Use array literals over Array constructordata-destructuring-for-multiple-values- Use destructuring for multiple propertiesdata-no-mixing-quoted-unquoted-keys- Never mix quoted and unquoted keysdata-object-literals-over-constructor- Use object literals over constructordata-spread-over-concat-slice- Use spread over concat and slicedata-trailing-commas- Use trailing commas in multi-line literals
8. Formatting & Style (LOW)
format-braces-required- Always use braces for control structuresformat-column-limit- Limit lines to 80 charactersformat-one-statement-per-line- Place one statement per lineformat-single-quotes- Use single quotes for string literalsformat-two-space-indent- Use two-space indentation
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
Full Compiled Document
For a complete compiled guide with all rules, see AGENTS.md.
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 |
You Might Also Like
Related Skills

coding-agent
Run Codex CLI, Claude Code, OpenCode, or Pi Coding Agent via background process for programmatic control.
openclaw
add-uint-support
Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.
pytorch
at-dispatch-v2
Convert PyTorch AT_DISPATCH macros to AT_DISPATCH_V2 format in ATen C++ code. Use when porting AT_DISPATCH_ALL_TYPES_AND*, AT_DISPATCH_FLOATING_TYPES*, or other dispatch macros to the new v2 API. For ATen kernel files, CUDA kernels, and native operator implementations.
pytorch
skill-writer
Guide users through creating Agent Skills for Claude Code. Use when the user wants to create, write, author, or design a new Skill, or needs help with SKILL.md files, frontmatter, or skill structure.
pytorch
implementing-jsc-classes-cpp
Implements JavaScript classes in C++ using JavaScriptCore. Use when creating new JS classes with C++ bindings, prototypes, or constructors.
oven-sh
implementing-jsc-classes-zig
Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts). Use when implementing new JS APIs in Zig with JSC integration.
oven-sh