‹ 首页

javascript-pro

@jeffallan · 收录于 1 周前 · 上游提交 1 个月前

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.

适合你,如果主要用 JavaScript 开发应用或 Node.js 服务

/ 下载安装
javascript-pro.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add jeffallan/claude-skills/javascript-pro
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- jeffallan/claude-skills/javascript-pro
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify jeffallan/claude-skills/javascript-pro
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
10501GitHub stars
~999最小装载
~9.8K含声明引用
~9.8K文本包总量
镜像托管

怎么用

商店整理自技能原文 · 版本 e8be415 · 表述以原文为准
它做什么

Claude 会使用 ES2023+ 语法、async/await、ESM 模块等现代 JavaScript 特性来编写、调试和重构代码,并自动检查代码质量、修复 lint 错误、测试覆盖率需达 85% 以上。

什么时候触发

当你要求编写或审查 JavaScript 代码,尤其是涉及异步流程、模块系统、浏览器 API 或 Node.js 时触发。

装好后可以这样说
Claude 会按现代模式重构异步代码。
Claude 会分析代码并建议修复。
Claude 会生成完整模块和测试。
技能原文 SKILL.md作者撰写 · MIT · e8be415

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:

| Topic | Reference | Load When | |-------|-----------|-----------| | Modern Syntax | references/modern-syntax.md | ES2023+ features, optional chaining, private fields | | Async Patterns | references/async-patterns.md | Promises, async/await, error handling, event loop | | Modules | references/modules.md | ESM vs CJS, dynamic imports, package.json exports | | Browser APIs | references/browser-apis.md | Fetch, Web Workers, Storage, IntersectionObserver | | Node Essentials | references/node-essentials.md | fs/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

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。