modern-javascript-patterns

modern-javascript-patterns is a skill for Claude Code from thapaliyabikendra/ai-artifacts. It costs 64 tokens per session (1,668 once invoked), scanned A, original, Apache-2.0.

A reference for modern JavaScript features such as async and await, modules, promises, destructuring, and arrow functions. These features provide newer ways to write and organize JavaScript code.

In plain words
What is it for?
Use it when refactoring older JavaScript, implementing asynchronous code, organizing modules, or working with arrays, objects, functions, and iterators.
Why use it?
It helps replace older or awkward code patterns with clearer approaches and provides examples for common language features and functional programming techniques.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it when refactoring older JavaScript, implementing asynchronous code, organizing modules, or working with arrays, objects, functions, and iterators.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/thapaliyabikendra/ai-artifacts/modern-javascript-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add thapaliyabikendra/ai-artifacts --skill modern-javascript-patterns
Clone the repo
git clone --depth 1 https://github.com/thapaliyabikendra/ai-artifacts

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for modern-javascript-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/thapaliyabikendra/ai-artifacts/modern-javascript-patterns/github.svg)](https://agentmods.dev/skills/thapaliyabikendra/ai-artifacts/modern-javascript-patterns)
Your own site
<a href="https://agentmods.dev/skills/thapaliyabikendra/ai-artifacts/modern-javascript-patterns"><img src="https://agentmods.dev/badge/skills/thapaliyabikendra/ai-artifacts/modern-javascript-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for modern-javascript-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/thapaliyabikendra/ai-artifacts/modern-javascript-patterns"><img src="https://agentmods.dev/badge/skills/thapaliyabikendra/ai-artifacts/modern-javascript-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,668 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00064 $0.01668
Opus 5 $0.00032 $0.00834
Sonnet 5 $0.00013 $0.00334
Haiku 4.5 $0.00006 $0.00167

Measured 8d ago against content hash 233d8cdf88c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

modern-javascript-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/modern-javascript-patterns/SKILL.md · 255 lines

How it starts

The opening of the file, as written. The whole thing — 255 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Modern JavaScript Patterns

Master ES6+ features and functional programming for clean, efficient code.

Arrow Functions

// Basic syntax
const add = (a, b) => a + b;
const double = x => x * 2;
const getRandom = () => Math.random();

// Multi-line (need braces)
const processUser = user => {
  const normalized = user.name.toLowerCase();
  return { ...user, name: normalized };
};

// Returning objects (wrap in parentheses)
const createUser = (name, age) => ({ name, age });

// Lexical 'this' binding
class Counter {
  increment = () => { this.count++; };  // 'this' preserved
}

Destructuring

// Object destructuring
const { name, email } = user;
const { name: userName } = user;           // Rename
const { age = 25 } = user;                 // Default value
const { address: { city } } = user;        // Nested
const { id, ...userData } = user;          // Rest

// Array destructuring
const [first, second] = numbers;
const [, , third] = numbers;               // Skip elements
const [head, ...tail] = numbers;           // Rest
let [a, b] = [1, 2]; [a, b] = [b, a];     // Swap

// Function parameters
function greet({ name, age = 18 }) {
  console.log(`Hello ${name}`);
}

Spread & Rest

// Spread arrays
const combined = [...arr1, ...arr2];
const copy = [...arr1];

// Spread objects
const settings = { ...defaults, ...userPrefs };
const newObj = { ...user, age: 31 };

// Rest parameters
function sum(...numbers) {
  return numbers.reduce((total, n) => total + n, 0);
}

Async/Await

// Basic usage
async function fetchUser(id) {
  try {
    const response = await fetch(`/api/users/${id}`);
    return await response.json();
  } catch (error) {
    console.error('Error:', error);
    throw error;
  }
}

// Parallel execution
const [user1, user2] = await Promise.all([
  fetchUser(1),
  fetchUser(2)
]);

// Promise combinators
Promise.all(promises);        // Wait for all
Promise.allSettled(promises); // All results, regardless of outcome
Promise.race(promises);       // First to complete
Promise.any(promises);        // First to succeed

Read the full file on GitHub · 255 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 255 lines · 64 tokens per session scan A 233d8cdf88c2

Subscribe to this mod's changes

modern-javascript-patterns is a skill published in the GitHub repository thapaliyabikendra/ai-artifacts (24 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 64 tokens to every session and 1,668 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

Async Correctness 非同期処理の正しさ検証

A code review check for asynchronous code, meaning work that finishes later through async/await, promises, or chained callbacks. It looks for missing waits, ignored errors, and operations that can run in the wrong order or interfere with each other.

s977043/river-review · 95 tokens

python-backend

Production Python async patterns including asyncio TaskGroup, FastAPI dependency injection and middleware, SQLAlchemy 2.0 async sessions, and database connection pool tuning. Python 3.11+ runtime concerns such as ExceptionGroup, cancellation semantics, and session rollback. Use when building async services, wiring…

yonatangross/orchestkit · 82 tokens

pytdbot

Write Telegram bots and userbots with Pytdbot (async TDLib wrapper with high-level helpers; not the Telegram Bot API). Use when the user works with Pytdbot, TDLib, or pytdbot.Client.

pytdbot/client · 49 tokens

fastapi

Use when building, reviewing, testing, securing or shipping a FastAPI / async Python service — routers, Pydantic v2 schemas, dependency injection, async SQLAlchemy 2.0, OAuth2/JWT, ASGITransport tests, production wiring. NOT language-level Python or packaging (that is python), NOT engine-level SQL (that is…

ericrisco/rsc-harness · 94 tokens

python

Use when the task is Python itself, in any framework or none: PEP 695 generics, mypy --strict typing, dataclass/Protocol/TypedDict/Enum choices, asyncio.TaskGroup, stdlib idioms, src/ layout + pyproject.toml with uv, ruff+mypy+pytest gate. NOT a FastAPI/ASGI service (that is fastapi), NOT a deep pytest suite (that is…

ericrisco/rsc-harness · 94 tokens

fastapi-expert

Expert-level FastAPI development for high-performance Python APIs with async support. Use when the user mentions Python, API, async, REST, OpenAPI, or Pydantic, or when the task involves FastAPI Features.

personamanagmentlayer/pcl · 49 tokens