docs: add CLAUDE.md, and cover Storybook in CONTRIBUTING - #535
Merged
Conversation
Three rules that keep having to be restated: - UI changes land in Storybook in the same PR -- added, changed or removed. A state only reachable by clicking through the app is one nobody reviews. - A UI PR links the stories it affects on that branch's Storybook deploy, and screenshots anything visual, since the deploy is behind SSO. - Comments say why the code is the way it is, present tense. History belongs in the commit message and PR description, where it stays accurate. Plus the Storybook gotchas that cost time to rediscover: async server components can't be storied, server actions need sb.mock(), and responsive states want a pinned viewport rather than a fixed-width wrapper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JoNCbzms6gPxEbKCgSPe9L
Storybook has been published at ui.source.coop since #498 and went unmentioned here. Adds a Code Conventions section for it, and a PR step asking UI changes to link their stories and screenshot anything visual. The gotchas stay in CLAUDE.md; this is the part a human contributor needs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JoNCbzms6gPxEbKCgSPe9L
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Claude finished @alukach's task in 1m 4s —— View job ✅ No blocking issues — safe to merge. This is a docs-only change ( One non-blocking consistency note:
Simplify (ponytail)
💰 Estimated review cost: $0.27 · 1m03s · 16 turns |
A description written when the PR was opened is read later as the spec. This session produced the example: #533 still described a fixed-width Storybook wrapper and testing "inside the 320px container" two commits after both were replaced by a pinned viewport. Flags the two parts that rot first -- a Testing section asserting checks that predate the current commits, and a Conventional Commits title that no longer matches the work's shape. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JoNCbzms6gPxEbKCgSPe9L
…ded claim The server-component note assumed the reader already knew the mechanism. Says it outright now: stories render in a browser bundle, ProductSummaryCard awaits getPageSession() for cookies and a DynamoDB lookup, so no prop makes it render -- hence the split into a data half and a presentational half. Also replaces the reason for screenshotting UI changes. Branch deployments do 302 to Vercel SSO unauthenticated, but reviewers here are generally logged in, outside contributions have their own approval flow, and anyone can run the stories locally -- so "all a reviewer can see" was overstated. A screenshot earns its place by showing the change in the review and outliving the deployment. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JoNCbzms6gPxEbKCgSPe9L
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Four things keep having to be restated across sessions, and none of them are
visible from the code:
removed. A state you can only reach by clicking through the running app is a
state nobody reviews.
screenshot shows the change in the review itself, and outlives the branch
deployment, which goes away with the branch.
stood when the PR was opened. A description is read later as the spec, so a
stale one sends a reviewer looking for code that isn't there.
used to do and what a change fixed belong in the commit message and PR
description, where someone actually goes looking for history — and where it
stays accurate as the code moves on.
CLAUDE.mdis loaded automatically into every Claude Code session in this repo,so it is the mechanism that makes these stick without being re-explained.
Rule 3 earned its place during this session: #533 still described a fixed-width
Storybook wrapper, and testing "inside the 320px container", two commits after
both had been replaced by a pinned viewport. It called out the two parts that rot
first — a Testing section asserting checks that predate the current commits, and
a Conventional Commits title that no longer matches the work's shape.
Also in CLAUDE.md
The Storybook gotchas that otherwise cost an hour to rediscover:
presentational part, as
ProductDoidoes besideProductSummaryCard;sb.mock()inpreview.tsx, orits story dies on
__filename is not defined;exactly as wide as the frame has none of the page padding the real layout has,
so it invents overflow the page doesn't have. (Learned the hard way in fix(products): truncate a product's DOI instead of overflowing the row #533.)
CONTRIBUTING.md
Storybook has been published at ui.source.coop since #498 and was not mentioned
in CONTRIBUTING at all. Adds a Code Conventions section for it, plus two PR
steps: describing UI changes, and keeping the PR current. The gotchas stay in
CLAUDE.md — one copy of each rule, so the two files can't drift.
Notes
Rules 1–3 are not component-scoped, which is why this is a root
CLAUDE.mdrather than a scoped
src/components/CLAUDE.md.Worth considering separately: much of rule 1 could be enforced rather than
documented — this repo already codifies conventions as
no-restricted-syntaxrules with a teaching message. A test asserting every component has a sibling
.stories.tsxwould need an allowlist for the current gaps, so it is left outhere.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JoNCbzms6gPxEbKCgSPe9L