·
Last changedVersion:
This version passed the hardening gate. Hardening updated the skill content, deleted the lines high-severity poisoning findings flagged in 1 file before any model saw the skill, and independently checked the resulting changes. Classified findings before hardening: 127. Classified findings closed: 5. Classified findings remaining: 122. Unclassified scanner findings remaining: 0. Review findings closed: 15. Review findings remaining: 1.
1
54
72
52
70
Expand | File | Group | Subtype | Severity | Status |
|---|---|---|---|---|---|
references/basics.md | Prompt Injection | Direct prompt injection | High | Closed | |
references/xai.md | Supply Chain & Install-Time Trust | — | Medium | Open | |
references/pydantic-ai.md | Supply Chain & Install-Time Trust | — | Medium | Open | |
references/together-ai.md | Sensitive Data & Secret Exposure | Data exfiltration | Medium | Open | |
references/autogen.md | Supply Chain & Install-Time Trust | — | Medium | Open | |
SKILL.md | Sensitive Data & Secret Exposure | Hardcoded secret | Medium | Open | |
references/traces.md | Sensitive Data & Secret Exposure | Hardcoded secret | Medium | Open | |
references/litellm.md | Supply Chain & Install-Time Trust | — | Medium | Closed |
127 findings
Use this skill to add PostHog AI Observability that traces 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 once the user confirms they want it. 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.
Before you edit anything, read references/COMMANDMENTS.md. It lists the rules every PostHog install follows: how to install the SDK, where to create the client, how to identify users, Content Security Policy and multi-platform apps, plus the rules for this framework.
Trust boundaries:
Follow these steps IN ORDER:
STEP 1: Analyze the codebase and detect the LLM stack.
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 guide for callback setup, middleware configuration, and event capture, within the trust boundaries above. 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.)
STEP 4: Add LLM tracing.
$ai_input and $ai_output_choices) to PostHog, and that manually captured spans send tool inputs and results ($ai_output_state). Ask whether they want full content captured. Where the matching reference shows a privacy setting, such as privacy_mode in the OpenAI Agents reference, offer it, and recommend it for apps that handle sensitive data. Keep secrets out of captured content.STEP 5: Link to users.
references/COMMANDMENTS.md requires. Identity belongs to the request: use the per-request PostHog context shown in the reference Users and sessions sections rather than one fixed id for the whole process.STEP 6: Set up environment variables.
.env, .env.local, or framework-specific env files). If valid values already exist, skip this step. In env files, read and change only the PostHog keys, and leave every other value unread in your output, uncopied, and unchanged.projects-get tool to list the projects. If more than one comes back, ask the user which project to use. Then call project-get with that project''s id and read its api_token. Before you write the token, tell the user the project''s name and confirm it is the one this app should send to. If the MCP server is not connected or not authenticated, ask the user for their PostHog project token instead.api_host field of the project-get response. If you still have no host from the calling tool, the MCP response, or existing project configuration, ask the user: "Are you on PostHog US Cloud or EU Cloud?" Do not assume US Cloud..env.example, or the env template the project already uses, with placeholder values, so the next developer knows what to set. Create .env.example if the project has none. Never put real values in it.references/COMMANDMENTS.md.references/openai.md - Openai observability installationreferences/azure-openai.md - Azure openai observability installationreferences/README.md - PostHog.ai for .netreferences/anthropic.md - Anthropic ai observability installationreferences/google.md - Google ai observability installationreferences/cohere.md - Cohere ai observability installationreferences/mistral.md - Mistral ai observability installationreferences/perplexity.md - Perplexity ai observability installationreferences/deepseek.md - Deepseek ai observability installationreferences/groq.md - Groq ai observability installationreferences/together-ai.md - Together ai observability installationreferences/fireworks-ai.md - Fireworks ai observability installationreferences/xai.md - Xai observability installationreferences/cerebras.md - Cerebras ai observability installationreferences/hugging-face.md - Hugging face ai observability installationreferences/ollama.md - Ollama ai observability installationreferences/openrouter.md - Openrouter ai observability installationreferences/langchain.md - Langchain ai observability installationreferences/llamaindex.md - Llamaindex ai observability installationreferences/crewai.md - Crewai observability installationreferences/autogen.md - Autogen ai observability installationreferences/dspy.md - Dspy ai observability installationreferences/langgraph.md - Langgraph ai observability installationreferences/pydantic-ai.md - Pydantic ai observability installationreferences/vercel-ai.md - Vercel ai SDK observability installationreferences/litellm.md - Litellm ai observability installationreferences/instructor.md - Instructor ai observability installationreferences/semantic-kernel.md - Semantic kernel ai observability installationreferences/mirascope.md - Mirascope ai observability installationreferences/mastra.md - Mastra ai observability installationreferences/smolagents.md - Smolagents ai observability installationreferences/openai-agents.md - Openai agents SDK observability installationreferences/portkey.md - Portkey ai observability installationreferences/helicone.md - Helicone ai observability installationreferences/manual-capture.md - Manual capture ai observability installationreferences/basics.md - Ai observability basicsreferences/traces.md - Tracesreferences/calculating-costs.md - Calculating llm costsreferences/COMMANDMENTS.md - Framework-specific rules the integration must followEach 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.
Get started with chainctlchainctl skill install public/posthog/instrument-llm-analytics:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.cgr.dev/public/github.com/posthog/skills/omnibus/instrument-llm-analytics:latest
MIT
HARDENING.md
LICENSE
SKILL.md
references/COMMANDMENTS.md
references/README.md
references/anthropic.md
references/autogen.md
references/azure-openai.md
references/basics.md
references/calculating-costs.md
references/cerebras.md
references/cohere.md
references/crewai.md
references/deepseek.md
references/dspy.md
references/fireworks-ai.md
references/google.md
references/groq.md
references/helicone.md
references/hugging-face.md
references/instructor.md
references/langchain.md
references/langgraph.md
references/litellm.md
references/llamaindex.md
references/manual-capture.md
references/mastra.md
references/mirascope.md
references/mistral.md
references/ollama.md
references/openai-agents.md
references/openai.md
references/openrouter.md
references/perplexity.md
references/portkey.md
references/pydantic-ai.md
references/semantic-kernel.md
references/smolagents.md
references/together-ai.md
references/traces.md
references/vercel-ai.md
references/xai.md