integration-react-vite
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "integration-react-vite":https://skillpi.com/zh/skills/deepskill-314e2558a62dcade9528b61402e13b409805cda67c7dff419935d98cc7ad7549。安装前核对上游来源和版本:https://skills.sh/posthog/skills/integration-react-vite。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skills.sh
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
将 PostHog 集成到使用 Vite 构建且不含路由的 React 应用程序中,适用于需要在此类型项目中添加 PostHog 的场景。
介绍来源: third_party · posthog · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: integration-react-vite
description: PostHog integration for React applications built with Vite (no router)
metadata:
author: PostHog
version: 1.9.4PostHog integration for React (Vite)
This skill helps you add PostHog analytics to React (Vite) applications.
Workflow
Follow these steps in order to complete the integration:
basic-integration-1.0-begin.md- PostHog Setup - Begin ← Start herebasic-integration-1.1-edit.md- PostHog Setup - Editbasic-integration-1.2-revise.md- PostHog Setup - Revisebasic-integration-1.3-conclude.md- PostHog Setup - Conclusion
Reference files
references/react.md- React - docsreferences/identify-users.md- Identify users - docsreferences/basic-integration-1.0-begin.md- PostHog setup - beginreferences/basic-integration-1.1-edit.md- PostHog setup - editreferences/basic-integration-1.2-revise.md- PostHog setup - revisereferences/basic-integration-1.3-conclude.md- PostHog setup - conclusion
The example project shows the target implementation pattern. Consult the documentation for API details.
Key principles
- Environment variables: Always use environment variables for PostHog keys. Never hardcode them.
- Minimal changes: Add PostHog code alongside existing integrations. Don't replace or restructure existing code.
- Match the example: Your implementation should follow the example project's patterns as closely as possible.
Framework guidelines
- For feature flags, use useFeatureFlagEnabled() or useFeatureFlagPayload() hooks - they handle loading states and external sync automatically
- Add analytics capture in event handlers where user actions occur, NOT in useEffect reacting to state changes
- Do NOT use useEffect for data transformation - calculate derived values during render instead
- Do NOT use useEffect to respond to user events - put that logic in the event handler itself
- Do NOT use useEffect to chain state updates - calculate all related updates together in the event handler
- Do NOT use useEffect to notify parent components - call the parent callback alongside setState in the event handler
- To reset component state when a prop changes, pass the prop as the component's key instead of using useEffect
- useEffect is ONLY for synchronizing with external systems (non-React widgets, browser APIs, network subscriptions)
Identifying users
Identify users during login and signup events. Refer to the example code and documentation for the correct identify pattern for this framework. If both frontend and backend code exist, pass the client-side session and distinct ID using X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers to maintain correlation.
Error tracking
Add PostHog error tracking to relevant files, particularly around critical user flows and API boundaries.
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 为 Vite React 应用提供 PostHog 分析集成方案
- 面向开发者群体的实用工具,具有明确的应用场景
亮点
- 触发词描述清晰准确,覆盖 Vite React 应用集成场景
- description 位置正确,内容完整无截断
待提升项
-
缺少端到端示例 原报告严重程度:轻微
文档提供了步骤指南和原则,但缺少完整的端到端实现示例代码
改进建议:建议添加一个完整的端到端集成示例,展示从环境变量配置到实际使用的完整流程
亮点
- Workflow 步骤划分清晰,分为4个阶段
- Key principles 和 Framework guidelines 提供了良好的开发指导
待提升项
-
引用文件未验证存在性 原报告严重程度:轻微
文档引用了多个参考文件,但未确认这些文件是否实际存在
改进建议:建议验证所有引用文件的存在性,或提供替代的在线文档链接
-
缺少异常处理说明 原报告严重程度:轻微
集成指南中缺少对网络错误、配置错误等异常情况的处理建议
改进建议:建议添加异常处理的最佳实践,如网络失败重试、配置验证等
亮点
- 明确强调使用环境变量管理 PostHog keys,避免硬编码
- 提供了用户识别和错误跟踪的具体指导
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。