posthog-instrument-error-tracking
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "posthog-instrument-error-tracking":https://skillpi.com/zh/skills/deepskill-5526ee8773f7adfa7b0cd5efb8bceed90f36cc56435adc70825db7f81cbe3173。安装前核对上游来源和版本:https://skills.sh/posthog/ai-plugin/instrument-error-tracking。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skills.sh
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
为项目添加 PostHog 错误追踪功能,用于捕获与监控异常,确保错误包含堆栈跟踪和源映射以便追踪;在实现功能或审查 PR 后使用,并在尚未安装时处理 PostHog SDK 的初始设置。元数据:作者:PostHog。
介绍来源: third_party · posthog · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
Frontmatter
name: instrument-error-tracking
description: >-
Add PostHog error tracking to capture and monitor exceptions. Use after
implementing features or reviewing PRs to ensure errors are tracked with stack
traces and source maps. Also handles initial PostHog SDK setup if not yet
installed.
metadata:
author: PostHogAdd PostHog error tracking
Use this skill to add PostHog error tracking that captures and monitors exceptions in your application. Use it after implementing features or reviewing PRs to ensure errors are tracked with full stack traces and source maps. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any platform or language.
Supported platforms: React, Next.js, Web (JavaScript), Node.js, Python, PHP, Ruby, Ruby on Rails, Go, Elixir, Angular, Svelte, Nuxt, React Native, Flutter, iOS, Android, and Hono.
Instructions
Follow these steps IN ORDER:
STEP 1: Analyze the codebase and detect the platform.
Look for dependency files (package.json, pubspec.yaml, Podfile, Package.swift, requirements.txt, go.mod, Gemfile, composer.json, mix.exs, etc.) to determine the language and framework.
Look for lockfiles (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lockb, go.sum, pubspec.lock, Podfile.lock, Package.resolved, mix.lock) to determine the package manager.
- Check for existing PostHog setup (SDK initialization, env vars, etc.). If PostHog is already installed and initialized, skip to STEP 4.
STEP 2: Research instrumentation. (Skip if PostHog is already set up.) 2.1. Find the reference file below that matches the detected platform — it is the source of truth for SDK initialization, exception autocapture, and framework-specific error tracking patterns. Read it now. 2.2. If no reference matches, fall back to your general knowledge and web search. Use posthog.com/docs as the primary search source.
STEP 3: Install and initialize the PostHog SDK. (Skip if PostHog is already set up.)
- Add the PostHog SDK package for the detected platform. Do not manually edit package.json — use the package manager's install command.
- Follow the framework reference for where and how to initialize.
STEP 4: Enable exception autocapture.
- Follow the platform reference to enable exception autocapture. This automatically captures unhandled exceptions without additional code.
STEP 5: Add manual error captures.
- Identify error boundaries, catch blocks, and critical user flows where errors should be explicitly captured.
- Add
posthog.captureException()or the platform-equivalent at these locations. - Do not alter the fundamental architecture of existing error handling. Make additions minimal and targeted.
- You must read a file immediately before attempting to write it.
STEP 6: Upload source maps (frontend/mobile only).
- Configure source map uploads so stack traces resolve to original source code, not minified bundles.
- Follow the platform-specific reference for upload configuration (build plugins, CI scripts, etc.).
STEP 7: 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 project token is missing, use the PostHog MCP server's
projects-gettool to retrieve the project'sapi_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 token instead. - For the PostHog host URL: check the
projects-getMCP response for aregionfield —USmaps tohttps://us.i.posthog.com,EUmaps tohttps://eu.i.posthog.com. If the region is not available from the MCP response or from existing project configuration, ask the user: "Are you on PostHog US Cloud or EU Cloud?" Do not assume US 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.
STEP 8: Verify and clean up.
- Check the project for errors. Look for type checking or build scripts in package.json.
- Ensure any components created were actually used.
- Run any linter or prettier-like scripts found in the package.json, but ONLY on the files you have edited or created during this session. Never run formatting or linting across the entire project's codebase.
Reference files
references/react.md- React error tracking installation - docsreferences/web.md- Web error tracking installation - docsreferences/nextjs.md- Next.js error tracking installation - docsreferences/node.md- Node.js error tracking installation - docsreferences/python.md- Python error tracking installation - docsreferences/django.md- Django - docsreferences/flask.md- Flask - docsreferences/php.md- Php error tracking installation - docsreferences/laravel.md- Laravel - docsreferences/ruby.md- Ruby error tracking installation - docsreferences/ruby-on-rails.md- Ruby on rails error tracking installation - docsreferences/ruby-on-rails.md- Ruby on rails - docsreferences/go.md- Go error tracking installation - docsreferences/dotnet.md- .net error tracking installation - docsreferences/dotnet.md- .net - docsreferences/elixir.md- Elixir error tracking installation - docsreferences/angular.md- Angular error tracking installation - docsreferences/svelte.md- Sveltekit error tracking installation - docsreferences/nuxt-3-7.md- Nuxt error tracking installation (v3.7 and above) - docsreferences/nuxt-3-6.md- Nuxt error tracking installation (v3.6 and below) - docsreferences/react-native.md- React native error tracking installation - docsreferences/flutter.md- Flutter error tracking installation - docsreferences/ios.md- Ios error tracking installation - docsreferences/android.md- Android error tracking installation - docsreferences/hono.md- Hono error tracking installation - docsreferences/fingerprints.md- Fingerprints - docsreferences/alerts.md- Send error tracking alerts - docsreferences/monitoring.md- Monitor and search issues - docsreferences/assigning-issues.md- Assign issues to teammates - docsreferences/upload-source-maps.md- Upload source maps - docsreferences/COMMANDMENTS.md- Framework-specific rules the integration must follow
Each platform reference contains SDK-specific installation and manual capture patterns. Find the one matching the user's stack.
Key principles
- Environment variables: Always use environment variables for PostHog keys. Never hardcode them.
- Minimal changes: Add error tracking alongside existing error handling. Don't replace or restructure existing code.
- Autocapture first: Enable exception autocapture before adding manual captures.
- Source maps: Upload source maps so stack traces resolve to original source code, not minified bundles.
- Manual capture for boundaries: Use
captureException()at error boundaries and catch blocks for errors that don't propagate to the global handler.
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 支持20+平台/框架的错误追踪集成
- 提供完整的SDK安装、初始化和配置流程
- 覆盖从检测到验证的完整工作流
亮点
- 触发词精准完整,边界清晰
- description位置正确且内容完整
- 覆盖多种使用场景和变体
亮点
- 8个有序步骤,逻辑清晰完整
- 包含端到端示例和参考文件
- frontmatter完整,文档结构规范
亮点
- 工具来源明确,使用官方PostHog SDK
- 覆盖主要异常场景和错误处理
- 不可逆操作有用户确认机制
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- eu.i.posthog.com
- us.i.posthog.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。