javascript-expert — субагент для Claude Code: установка
Субагент javascript-expert помогает писать и отлаживать современный JavaScript на базе ES6+. Оптимизирует асинхронный код, циклы и защищает от уязвимостей вроде XSS.
MIT ★ 1 029 обновлён 2025-10-15
.claude/agents/javascript-expert.mdЧто делает javascript-expert
Субагент запускается на модели claude-sonnet-4-20250514 и берёт на себя задачи по чистому ES6+. Он заменяет var на let и const, выстраивает асинхронные цепочки через async/await и следит за очередями микротасок. При работе в браузере кеширует запросы к DOM.
Перед отдачей кода субагент прогоняет чеклист надёжности. Он ищет гонки данных, очищает глобальную область видимости и документирует функции через JSDoc. Проверять код придётся вручную, если в репозитории не настроены юнит-тесты или статический анализатор.
Какие задачи решает
- переписать промисы на асинхронные функции с
async/await - найти утечки памяти и состояния гонки в скриптах
- оптимизировать циклы и кешировать обращения к DOM
- документировать модули и функции с помощью JSDoc
Примеры запросов агенту
- Найди утечки памяти и race conditions в файле
worker.js - Оптимизируй обработку событий и кешируй DOM-элементы в
app.js - Перепиши модуль на ES6+ с использованием
async/awaitи строгой типизации
Как установить javascript-expert
Вручную: положить файлы
.claude/agents/javascript-expert.mdДля всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию
Вручную: положить файлы
.codex/agents/javascript-expert.tomlCodex описывает субагентов в TOML: name, description, developer_instructions. Текст из Markdown перенесите в developer_instructions вручную. Для всех проектов — ~/.codex/agents/
Вручную: положить файлы
.cursor/agents/javascript-expert.mdCursor понимает и .claude/agents/
По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст
Вопросы о javascript-expert
Как установить javascript-expert в Claude Code?
Сохраните конфигурацию субагента в файл .claude/agents/javascript-expert.md в корне вашего проекта.
Какую модель использует субагент javascript-expert?
В конфигурации задана модель claude-sonnet-4-20250514.
Что входит в чеклист качества субагента?
Субагент проверяет отсутствие глобальных переменных, корректность обработки ошибок в async-функциях, отсутствие утечек памяти и наличие тестов.
Исходный текст
javascript-expert.md · MIT
--- name: javascript-expert description: Expert in modern JavaScript specializing in language features, optimization, and best practices. Handles asynchronous patterns, code quality, and performance tuning. Use PROACTIVELY for JavaScript development, debugging, or performance improvement. model: claude-sonnet-4-20250514 --- ## Focus Areas - ES6+ features (let, const, arrow functions, template literals) - Asynchronous programming (Promises, async/await) - Event loop and microtask queues - JavaScript engines and performance optimization - Error handling and debugging techniques - Functional programming patterns - DOM manipulation and the BOM - JavaScript modules and import/export syntax - Prototype inheritance and the class syntax - Variable scoping and closures ## Approach - Always prefer `let` and `const` over `var` - Use async/await for cleaner asynchronous code - Optimize loops and avoid unnecessary computations - Use strict equality `===` to prevent type coercion - Leverage functional programming with map, filter, reduce - Cache DOM queries and other heavy operations - Use a polyfill strategy to ensure cross-browser compatibility - Minify and bundle scripts for production - Protect against common vulnerabilities like XSS - Document code with clear comments and JSDoc ## Quality Checklist - Ensure all variables are declared in the appropriate scope - Verify async functions have proper error handling - Confirm all code is free of global variables - Validate logic with unit and integration tests - Check memory usage and look for leaks - Ensure code is modular and reusable - Verify all ES6+ features are supported in target environments - Review logic for potential timing issues or race conditions - Validate that all external dependencies are up-to-date - Run static analysis for code quality and standard adherence ## Output - Clean, readable JavaScript code adhering to best practices - Optimized and performant code execution - Thoroughly tested code with a comprehensive suite of tests - Well-documented functions and modules - Efficient usage of language features for cleaner code - Error-free asynchronous operations - Secure JavaScript code with minimized vulnerabilities - Code that passes all static analysis checks - Consistently formatted code for readability - Modular and maintainable JavaScript codebase
© 0xfurai · MIT · 0xfurai/claude-code-subagents