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-patternsHow to use modern-javascript-patterns
- 1.Review the core patterns documentation in references/details.md
- 2.Study the 15 best practices including const/let usage, arrow functions, and async/await
- 3.Consult references/advanced-patterns.md for common pitfalls like this binding and memory leaks
- 4.Apply patterns incrementally to your codebase, starting with async/await migration
- 5.Use destructuring and spread operators in new code to improve readability
- 6.Implement pure functions and functional programming methods in data pipelines
Use cases
- 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
- 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
Use const by default for all variables. Only use let when you need to reassign a variable. Avoid var entirely in modern JavaScript.
Prefer async/await over Promise chains as it's more readable, easier to debug, and simplifies error handling with try/catch blocks.
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.
Wrap async/await calls in try/catch blocks to handle errors synchronously, making error handling clearer than Promise .catch() chains.
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
- Use const by default: Only use let when reassignment is needed
- Prefer arrow functions: Especially for callbacks
- Use template literals: Instead of string concatenation
- Destructure objects and arrays: For cleaner code
- Use async/await: Instead of Promise chains
- Avoid mutating data: Use spread operator and array methods
- Use optional chaining: Prevent "Cannot read property of undefined"
- Use nullish coalescing: For default values
- Prefer array methods: Over traditional loops
- Use modules: For better code organization
- Write pure functions: Easier to test and reason about
- Use meaningful variable names: Self-documenting code
- Keep functions small: Single responsibility principle
- Handle errors properly: Use try/catch with async/await
- Use strict mode:
'use strict'for better error catching
For common pitfalls (this binding, promise anti-patterns, memory leaks), see references/advanced-patterns.md.
Related skills
More from wshobson/agents and the wider catalog.

monorepo-management
Master Turborepo, Nx, and pnpm workspaces for efficient, scalable multi-package repositories.

mtls-configuration
Configure mutual TLS for zero-trust service-to-service communication with certificate management.

multi-cloud-architecture
Design multi-cloud architectures across AWS, Azure, GCP, and OCI with decision frameworks and service selection patterns.

multi-reviewer-patterns
Coordinate parallel code reviews across multiple dimensions with deduplication, severity calibration, and consolidated reporting.

nextjs-app-router-patterns
Master Next.js 14+ App Router with Server Components, streaming, and advanced patterns.

nft-standards
Implement ERC-721 and ERC-1155 NFT standards with metadata, minting, royalties, and marketplace integration.