error-tracking-web — Claude Code skill: PostHog error tracking for web
error-tracking-web adds PostHog error tracking to a JavaScript web app: exception capture, source maps, alerts and issue triage, with the agent editing your code.
MIT 116 installs ★ 80 updated 2026-10-24
npx skills add PostHog/skills --skill error-tracking-web -a claude-codeWhat error-tracking-web does
The skill steers an agent through wiring PostHog error reporting into a JavaScript front end. It ships six reference documents covering web installation, fingerprints, alerting, searching and monitoring issues, assigning issues to teammates, and uploading source maps. The agent opens the one it needs and works from there.
Keys stay out of the source: the project key and host URL belong in environment variables. Existing error handling stays put, with tracking layered next to it. Exception autocapture goes on at posthog.init() first; manual captureException() calls come afterwards, in error boundaries and catch blocks. Skip the source map upload and stack traces keep pointing at minified bundles, so that step matters.
posthog-js runs in the browser only, server code needs posthog-node. Call posthog.init() before anything else from the SDK. Keep personal data out of capture() event properties and hand it to posthog.identify() instead, on login and again on a page refresh; posthog.reset() on logout. Single-page apps without a router can record views with $pageview or the capture_pageview option set to history_change.
What it helps with
- add exception capture to a JavaScript web app
- get readable stack traces by uploading source maps
- group repeated errors under one fingerprint
- set up alerts when a new error shows up
- hand an issue over to the right developer
Example prompts for the agent
- Add PostHog error tracking to our React app, read the key from
VITE_POSTHOG_KEY - Stack traces are coming back minified, walk me through the source map upload in
references/upload-source-maps.md - Which errors in PostHog should I assign to the frontend team?
How to install error-tracking-web
1Skills CLI (Vercel)
npx skills add PostHog/skills --skill error-tracking-web -a claude-code2Manually: put the files in place
~/.claude/skills/error-tracking-web/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/error-tracking-web/
1Skills CLI (Vercel)
npx skills add PostHog/skills --skill error-tracking-web -a codex2Manually: put the files in place
.agents/skills/error-tracking-web/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add PostHog/skills --skill error-tracking-web -a cursor2Manually: put the files in place
.cursor/skills/error-tracking-web/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install PostHog/skills skills/posthog/all/skills/error-tracking-web2Manually: put the files in place
.github/skills/error-tracking-web/SKILL.md1Skills CLI (Vercel)
npx skills add PostHog/skills --skill error-tracking-web -a gemini-cli2Platform CLI
gemini skills install https://github.com/PostHog/skills --path skills/posthog/all/skills/error-tracking-webManually: put the files in place
.devin/skills/error-tracking-web/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add PostHog/skills --skill error-tracking-web -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about error-tracking-web
How do I install error-tracking-web in Claude Code?
Run npx skills add PostHog/skills --skill error-tracking-web -a claude-code. The skill lands at ~/.claude/skills/error-tracking-web/SKILL.md.
What does error-tracking-web do?
It guides an agent through adding PostHog error tracking to a web app: exception autocapture, manual captureException() at error boundaries, source map upload and alerts.
Do I need posthog-node as well?
Only for server-side code. posthog-js is browser-only and should not be imported in Node.
Source text
SKILL.md · MIT
---
name: error-tracking-web
description: PostHog error tracking for Web (JavaScript)
metadata:
author: PostHog
version: 1.9.4
---
# PostHog error tracking for Web (JavaScript)
This skill helps you add PostHog error tracking to Web (JavaScript) applications.
## Reference files
- `references/web.md` - Web error tracking installation - docs
- `references/fingerprints.md` - Fingerprints - docs
- `references/alerts.md` - Send error tracking alerts - docs
- `references/monitoring.md` - Monitor and search issues - docs
- `references/assigning-issues.md` - Assign issues to teammates - docs
- `references/upload-source-maps.md` - Upload source maps - docs
Consult the documentation for API details and framework-specific patterns.
## Key principles
- **Environment variables**: Always use environment variables for PostHog keys and host URLs. Never hardcode them.
- **Minimal changes**: Add error tracking alongside existing error handling. Don't replace or restructure existing error handling code.
- **Autocapture first**: Enable exception autocapture in the SDK initialization 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.
## Framework guidelines
- Remember that source code is available in the node_modules directory
- Check package.json for type checking or build scripts to validate changes
- posthog-js is the JavaScript SDK package name
- posthog.init() MUST be called before any other PostHog methods (capture, identify, etc.)
- posthog-js is browser-only — do NOT import it in Node.js or server-side contexts (use posthog-node instead)
- Autocapture is ON by default with posthog-js (tracks clicks, form submissions, pageviews). Do NOT disable autocapture unless the user explicitly requests it.
- NEVER send PII in posthog.capture() event properties — no emails, full names, phone numbers, physical addresses, IP addresses, or user-generated content
- PII belongs in posthog.identify() person properties (email, name, role), NOT in capture() event properties
- Call posthog.identify(userId, { email, name, role }) on login AND on page refresh if the user is already logged in
- Call posthog.reset() on logout to unlink future events from the current user
- For SPAs without a framework router, capture pageviews with posthog.capture($pageview) or use the capture_pageview history_change option in init for History API routing
© PostHog · MIT · PostHog/skills