javascript-coding-standards
БесплатноЗапускает вложенные скриптыНе проверенJavaScript/ES6+ coding standards following Airbnb guidelines, modern patterns, React best practices, and comprehensive Jest testing. Use for JavaScript…
Об этом скилле
JavaScript Coding Standards
Quick Navigation: Level 1: Quick Start (5 min) → Level 2: Implementation (30 min) → Level 3: Mastery (Extended)
Level 1: Quick Start (<2,000 tokens, 5 minutes)
Core Principles
- Modern JavaScript: Use ES6+ features (arrow functions, destructuring, async/await)
- Type Safety: Use TypeScript or JSDoc for type annotations where complexity warrants
- Test-First: Write Jest tests before implementation
- Clean Code: Follow Airbnb style guide, use meaningful names
- Modern Tooling: ESLint + Prettier for consistent formatting
Essential Checklist
- ESLint + Prettier: Code formatted and linted automatically
- Modern Syntax: Arrow functions, const/let (no var), template literals
- Testing: Jest tests with >80% coverage
- Documentation: JSDoc for complex functions and public APIs
- Error Handling: Try/catch for async operations, proper error types
- Security: Input validation, no eval(), sanitize user input
- Module System: ES6 modules (import/export), not CommonJS
- Dependencies: package.json with exact versions, npm audit passing
Quick Example
/**
* User authentication module with secure session handling.
* @module auth
*/
import bcrypt from 'bcrypt';
import jwt from 'jsonwebtoken';
/**
* Authenticate user with username and password.
*
* @param {string} username - User's username
* @param {string} password - Plain text password
* @returns {Promise<{success: boolean, token?: string, error?: string}>}
* @throws {ValidationError} If credentials are invalid
*
* @example
* const result = await authenticateUser('alice', 'secret123');
* if (result.success) {
* console.log('Token:', result.token);
* }
*/
export const authenticateUser = async (username, password) => {
// Validate inputs
if (!username || !password) {
throw new ValidationError('Username and password required');
}
try {
// Fetch user from database
const user = await fetchUserFromDb(username);
if (!user) {
return { success: false, error: 'Invalid credentials' };
}
// Verify password
const isValid = await bcrypt.compare(password, user.passwordHash);
if (!isValid) {
return { success: false, error: 'Invalid credentials' };
}
// Generate JWT token
const token = jwt.sign(
{ userId: user.id, username: user.username },
process.env.JWT_SECRET,
{ expiresIn: '1h' }
);
return { success: true, token };
} catch (error) {
console.error('Authentication error:', error);
throw new AuthenticationError('Authentication failed', error);
}
};
/**
* Custom validation error.
*/
class ValidationError extends Error {
constructor(message) {
super(message);
this.name = 'ValidationError';
}
}
/**
* Custom authentication error.
*/
class AuthenticationError extends Error {
constructor(message, cause) {
super(message);
this.name = 'AuthenticationError';
this.cause = cause;
}
}
Quick Links to Level 2
- Code Style & Formatting
- Modern JavaScript Features
- Testing Standards
- React Best Practices
- Error Handling
- Async Patterns
- Security Considerations
Level 2: Implementation (<5,000 tokens, 30 minutes)
Code Style & Formatting
Airbnb Style Guide + Automation
// ✅ Good: Modern ES6+ syntax
const calculateDiscount = (user, purchaseAmount, promoCode = null) => {
const baseDiscount = getLoyaltyDiscount(user);
const promoDiscount = promoCode ? validatePromoCode(promoCode) : 0;
return Math.min(baseDiscount + promoDiscount, 0.5);
};
// ❌ Bad: Old-style function, var, no default param
function calculateDiscount(user, purchaseAmount, promoCode) {
var baseDiscount = getLoyaltyDiscount(user);
var promoDiscount = promoCode ? validatePromoCode(promoCode) : 0;
return Math.min(baseDiscount + promoDiscount, 0.5);
}
Tool Configuration (see resources/configs/.eslintrc.json):
{
"extends": ["airbnb-base", "prettier"],
"env": {
"node": true,
"es2022": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
"rules": {
"no-console": ["warn", { "allow": ["warn", "error"] }],
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"prefer-const": "error",
"no-var": "error",
"arrow-body-style": ["error", "as-needed"]
}
}
Common Patterns:
// Destructuring
const { name, email } = user;
const [first, ...rest] = items;
// Spread operator
const newUser = { ...user, updatedAt: Date.now()
Установить javascript-coding-standards в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл javascript-coding-standards?
JavaScript/ES6+ coding standards following Airbnb guidelines, modern patterns, React best practices, and comprehensive Jest testing. Use for JavaScript projects requiring clean, maintainable, production-ready code with modern tooling.
Как установить скилл javascript-coding-standards?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл javascript-coding-standards запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic