Logotipo de Installing Posthog In A Codebase

Installing Posthog In A Codebase

Organización
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.

Descripción general

EditorPostHog
Repositorioskills
Nombre de la habilidadinstalling-posthog-in-a-codebase
Estrellas
77
Forks
8
Archivos incluidos
Solo instrucciones
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando una petición es realmente relevante.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Todo en las instrucciones

    Todo lo que necesita el modelo está en las instrucciones: no hay archivos adicionales que sincronizar.

  • Código abierto

    Publicada por PostHog en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Installing Posthog In A Codebase en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebase
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → Desde URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

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
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Installing Posthog In A Codebase en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición es relevante, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Installing Posthog In A Codebase automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Installing Posthog In A Codebase no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición relevante, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

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.

Preguntas frecuentes

¿Qué hace la habilidad de 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...

¿Por qué usar Installing Posthog In A Codebase en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Installing Posthog In A Codebase está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Installing Posthog In A Codebase en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebase. TypingMind lee su archivo SKILL.md y la instala como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Installing Posthog In A Codebase?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Installing Posthog In A Codebase?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Installing Posthog In A Codebase con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Installing Posthog In A Codebase?

Sí. PostHog la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇