installing-posthog-in-a-codebase
Fungsinya
Skill ini membuat agent memasang pustaka analitik PostHog di basis kode yang bisa dibaca dan diedit agent. Skill ini untuk pengembang yang ingin menambahkan analitik produk dan session replay ke aplikasi mereka.
Kapan dipakai
- ✓Saat Anda meminta PostHog, analitik produk, atau session replay ditambahkan ke aplikasi Anda.
- ✓Saat Anda ingin pustaka PostHog dipasang untuk framework Anda, seperti React atau Next.js.
- ✓Saat Anda ingin agent menyimpan token proyek dan pengaturan host Anda di tempat yang benar.
Link skill
https://github.com/PostHog/posthog/blob/master/products/wizard/skills/installing-posthog-in-a-codebase/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Tolong tambahkan analitik PostHog ke aplikasi Next.js saya dengan penyiapan terbaru dari dokumentasi mereka.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent mendeteksi framework Anda dari file proyek lalu membaca halaman dokumentasi PostHog yang sesuai. Setelah itu agent memasang paket terbaru, menambahkan token proyek dan pengaturan host, lalu menulis kode penyiapannya.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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.
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_TOKENandNEXT_PUBLIC_POSTHOG_HOST). - Write the real values to the env file the framework loads, such as
.env.localor.env. If the project has an example env file, add the variable names there with empty values. - Never hard-code the
Pertanyaan umum
Apakah agent mengandalkan memori untuk penyiapan PostHog?
Tidak. Agent membaca dokumentasi terbaru untuk framework Anda terlebih dahulu, karena detail penyiapan berubah antar rilis.
Bagaimana jika saya tidak bisa memberi agent akses ke kode saya?
Maka digunakan skill lain, yang memandu penyiapan lewat chat dan mengirimkannya sebagai pull request.
Framework apa saja yang dicakup?
Framework web umum seperti React, Next.js, Vue, dan Nuxt, serta beberapa bahasa server, masing-masing dengan halaman dokumentasinya sendiri.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 41k
- Peringkat
- #6979
- Lisensi
- —
- Diperbarui
- 2/11/2026
Komentar
- …
Skill lain dari repositori ini
depot-ci
41kMembantu agent Anda menyiapkan dan menjalankan alur kerja Depot CI, alternatif GitHub Actions, termasuk memigrasikan alur kerja yang ada dan membaca log eksekusi.
depot-container-builds
41kMembantu agent Anda membangun image Docker di builder jarak jauh Depot, termasuk image multi-platform, pengiriman ke registry, dan perbaikan kegagalan build.
depot-github-runners
41kMembantu agent Anda memindahkan job GitHub Actions ke runner yang dikelola Depot, memilih ukuran dan label runner, serta memecahkan masalah pengaturan runner.
editing-agents-md
41kMembantu agent Anda memutuskan apakah sebuah aturan layak masuk ke berkas AGENTS.md atau CLAUDE.md, dan menulisnya agar tetap dipatuhi tanpa membuat berkas membengkak.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.