agentsclimarketplace

Javascript language

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/javascript-language

Modern JavaScript (ES2022+) patterns for clean, maintainable code. Use when working with modern JavaScript features like optional chaining, nullish coalescing, or ESM. (triggers: **/*.js, **/*.mjs, **/*.cjs, const, let, arrow, async, await, promise, destructuring, spread, class)From its SKILL.md

Install
npx -y skills add ComeOnOliver/skillshub --skill javascript-language

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

2.0 KB, 421 tokens by cl100k_base, as published. Nobody here has run it

JavaScript Language Patterns

Priority: P0 (CRITICAL)

Implementation Guidelines

  • Variables: const default. let if needed. No var — block scope only.
  • Functionality: Use Arrow Functions for callbacks/inlines; Function Declaration for core logic.
  • Async Logic: Use async/await with try/catch and Promise.all() for parallel operations. ESM import/export only. No Callbacks — promisify everything.
  • 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, and reduce over imperative for loops.
  • Modules: Standardize on ESM import/export; use Named Exports over Default.
  • Encapsulation: Leverage #private class 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 Callbacks: Promisify everything.
  • No Mutation: Immutability first.

Code

// Modern Syntax
const [x, ...rest] = items;
const name = user?.profile?.name ?? 'Guest';

// Async + Error Handling
async function getUser(id) {
  const res = await fetch(`/api/${id}`);
  return res.json(); // Errors propagate
}

// Private Fields
class Service {
  #key;
  constructor(k) {
    this.#key = k;
  }
}

Reference & Examples

For advanced patterns and functional programming: See references/REFERENCE.md.

Related Topics

best-practices | tooling

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.