PluginBench
Skill
Pass
Audit score 90

modern-javascript-patterns

wshobson/agents

Master ES6+ features and modern JavaScript patterns for clean, efficient code.

What is modern-javascript-patterns?

Comprehensive guide to ES6+ syntax including async/await, destructuring, arrow functions, promises, and functional programming. Use when refactoring legacy code, implementing modern patterns, or optimizing JavaScript applications.

  • Learn async/await, promises, and asynchronous operation patterns
  • Master destructuring, spread operators, and modern syntax features
  • Implement functional programming and data transformation pipelines
  • Apply best practices for const/let, arrow functions, and template literals
  • Use optional chaining and nullish coalescing for safer code
  • Understand iterators, generators, and module patterns

How to install modern-javascript-patterns

npx skills add https://github.com/wshobson/agents --skill modern-javascript-patterns
Claude Code
Cursor
Windsurf
Cline

How to use modern-javascript-patterns

  1. 1.Review the core patterns documentation in references/details.md
  2. 2.Study the 15 best practices including const/let usage, arrow functions, and async/await
  3. 3.Consult references/advanced-patterns.md for common pitfalls like this binding and memory leaks
  4. 4.Apply patterns incrementally to your codebase, starting with async/await migration
  5. 5.Use destructuring and spread operators in new code to improve readability
  6. 6.Implement pure functions and functional programming methods in data pipelines

Use cases

Good for
  • Refactoring callback-based code to async/await patterns
  • Building modern web applications with clean, maintainable syntax
  • Implementing data transformation pipelines with functional methods
  • Migrating legacy JavaScript to ES6+ standards
  • Optimizing performance through modern language features
Who it's for
  • JavaScript developers modernizing codebases
  • Frontend engineers building web applications
  • Backend Node.js developers
  • Developers learning functional programming concepts
  • Teams standardizing on modern JavaScript practices

modern-javascript-patterns FAQ

When should I use const vs let?

Use const by default for all variables. Only use let when you need to reassign a variable. Avoid var entirely in modern JavaScript.

Should I use async/await or Promise chains?

Prefer async/await over Promise chains as it's more readable, easier to debug, and simplifies error handling with try/catch blocks.

What's the difference between arrow functions and regular functions?

Arrow functions have lexical this binding (inherit from surrounding scope), are more concise, and lack their own arguments object. Use them for callbacks and short functions.

How do I handle errors in async/await code?

Wrap async/await calls in try/catch blocks to handle errors synchronously, making error handling clearer than Promise .catch() chains.

Where can I find detailed pattern examples?

Detailed pattern documentation and worked examples are in references/details.md. Advanced patterns and common pitfalls are covered in references/advanced-patterns.md.

Full instructions (SKILL.md)

Source of truth, from wshobson/agents.


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.