integration-react-tanstack-router-file-based

为使用 TanStack Router 的 React 应用程序集成 PostHog,支持基于文件的路由元数据。作者:PostHog,版本:1.9.4。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "integration-react-tanstack-router-file-based":https://skillpi.com/zh/skills/deepskill-76a925248f2e510990223ed2d7717ffc5c89ca77b292b36cbd302ca68ded4d61。安装前核对上游来源和版本:https://skills.sh/posthog/skills/integration-react-tanstack-router-file-based。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skills.sh

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为使用 TanStack Router 的 React 应用程序集成 PostHog,支持基于文件的路由元数据。作者:PostHog,版本:1.9.4。

0 下载

介绍来源: third_party · posthog · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: integration-react-tanstack-router-file-based
description: >-
  PostHog integration for React applications using TanStack Router with
  file-based routing
metadata:
  author: PostHog
  version: 1.9.4

PostHog integration for React with TanStack Router (file-based)

This skill helps you add PostHog analytics to React with TanStack Router (file-based) applications.

Workflow

Follow these steps in order to complete the integration:

  1. basic-integration-1.0-begin.md - PostHog Setup - Begin ← Start here
  2. basic-integration-1.1-edit.md - PostHog Setup - Edit
  3. basic-integration-1.2-revise.md - PostHog Setup - Revise
  4. basic-integration-1.3-conclude.md - PostHog Setup - Conclusion

Reference files

  • references/EXAMPLE.md - React with TanStack Router (file-based) example project code
  • references/tanstack-start.md - Tanstack start - docs
  • references/identify-users.md - Identify users - docs
  • references/basic-integration-1.0-begin.md - PostHog setup - begin
  • references/basic-integration-1.1-edit.md - PostHog setup - edit
  • references/basic-integration-1.2-revise.md - PostHog setup - revise
  • references/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)
  • Use TanStack Router's built-in navigation events for pageview tracking instead of useEffect
  • Use PostHogProvider in the root component defined in either the file-based convention (__root.tsx) or code-based convention (wherever createRootRoute() is called) so all child routes have access to the PostHog client

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 实验室的评测报告。

场景价值75/100

亮点

  • 提供 PostHog 与 TanStack Router 的集成方案,解决前端开发者集成分析工具的实际需求
  • 内容覆盖环境变量使用、用户识别、错误跟踪等关键集成点,实用性强
触发精准90/100

亮点

  • description 在顶层 frontmatter 中完整且清晰,准确描述了 Skill 的核心功能
  • 触发词精准,边界清晰,便于用户理解 Skill 的适用范围
结构规范70/100

待提升项

  • 缺少 When to Use 和示例章节 原报告严重程度:轻微

    Skill 缺少 When to Use 章节和端到端示例,影响用户快速理解使用场景

    改进建议:建议补充 When to Use 章节说明适用场景,并添加端到端示例展示完整集成流程

亮点

  • Workflow 步骤清晰,分为 4 个阶段,便于用户按顺序执行
  • 提供了详细的参考文件列表和关键原则,结构完整
执行可靠75/100

待提升项

  • 缺少不可逆操作确认机制说明 原报告严重程度:轻微

    Skill 未明确提及不可逆操作的确认机制,可能影响执行安全性

    改进建议:建议在涉及关键配置变更的步骤中添加确认机制说明,提升执行可靠性

亮点

  • 提供了详细的集成指南和最佳实践,工具来源明确
  • 覆盖了环境变量使用、用户识别、错误跟踪等主要异常场景
证据可验 (前四项均值)78/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。