writing-kea-logics

Installation
SKILL.md

Writing kea logics

PostHog uses kea as the state container for the frontend. Almost all non-trivial business logic lives in a *Logic.ts / *Logic.tsx file, not in React. We may be on a kea pre-release ahead of the version the keajs.org docs cover — when in doubt, check pnpm-workspace.yaml for the pinned version.

This skill captures the PostHog-specific conventions on top of the upstream kea docs. When in doubt about a builder's signature, go upstream. When in doubt about whether to use it, read here.

Use this skill when

  • Creating a new *Logic.ts / *Logic.tsx file
  • Adding builders to an existing logic (actions, reducers, selectors, listeners, loaders, forms)
  • Choosing between reducer vs selector vs cache vs loader for a piece of state
  • Wiring a React component to a logic
  • Reviewing a PR that introduces or modifies a kea logic
  • Reviewing code that uses React hooks where a logic would be more idiomatic
Installs
3
GitHub Stars
513
First Seen
3 days ago
writing-kea-logics — posthog/posthog-foss