Token导航 LogoToken导航

Agent Skill · 前端设计

api-analytics-posthog-analytics(API 分析 posthog 分析)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

api-analytics-posthog-analytics 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 8,536。

总安装 279周安装 12GitHub Stars 5下载 98核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:api-analytics-posthog-analytics(API 分析 posthog 分析)
来源仓库:https://github.com/agents-inc/skills
仓库路径:skills/api-analytics-posthog-analytics
安装命令:
npx skills add https://github.com/agents-inc/skills --skill api-analytics-posthog-analytics
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/agents-inc/skills --skill api-analytics-posthog-analytics

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

api-analytics-posthog-analytics 提供 PostHog 产品分析的事件命名规范与客户端/服务端埋点实践。适用于 Codex、Claude、Cursor、Gemini CLI 中设计结构化事件体系与用户识别方案。

强调 category:object_action 命名法、PII 过滤与 serverless 环境下的 shutdown 处理。使用前应确认项目已配置环境变量且无 PII 泄露风险,避免违反隐私政策。建议结合现有认证流集成 user identification,确保数据一致性。

来源仓库内路径:skills/api-analytics-posthog-analytics

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/agents-inc/skills --skill api-analytics-postho…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

api-analytics-posthog-analytics 怎么安装?

在终端执行 npx skills add https://github.com/agents-inc/skills --skill api-analytics-posthog-analytic…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

api-analytics-posthog-analytics 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

api-analytics-posthog-analytics 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

api-analytics-posthog-analytics 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

api-analytics-posthog-analytics 用的人多吗?

公开数据是累计安装 279 次,近一周安装 12 次,下载 98 次,GitHub 5 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

api-analytics-posthog-analytics 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
api-analytics-posthog-analytics

API 分析 posthog 分析 · 本页

2795需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

PostHog Analytics Patterns

Quick Guide: Use PostHog for product analytics with structured event naming (category:object_action), server-side tracking for reliability, and proper user identification integrated with your authentication flow. Client-side for UI interactions, server-side for business events. Always call reset() on logout, never store PII in event properties, and use captureImmediate() or await shutdown() in serverless environments.

Detailed Resources:


<critical_requirements>

CRITICAL: Before Using This Skill

All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

(You MUST call posthog.identify() ONLY when a user signs up or logs in - never on every page load)

(You MUST include the user's database ID as distinct_id in ALL server-side events)

(You MUST call posthog.reset() when a user logs out to unlink future events)

(You MUST use the category:object_action naming convention for all custom events)

(You MUST NEVER include PII (email, name, phone) in event properties - use user IDs only)

</critical_requirements>


Auto-detection: PostHog, posthog-js, posthog-node, usePostHog, PostHogProvider, capture, identify, group analytics, product analytics, event tracking, funnel analysis

When to use:

  • Tracking user behavior and product analytics
  • Setting up conversion funnels and retention analysis
  • Implementing group analytics for B2B multi-tenant apps
  • Understanding feature adoption and user journeys
  • A/B testing analysis (in conjunction with feature flags)

When NOT to use:

  • Feature flag implementation (separate concern)
  • Error tracking and logging (use dedicated error tracking tools)
  • Infrastructure monitoring (use observability tools)

Key patterns covered:

  • Event naming conventions (category:object_action)
  • Property naming patterns (object_adjective, is_/has_ booleans)
  • User identification with authentication flow integration
  • Client-side tracking with React hooks
  • Server-side tracking with posthog-node
  • Group analytics for B2B organizations
  • Privacy and GDPR consent patterns
  • TypeScript patterns for type-safe events

Philosophy

PostHog analytics follows a structured taxonomy approach: consistent naming conventions, meaningful properties, and strategic placement (client vs server). Track what matters for product decisions, not everything.

Core principles:

  1. Server-side for business events - User signups, purchases, subscriptions (reliable, not blocked)
  2. Client-side for UI interactions - Button clicks, page views, form interactions
  3. Identify once per session - Not on every page load
  4. Structured naming - Makes querying and analysis possible at scale

Core Patterns

Pattern 1: Event Naming Conventions

Use the category:object_action framework for consistent, queryable event names.

// category: Context (signup_flow, settings, dashboard)
// object: Component/location (password_button, pricing_page)
// action: Present-tense verb (click, submit, view)

"signup_flow:email_form_submit";
"dashboard:project_create";
"settings:billing_plan_upgrade";

// Simpler alternative: object_verb
"project_created";
"user_signed_up";

Why good: Category prefix groups related events in PostHog UI, enables wildcard queries like signup_flow:*, consistent naming makes analysis possible at scale.

Property naming rules:

  • object_adjective: project_id, plan_name, item_count
  • is_ / has_ for booleans: is_first_purchase, has_completed_onboarding
  • _date / _timestamp suffix: trial_end_date, last_login_timestamp

See examples/core.md for complete naming examples.


Pattern 2: User Identification with Authentication

Call identify() only on auth state change (not every render). Use database user ID as distinct_id. Call reset() on logout.

// Check _isIdentified() to prevent duplicate calls
useEffect(() => {
  if (session?.user && !posthog._isIdentified()) {
    posthog.identify(session.user.id, {
      plan: session.user.plan ?? "free",
      created_at: session.user.createdAt,
      is_verified: session.user.emailVerified ?? false,
    });
  }
}, [session?.user]);
// Always reset on logout
posthog?.capture("user_logged_out");
posthog?.reset(); // Unlink future events from this user

See examples/core.md for full identification hook and logout handler.


Pattern 3: Server-Side Tracking

Track business events reliably from your backend with posthog-node.

// Serverless: use captureImmediate (guarantees HTTP completion)
await posthogServer.captureImmediate({
  distinctId: user.id,
  event: "subscription_created",
  properties: { plan: "pro", is_annual: true },
});

// Always call shutdown before returning in serverless
await posthogServer.shutdown();

Key rules:

  1. Always include distinctId (user's database ID)
  2. Use captureImmediate() for serverless (guarantees HTTP completion)
  3. Always call shutdown() before returning in serverless
  4. Configure flushAt: 1 and flushInterval: 0 for serverless

See examples/server-tracking.md for complete server setup and route examples.


Pattern 4: Group Analytics (B2B)

Associate events with organizations using PostHog groups for B2B metrics.

// Client-side: identify organization
posthog.group("company", org.id, {
  name: org.name,
  plan: org.plan ?? "free",
  member_count: org.memberCount,
});

// Server-side: include groups in event
posthogServer.capture({
  distinctId: user.id,
  event: "organization:member_invited",
  properties: { role: data.role },
  groups: { company: data.organizationId },
});

Limitations: Maximum 5 group types per project. One group per type per event.

See examples/group-analytics.md for complete group patterns.


Pattern 5: Privacy and GDPR Consent

PostHog supports cookieless tracking and consent management.

// Cookieless mode: "always" (no consent needed) or "on_reject" (with banner)
posthog.init(POSTHOG_KEY, {
  cookieless_mode: "on_reject",
  person_profiles: "identified_only",
});

// Consent methods
posthog.opt_in_capturing(); // User accepts
posthog.opt_out_capturing(); // User rejects

Key rule: Never store PII (email, name, phone, IP, address) in event properties. Use pseudonymized IDs only.

See examples/privacy-gdpr.md for consent banner integration and before_send filtering.


Performance Optimization

Web Apps (default batching): Use default settings -- PostHog batches efficiently out of the box.

Serverless (immediate delivery):

const posthogServer = new PostHog(POSTHOG_KEY, {
  flushAt: 1, // Flush after 1 event
  flushInterval: 0, // No interval batching
});
// Use captureImmediate() or capture() + await shutdown()

Reducing Costs:

posthog.init(POSTHOG_KEY, {
  person_profiles: "identified_only", // Anonymous events 4x cheaper
  autocapture: false, // Disable for high-traffic sites
});

<red_flags>

RED FLAGS

High Priority Issues:

  • Using email as distinct_id -- PII should not be the identifier
  • Missing posthog.reset() on logout -- users get mixed together
  • No await shutdown() in serverless -- events are lost
  • PII in event properties -- GDPR violation risk
  • Calling identify() on every render -- performance degradation

Common Mistakes:

  • Importing posthog directly instead of using usePostHog hook in React
  • Not setting up reverse proxy (api_host: "/ingest") -- events blocked by ad blockers
  • Different event names for same action on frontend vs backend
  • Not using person_profiles: "identified_only" -- 4x higher costs on anonymous events
  • Using capture() instead of captureImmediate() in serverless -- events may not complete

Gotchas & Edge Cases:

  • distinct_id is required for ALL server-side events (unlike client-side which auto-generates one)
  • group() must include group ID with every event (not persisted like identify())
  • Maximum 5 group types per project
  • cookieless_mode: "always" disables identify() entirely -- privacy trade-off
  • PostHog web SDK is client-side only -- will not work in server components
  • Session IDs must be manually passed to server-side events for session linking

</red_flags>


<critical_reminders>

CRITICAL REMINDERS

All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

(You MUST call posthog.identify() ONLY when a user signs up or logs in - never on every page load)

(You MUST include the user's database ID as distinct_id in ALL server-side events)

(You MUST call posthog.reset() when a user logs out to unlink future events)

(You MUST use the category:object_action naming convention for all custom events)

(You MUST NEVER include PII (email, name, phone) in event properties - use user IDs only)

Failure to follow these rules will cause analytics data quality issues, privacy violations, or lost events.

</critical_reminders>

平台分布

Codex

35.43%
按下载量换算35

Claude

30.92%
按下载量换算30

Cursor

17.25%
按下载量换算17

Gemini CLI

8.09%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills