Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

building-product-empty-states

БесплатноБез исполняемых скриптовНе проверен

Guide for adding a product setup empty state — the skippable first-run screen a product scene shows until real data arrives, built on the shared…

PostHogот PostHog★ 41 278 звёзд на GitHub

Об этом скилле

Building product empty states

Before a user has set a product up, its scene should show a setup empty state: the product pitch and install command on the left, an animated preview of the product filled with realistic example data on the right. The shared component lives in frontend/src/lib/components/ProductEmptyState/; MCP analytics (products/mcp_analytics/frontend/emptyState/) is the reference adoption.

This system is for product landing scenes. ProductIntroduction stays the inline panel for surfaces the gate cannot cover; see "Scene gate or inline panel?" at the end before choosing.

How it works

  1. A scene declares emptyState on its SceneExport. The app shell (frontend/src/scenes/App.tsx) wraps the scene in ProductEmptyStateGate — the scene component itself contains no empty-state branching.
  2. The gate mounts the product's detection logic, which pushes a normalized status into productSetupStatusLogic({ productKey }) — the app-wide single read point for "is product X set up?".
  3. The gate renders the setup empty state for needs-setup / waiting-for-data, and the scene untouched for has-data. While loading it shows the standard scene-level spinner — the one shared loading treatment. Never add a product-specific loading fallback.
  4. Statuses are preloaded at app boot: productSetupPreloadLogic (mounted in App.tsx) answers every manifest-declared probe (each product's setupProbe, aggregated into productSetupProbes) with one combined event-count query on idle, so by the time a user opens the scene the status is usually already known and the spinner never shows. The product's in-scene detection stays the fresher source of truth.
  5. Users can skip by default. Skip is local-only (localStorage, keyed team + product, never backend-persisted); detection keeps polling, and a slim "Set up" banner stays visible until data lands. Creation-first products whose gated scene is just an empty list can set skippable: false on the config to drop the escape hatch — the primary action is the only next step anyway.

Adoption steps

1. Write (or extend) the detection logic

The status must come from a real signal: a data-existence query (HogQL count / exists API), the product's opt-in flag, or an entity count for creation-first products. Never a dismissal flag — has_completed_onboarding_for is routing metadata, not evidence of data.

Default: one call to createSetupDetectionLogic (lib/components/ProductEmptyState/setupDetectionLogic.ts). Supply a detect function resolving the product's status; the factory owns the shared contract - detect on mount, optionally poll until data lands (stopping for good on has-data, pausing on hidden tabs), fail open on errors, and wait out bootstrap before the first check:

export const logsSetupLogic = createSetupDetectionLogic({
  productKey: ProductKey.LOGS,
  path: ['products', 'logs', 'frontend', 'emptyState', 'logsSetupLogic'],
  detect: async () => ((await api.logs.hasLogs()) ? 'has-data' : 'needs-setup'),
  // Only for products where data arrives from outside (SDK events); entity-count
  // products omit it - the gate remounts the logic on every scene entry.
  pollIntervalMs: 20000,
})

detect composes freely: retry inside it with retryWithBackoff, return unknown for "cannot tell" (e.g. no access), return waiting-for-data from an opt-in flag + count check. When the query is a fresh event count, use refresh: 'force_blocking' - a cached pre-ingestion [0,0] would otherwise stick. recheckActionTypes re-detects immediately when app state changes elsewhere (a team-setting opt-in). cacheHasData remembers a has-data answer in localStorage so returning users skip the spinner and the query - use it for products with no boot-time probe. Add revalidateCachedHasData when the data can go away (entities users delete, recordings that expire, a lookback window): the cached answer still opens the gate at once, detection runs once in the background, and a needs-setup or waiting-for-data answer clears the cache so the next visit shows the empty state. It never replaces the mounted scene, so an open modal or a half-created entity survives. Plain cacheHasData is for ingested data that stays. Recheck actions stop re-detecting once the status is has-data, since their job is to flip the gate open after the first entity is created in place. For a creation-first product that must return to its empty state after its last entity is deleted, set allowReturnToSetup: true. Include successful creation, deletion, bulk deletion, and restore actions in recheckActionTypes. The factory then refreshes the count after those actions and clears its cached answer when the product becomes empty. Keep the default for data-based products so a background check cannot replace an active scene.

Products whose detection drives more than the gate (extra selectors, staged dashboards) keep a bespoke logic instead - templat

Полный SKILL.md на GitHub

Установить building-product-empty-states в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл building-product-empty-states?

Guide for adding a product setup empty state — the skippable first-run screen a product scene shows until real data arrives, built on the shared ProductEmptyState component. Use when adding an empty state or first-run/setup screen to a product scene, declaring `emptyState` on a `SceneExport`, writing a product setup-status detection logic, building an animated example-data preview widget, or deciding between the scene-level `ProductEmptyState` gate and an inline `ProductIntroduction` panel. Covers the `productSetupStatusLogic` single-layer contract, real-data detection rules, local-only skip semantics, wizard commands, and design tokens.

Как установить скилл building-product-empty-states?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл building-product-empty-states запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить building-product-empty-states с