Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

observability可观测性

Agent Skill

observability 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

509

周安装

21

GitHub Stars

23

下载量

166
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/akaszubski/autonomous-dev --skill observability

简介

提供 Python 应用的可观测性实践指南,涵盖日志、调试与性能监控。

  • 适用于添加结构化日志、分析堆栈跟踪或定位性能瓶颈。
  • 使用时需配置 JSON 格式日志并附加丰富上下文信息。
  • 安装命令:npx skills add https://github.com/akaszubski/autonomous-dev --skill observability
  • 建议区分开发与生产环境配置,避免敏感信息泄露。

SKILL.md

Observability Skill

Comprehensive guide to logging, debugging, profiling, and performance monitoring in Python applications.

When This Skill Activates

  • Adding logging to code
  • Debugging production issues
  • Profiling performance bottlenecks
  • Monitoring application metrics
  • Analyzing stack traces
  • Performance optimization
  • Keywords: "logging", "debug", "profiling", "performance", "monitoring"

Core Concepts

1. Structured Logging

Structured logging with JSON format for machine-readable logs and rich context.

Why Structured Logging?

  • Machine-parseable (easy to search, filter, aggregate)
  • Context-rich (attach metadata to log entries)
  • Consistent format across services

Key Features:

  • JSON-formatted logs
  • Log levels (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • Context logging with extra metadata
  • Best practices for meaningful logs

Example:

import logging
import json

logger = logging.getLogger(__name__)
logger.info("User action", extra={
    "user_id": 123,
    "action": "login",
    "ip": "192.168.1.1"
})

See: docs/structured-logging.md for Python logging setup and patterns


2. Debugging Techniques

Interactive debugging with pdb/ipdb and effective debugging strategies.

Tools:

  • Print debugging - Quick and simple
  • pdb - Python's built-in debugger
  • ipdb - IPython-enhanced debugger
  • Post-mortem debugging - Debug after crash

pdb Commands:

  • n (next) - Execute current line
  • s (step) - Step into function
  • c (continue) - Continue execution
  • p variable - Print variable value
  • l - List source code
  • q - Quit debugger

Example:

import pdb; pdb.set_trace()  # Debugger starts here

See: docs/debugging.md for interactive debugging patterns


3. Profiling

CPU and memory profiling to identify performance bottlenecks.

Tools:

  • cProfile - CPU profiling (built-in)
  • line_profiler - Line-by-line CPU profiling
  • memory_profiler - Memory usage analysis
  • py-spy - Sampling profiler (no code changes)

cProfile Example:

python -m cProfile -s cumulative script.py

Profile Decorator:

import cProfile
import pstats

def profile(func):
    def wrapper(*args, **kwargs):
        profiler = cProfile.Profile()
        profiler.enable()
        result = func(*args, **kwargs)
        profiler.disable()
        stats = pstats.Stats(profiler)
        stats.sort_stats('cumulative')
        stats.print_stats(10)  # Top 10 functions
        return result
    return wrapper

@profile
def slow_function():
    # Your code here
    pass

See: docs/profiling.md for comprehensive profiling techniques


4. Monitoring & Metrics

Performance monitoring, timing decorators, and simple metrics.

Timing Patterns:

  • Timing decorator - Measure function execution time
  • Context manager timer - Measure code block duration
  • Performance assertions - Fail if too slow

Simple Metrics:

  • Counters - Track event occurrences
  • Histograms - Track value distributions

Example:

import time
from functools import wraps

def timer(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        start = time.time()
        result = func(*args, **kwargs)
        duration = time.time() - start
        print(f"{func.__name__} took {duration:.2f}s")
        return result
    return wrapper

@timer
def process_data():
    # Your code here
    pass

See: docs/monitoring-metrics.md for stack traces, timers, and metrics


5. Best Practices & Anti-Patterns

Debugging strategies and logging anti-patterns to avoid.

Debugging Best Practices:

  1. Binary Search Debugging - Narrow down the problem area
  2. Rubber Duck Debugging - Explain the problem to someone (or something)
  3. Add Assertions - Catch bugs early
  4. Simplify and Isolate - Reproduce with minimal code

Logging Anti-Patterns to Avoid:

  • Logging sensitive data (passwords, tokens)
  • Logging in loops (use counters instead)
  • No context in error logs
  • Inconsistent log formats
  • Too verbose logging (noise)

See: docs/best-practices-antipatterns.md for detailed strategies


Quick Reference

ToolUse CaseDetails
Structured LoggingProduction logsdocs/structured-logging.md
pdb/ipdbInteractive debuggingdocs/debugging.md
cProfileCPU profilingdocs/profiling.md
line_profilerLine-by-line profilingdocs/profiling.md
memory_profilerMemory analysisdocs/profiling.md
Timer decoratorFunction timingdocs/monitoring-metrics.md
Context timerCode block timingdocs/monitoring-metrics.md

Logging Cheat Sheet

import logging

# Setup
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)

# Usage
logger.debug("Debug message")       # Detailed diagnostic
logger.info("Info message")         # General information
logger.warning("Warning message")   # Warning (recoverable)
logger.error("Error message")       # Error (handled)
logger.critical("Critical message") # Critical (unrecoverable)

# With context
logger.info("User action", extra={"user_id": 123, "action": "login"})

Debugging Cheat Sheet

# pdb
import pdb; pdb.set_trace()

# ipdb (enhanced)
import ipdb; ipdb.set_trace()

# Post-mortem (debug after crash)
import pdb, sys
try:
    # Your code
    pass
except Exception:
    pdb.post_mortem(sys.exc_info()[2])

Profiling Cheat Sheet

# CPU profiling
python -m cProfile -s cumulative script.py

# Line profiling
kernprof -l -v script.py

# Memory profiling
python -m memory_profiler script.py

# Sampling profiler (no code changes)
py-spy top --pid 12345

Progressive Disclosure

This skill uses progressive disclosure to prevent context bloat:

  • Index (this file): High-level concepts and quick reference (<500 lines)
  • Detailed docs: docs/*.md files with implementation details (loaded on-demand)

Available Documentation:

  • docs/structured-logging.md - Logging setup, levels, JSON format, best practices
  • docs/debugging.md - Print debugging, pdb/ipdb, post-mortem debugging
  • docs/profiling.md - cProfile, line_profiler, memory_profiler, py-spy
  • docs/monitoring-metrics.md - Stack traces, timing patterns, simple metrics
  • docs/best-practices-antipatterns.md - Debugging strategies and logging anti-patterns

Cross-References

Related Skills:

  • error-handling-patterns - Error handling best practices
  • python-standards - Python coding conventions
  • testing-guide - Testing and debugging strategies
  • performance-optimization - Performance tuning techniques

Related Tools:

  • Python logging - Standard library logging module
  • pdb/ipdb - Interactive debuggers
  • cProfile - CPU profiling
  • memory_profiler - Memory analysis
  • py-spy - Sampling profiler

Key Takeaways

  1. Use structured logging - JSON format for machine-readable logs
  2. Log at appropriate levels - DEBUG < INFO < WARNING < ERROR < CRITICAL
  3. Include context - Add metadata to logs (user_id, request_id, etc.)
  4. Don't log sensitive data - Passwords, tokens, PII
  5. Use pdb/ipdb for debugging - Interactive debugging is powerful
  6. Profile before optimizing - Measure to find real bottlenecks
  7. Use cProfile for CPU profiling - Identify slow functions
  8. Use line_profiler for line-level profiling - Fine-grained analysis
  9. Use memory_profiler for memory leaks - Track memory usage
  10. Time critical sections - Decorator or context manager
  11. Binary search debugging - Narrow down problem area
  12. Simplify and isolate - Reproduce with minimal code

Hard Rules

FORBIDDEN:

  • Logging sensitive data (passwords, tokens, API keys) at any level
  • Using print() for production logging (MUST use structured logging)
  • Swallowing exceptions silently without logging

REQUIRED:

  • All errors MUST be logged with context (what failed, input summary, stack trace)
  • Log levels MUST be used correctly: DEBUG for dev, INFO for operations, WARNING for recoverable issues, ERROR for failures
  • Performance-critical paths MUST have timing instrumentation
  • All external calls MUST log duration and status

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

34.96%
按下载量换算58

Claude

27.48%
按下载量换算46

Cursor

18.53%
按下载量换算31

Gemini CLI

9.43%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills