Use Cursor's browser aria snapshots to audit a page for accessibility issues — missing labels, broken tab order, contrast, and ARIA misuse.
中文简介正在准备中。当前显示原文说明。
Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Use this skill when the user asks to add analytics, event tracking, page views, feature flags, or session replay to a web application.
Detect the framework — check for next.config.*, vite.config.*, package.json scripts, or index.html to determine if this is Next.js, React (Vite/CRA), Vue, Svelte, or plain HTML.
Install the SDK
npm install posthog-jsnpm install posthog-js posthog-nodepip install posthognpm install posthog-nodeCreate a provider / init module
For Next.js App Router, create app/providers.tsx:
"use client";
import posthog from "posthog-js";
import { PostHogProvider as PHProvider } from "posthog-js/react";
import { useEffect } from "react";
export function PostHogProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST ?? "https://us.i.posthog.com",
capture_pageview: false, // we capture manually for SPAs
});
}, []);
return <PHProvider client={posthog}>{children}</PHProvider>;
}
Wrap {children} in the root layout with <PostHogProvider>.
For Pages Router, init in _app.tsx inside a useEffect.
Add page-view tracking — for SPAs, create a component that calls posthog.capture('$pageview') on route change using the framework's router events.
Add .env variables — prompt the user for their PostHog project API key and host:
NEXT_PUBLIC_POSTHOG_KEY=phc_...
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
Add these keys to .env.example as well.
Add custom events — if the user specifies events to track (e.g. sign-up, purchase), add posthog.capture("event_name", { ...properties }) calls in the relevant handlers.
Feature flags (optional) — if requested, show how to use posthog.isFeatureEnabled("flag-name") or the useFeatureFlagEnabled hook.
Session replay (optional) — enable by adding session_recording: { maskAllInputs: false } to the init config if requested.
posthog-js to the Content Security Policy if the project has one.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Use Cursor's browser aria snapshots to audit a page for accessibility issues — missing labels, broken tab order, contrast, and ARIA misuse.
中文简介正在准备中。当前显示原文说明。
Generate OpenAPI/Swagger documentation for an API, including endpoint schemas, request/response types, and interactive docs UI.
中文简介正在准备中。当前显示原文说明。
Add authentication to a web application using NextAuth.js (Auth.js), including OAuth providers, session management, and protected routes.
中文简介正在准备中。当前显示原文说明。
Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.
中文简介正在准备中。当前显示原文说明。
Set up Playwright end-to-end testing in a project, including test configuration, example tests, and CI integration.
中文简介正在准备中。当前显示原文说明。
Add Sentry error tracking, performance monitoring, and source maps to a web application.
中文简介正在准备中。当前显示原文说明。