javascript-language
FreeNo executable scriptsNot checkedModern JavaScript (ES2022+) patterns for clean, maintainable code. Use when working with modern JavaScript features like optional chaining, nullish…
by HoangNguyen0403★ 598 GitHub starsAbout this skill
JavaScript Language Patterns
Priority: P0 (CRITICAL)
Implementation Guidelines
- Variables: const default. let if needed. No var — block scope only.
- Functionality: Use
Arrow Functionsfor callbacks/inlines;Function Declarationfor core logic. - Async Logic: Use async/await with try/catch and Promise.all() for parallel operations. Prefer native Promise APIs; use
node:util.promisifyonly for one-shot, error-first callbacks. - Module Loaders: Preserve the module system consumers already load:
.cjs/type: commonjsstays CommonJS,.mjs/type: moduleuses ESM. Prefer ESM for new modules only when every consumer can load it; an ESM rewrite of a working CJS module is a separate, explicit migration. - Modern Syntax: Use Destructuring, Spread (...), Optional Chain ?. and Nullish ?? coalescing.
- String Handling: Use
Template Literals(backticks) for interpolation and multi-line strings. - Data Collections: Prefer
map,filter, andreduceover imperativeforloops. - Modules: Standardize new modules on ESM import/export; use Named Exports over Default. Match
package.jsontype, file extension, and the consumer's loader when editing existing code. - Encapsulation: Leverage
#privateclass fields for encapsulation. - Error States: Throw
new Error()with descriptive messages; never throw strings.
Anti-Patterns
- No var — Block scope only.
- No
==: Strict===. - No
new Object(): Use literals{}. - No blanket promisification:
promisifyassumes one error-first callback per call; it breaks receiver-dependent methods, event/retry callbacks, Promise-returning functions and synchronous APIs. - No implicit ESM migration: Never rewrite a
.cjsor CommonJS consumer unless that consumer's loader is part of the change. - No Mutation: Immutability first.
Code & Reference
See references/REFERENCE.md for modern syntax, async patterns, private fields, and functional programming examples.
Related Topics
best-practices | tooling
Install javascript-language in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the javascript-language skill do?
Modern JavaScript (ES2022+) patterns for clean, maintainable code. Use when working with modern JavaScript features like optional chaining, nullish coalescing, or ESM.
How do I install the javascript-language skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the javascript-language skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic