js-google
35
总安装量
35
周安装量
#5903
全站排名
安装命令
npx skills add https://github.com/pproenca/dot-skills --skill js-google
Agent 安装分布
claude-code
30
gemini-cli
28
antigravity
26
codex
26
opencode
26
windsurf
23
Skill 文档
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 |