modern-javascript-patterns

Applies ES6+ syntax, async patterns, and functional programming techniques to JavaScript codebases.

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill modern-javascript-patterns-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-javascript-patterns
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/modern-javascript-patterns
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill modern-javascript-patterns-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Legacy JavaScript codebases often rely on outdated syntax, callback pyramids, and mutable data patterns that are hard to read, test, and maintain. This Skill provides structured guidance and code examples for modernizing JavaScript with ES6+ features and functional programming patterns. ## Core Features & Use Cases - ES6+ Syntax Modernization: Covers arrow functions, destructuring, spread/rest operators, template literals, enhanced object literals, optional chaining, and nullish coalescing. - Asynchronous Patterns: Guides migration from callbacks to Promises and async/await, including Promise combinators, retry logic, timeouts, and parallel execution. - Functional Programming: Demonstrates map/filter/reduce pipelines, currying, memoization, function composition, and immutable data updates. - Use Case: When refactoring a legacy Express route handler that nests callbacks three levels deep, use this Skill to rewrite it with async/await, destructured parameters, and immutable state updates. ## Quick Start Refactor this JavaScript file to use modern ES6+ syntax with async/await and immutable data patterns.

Frequently Asked Questions about modern-javascript-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor JavaScript callbacks to async/await?

Wrap callback-based operations in Promises, then consume them with async/await inside try/catch blocks for error handling. Use Promise.all to run independent operations in parallel instead of awaiting them sequentially.

How to update JavaScript objects without mutating them?

Use the spread operator to create copies with updated properties, such as { ...user, age: 31 }. For arrays, use map, filter, and spread instead of push or splice to keep operations immutable.

What is the difference between Promise.all and Promise.allSettled?

Promise.all rejects immediately when any promise fails, while Promise.allSettled waits for all promises and reports each result's status as fulfilled or rejected. Use allSettled when partial results are acceptable.

Does optional chaining work with nullish coalescing?

Yes, they combine well: user?.address?.city ?? 'unknown' safely accesses nested properties and provides a default only for null or undefined. Unlike logical OR, nullish coalescing preserves falsy values like 0 and empty strings.

When should I avoid arrow functions in JavaScript?

Avoid arrow functions when you need dynamic this binding, such as object methods that reference the instance, event handlers needing the element context, or prototype methods. Arrow functions capture lexical this from the enclosing scope.