Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

javascript-coding-standards

БесплатноЗапускает вложенные скриптыНе проверен

JavaScript/ES6+ coding standards following Airbnb guidelines, modern patterns, React best practices, and comprehensive Jest testing. Use for JavaScript…

williamzujkowskiот williamzujkowski★ 23 звезды на GitHub19 установок в других каталогах

Об этом скилле

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

  1. Modern JavaScript: Use ES6+ features (arrow functions, destructuring, async/await)
  2. Type Safety: Use TypeScript or JSDoc for type annotations where complexity warrants
  3. Test-First: Write Jest tests before implementation
  4. Clean Code: Follow Airbnb style guide, use meaningful names
  5. 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


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()
Полный SKILL.md на GitHub

Установить javascript-coding-standards в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

resources/README.mdresources/configs/.eslintrc.jsonresources/configs/.prettierrcresources/configs/jest.config.jsonresources/configs/package.jsonscripts/README.mdtemplates/README.md

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 запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить javascript-coding-standards с