Token导航 LogoToken导航TokenDH.com
开发规范只读github未标认证来源可访问clear审计通过

logging-best-practices记录最佳实践

Agent Skill

logging-best-practices 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

6,047

周安装

247

GitHub Stars

87

下载量

1,936
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:logging-best-practices(记录最佳实践)
来源仓库:https://github.com/mindrally/skills
仓库路径:skills/logging-best-practices
安装命令:
npx skills add https://github.com/mindrally/skills --skill logging-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/mindrally/skills --skill logging-best-practices

简介

logging-best-practices 用于记录任务执行中的错误、用户反馈和能力缺口,帮助 Agent 持续优化行为模式。

  • 适用于希望让 AI 沉淀问题修正和经验积累的长期协作场景。
  • 通过 npx skills add 命令从 GitHub 安装,需关注其是否会触发文件写入或外部日志服务调用。
  • 建议确认日志存储位置和敏感信息脱敏机制,避免泄露凭证或用户数据。
  • 使用前应评估其对系统资源的影响,确保不会因频繁记录导致性能下降。

SKILL.md

Logging Best Practices

Apply these logging principles to ensure effective debugging, monitoring, and audit capabilities across applications and services.

Structured Logging

  • Use structured logging formats (JSON) for all log output
  • Include consistent fields across all log entries
  • Make logs machine-parseable while remaining human-readable
  • Use a logging library that supports structured output natively
  • Avoid string concatenation for log messages; use structured fields

Standard Log Fields

Include these fields in every log entry:

  • timestamp: ISO 8601 format with timezone
  • level: Log severity (DEBUG, INFO, WARN, ERROR, FATAL)
  • message: Human-readable description of the event
  • service: Name of the service or application
  • version: Application version or build identifier
  • trace_id: Distributed tracing correlation ID
  • span_id: Current span identifier
  • request_id: Unique identifier for the request

Log Levels

Use appropriate log levels consistently:

  • DEBUG: Detailed diagnostic information for development
  • INFO: Normal operational events and state changes
  • WARN: Unexpected situations that are handled gracefully
  • ERROR: Failures that affect current operation but not the service
  • FATAL: Critical failures requiring immediate attention

Context Propagation

  • Include request context in all log entries within a request lifecycle
  • Propagate trace IDs across service boundaries
  • Add user context (anonymized) for user-initiated actions
  • Include relevant business context for domain events
  • Use MDC (Mapped Diagnostic Context) or equivalent for context management

Security and Privacy

  • Never log sensitive information (passwords, tokens, PII)
  • Mask or redact sensitive data when it must be referenced
  • Implement log access controls appropriate to data sensitivity
  • Consider data retention policies and compliance requirements
  • Audit log access for sensitive systems

Performance Considerations

  • Use asynchronous logging to avoid blocking application threads
  • Implement log sampling for high-volume debug logs in production
  • Buffer logs appropriately to balance latency and throughput
  • Monitor logging infrastructure for bottlenecks
  • Set appropriate log levels per environment

Log Aggregation

  • Centralize logs from all services into a single platform
  • Use consistent formatting across all services
  • Implement log rotation and retention policies
  • Enable full-text search and filtering capabilities
  • Set up log-based alerts for critical patterns

Error Logging

  • Include full error context: message, code, stack trace
  • Log the chain of errors in wrapped/nested exceptions
  • Include relevant request and state information
  • Avoid duplicate error logging across layers
  • Log error recovery actions and outcomes

Best Practices

  • Log at service boundaries (entry and exit points)
  • Include timing information for performance analysis
  • Log configuration changes and deployments
  • Create actionable log messages that aid debugging
  • Review and clean up logging regularly to reduce noise

Log Message Guidelines

  • Write clear, descriptive messages
  • Include relevant identifiers (user ID, order ID, etc.)
  • Avoid generic messages like "Error occurred"
  • Use consistent terminology across the application
  • Include enough context to understand the event without additional lookups

Environment-Specific Configuration

  • Development: DEBUG level, console output, verbose formatting
  • Staging: INFO level, structured JSON, full context
  • Production: INFO/WARN level, structured JSON, sampling for DEBUG

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

27.52%
按下载量换算533

Claude Code

21.88%
按下载量换算424

Antigravity

21.17%
按下载量换算410

Codex

12.85%
按下载量换算249

Gemini CLI

8.13%
按下载量换算157

github-copilot

3.61%
按下载量换算70

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills