formatting-insight-axes
Fungsinya
Skill ini mengatur format sumbu pada insight PostHog agar angka menampilkan satuan yang jelas, seperti detik, menit, atau persentase. Ditujukan untuk analis yang membuat grafik dengan nilai waktu atau rasio.
Kapan dipakai
- βSaat Anda akan membagi sebuah nilai hanya agar tampil dalam menit atau sebagai persen.
- βSaat Anda ingin sumbu grafik menampilkan nilai waktu dengan satuan yang mudah dibaca.
- βSaat Anda ingin kolom insight SQL menampilkan satuan tanpa mengubah angkanya.
Link skill
https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/formatting-insight-axes/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
βTampilkan rata-rata waktu respons di grafik saya dalam menit, tanpa mengubah angkanya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill mengatur format sumbu bawaan alih-alih menambahkan pembagian atau akhiran teks tetap. Pemformat kemudian memilih satuan yang mudah dibaca untuk setiap nilai, dan angka dasarnya tetap benar.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Formatting insight axes
PostHog renders insights with a built-in axis formatter. Use it instead of contorting the query or a literal prefix/postfix to fake units.
The two insight kinds configure it in different places:
- TrendsQuery β
trendsFilter.aggregationAxisFormat(this page, below) - SQL insights (
DataVisualizationNode) β per-columnsettings.formatting(see SQL insights)
The anti-pattern
If you are reaching for any of these, stop and pick a format below first:
formula: "A / 60"withaggregationAxisPostfix: " mins"β manual seconds -> minutesformula: "A / 1000"withaggregationAxisPostfix: " s"β manual ms -> secondsformula: "A * 100"withaggregationAxisPostfix: "%"β manual ratio -> percentaggregationAxisPostfix: "ms"/"s"/"min"/"hr"on raw values
These freeze the unit at one scale. The built-in formatter picks a friendly unit per value (1.5s, 2m 12s, 1h 4m) and keeps the underlying series numerically correct for further math, breakdowns, and alerts.
Available formats
Set trendsFilter.aggregationAxisFormat on the TrendsQuery:
| Value | Use when the series is... | Renders as |
|---|---|---|
numeric (default) |
a plain count | 1,234 |
duration |
seconds (any scale) | 45s, 2m 12s, 1h 4m |
duration_ms |
milliseconds | 850ms, 1.5s, 1m 4s |
percentage |
already 0-100 | 47.3% |
percentage_scaled |
a ratio 0-1 | 47.3% |
currency |
money in the project's base currency | $1,234.56 (or local code) |
short |
large counts you want compacted | 1.2K, 3.4M |
Companion fields on trendsFilter:
aggregationAxisPrefixβ literal prefix (e.g."$") when you need a symbol pinned to a specific currency or unit, regardless of project settingsaggregationAxisPostfixβ literal suffix; reserve for genuine units the format can't express (e.g." req"," events"), never for"mins"/"s"/"%"β the percentage formats already append the%sign, so a"%"postfix renders50%%decimalPlacesβ cap decimals (1 or 2 is usually right for currency / ratios)
Currency β pick format or prefix carefully
aggregationAxisFormat: "currency" renders with the project's base currency
(set in project settings, defaults to USD). Use it when the underlying values
are in that same currency β e.g. revenue events that PostHog auto-converts to
the project's base currency.
If the values are pinned to a specific currency regardless of project (e.g.
$ai_total_cost_usd is always USD, even on a EUR-base project), use
aggregationAxisPrefix: "$" + decimalPlaces: 2 so the symbol matches the
data. Using format: "currency" here would render USD values with β¬ on a
EUR project.
When the series is in seconds
If the series is in seconds (latency, session length, time-to-first-event,
processing time, page load, etc.), silently default to
aggregationAxisFormat: "duration". Do not stop to ask β the formatter is
non-destructive (the underlying values stay in seconds either way, only the
labels change), so picking it is always at least as good as raw seconds.
Only confirm with the user when they have explicitly named a fixed unit they want pinned ("show this in minutes", "graph the average in hours"):
"I can pin the y-axis to minutes by dividing the series by 60, or use PostHog's
durationformatter which auto-picks seconds / minutes / hours per value β90srenders as1m 30sand5400sas1h 30m. Which would you prefer?"
In one-shot MCP contexts where no user is in the loop, just pick duration
and move on.
Examples
Latency β duration in milliseconds
{
"kind": "TrendsQuery",
"series": [
{
"kind": "EventsNode",
"event": "$pageview",
"math": "p95",
"math_property": "$performance_page_loaded"
}
],
"trendsFilter": {
"aggregationAxisFormat": "duration_ms"
}
}
Average session length β duration in seconds
{
"kind": "TrendsQuery",
"series": [
{
"kind": "E
Pertanyaan umum
Mengapa tidak menambahkan rumus untuk mengonversi satuan?
Konversi tetap mengunci satuan pada satu skala, sedangkan format bawaan menyesuaikan dengan setiap nilai dan tetap menjaga data dapat digunakan untuk perhitungan lain.
Apakah ini berfungsi untuk insight SQL?
Ya. Insight SQL mengatur format untuk setiap kolom di pengaturan grafiknya.
Apakah angka saya akan berubah?
Tidak. Hanya tampilannya yang berubah, sehingga nilainya tetap benar secara numerik.
Detail
Deskripsi asli dari pembuat
Pick the right y-axis unit when creating or updating an insight via `posthog:insight-create` or `posthog:insight-update` β both TrendsQuery (`trendsFilter.aggregationAxisFormat`) and SQL insights (`DataVisualizationNode`, `chartSettings.yAxis[].settings.formatting`). Use when the agent is about to add a `formula` purely to convert units (e.g. dividing seconds by 60 to display minutes), when a `math_property` or SQL column is a duration, currency, ratio, or large count, or whenever the user mentions "format the y-axis", "duration", "seconds", "minutes", "hours", "milliseconds", "ms", "percentag
repo: PostHog/posthog
Popularitas
- Bintang GitHub
- 41k
- Peringkat
- #6903
- 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
gitcrawl
394kMemungkinkan agent Anda mencari arsip issue dan pull request GitHub yang tersimpan, mengelompokkan yang duplikat, dan memeriksa status terkininya di GitHub.
slacrawl
394kMemungkinkan agent Anda mencari dan menghitung pesan di arsip Slack lokal, memeriksa seberapa baru arsip itu, dan menyegarkannya bila diperlukan.
goplaces
394kMembantu agent Anda mencari tempat, mendapatkan detail dan ulasannya, serta menentukan nama tempat memakai Google Places, dengan keluaran JSON untuk skrip.