Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): pick PR screenshot sources and keep scratch stories out (#109946)

Julian Bez90d0c69036c7
diff --git a/.agents/skills/writing-pr-descriptions/SKILL.md b/.agents/skills/writing-pr-descriptions/SKILL.md
index 35326907ad29..8f0874daa975 100644
--- a/.agents/skills/writing-pr-descriptions/SKILL.md
+++ b/.agents/skills/writing-pr-descriptions/SKILL.md
@@ -94,6 +94,13 @@ No PR needs every form. Reach for one because it makes review faster, never as d
### Screenshots
+Take each screenshot from the first source that can show the change:
+
+1. The running app, when one is up.
+2. Storybook, through a headless browser. Use the story that covers the surface. When no story does, write a scratch story for the screenshot and keep it out of the commit.
+
+Capture at `deviceScaleFactor: 2`. A 1x image looks soft on a high-density screen, and GitHub shrinks a wider image to fit the column. Take the before from the base branch the same way. A new surface has no before, so say that in one line.
+
Upload with `hogli pr:upload-image <file>` and paste the markdown it prints. The first run only warns; re-run with `--yes`. The assets are public forever, so never upload customer data, customer names, secrets, or internal info.
Touching UI code without a visible change is common, and the mandate has to be dischargeable. When nothing looks different, say so in one line. A reviewer cannot tell that case from a missing screenshot, and silence reads as the second.
diff --git a/.agents/skills/writing-ui-components/SKILL.md b/.agents/skills/writing-ui-components/SKILL.md
index 905915921f08..43fa0fca280c 100644
--- a/.agents/skills/writing-ui-components/SKILL.md
+++ b/.agents/skills/writing-ui-components/SKILL.md
@@ -212,9 +212,12 @@ acts on it.
- **`data-attr` on meaningful interactions.** New buttons and key interactive elements get a
kebab-case `data-attr` (match the surrounding scene's pattern) — it's how autocapture
dashboards and Playwright find them. Once shipped it's frozen (see the table above).
-- **New presentational components ship with a story** (handbook rule) — visual-regression
- coverage is free once the story exists. Flag-gated components use the `featureFlags` story
- parameter ([setting-feature-flags-in-storybook](../setting-feature-flags-in-storybook/SKILL.md)).
+- **New presentational components ship with a story** (handbook rule). Each committed story
+ shows a state that no other story shows. A story adds a light and a dark visual review
+ baseline, and every later change to that surface must re-approve both. A story written only
+ to look at a change or to take a PR screenshot is scratch: keep it out of the commit.
+ Flag-gated components use the `featureFlags` story parameter
+ ([setting-feature-flags-in-storybook](../setting-feature-flags-in-storybook/SKILL.md)).
## Anti-patterns
@@ -232,6 +235,7 @@ before/after for the rules above. Read it when reviewing UI diffs.
data
- [ ] No hardcoded colors; arbitrary Tailwind values justified or replaced
- [ ] Renames swept (`git grep` the old name returns nothing); wire strings untouched and pinned
-- [ ] New presentational component has a story
+- [ ] New presentational component has a story; every committed story shows a distinct state,
+ and no scratch story is committed
- [ ] Typecheck/lint cadence per [frontend/src/AGENTS.md](../../../frontend/src/AGENTS.md) —
full check once at the end, `pnpm --filter=@posthog/frontend fix` before finishing
diff --git a/AGENTS.md b/AGENTS.md
index 7d962cb752f1..9e8eb164ac43 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -12,7 +12,7 @@
- Environment:
- This is a full dev environment with `node`, `pnpm`, a package mirror and `apt`. A missing `node_modules`, browser binary or flox means setup has not run yet (`pnpm install`, `npx playwright install --with-deps chromium`), not that running things is impossible — install it and continue. Report "can't run" only for a specific, nameable failure (no network, no `apt`, out of memory), alongside whatever fallback you took.
- - Visual and UX work is not confirmed by reading the code. Render the affected surface (Storybook via a headless browser) and compare before and after. Worth the setup cost.
+ - Visual and UX work is not confirmed by reading the code. Render the affected surface (the running app, or Storybook via a headless browser) and compare before and after. Worth the setup cost. A story written only for this check is scratch: keep it out of the commit.
- Use flox when available — prefer `flox activate -- bash -c "<command>"` if commands fail
- Never use `flox activate` in interactive sessions (it hangs if you try)
- Tests: