Logo de Installing Posthog In A Codebase

Installing Posthog In A Codebase

Organisation
PostHog
installing-posthog-in-a-codebase

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-chat instead.

Présentation

ÉditeurPostHog
Dépôtskills
Nom de la compétenceinstalling-posthog-in-a-codebase
Étoiles
77
Forks
8
Fichiers inclus
Instructions uniquement
LicenceMIT
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont en simple Markdown, et non en code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Tout dans les instructions

    Tout ce dont le modèle a besoin se trouve dans les instructions : aucun fichier supplémentaire à synchroniser.

  • Open source

    Publiée par PostHog sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Installing Posthog In A Codebase dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Collez l’URL du dossier de la compétence indiquée ci-dessous, puis confirmez.
    https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebase
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter → Via URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/PostHog/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/omnibus/installing-posthog-in-a-codebase .claude/skills/installing-posthog-in-a-codebase
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Installing Posthog In A Codebase dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Installing Posthog In A Codebase dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, Installing Posthog In A Codebase n’est pas lié au modèle pour lequel cette compétence a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

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.

FrameworkDocs page
JavaScript web (any framework)https://posthog.com/docs/libraries/js.md
React, including Vite appshttps://posthog.com/docs/libraries/react.md
Next.jshttps://posthog.com/docs/libraries/next-js.md
Vue.jshttps://posthog.com/docs/libraries/vue-js.md
Nuxthttps://posthog.com/docs/libraries/nuxt-js.md
Svelte and SvelteKithttps://posthog.com/docs/libraries/svelte.md
Angularhttps://posthog.com/docs/libraries/angular.md
Astrohttps://posthog.com/docs/libraries/astro.md
Remixhttps://posthog.com/docs/libraries/remix.md
React Routerhttps://posthog.com/docs/libraries/react-router.md
TanStack Starthttps://posthog.com/docs/libraries/tanstack-start.md
Node.js, including Expresshttps://posthog.com/docs/libraries/node.md
Python, including FastAPIhttps://posthog.com/docs/libraries/python.md
Djangohttps://posthog.com/docs/libraries/django.md
Flaskhttps://posthog.com/docs/libraries/flask.md
Rubyhttps://posthog.com/docs/libraries/ruby.md
Ruby on Railshttps://posthog.com/docs/libraries/ruby-on-rails.md
PHPhttps://posthog.com/docs/libraries/php.md
Laravelhttps://posthog.com/docs/libraries/laravel.md
Gohttps://posthog.com/docs/libraries/go.md
Javahttps://posthog.com/docs/libraries/java.md
.NEThttps://posthog.com/docs/libraries/dotnet.md
Elixirhttps://posthog.com/docs/libraries/elixir.md
Rusthttps://posthog.com/docs/libraries/rust.md
React Nativehttps://posthog.com/docs/libraries/react-native.md
Flutterhttps://posthog.com/docs/libraries/flutter.md
iOShttps://posthog.com/docs/libraries/ios.md
Androidhttps://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 token or the host in source files, and never use them as fallback defaults in code.

4. Initialize as the docs show

  • Initialize the SDK once, in the place the docs page names. Don't add a second initialization elsewhere.
  • For posthog-js, set defaults to the date the docs page shows. It selects the newest set of recommended settings, so don't take a date from memory.
  • For a backend SDK in a long-running server, create one client for the process, reuse it, and shut it down when the process exits. Don't create a client per request.
  • In serverless or edge handlers (for example Next.js route handlers on Vercel, or AWS Lambda), the runtime can freeze as soon as the response is sent, so queued events are lost. Flush before the handler returns: await flush() on a reused client, or use the platform's waitUntil, as the docs page describes.
  • For a server-rendered app (Django, Rails, Laravel and similar), add the server SDK as well as the browser snippet.

5. Identify users

If the app has login, call identify after login with a stable user ID from the auth system, such as the database ID, not an email address or display name. Call reset() on logout. Send server-side events with the same distinct ID, so client and server events land on the same person.

6. Verify

Run the project's build, type check or tests, and fix anything your change broke. If you can run the app, load a page and check that events arrive with read-data-schema or execute-sql. Tell the user which environment variables to add in their hosting provider before they deploy.

Foire aux questions

À quoi sert la compétence IA Installing Posthog In A Codebase ?

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-f...

Pourquoi utiliser Installing Posthog In A Codebase sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Installing Posthog In A Codebase se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Installing Posthog In A Codebase dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebase. TypingMind lit le fichier SKILL.md et l’installe sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Installing Posthog In A Codebase ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Installing Posthog In A Codebase ?

Autant que vous le souhaitez. Tant qu’un modèle prend en charge les compétences, vous pouvez utiliser Installing Posthog In A Codebase avec lui : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Installing Posthog In A Codebase est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par PostHog sous licence MIT. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, modèles de documents ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇