Command Palette

Search for a command to run...

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

coding-standards

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

Comprehensive coding standards and best practices for maintainable, consistent software development across multiple languages and paradigms

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

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

Coding Standards Skill

Level 1: Quick Start (5 minutes)

What You'll Learn

Apply essential coding standards for clean, maintainable code that follows industry best practices.

Core Principles

  • Consistency: Follow established style guides (PEP 8, Airbnb, Google)
  • Readability: Write self-documenting code with clear naming
  • Maintainability: Keep functions small (<50 lines), files focused (<500 lines)
  • Quality: Enforce standards with linters and formatters

Quick Reference

# ✅ Good: Clear naming, single responsibility
def calculate_user_discount(user: User, order: Order) -> Decimal:
    """Calculate discount based on user tier and order total."""
    if user.tier == "premium":
        return order.total * Decimal("0.15")
    return order.total * Decimal("0.05")

# ❌ Bad: Unclear naming, mixed concerns
def calc(u, o):
    d = 0.15 if u.t == "p" else 0.05
    save_to_db(u, o, d)  # Side effect!
    return o.t * d

Essential Checklist

  • Follow language-specific style guide
  • Use meaningful, descriptive names
  • Limit function complexity (cyclomatic < 10)
  • Configure linter and formatter
  • Add pre-commit hooks

Common Pitfalls

  • Inconsistent naming conventions within a project
  • Functions that do too many things
  • Missing or outdated documentation
  • Skipping code reviews

Level 2: Implementation (30 minutes)

Deep Dive Topics

1. Code Style and Formatting

Naming Conventions by Language:

// TypeScript/JavaScript
class UserService {}           // PascalCase for classes
const getUserById = () => {}   // camelCase for functions
const API_ENDPOINT = "..."     // UPPER_SNAKE_CASE for constants
# Python
class UserService:              # PascalCase for classes
def get_user_by_id():          # snake_case for functions
API_ENDPOINT = "..."           # UPPER_SNAKE_CASE for constants

File Organization:

src/
├── models/           # Data models and types
├── services/         # Business logic (max 500 lines/file)
├── controllers/      # Request handlers
├── utils/           # Shared utilities
└── config/          # Configuration

2. Documentation Standards

Function Documentation:

/**
 * Calculates the final price after applying discounts and tax.
 *
 * @param basePrice - The original price before any adjustments
 * @param discountRate - Discount as a decimal (0.1 = 10%)
 * @param taxRate - Tax rate as a decimal (0.08 = 8%)
 * @returns The final price rounded to 2 decimal places
 * @throws {ValidationError} If basePrice is negative
 *
 * @example
 * const finalPrice = calculateFinalPrice(100, 0.1, 0.08);
 * // Returns 97.20 (100 - 10% discount + 8% tax)
 */
function calculateFinalPrice(
  basePrice: number,
  discountRate: number,
  taxRate: number
): number {
  if (basePrice < 0) {
    throw new ValidationError("Base price cannot be negative");
  }
  const discounted = basePrice * (1 - discountRate);
  return Math.round(discounted * (1 + taxRate) * 100) / 100;
}

3. Architecture Patterns

SOLID Principles Application:

// Single Responsibility Principle
class UserRepository {
  async findById(id: string): Promise<User> {}
  async save(user: User): Promise<void> {}
}

class UserValidator {
  validate(user: User): ValidationResult {}
}

// Dependency Injection
class UserService {
  constructor(
    private readonly repository: UserRepository,
    private readonly validator: UserValidator
  ) {}

  async createUser(userData: UserData): Promise<User> {
    const validation = this.validator.validate(userData);
    if (!validation.isValid) {
      throw new ValidationError(validation.errors);
    }
    return this.repository.save(new User(userData));
  }
}

4. Error Handling

// Custom error hierarchy
class ApplicationError extends Error {
  constructor(
    message: string,
    public code: string,
    public statusCode: number = 500
  ) {
    super(message);
    this.name = this.constructor.name;
  }
}

class ValidationError extends ApplicationError {
  constructor(message: string, public fields: string[]) {
    super(message, "VALIDATION_ERROR", 400);
  }
}

// Usage with proper error handling
async function processPayment(payment: Payment): Promise<Result> {
  try {
    validatePaymentData(payment);
    const result = await paymentGateway.charge(payment);
    await auditLog.record("payment.success", { paymentId: result.id });
    return result;
  } catch (error) {
    if (error instanceof ValidationError) {
      logger.warn("Invalid payment data", { fields: error.fields });
      throw error;
    }
    logger.error("Payment processing failed", { error, payment });
    throw new ApplicationError(
      "Payment processing failed",
      "PAYMENT_ERROR",
      502
    );
  }
}

Implementation Patterns

DRY (Don't Repeat Yourself)

// ❌ Bad: Repeated logic
function calculateEmploye
Полный SKILL.md на GitHub

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

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

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

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

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

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

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

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

go/SKILL.mdgo/resources/README.mdgo/resources/configs/.golangci.ymlgo/scripts/README.mdgo/templates/README.mdjavascript/SKILL.mdjavascript/resources/README.mdjavascript/resources/configs/.eslintrc.jsonjavascript/resources/configs/.prettierrcjavascript/resources/configs/jest.config.jsonjavascript/resources/configs/package.jsonjavascript/scripts/README.mdjavascript/templates/README.mdkotlin/REFERENCE.mdkotlin/SKILL.mdkotlin/config/detekt.ymlkotlin/scripts/setup-kotlin-project.shkotlin/templates/Repository.ktkotlin/templates/ViewModel.ktkotlin/templates/sealed-class.ktkotlin/templates/test-template.ktpython/REFERENCE.mdpython/SKILL.mdpython/resources/README.mdpython/resources/advanced-patterns.mdpython/resources/configs/.pre-commit-config.yamlpython/resources/configs/pyproject.tomlpython/scripts/README.mdpython/scripts/check-code-quality.shpython/scripts/setup-project.shpython/templates/README.mdpython/templates/test-template.pyrust/REFERENCE.mdrust/SKILL.mdrust/config/clippy.tomlrust/config/rustfmt.tomlrust/resources/README.mdrust/scripts/README.mdrust/scripts/setup-rust-project.shrust/templates/README.md

FAQ

Что делает скилл coding-standards?

Comprehensive coding standards and best practices for maintainable, consistent software development across multiple languages and paradigms

Как установить скилл coding-standards?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл coding-standards запускает скрипты?

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

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

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