building-product-empty-states

Implements product setup empty states for PostHog scenes using the shared ProductEmptyState component.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill building-product-empty-states
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-product-empty-states
Source: https://github.com/PostHog/posthog-foss/tree/main/.agents/skills/building-product-empty-states
Command: npx skills add https://github.com/PostHog/posthog-foss --skill building-product-empty-states

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostHog product scenes previously handled first-run setup screens inconsistently, with bespoke empty/loading branches and the deprecated ProductIntroduction component scattered across codebases. This Skill standardizes how a scene declares, detects, and renders a skippable setup empty state until real product data arrives.

Core Features & Use Cases

  • Setup status detection: Build detection logic with createSetupDetectionLogic that pushes normalized statuses (loading, needs-setup, waiting-for-data, has-data) into productSetupStatusLogic from real data signals like HogQL counts or entity counts.
  • Empty state configuration: Create a SceneProductEmptyState config with wizard or primaryAction CTAs, product accent tokens, mode-keyed copy, and declare it on the scene's SceneExport.
  • Animated preview widgets: Build CSS-driven example-data previews with hidden-checkbox interactions, ambient keyframe motion, and accessibility-safe crossfades.
  • Use Case: When adding a new PostHog product scene, use this Skill to wire up detection, register a boot-time setup probe, add Storybook coverage, and migrate away from ProductIntroduction.

Quick Start

Add a setup empty state to my product scene by creating the detection logic, empty state config, and preview, then declaring emptyState on the SceneExport.

Frequently Asked Questions about building-product-empty-states

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add an empty state to a PostHog product scene?

Create a setup detection logic with createSetupDetectionLogic, build a SceneProductEmptyState config in your product's emptyState directory, then declare emptyState on the scene's SceneExport. The app shell's ProductEmptyStateGate handles rendering, so the scene itself contains no empty-state branching.

How do I migrate away from the ProductIntroduction component?

Replace full-scene ProductIntroduction uses with the ProductEmptyState system by writing detection logic and a scene-level emptyState declaration. Entity-list empties map to entity-count detection with a primaryAction create button, and has_seen_product_intro_for dismissals are superseded by local skip.

What statuses does productSetupStatusLogic support?

It supports loading, unknown, needs-setup, waiting-for-data, and has-data. Detection logic must handle failure paths so a failing query never strands the status on loading; fail open to unknown so the gate renders the real scene.

Can users skip the product setup empty state?

Yes, skip is enabled by default and stored locally in localStorage keyed by team and product, never persisted to the backend. Creation-first products can set skippable: false on the config to remove the escape hatch.

Why must preview animations avoid JavaScript timers and React state?

Previews use hidden checkbox or radio inputs with :checked ~ selectors and CSS keyframes so interactions need no JS and ambient motion stays continuous. This keeps visual-regression snapshots stable and lets prefers-reduced-motion guard all animation.

How do I test the empty state on a project that already has data?

Append ?empty_state=1 to the scene URL to force the setup screen, or ?empty_state=waiting-for-data for the middle mode. This overrides detection and local skip without requiring you to empty a project.