What problem does it solve?
Frontend developers at PostHog must place business logic in kea *Logic.ts files rather than React hooks, and choosing the wrong state container (reducer vs selector vs loader vs cache) causes bugs like stale UI, duplicated state, and leaked timers. This Skill encodes the PostHog-specific kea conventions so new and reviewed logics follow the correct patterns.
Core Features & Use Cases
- State container decision flow: Directs each piece of state to a loader, selector, reducer, or
cache.disposables based on whether it is async, derived, action-driven, or disposable.
- Pattern references: Covers loaders with
breakpoint debouncing, kea-forms validation, keyed logics, URL sync via urlToAction/actionToUrl, polling through disposables, persistence, and testing with kea-test-utils.
- Anti-pattern catalogue: Lists concrete shapes to convert on sight, such as reducers mirroring loaders,
useEffect business logic, and kea-subscriptions in products/* code.
- Use Case: When creating a new
fooLogic.ts that fetches an API resource, the Skill prescribes the builder order, a loader with fooLoading, inline typegen blocks, and an afterMount dispatch.
Quick Start
Ask the assistant to create a new kea logic for a PostHog scene that loads data from the API and follows the writing-kea-logics conventions.