skilly. Buy ad slot
All skills
Data Analysis · Automation / AGENT SKILL

posthog-instrumentation

posthog/posthog-for-claude
2K installs 13 GitHub stars
0

Automatically add PostHog event tracking, analytics instrumentation, and feature flags to code.
Automatically add PostHog analytics instrumentation to code. Triggers when user asks to add tracking, instrument events, add analytics, or implement feature flags in their codebase.

BEFORE YOU INSTALL

Understand the trade-offs.

SECURITY REVIEW

Not yet assessed

Review the original instructions and requested permissions before installing.

No security review is available for this catalog entry yet.

SKILL QUALITY

Not yet assessed

How clearly the skill guides your agent, how complete its workflow is, and how you can check the outcome.

No quality assessment is available for this catalog entry yet.

The full skill.

Original instructions from the publisher’s SKILL.md

# PostHog Instrumentation Skill

Help users add PostHog analytics, event tracking, and feature flags to their code.

## When to Use

- User asks to "add PostHog" or "add analytics"
- User wants to track events or user actions
- User needs to implement feature flags
- User asks about instrumenting their code

## Workflow

1. Identify the framework (React, Next.js, Python, Node.js, etc.)
2. Check for existing PostHog setup
3. Add appropriate instrumentation

## Code Patterns

### JavaScript/TypeScript
```javascript
// Event tracking
posthog.capture('button_clicked', { button_name: 'signup' })

// Feature flags
if (posthog.isFeatureEnabled('new-feature')) {
  // Show new feature
}

// User identification
posthog.identify(userId, { email: user.email })
```

### Python
```python
from posthog import Posthog
posthog = Posthog(api_key='<ph_project_api_key>')

# Event tracking
posthog.capture(distinct_id='user_123', event='purchase_completed')

# Feature flags
if posthog.feature_enabled('new-feature', 'user_123'):
    # Show new feature
```

### React
```jsx
import { usePostHog } from 'posthog-js/react'

function MyComponent() {
  const posthog = usePostHog()

  const handleClick = () => {
    posthog.capture('button_clicked')
  }
}
```

## Best Practices

- Use consistent event naming (snake_case recommended)
- Include relevant properties with events
- Identify users early in their session
- Use feature flags for gradual rollouts