writing-kea-logics
Skill by PostHog
Guides writing and reviewing PostHog kea logic files. Covers choosing between reducers, selectors, loaders and listeners, and wiring React components to logics. Built for PostHog frontend developers.
Install writing-kea-logics
Built from the published package, never by AI.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/.agents/skills/writing-kea-logics ~/.claude/skills/writing-kea-logicsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/posthog/.agents/skills/writing-kea-logics ~/.gemini/antigravity-cli/skills/writing-kea-logicsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The writing-kea-logics skill is a guide from PostHog for writing or reviewing kea logic files, the *Logic.ts and *Logic.tsx files that hold most frontend business logic in PostHog. It explains when to use a reducer, selector, cache entry or loader, when to prefer listeners over kea-subscriptions, and how to wire React components with useValues, useActions and BindLogic.
The skill lists PostHog-specific conventions on top of the upstream keajs.org docs. These include the order of logic builder blocks, inline generated type blocks from kea-typegen, and scoped typegen commands for a single file. It points to companion references on forms, routing, polling, persistence and testing. It is aimed at engineers working on the PostHog frontend and anyone onboarding to kea conventions.
Written from the project's SKILL.md and checked against it.
What it can do
- Choose state containersDecides between reducer, selector, cache and loader for a piece of state.
- Create new logicsGuides the structure and block order of a new *Logic.ts or *Logic.tsx file.
- Prefer listenersRecommends listeners over kea-subscriptions for reacting to value changes.
- Wire React to logicsExplains connecting components with useValues, useActions and BindLogic.
- Review kea codeChecks logic files and PRs against PostHog kea conventions.
- Run scoped typegenShows commands to regenerate types for one logic file during development.
What you need
- A PostHog repository checkout with the pnpm workspace
- kea and kea-typegen 3.8.3 as used by the PostHog frontend
Try asking
- Create a new kea logic for a settings page with a loader and a reducer
- Should this state be a reducer, a selector or a loader? Here is the code
- Review my kea listeners against the PostHog conventions in this PR
Good to know
- Written for PostHog's kea setup and may not match other kea projects
- Full typegen is slow, and tsgo does not accept a project config with a file argument
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/writing-kea-logics/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md9 KB -
references/anti-patterns.md14 KB -
references/connecting-logics.md4 KB -
references/forms.md3 KB -
references/keyed-logics.md4 KB
Show all 12 files
-
references/loading-data.md4 KB -
references/persisting-state.md3 KB -
references/polling.md4 KB -
references/reacting-to-changes.md5 KB -
references/routing.md3 KB -
references/state-decision.md5 KB -
references/testing.md7 KB
Alternatives to writing-kea-logics
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
writing-kea-logics: common questions
Who is this skill for?
It is written for PostHog frontend work that uses kea, and for anyone onboarding to kea conventions in that codebase.
Does it replace the kea documentation?
No. The skill says to read keajs.org for upstream API signatures and uses itself for PostHog-specific conventions.
Why avoid kea-subscriptions?
The skill says subscriptions install a redux subscription that re-runs on every dispatch and is measurably slower, so listeners are preferred.
How do I install writing-kea-logics?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is writing-kea-logics free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is writing-kea-logics safe to use?
It scores 86 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to writing-kea-logics?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
