New to Claude Skills? Learn how to install them →

jeffallan on GitHub

JavaScript Pro

Free

Write and debug modern JavaScript with best practices.

Get this skill

Free · Opens the source repo

What JavaScript Pro does

JavaScript Pro is a skill designed for developers who want to enhance their JavaScript coding practices using modern features and patterns. This skill focuses on writing, debugging, and refactoring JavaScript code compliant with ES2023+ standards. It is particularly useful for those building vanilla JavaScript applications, implementing async/await patterns, and optimizing performance in both browser and Node.js environments. With a strong emphasis on best practices, this skill guides users through the entire development process, from analyzing requirements to validating code quality.

The core workflow of JavaScript Pro includes analyzing project requirements, designing architecture, implementing code, validating it with linters, and testing for coverage. Users will be encouraged to utilize advanced features such as optional chaining, nullish coalescing, and the modern ESM module system. The skill also provides reference guides covering essential topics like async patterns, browser APIs, and Node.js essentials, ensuring that developers have access to the information they need right when they need it.

JavaScript Pro is ideal for developers who are either new to modern JavaScript or those looking to refine their existing skills. By following the guidelines and patterns provided, users can avoid common pitfalls such as unhandled Promise rejections and improper error handling. The skill promotes a clean, maintainable coding style that adheres to functional programming principles, making it suitable for both front-end and back-end development tasks.

Whether you are developing a new application or maintaining existing code, JavaScript Pro will help you write efficient, high-quality JavaScript that leverages the latest language features and best practices. This skill is a valuable resource for anyone looking to elevate their JavaScript development skills and deliver robust applications.

When to use it

Use JavaScript Pro when building new JavaScript applications, especially when implementing async flows or optimizing performance.

When not to use it

This skill may not be suitable for legacy projects that rely heavily on older JavaScript patterns or for developers who prefer not to use modern ES2023+ features.

What you can build with it

Building a New Web App

Use JavaScript Pro to implement modern JavaScript features while ensuring best practices in a new web application.

Optimizing Node.js Services

Leverage this skill to improve performance and memory usage in your Node.js backend services.

Reviewing Existing Code

Utilize JavaScript Pro to analyze and refactor existing JavaScript code for compliance with modern standards.

How to install JavaScript Pro

View source

1. Install with the skills CLI

npx skills add jeffallan/claude-skills/javascript-pro --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by jeffallan

JavaScript Pro

When to Use This Skill

  • Building vanilla JavaScript applications
  • Implementing async/await patterns and Promise handling
  • Working with modern module systems (ESM/CJS)
  • Optimizing browser performance and memory usage
  • Developing Node.js backend services
  • Implementing Web Workers, Service Workers, or browser APIs

Core Workflow

  1. Analyze requirements — Review package.json, module system, Node version, browser targets; confirm .js/.mjs/.cjs conventions
  2. Design architecture — Plan modules, async flows, and error handling strategies
  3. Implement — Write ES2023+ code with proper patterns and optimisations
  4. Validate — Run linter (eslint --fix); if linter fails, fix all reported issues and re-run before proceeding. Check for memory leaks with DevTools or --inspect, verify bundle size; if leaks are found, resolve them before continuing
  5. Test — Write comprehensive tests with Jest achieving 85%+ coverage; if coverage falls short, add missing cases and re-run. Confirm no unhandled Promise rejections

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
Modern Syntaxreferences/modern-syntax.mdES2023+ features, optional chaining, private fields
Async Patternsreferences/async-patterns.mdPromises, async/await, error handling, event loop
Modulesreferences/modules.mdESM vs CJS, dynamic imports, package.json exports
Browser APIsreferences/browser-apis.mdFetch, Web Workers, Storage, IntersectionObserver
Node Essentialsreferences/node-essentials.mdfs/promises, streams, EventEmitter, worker threads

Constraints

MUST DO

  • Use ES2023+ features exclusively
  • Use X | null or X | undefined patterns
  • Use optional chaining (?.) and nullish coalescing (??)
  • Use async/await for all asynchronous operations
  • Use ESM (import/export) for new projects
  • Implement proper error handling with try/catch
  • Add JSDoc comments for complex functions
  • Follow functional programming principles

MUST NOT DO

  • Use var (always use const or let)
  • Use callback-based patterns (prefer Promises)
  • Mix CommonJS and ESM in the same module
  • Ignore memory leaks or performance issues
  • Skip error handling in async functions
  • Use synchronous I/O in Node.js
  • Mutate function parameters
  • Create blocking operations in the browser

Key Patterns with Examples

Async/Await Error Handling

// ✅ Correct — always handle async errors explicitly
async function fetchUser(id) {
  try {
    const response = await fetch(`/api/users/${id}`);
    if (!response.ok) throw new Error(`HTTP ${response.status}`);
    return await response.json();
  } catch (err) {
    console.error("fetchUser failed:", err);
    return null;
  }
}

// ❌ Incorrect — unhandled rejection, no null guard
async function fetchUser(id) {
  const response = await fetch(`/api/users/${id}`);
  return response.json();
}

Optional Chaining & Nullish Coalescing

// ✅ Correct
const city = user?.address?.city ?? "Unknown";

// ❌ Incorrect — throws if address is undefined
const city = user.address.city || "Unknown";

ESM Module Structure

// ✅ Correct — named exports, no default-only exports for libraries
// utils/math.mjs
export const add = (a, b) => a + b;
export const multiply = (a, b) => a * b;

// consumer.mjs
import { add } from "./utils/math.mjs";

// ❌ Incorrect — mixing require() with ESM
const { add } = require("./utils/math.mjs");

Avoid var / Prefer const

// ✅ Correct
const MAX_RETRIES = 3;
let attempts = 0;

// ❌ Incorrect
var MAX_RETRIES = 3;
var attempts = 0;

Output Templates

When implementing JavaScript features, provide:

  1. Module file with clean exports
  2. Test file with comprehensive coverage
  3. JSDoc documentation for public APIs
  4. Brief explanation of patterns used

Documentation

Frequently asked questions about JavaScript Pro

Similar skills