PluginBench
Skill
Pass
Audit score 90

javascript-pro

jeffallan/claude-skills

Write, debug, and refactor modern JavaScript using ES2023+, async/await, and Node.js best practices.

What is javascript-pro?

JavaScript Pro handles vanilla JavaScript development with ES2023+ syntax, async/await patterns, ESM modules, and Node.js APIs. Use it when building JavaScript applications, optimizing performance, implementing async flows, or reviewing code for correctness and best practices.

  • Writes ES2023+ JavaScript with proper async/await and Promise handling
  • Debugs and refactors code for memory leaks, performance, and correctness
  • Implements ESM and CommonJS module systems with proper exports
  • Develops Node.js backend services using fs/promises, streams, and worker threads
  • Works with browser APIs including Fetch, Web Workers, Service Workers, and Storage
  • Validates code with linting, testing (85%+ coverage), and bundle analysis

How to install javascript-pro

npx skills add https://github.com/jeffallan/claude-skills --skill javascript-pro
Claude Code
Cursor
Windsurf
Cline

How to use javascript-pro

  1. 1.Review package.json and confirm module system (ESM/CJS) and Node version target
  2. 2.Analyze requirements and plan module architecture with async flows
  3. 3.Write code using ES2023+ features, async/await, and optional chaining patterns
  4. 4.Run eslint --fix and resolve all linting issues before proceeding
  5. 5.Check for memory leaks using DevTools or --inspect flag; resolve any found
  6. 6.Write comprehensive tests with Jest targeting 85%+ coverage; add missing test cases if needed
  7. 7.Verify no unhandled Promise rejections and confirm bundle size acceptable

Use cases

Good for
  • Building vanilla JavaScript applications with modern syntax and patterns
  • Implementing Promise-based async flows with proper error handling
  • Optimizing browser performance and detecting memory leaks with DevTools
  • Developing Node.js backend services with async I/O and streams
  • Reviewing .js/.mjs/.cjs files for ES2023+ compliance and best practices
Who it's for
  • JavaScript developers building vanilla applications
  • Node.js backend engineers
  • Frontend developers optimizing performance
  • Code reviewers ensuring modern standards
  • Full-stack developers working with ESM modules

javascript-pro FAQ

Should I use ESM or CommonJS?

Use ESM (import/export) for new projects. Only use CommonJS (.cjs) for legacy Node.js projects or when required by dependencies. Do not mix both in the same module.

How do I handle errors in async functions?

Always wrap async operations in try/catch blocks. Check response.ok for fetch calls and throw errors explicitly. Return null or a default value on failure rather than letting rejections propagate unhandled.

What should I use instead of callbacks?

Use async/await for all asynchronous operations. Promises are acceptable but async/await is preferred for readability and error handling.

How do I avoid memory leaks?

Use DevTools or Node.js --inspect flag to profile memory. Avoid retaining large objects, properly clean up event listeners, and ensure Web Workers are terminated when no longer needed.

What's the minimum test coverage required?

Aim for 85%+ code coverage with Jest. Add tests for error cases, edge conditions, and async flows. Ensure all Promise rejections are handled in tests.

Full instructions (SKILL.md)

Source of truth, from jeffallan/claude-skills.


name: javascript-pro description: Writes, debugs, and refactors JavaScript code using modern ES2023+ features, async/await patterns, ESM module systems, and Node.js APIs. Use when building vanilla JavaScript applications, implementing Promise-based async flows, optimising browser or Node.js performance, working with Web Workers or Fetch API, or reviewing .js/.mjs/.cjs files for correctness and best practices. license: MIT metadata: author: https://github.com/Jeffallan version: "1.1.0" domain: language triggers: JavaScript, ES2023, async await, Node.js, vanilla JavaScript, Web Workers, Fetch API, browser API, module system role: specialist scope: implementation output-format: code related-skills: fullstack-guardian

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