AI студия Владимира Ломтева
УСЛУГИПРОЕКТЫСТАТЬИБАЗА ЗНАНИЙМаркетплейсОбучениеПолезные сервисы

Оставьте заявку,
чтобы обсудить проект

Напишите ваш вопрос, не забудьте указать телефон. Мы перезвоним и все расскажем.

Контакты

Москва

Работаем по всей России
и миру (онлайн)

+7 (999) 760-24-41

Ежедневно с 9:00 до 21:00

v.lomtev@airassvet.ru

По вопросам сотрудничества

TelegramWhatsApp

Есть предложение?

Напишите нам в мессенджеры

© 2025 AI студия Владимира Ломтева

Политика конфиденциальностиСогласие на обработку ПДн|ИНН 623412173261
    Logging Best Practices — Скилл для ИИ-агентов | AI Рассвет

    Logging Best Practices

    Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics

    Скиллы для операций#GitHub#boristane/agent-skills#skills.sh
    Скачивания
    0
    В избранном
    0
    Комментарии
    0
    Просмотры
    1

    Установить скилл

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

    npx skills add boristane/agent-skills --skill logging-best-practices
    Скачать ZIP
    Версия
    1.0.0+8aa14dd16a13
    Автор
    Владимир Ломтев
    Репозиторий
    boristane/agent-skills
    GitHub: boristane/agent-skills

    Как установить

    1. 1Скопируйте команду из блока установки.
    2. 2Запустите её в терминале из каталога проекта.

    Документация

    Logging Best Practices Skill

    Version: 1.0.0

    Purpose

    This skill provides guidelines for implementing effective logging in applications. It focuses on wide events (also called canonical log lines) - a pattern where you emit a single, context-rich event per request per service, enabling powerful debugging and analytics.

    When to Apply

    Apply these guidelines when:

    • Writing or reviewing logging code
    • Adding console.log, logger.info, or similar
    • Designing logging strategy for new services
    • Setting up logging infrastructure

    Core Principles

    1. Wide Events (CRITICAL)

    Emit one context-rich event per request per service. Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion.

    const wideEvent: Record<string, unknown> = {
      method: 'POST',
      path: '/checkout',
      requestId: c.get('requestId'),
      timestamp: new Date().toISOString(),
    };
    
    try {
      const user = await getUser(c.get('userId'));
      wideEvent.user = { id: user.id, subscription: user.subscription };
    
      const cart = await getCart(user.id);
      wideEvent.cart = { total_cents: cart.total, item_count: cart.items.length };
    
      wideEvent.status_code = 200;
      wideEvent.outcome = 'success';
      return c.json({ success: true });
    } catch (error) {
      wideEvent.status_code = 500;
      wideEvent.outcome = 'error';
      wideEvent.error = { message: error.message, type: error.name };
      throw error;
    } finally {
      wideEvent.duration_ms = Date.now() - startTime;
      logger.info(wideEvent);
    }
    

    2. High Cardinality & Dimensionality (CRITICAL)

    Include fields with high cardinality (user IDs, request IDs - millions of unique values) and high dimensionality (many fields per event). This enables querying by specific users and answering questions you haven't anticipated yet.

    3. Business Context (CRITICAL)

    Always include business context: user subscription tier, cart value, feature flags, account age. The goal is to know "a premium customer couldn't complete a $2,499 purchase" not just "checkout failed."

    4. Environment Characteristics (CRITICAL)

    Include environment and deployment info in every event: commit hash, service version, region, instance ID. This enables correlating issues with deployments and identifying region-specific problems.

    5. Single Logger (HIGH)

    Use one logger instance configured at startup and import it everywhere. This ensures consistent formatting and automatic environment context.

    6. Middleware Pattern (HIGH)

    Use middleware to handle wide event infrastructure (timing, status, environment, emission). Handlers should only add business context.

    7. Structure & Consistency (HIGH)

    • Use JSON format consistently
    • Maintain consistent field names across services
    • Simplify to two log levels: info and error
    • Never log unstructured strings

    Anti-Patterns to Avoid

    1. Scattered logs: Multiple console.log() calls per request
    2. Multiple loggers: Different logger instances in different files
    3. Missing environment context: No commit hash or deployment info
    4. Missing business context: Logging technical details without user/business data
    5. Unstructured strings: console.log('something happened') instead of structured data
    6. Inconsistent schemas: Different field names across services

    Guidelines

    Wide Events (rules/wide-events.md)

    • Emit one wide event per service hop
    • Include all relevant context
    • Connect events with request ID
    • Emit at request completion in finally block

    Context (rules/context.md)

    • Support high cardinality fields (user_id, request_id)
    • Include high dimensionality (many fields)
    • Always include business context
    • Always include environment characteristics (commit_hash, version, region)

    Structure (rules/structure.md)

    • Use a single logger throughout the codebase
    • Use middleware for consistent wide events
    • Use JSON format
    • Maintain consistent schema
    • Simplify to info and error levels
    • Never log unstructured strings

    Common Pitfalls (rules/pitfalls.md)

    • Avoid multiple log lines per request
    • Design for unknown unknowns
    • Always propagate request IDs across services

    References:

    • Logging Sucks
    • Observability Wide Events 101
    • Stripe - Canonical Log Lines

    Требования и возможности

    Источник пакета
    https://github.com/boristane/agent-skills/tree/8aa14dd16a1340a6049e6d7cd58e2ed52333a550/skills/logging-best-practices

    Файлы версии

    ПутьРазмерSHA256
    README.md21023a8663d96d0dbe6b...
    SKILL.md4657eadd94d35b6d9ed4...
    metadata.json448c29c6d7584272793...
    rules/context.md4806d7f55cf2cd8f06af...
    rules/pitfalls.md3373078dfe0aae9138a2...

    Частые вопросы

    Как установить Logging Best Practices?
    Используйте команду npx skills add boristane/agent-skills --skill logging-best-practices или скачайте ZIP-архив.
    Можно ли скачать Logging Best Practices бесплатно?
    Да, опубликованную версию можно скачать из маркетплейса бесплатно.

    Похожие инструменты

    Смотреть все
    Ozon Seller и Performance APIСправочник Ozon Seller API и Performance API с локальными OpenAPI-спецификациями.Grill MeA relentless interview to sharpen a plan or design.Git CommitExecute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping
    Комментарии

    Войдите, чтобы оставить комментарий.

    Комментариев пока нет.

    Установить скилл

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

    npx skills add boristane/agent-skills --skill logging-best-practices
    Скачать ZIP
    Версия
    1.0.0+8aa14dd16a13
    Автор
    Владимир Ломтев
    Репозиторий
    boristane/agent-skills
    GitHub: boristane/agent-skills
    Llm WikiThe foundational knowledge distillation pattern for building and maintaining an AI-powered Obsidian wiki. Based on Andrej Karpathy's LLM Wiki architecture. Use this skill whenever the user wants to understand the wiki pattern, set up a new knowledge base, or needs guidance on the three-layer architecture (raw sources → wiki → schema). Also use when discussing knowledge management strategy, wiki structure decisions, or how to organize distilled knowledge. This is the "theory" skill — other skills handle specific operations (ingesting, querying, linting).