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

instrument-llm-analyticsinstrument LLM 分析

Agent Skill

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

总安装

988

周安装

42

GitHub Stars

26

下载量

346
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/posthog/ai-plugin --skill instrument-llm-analytics

简介

用于辅助数据整理、表格处理、CSV/Excel 分析和图表准备。

  • 适合清洗字段、汇总数据、发现异常或生成统计口径。
  • 使用时需确认数据来源、字段含义和时间范围。
  • 涉及敏感数据或批量写回时需先确认权限和脱敏边界。
  • instrument-llm-analytics 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Add PostHog LLM analytics

Use this skill to add PostHog LLM analytics that trace AI model usage in new or changed code. Use it after implementing LLM features or reviewing PRs to ensure all generations are captured with token counts, latency, and costs. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any provider or framework.

Supported providers: OpenAI, Azure OpenAI, Anthropic, Google, Cohere, Mistral, Perplexity, DeepSeek, Groq, Together AI, Fireworks AI, xAI, Cerebras, Hugging Face, Ollama, OpenRouter.

Supported frameworks: LangChain, LlamaIndex, CrewAI, AutoGen, DSPy, LangGraph, Pydantic AI, Vercel AI, LiteLLM, Instructor, Semantic Kernel, Mirascope, Mastra, SmolAgents, OpenAI Agents.

Proxy/gateway: Portkey, Helicone.

Instructions

Follow these steps IN ORDER:

STEP 1: Analyze the codebase and detect the LLM stack.

  • Look for LLM provider SDKs (openai, anthropic, google-generativeai, etc.) and AI frameworks (langchain, llamaindex, crewai, etc.) in dependency files and imports.
  • Look for lockfiles to determine the package manager.
  • Check for existing PostHog or observability setup. If PostHog is already installed and LLM tracing is configured, skip to STEP 4 to add tracing for any new LLM calls.

STEP 2: Research instrumentation. (Skip if PostHog LLM tracing is already set up.) 2.1. Find the reference file below that matches the detected provider or framework — it is the source of truth for callback setup, middleware configuration, and event capture. Read it now. 2.2. If no reference matches, use manual-capture.md as a fallback — it covers the generic event capture approach that works with any provider.

STEP 3: Install the PostHog SDK. (Skip if PostHog is already set up.)

  • Add the PostHog SDK and any required callback/integration packages.
  • Do not manually edit dependency files — use the package manager's install command.
  • Always install packages as a background task. Don't await completion; proceed with other work immediately.

STEP 4: Add LLM tracing.

  • Instrument LLM calls to capture input tokens, output tokens, model name, latency, and costs for every generation.
  • Follow the provider-specific reference for the exact callback/middleware setup.
  • Do not alter the fundamental architecture of existing files. Make additions minimal and targeted.
  • You must read a file immediately before attempting to write it.

STEP 5: Link to users.

  • Associate LLM generations with identified users via distinct IDs when possible.

STEP 6: Set up environment variables.

  • Check if the project already has PostHog environment variables configured (e.g. in .env, .env.local, or framework-specific env files). If valid values already exist, skip this step.
  • If the PostHog API key is missing, use the PostHog MCP server's projects-get tool to retrieve the project's api_token. If multiple projects are returned, ask the user which project to use. If the MCP server is not connected or not authenticated, ask the user for their PostHog project API key instead.
  • For the PostHog host URL, use https://us.i.posthog.com for US Cloud or https://eu.i.posthog.com for EU Cloud.
  • Write these values to the appropriate env file using the framework's naming convention.
  • Reference these environment variables in code instead of hardcoding them.

Reference files

  • references/openai.md - Openai llm analytics installation - docs
  • references/azure-openai.md - Azure openai llm analytics installation - docs
  • references/anthropic.md - Anthropic llm analytics installation - docs
  • references/google.md - Google llm analytics installation - docs
  • references/cohere.md - Cohere llm analytics installation - docs
  • references/mistral.md - Mistral llm analytics installation - docs
  • references/perplexity.md - Perplexity llm analytics installation - docs
  • references/deepseek.md - Deepseek llm analytics installation - docs
  • references/groq.md - Groq llm analytics installation - docs
  • references/together-ai.md - Together ai llm analytics installation - docs
  • references/fireworks-ai.md - Fireworks ai llm analytics installation - docs
  • references/xai.md - Xai llm analytics installation - docs
  • references/cerebras.md - Cerebras llm analytics installation - docs
  • references/hugging-face.md - Hugging face llm analytics installation - docs
  • references/ollama.md - Ollama llm analytics installation - docs
  • references/openrouter.md - Openrouter llm analytics installation - docs
  • references/langchain.md - Langchain llm analytics installation - docs
  • references/llamaindex.md - Llamaindex llm analytics installation - docs
  • references/crewai.md - Crewai llm analytics installation - docs
  • references/autogen.md - Autogen llm analytics installation - docs
  • references/dspy.md - Dspy llm analytics installation - docs
  • references/langgraph.md - Langgraph llm analytics installation - docs
  • references/pydantic-ai.md - Pydantic ai llm analytics installation - docs
  • references/vercel-ai.md - Vercel ai SDK llm analytics installation - docs
  • references/litellm.md - Litellm llm analytics installation - docs
  • references/instructor.md - Instructor llm analytics installation - docs
  • references/semantic-kernel.md - Semantic kernel llm analytics installation - docs
  • references/mirascope.md - Mirascope llm analytics installation - docs
  • references/mastra.md - Mastra llm analytics installation - docs
  • references/smolagents.md - Smolagents llm analytics installation - docs
  • references/openai-agents.md - Openai agents SDK llm analytics installation - docs
  • references/portkey.md - Portkey llm analytics installation - docs
  • references/helicone.md - Helicone llm analytics installation - docs
  • references/manual-capture.md - Manual capture llm analytics installation - docs
  • references/basics.md - Llm analytics basics - docs
  • references/traces.md - Traces - docs
  • references/calculating-costs.md - Calculating llm costs - docs

Each provider reference contains installation instructions, SDK setup, and code examples specific to that provider or framework. Find the reference that matches the user's stack.

If the user's provider isn't listed, use manual-capture.md as a fallback — it covers the generic event capture approach that works with any provider.

Key principles

  • Environment variables: Always use environment variables for PostHog and LLM provider keys. Never hardcode them.
  • Minimal changes: Add LLM analytics alongside existing LLM calls. Don't replace or restructure existing code.
  • Trace all generations: Capture input tokens, output tokens, model name, latency, and costs for every LLM call.
  • Link to users: Associate LLM generations with identified users via distinct IDs when possible.
  • One provider at a time: Only instrument the provider(s) the user is actually using. Don't add instrumentation for providers not present in the codebase.

适合场景

01

调用多模型

02

代码和文本生成

03

Agent 推理流程

04

OpenRouter 模型接入

能力概览

能力 1

统一调用多种 LLM

能力 2

支持 Claude、Gemini、Kimi 等模型

能力 3

适合聊天、代码和推理任务

能力 4

可作为 Agent 模型调用入口

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

平台分布

Codex

37.95%
按下载量换算131

Claude

28.28%
按下载量换算98

Cursor

19.96%
按下载量换算69

Gemini CLI

9.49%
按下载量换算33

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

来源信息

继续浏览同类 Skills