Перейти к содержанию
Skillpedia
Код в целом41k · #6979

installing-posthog-in-a-codebase

Что он делает

Этот скилл позволяет агенту установить библиотеку аналитики PostHog в кодовую базу, с которой он может работать. Он нужен разработчикам, которые хотят добавить в приложение продуктовую аналитику и воспроизведение сессий.

Когда использовать

  • ✓Когда вы просите добавить PostHog, продуктовую аналитику или воспроизведение сессий в ваше приложение.
  • ✓Когда вы хотите установить библиотеку PostHog для своего фреймворка, например React или Next.js.
  • ✓Когда вы хотите, чтобы агент правильно хранил ваш ключ проекта и настройки хоста.

Ссылка на скилл

https://github.com/PostHog/posthog/blob/master/products/wizard/skills/installing-posthog-in-a-codebase/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/PostHog/posthog/blob/master/products/wizard/skills/installing-posthog-in-a-codebase/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Добавь аналитику PostHog в мое приложение на Next.js, используя актуальную настройку из их документации.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Агент определяет ваш фреймворк по файлам проекта и читает нужную страницу документации PostHog. Затем он устанавливает последний пакет, добавляет ключ проекта и настройки хоста и пишет код настройки.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

Installing PostHog in a codebase

Use this skill when you can read and edit the user's code. If you can't access their code, as is common in ChatGPT on the web or Claude on the web, use installing-posthog-from-chat.

PostHog's docs are the source of truth for each SDK's setup. Init options, file locations and recommended settings change between SDK releases, so read the docs page for the framework before you write code, and follow it rather than what you remember.

1. Find the framework and read its docs

Detect the framework from the manifest files (package.json, pyproject.toml, requirements.txt, Gemfile, composer.json, go.mod, and so on) and the app's entry points. A web app with its own backend usually needs a client SDK and a server SDK, so read both pages.

Framework Docs page
JavaScript web (any framework) https://posthog.com/docs/libraries/js.md
React, including Vite apps https://posthog.com/docs/libraries/react.md
Next.js https://posthog.com/docs/libraries/next-js.md
Vue.js https://posthog.com/docs/libraries/vue-js.md
Nuxt https://posthog.com/docs/libraries/nuxt-js.md
Svelte and SvelteKit https://posthog.com/docs/libraries/svelte.md
Angular https://posthog.com/docs/libraries/angular.md
Astro https://posthog.com/docs/libraries/astro.md
Remix https://posthog.com/docs/libraries/remix.md
React Router https://posthog.com/docs/libraries/react-router.md
TanStack Start https://posthog.com/docs/libraries/tanstack-start.md
Node.js, including Express https://posthog.com/docs/libraries/node.md
Python, including FastAPI https://posthog.com/docs/libraries/python.md
Django https://posthog.com/docs/libraries/django.md
Flask https://posthog.com/docs/libraries/flask.md
Ruby https://posthog.com/docs/libraries/ruby.md
Ruby on Rails https://posthog.com/docs/libraries/ruby-on-rails.md
PHP https://posthog.com/docs/libraries/php.md
Laravel https://posthog.com/docs/libraries/laravel.md
Go https://posthog.com/docs/libraries/go.md
Java https://posthog.com/docs/libraries/java.md
.NET https://posthog.com/docs/libraries/dotnet.md
Elixir https://posthog.com/docs/libraries/elixir.md
Rust https://posthog.com/docs/libraries/rust.md
React Native https://posthog.com/docs/libraries/react-native.md
Flutter https://posthog.com/docs/libraries/flutter.md
iOS https://posthog.com/docs/libraries/ios.md
Android https://posthog.com/docs/libraries/android.md

For a framework that isn't listed, call docs-search with the framework name.

2. Install the latest SDK

Add each package with the project's own package manager and no version, for example npm install posthog-js, pnpm add posthog-node, uv add posthog or bundle add posthog-ruby. That resolves the newest release. Don't type a version into the manifest from memory, because that pins an old release.

In a monorepo, install into the package that runs the app, not the workspace root.

3. Get the token and host

Call project-get without an ID. Use api_token as the project token and api_host as the SDK's host option.

  • Read both from environment variables in code, using the names the docs page uses (for example NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN and NEXT_PUBLIC_POSTHOG_HOST).
  • Write the real values to the env file the framework loads, such as .env.local or .env. If the project has an example env file, add the variable names there with empty values.
  • Never hard-code the
Частые вопросы

Агент полагается на память при настройке PostHog?

Нет. Сначала он читает актуальную документацию для вашего фреймворка, так как детали настройки меняются от версии к версии.

Что если я не могу дать агенту доступ к коду?

Тогда используется другой скилл, который проводит через настройку в чате и передает результат в виде pull request.

Какие фреймворки поддерживаются?

Популярные веб-фреймворки, например React, Next.js, Vue и Nuxt, а также несколько серверных языков, у каждого своя страница документации.

Подробности

Оригинальное описание автора

Install and configure a PostHog SDK in a repository you can read and edit, following PostHog's docs for the framework. Use when a user working in their codebase asks to add, install, or set up PostHog, product analytics, session replay, or a PostHog SDK. Covers finding the right docs page, installing the latest package, getting the project token and ingestion host from project-get, keeping them in the env file, server-side setup, identifying users, and verifying the change. If you can't access the user's code, as is common in ChatGPT on the web or Claude on the web, use installing-posthog-from

repo: PostHog/posthog

Популярность

Звёзды на GitHub
41k
Место в рейтинге
#6979
Лицензия
—
Обновлён
02.11.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы