Installing Posthog In A Codebaseのロゴ

Installing Posthog In A Codebase

組織
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.

概要

公開者PostHog
リポジトリskills
スキル名installing-posthog-in-a-codebase
スター
77
フォーク
8
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    PostHogがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルInstalling Posthog In A CodebaseをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebase
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでInstalling Posthog In A Codebaseを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にInstalling Posthog In A Codebaseを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Installing Posthog In A Codebaseは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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.

よくある質問

AIスキル「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...

TypingMindでInstalling Posthog In A Codebaseを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Installing Posthog In A Codebaseはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにInstalling Posthog In A Codebaseをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebaseを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Installing Posthog In A Codebaseを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Installing Posthog In A Codebaseは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもInstalling Posthog In A Codebaseを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Installing Posthog In A Codebase」は無料ですか?

はい。PostHogがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇