Claude-skill-registry 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.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/js-google" ~/.claude/skills/majiayu000-claude-skill-registry-js-google && rm -rf "$T"
manifest:
skills/data/js-google/SKILL.mdsource content
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 | |
| 2 | Language Features | CRITICAL | |
| 3 | Type Safety & JSDoc | HIGH | |
| 4 | Naming Conventions | HIGH | |
| 5 | Control Flow & Error Handling | MEDIUM-HIGH | |
| 6 | Functions & Parameters | MEDIUM | |
| 7 | Objects & Arrays | MEDIUM | |
| 8 | Formatting & Style | LOW | |
Quick Reference
1. Module System & Imports (CRITICAL)
- Prevent loading failures from circular importsmodule-avoid-circular-dependencies
- Include .js extension in import pathsmodule-file-extension-in-imports
- Prefer named exports for consistencymodule-named-exports-over-default
- Import from same file only oncemodule-no-duplicate-imports
- Keep original export namesmodule-no-import-aliasing
- Follow standard file structure ordermodule-source-file-structure
2. Language Features (CRITICAL)
- Use const by default, never varlang-const-over-let-over-var
- Use class syntax over prototype manipulationlang-es6-classes-over-prototypes
- Always use explicit semicolonslang-explicit-semicolons
- Never use eval or Function constructorlang-no-eval
- Never modify built-in prototypeslang-no-modify-builtins
- Use only standard ECMAScript featureslang-no-non-standard-features
- Never use primitive wrapper objectslang-no-primitive-wrappers
- Never use the with statementlang-no-with-statement
3. Type Safety & JSDoc (HIGH)
- Use parentheses for type caststype-cast-with-parentheses
- Annotate enums with static literal valuestype-enum-annotations
- Use explicit nullability modifierstype-explicit-nullability
- Require JSDoc for exported functionstype-jsdoc-required-for-exports
- Always specify template parameterstype-template-parameters
- Use typedef for complex object typestype-typedef-for-complex-types
4. Naming Conventions (HIGH)
- Use CONSTANT_CASE for immutable valuesnaming-constant-case-for-constants
- Prefer descriptive names over brevitynaming-descriptive-over-brief
- Use lowercase with dashes or underscoresnaming-file-naming-conventions
- Use lowerCamelCase for methods and variablesnaming-lowercamelcase-for-methods
- Avoid dollar sign prefix in identifiersnaming-no-dollar-prefix
- Use UpperCamelCase for classesnaming-uppercamelcase-for-classes
5. Control Flow & Error Handling (MEDIUM-HIGH)
- Document empty catch blockscontrol-comment-empty-catch
- Prefer for-of over for-incontrol-for-of-over-for-in
- Use strict equality except for null checkscontrol-strict-equality
- Always include default case in switchcontrol-switch-default-last
- Always throw Error objectscontrol-throw-error-objects
6. Functions & Parameters (MEDIUM)
- Prefer arrow functions for nested functionsfunc-arrow-functions-for-nested
- Always use parentheses around arrow paramsfunc-arrow-parentheses
- Use default parameters instead of conditionalsfunc-default-parameters
- Use rest parameters over argumentsfunc-rest-parameters-over-arguments
- Use spread operator instead of applyfunc-spread-over-apply
7. Objects & Arrays (MEDIUM)
- Use array literals over Array constructordata-array-literals-over-constructor
- Use destructuring for multiple propertiesdata-destructuring-for-multiple-values
- Never mix quoted and unquoted keysdata-no-mixing-quoted-unquoted-keys
- Use object literals over constructordata-object-literals-over-constructor
- Use spread over concat and slicedata-spread-over-concat-slice
- Use trailing commas in multi-line literalsdata-trailing-commas
8. Formatting & Style (LOW)
- Always use braces for control structuresformat-braces-required
- Limit lines to 80 charactersformat-column-limit
- Place one statement per lineformat-one-statement-per-line
- Use single quotes for string literalsformat-single-quotes
- Use two-space indentationformat-two-space-indent
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 |