Agent Skillstrycompai/crm › posthog-instrumentation

posthog-instrumentation

GitHub

辅助用户在代码中集成PostHog分析、事件追踪及功能标志,支持多种框架与语言。

.agents/skills/posthog-instrumentation/SKILL.md trycompai/crm

触发场景

用户请求添加PostHog或分析功能 需要追踪事件或用户行为 实现功能标志 询问代码埋点方法

安装

npx skills add trycompai/crm --skill posthog-instrumentation -g -y
更多选项

非标准路径

npx skills add https://github.com/trycompai/crm/tree/main/.agents/skills/posthog-instrumentation -g -y

不安装直接使用

npx skills use trycompai/crm@posthog-instrumentation

指定 Agent (Claude Code)

npx skills add trycompai/crm --skill posthog-instrumentation -a claude-code -g -y

安装 repo 全部 skill

npx skills add trycompai/crm --all -g -y

预览 repo 内 skill

npx skills add trycompai/crm --list

SKILL.md

Frontmatter
{
    "name": "posthog-instrumentation",
    "description": "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."
}

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

// 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

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

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

版本历史

  • 31ce937 当前 2026-08-06 08:49

同 Skill 集合

.agents/skills/ai-elements/SKILL.md
.agents/skills/better-auth-best-practices/SKILL.md
.agents/skills/eve/SKILL.md
.agents/skills/nestjs-best-practices/SKILL.md
.agents/skills/no-use-effect/SKILL.md
.agents/skills/nuqs/SKILL.md
.agents/skills/prisma-database-setup/SKILL.md
.agents/skills/shadcn/SKILL.md
.agents/skills/skill-creator/SKILL.md
.agents/skills/turborepo/SKILL.md
.agents/skills/typescript-advanced-types/SKILL.md
.agents/skills/vercel-composition-patterns/SKILL.md
.agents/skills/vercel-react-best-practices/SKILL.md
.agents/skills/web-design-guidelines/SKILL.md
.agents/skills/nestjs-trpc/SKILL.md
.agents/skills/seo-audit/SKILL.md

元信息

文件数
0
版本
31ce937
Hash
d32a621b
收录时间
2026-08-06 08:49

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-06 16:42
浙ICP备14020137号-1 $访客地图$