Skill Press

No. 635 · modern-javascript-patterns

Modern JavaScript Patterns

A field guide from Seth Hobson

Seth Hobson

When to use it

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.

Rank
No. 635 of 971
Installs
Not listed yet
Runs in
Claude, Codex, Cursor, GitHub Copilot
Length
235 words · 1 min
Files
4
License
MIT

Get this skill

Download the skill folder (.zip, 10 KB) ↓ · SKILL.md only ↓

Agent prompt

Paste into a coding agent with terminal access. Check the upstream requirements for the skill you’re installing.

Prompt
Install the "modern-javascript-patterns" Agent Skill by Seth Hobson, from https://github.com/wshobson/agents.

1. Fetch the whole folder plugins/javascript-typescript/skills/modern-javascript-patterns — SKILL.md plus every script, reference, and asset beside it, not just SKILL.md. For example:
   skill_checkout=$(mktemp -d)
   git init "$skill_checkout"
   git -C "$skill_checkout" fetch --depth 1 https://github.com/wshobson/agents.git 42203085cfc5736204bf0f6d436dff7e1da0bf3f
   git -C "$skill_checkout" checkout --detach FETCH_HEAD
2. Copy it into your skills directory as a folder named "modern-javascript-patterns":
   - Claude Code: ~/.claude/skills/modern-javascript-patterns/ (all projects) or .claude/skills/modern-javascript-patterns/ (this project only)
   - Another agent: the directory you load Agent Skills from (folders containing a SKILL.md)
3. Check that modern-javascript-patterns/SKILL.md exists and its frontmatter says name: modern-javascript-patterns.
4. Read SKILL.md, then tell me in two or three sentences what the skill does and when it will trigger, and list any dependencies it mentions (Python packages, npm packages, CLIs) that aren't installed yet. Don't install them without asking.

skills CLI

One command; the skills.sh installer detects your agents (Claude Code, Cursor, Codex, and more).

Terminal
npx skills add https://github.com/wshobson/agents/tree/42203085cfc5736204bf0f6d436dff7e1da0bf3f/plugins/javascript-typescript/skills/modern-javascript-patterns --skill modern-javascript-patterns

Claude.ai

Upload the .zip as a custom skill.

  1. In Settings → Capabilities, turn on “Code execution and file creation”.
  2. Download the .zip above.
  3. Go to Customize → Skills, click + → Create skill → Upload a skill, and choose it.
Anthropic’s guide to using skills ↗

Contents

  1. When to Use This Skill
  2. Detailed patterns and worked examples
  3. Best Practices

The skill, in full

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.

More in Software & Web Development

All Software & Web Development skills →

More from Seth Hobson

From wshobson/agents at 4220308, MIT. Install counts from skills.sh.