integration-astro-ssr
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "integration-astro-ssr":https://skillpi.com/zh/skills/deepskill-1dd239f8e5123e53daaf901acdfc1f6fc1a8bf75213b2a45879dcf8bbbeaa575。安装前核对上游来源和版本:https://skills.sh/posthog/skills/integration-astro-ssr。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skills.sh
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
为使用 API 路由的服务端渲染(SSR)Astro 应用集成 PostHog,以便在 SSR 场景下收集和分析事件数据。
介绍来源: third_party · posthog · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: integration-astro-ssr
description: PostHog integration for server-rendered Astro applications with API routes
metadata:
author: PostHog
version: 1.9.4PostHog integration for Astro (SSR)
This skill helps you add PostHog analytics to Astro (SSR) 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/EXAMPLE.md- Astro (SSR) example project codereferences/astro.md- Astro - 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
- Always use the is:inline directive on PostHog script tags to prevent Astro from processing them and causing TypeScript errors
- Use PUBLIC_ prefix for client-side environment variables in Astro (e.g., PUBLIC_POSTHOG_PROJECT_TOKEN)
- Create a posthog.astro component in src/components/ for reusable initialization across pages
- Import the PostHog component in a Layout and wrap all pages with that layout
- Use posthog-node in API routes under src/pages/api/ for server-side event tracking
- Store the posthog-node client instance in a singleton pattern (src/lib/posthog-server.ts) to avoid creating multiple clients
- Pass the client session ID to server via X-PostHog-Session-Id header for unified session tracking
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 实验室的评测报告。
亮点
- 为 Astro SSR 应用提供 PostHog 集成方案,解决前端框架与分析工具对接的实际开发需求
- 适用于明确的技术栈场景,具有广泛开发者受众
亮点
- 触发描述清晰,明确限定于 'server-rendered Astro applications with API routes',边界合理
待提升项
-
缺少端到端完整示例 原报告严重程度:轻微
工作流依赖多个外部文件,但未提供可直接运行的完整示例代码
改进建议:在 SKILL.md 中补充一个最小可运行示例,展示核心集成流程
-
未明确出口条件 原报告严重程度:轻微
未说明集成完成后的验证标准或成功标志
改进建议:添加 '验证集成是否成功' 的检查清单或测试方法
亮点
- 工作流步骤清晰,引用文件组织良好
- 关键原则和框架指南实用性强
待提升项
-
主要异常未处理 原报告严重程度:重大
未覆盖网络错误、初始化失败、环境变量缺失等关键异常场景
改进建议:添加错误处理建议和 fallback 机制说明
亮点
- 工具来源明确,参数建议合理(环境变量、singleton 模式)
- 提供了可复用的组件和布局集成方案
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。