Agent skill

Modern JavaScript Patterns

by wshobson in wshobson/agents

Covers ES6+ syntax and functional patterns for refactoring older JavaScript: async/await, destructuring, spread, modules, generators and data pipelines.

MITAuto-check passedDevelopment

Install Modern JavaScript Patterns

skills CLI
$ npx skills add wshobson/agents --skill modern-javascript-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install wshobson/agents modern-javascript-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/wshobson/agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/javascript-typescript/skills/modern-javascript-patterns .claude/skills/modern-javascript-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
modern-javascript-patterns
GitHub stars
40k
Used in
11 other repos
Token cost
~548 tokens
SKILL.md length
223 words
Files
3 (incl. references)
Skills in repo
142
Repo updated
First seen
Licence
MIT

At a glance

Covers ES6+ syntax and functional patterns for refactoring older JavaScript: async/await, destructuring, spread, modules, generators and data pipelines.

  • Works in 12 steps: Use const by default: Only use let when… → Prefer arrow functions: Especially for… → Use template literals: Instead of string… → …
  • Refactoring legacy JavaScript to ES6+ syntax
  • SKILL.md covers When to Use This Skill, Detailed patterns and worked… and Best Practices
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

This skill steers the agent toward current JavaScript idioms when it writes or rewrites code. Its checklist covers const by default, arrow functions for callbacks, template literals, destructuring, optional chaining, nullish coalescing, array methods in place of loops, modules, pure functions and strict mode.

It suits migrations such as turning callback code into promises or async/await, and building data transformation pipelines in a functional style. Pitfalls like this binding, promise anti-patterns and memory leaks are covered in references/advanced-patterns.md, and further worked patterns are in references/details.md.

When your agent uses it

  • Refactoring legacy JavaScript to ES6+ syntax
  • Converting callback-based code to promises or async/await
  • Writing data transformation pipelines in a functional style
  • Reviewing JavaScript for common pitfalls such as this binding

Example prompts

  • “Rewrite this callback-heavy Node module using async/await.”
  • “Modernize utils.js: replace var with const and let, and use destructuring and optional chaining.”
  • “Turn these nested for loops into array method chains.”

Workflow steps

12 steps, taken from the first numbered list in SKILL.md.

  1. Use const by default: Only use let when reassignment is needed
  2. Prefer arrow functions: Especially for callbacks
  3. Use template literals: Instead of string concatenation
  4. Destructure objects and arrays: For cleaner code
  5. Use async/await: Instead of Promise chains
  6. Avoid mutating data: Use spread operator and array methods
  7. Use optional chaining: Prevent "Cannot read property of undefined"
  8. Use nullish coalescing: For default values
  9. Prefer array methods: Over traditional loops
  10. Use modules: For better code organization
  11. Write pure functions: Easier to test and reason about
  12. Use meaningful variable names: Self-documenting code

What it can do on your machine

Read from SKILL.md and the folder at commit 46891e7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Modern JavaScript Patterns loads about 548 tokens when it runs, and up to ~5.7k if it reads all its reference files. Until then it costs about 87 tokens; SKILL.md has 223 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~87
When it runs · the whole SKILL.md, loaded when a task matches
~548
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from wshobson/agents at commit 46891e7, republished under its MIT licence (© wshobson). 223 words, ~548 tokens.

Download SKILL.mdSave it as .claude/skills/modern-javascript-patterns/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
modern-javascript-patterns
description
Master ES6+ features including async/await, destructuring, spread operators, arrow functions, promises, modules, iterators, generators, and functional programming patterns for writing clean, efficient JavaScript code. Use when refactoring legacy code, implementing modern patterns, or optimizing JavaScript applications.

Modern JavaScript Patterns

Comprehensive guide for mastering modern JavaScript (ES6+) features, functional programming patterns, and best practices for writing clean, maintainable, and performant code.

When to Use This Skill

  • Refactoring legacy JavaScript to modern syntax
  • Implementing functional programming patterns
  • Optimizing JavaScript performance
  • Writing maintainable and readable code
  • Working with asynchronous operations
  • Building modern web applications
  • Migrating from callbacks to Promises/async-await
  • Implementing data transformation pipelines

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Use const by default: Only use let when reassignment is needed
  2. Prefer arrow functions: Especially for callbacks
  3. Use template literals: Instead of string concatenation
  4. Destructure objects and arrays: For cleaner code
  5. Use async/await: Instead of Promise chains
  6. Avoid mutating data: Use spread operator and array methods
  7. Use optional chaining: Prevent "Cannot read property of undefined"
  8. Use nullish coalescing: For default values
  9. Prefer array methods: Over traditional loops
  10. Use modules: For better code organization
  11. Write pure functions: Easier to test and reason about
  12. Use meaningful variable names: Self-documenting code
  13. Keep functions small: Single responsibility principle
  14. Handle errors properly: Use try/catch with async/await
  15. Use strict mode: 'use strict' for better error catching

For common pitfalls (this binding, promise anti-patterns, memory leaks), see references/advanced-patterns.md.

© wshobson, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in plugins/javascript-typescript/skills/modern-javascript-patterns of wshobson/agents.

  • SKILL.md
  • references/advanced-patterns.md
  • references/details.md

Open the folder on GitHubat commit 46891e7

Used in 11 other repositories

We found 26 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 11 other GitHub owners. This page covers the copy in wshobson/agents, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Modern JavaScript Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Modern JavaScript Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Modern JavaScript Patterns this skillwshobson/agents40k11 repos~548Automated safety check: PassMIT
JavaScript ProJeffallan/claude-skills12k—~1.2kAutomated safety check: PassMIT
Code Refactoring Workflowluongnv89/claude-howto42k—~3.1kAutomated safety check: PassMIT
DRY Refactoring With jscpdkucherenko/jscpd6.3k—~2.1kAutomated safety check: PassMIT
jscpd Duplicate Code Detectorkucherenko/jscpd6.3k—~4.6kAutomated safety check: PassMIT
Fowler-Style Refactoringlhfer/claude-howto-zh-cn2.3k—~156Automated safety check: PassMIT

Similar skills

  • JavaScript Pro

    Jeffallan/claude-skills

    Writes and reviews modern JavaScript: ES2023+ syntax, async/await, ESM modules, Node.js and browser APIs, with linting, leak checks and Jest tests.

    12k GitHub stars~1.2k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Code Refactoring Workflow

    luongnv89/claude-howto

    Guides systematic, test-backed refactoring in the style of Martin Fowler, moving through research, planning and small incremental changes with your approval at each phase.

    42k GitHub stars~3.1k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Removes copy-paste duplication found by jscpd, starting with exact clones and hotspots, then renamed and near-miss copies, using proven refactoring strategies.

    6.3k GitHub stars~2.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Finds duplicated code in 220+ languages with jscpd, reports exact, renamed and near-miss clones in a compact agent-friendly format and measures duplication.

    6.3k GitHub stars~4.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Fowler-Style Refactoring

    lhfer/claude-howto-zh-cn

    基于 Martin Fowler 方法论做系统化重构。Use when users ask to refactor code, improve structure, reduce technical debt, clean up legacy code, or improve maintainability.

    2.3k GitHub stars~156 tokensUpdated 2 mo ago
    DevelopmentAuto-check passed
  • Refactoring Skill (Vietnamese)

    luongnv89/claude-howto

    Vietnamese edition of a systematic refactoring skill based on Martin Fowler's book, working in approved phases with small, test-backed changes.

    42k GitHub stars~3.1k tokensUpdated 7 days ago
    DevelopmentAuto-check passed

More from wshobson/agents

All 142 skills in this repo
  • Cuts cloud spend across AWS, Azure, GCP and OCI with cost tagging, rightsizing, commitment and spot pricing models, and architecture changes.

    40k GitHub starsUsed in 13 repos~1.7k tokens
    Auto-check passed
  • Billing Automation

    wshobson/agents

    Covers building subscription billing: billing cycles, subscription states, invoice generation, proration, tax handling and dunning for failed payments.

    40k GitHub starsUsed in 12 repos~473 tokens
    Auto-check passed
  • Profiles slow Python code with cProfile and memory profilers, then applies targeted fixes for CPU, memory, I/O and query bottlenecks.

    40k GitHub starsUsed in 12 repos~814 tokens
    Auto-check passed
  • Portfolio Risk Metrics

    wshobson/agents

    Covers portfolio risk measurement with VaR, CVaR, Sharpe, Sortino and drawdown, plus guidance on limits, stress tests and tail risk.

    40k GitHub starsUsed in 12 repos~502 tokens
    Auto-check passed
  • Plans memory headroom, works through out-of-memory failures and watches temperature and power during long ML training jobs on NVIDIA DGX Spark.

    40k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.

    40k GitHub starsUsed in 11 repos~1.3k tokens
    Auto-check passed

Works with

Categories

Questions about Modern JavaScript Patterns

What does Modern JavaScript Patterns do?

Covers ES6+ syntax and functional patterns for refactoring older JavaScript: async/await, destructuring, spread, modules, generators and data pipelines. This skill steers the agent toward current JavaScript idioms when it writes or rewrites code. Its checklist covers const by default, arrow functions for callbacks, template literals, destructuring, optional chaining, nullish coalescing, array methods in place of loops, modules, pure functions and strict mode.

When should I use Modern JavaScript Patterns?

Modern JavaScript Patterns fits situations like: refactoring legacy JavaScript to ES6+ syntax; converting callback-based code to promises or async/await; writing data transformation pipelines in a functional style; reviewing JavaScript for common pitfalls such as this binding.

How do I install Modern JavaScript Patterns in Claude Code?

Run `npx skills add wshobson/agents --skill modern-javascript-patterns -a claude-code`. Or copy the skill folder (plugins/javascript-typescript/skills/modern-javascript-patterns in wshobson/agents) into .claude/skills/modern-javascript-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Modern JavaScript Patterns in Codex?

Run `npx skills add wshobson/agents --skill modern-javascript-patterns -a codex`. Or copy the skill folder (plugins/javascript-typescript/skills/modern-javascript-patterns in wshobson/agents) into .agents/skills/modern-javascript-patterns in your project. Codex loads it when a task matches its description.

Can I use Modern JavaScript Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wshobson/agents --skill modern-javascript-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/modern-javascript-patterns, .gemini/skills/modern-javascript-patterns, .github/skills/modern-javascript-patterns and .opencode/skills/modern-javascript-patterns in your project.

What does Modern JavaScript Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Modern JavaScript Patterns is instructions for the agent only.

Does Modern JavaScript Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Modern JavaScript Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Modern JavaScript Patterns use?

Modern JavaScript Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Modern JavaScript Patterns use?

About 548 tokens (SKILL.md is roughly 2.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.1k tokens, read only when the agent opens those files.

What are the alternatives to Modern JavaScript Patterns?

Skills that share tags, products or a category with Modern JavaScript Patterns: JavaScript Pro (Jeffallan/claude-skills, 12k stars), Code Refactoring Workflow (luongnv89/claude-howto, 42k stars), DRY Refactoring With jscpd (kucherenko/jscpd, 6.3k stars) and jscpd Duplicate Code Detector (kucherenko/jscpd, 6.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Modern JavaScript Patterns?

wshobson (a GitHub user) maintains it in wshobson/agents, which has 40,254 GitHub stars. The repository holds 142 skills in this directory. The repository was last updated on October 5, 2026.

Source: wshobson/agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.