docs: ban Radix in agent instructions, add missing CLAUDE.md symlinks - #4064
docs: ban Radix in agent instructions, add missing CLAUDE.md symlinks#4064adamleithp wants to merge 1 commit into
Conversation
Agents keep reaching for `@radix-ui/themes` because the surrounding code does and nothing told them not to. Make the ban explicit everywhere an agent reads instructions. Root AGENTS.md gains a "UI Components" section: no `@radix-ui/*` import, ever; layout primitives (Box/Flex/Grid/Section/Container) become `div`s with Tailwind; everything else maps to its `@posthog/quill` equivalent. Replace Radix in the code you touch rather than matching it. Two carve-outs are spelled out so the rule isn't over-applied — the Radix CSS variables (`--gray-*`, `--radius-*`) stay, and the app/test `<Theme>` root stays pending a separate migration. Also reinforced in the feature guides (canvas, browser-tabs, inbox), in docs/conventions.md — whose canonical component example was itself teaching `<Box>` — and in the storybook-stories skill. Feature guides now follow the root convention: content in AGENTS.md with a CLAUDE.md symlink beside it, so Claude picks them up. Adds the missing symlinks for canvas and browser-tabs, and flips inbox (CLAUDE.md became AGENTS.md + symlink). Docs only — no source or lint-config changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DEM8aVRU7GGbWjMssYYoTf
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Prompt To Fix All With AI### Issue 1
AGENTS.md:233-237
**Radix ban contradicts carve-outs**
The unconditional ban on every `@radix-ui/*` import conflicts with the later instructions to retain the Radix Theme roots and token stylesheet. Qualify the ban wherever it is stated so agents do not remove sanctioned imports from `ThemeWrapper.tsx`, Storybook, existing themed tests, or `globals.css`, causing avoidable visual regressions and corrective work.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "docs: ban Radix in agent instructions, a..." | Re-trigger Greptile |
| **Radix is banned. Do not add a `@radix-ui/*` import to any file, ever.** That covers | ||
| `@radix-ui/themes` and every `@radix-ui/react-*` package. There is no "just this once" | ||
| exception for matching surrounding code: the ~500 files that still import Radix are | ||
| legacy awaiting migration, not a pattern to copy. If a file you are editing already | ||
| imports Radix, that is a reason to remove those imports, not to add more. |
There was a problem hiding this comment.
Radix ban contradicts carve-outs
The unconditional ban on every @radix-ui/* import conflicts with the later instructions to retain the Radix Theme roots and token stylesheet. Qualify the ban wherever it is stated so agents do not remove sanctioned imports from ThemeWrapper.tsx, Storybook, existing themed tests, or globals.css, causing avoidable visual regressions and corrective work.
Context Used: Do not attempt to comment on incorrect alphabetica... (source)
Knowledge Base Used: @posthog/ui shared UI package
Prompt To Fix With AI
This is a comment left during a code review.
Path: AGENTS.md
Line: 233-237
Comment:
**Radix ban contradicts carve-outs**
The unconditional ban on every `@radix-ui/*` import conflicts with the later instructions to retain the Radix Theme roots and token stylesheet. Qualify the ban wherever it is stated so agents do not remove sanctioned imports from `ThemeWrapper.tsx`, Storybook, existing themed tests, or `globals.css`, causing avoidable visual regressions and corrective work.
**Context Used:** Do not attempt to comment on incorrect alphabetica... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
**Knowledge Base Used:** [`@posthog/ui` shared UI package](https://app.greptile.com/posthog-org-19734/-/custom-context/knowledge-base/posthog/code/-/docs/ui-package.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Problem
Agents keep writing new UI with
@radix-ui/themes—Box,Flex,Text— because ~500 files in the repo already do and nothing in the instruction files told them not to. Every one of those is new legacy to migrate later. The one file that did say "use quill, not Radix" (features/canvas/AGENTS.md) hedged it as a preference.Two of the three feature guides were also invisible to Claude:
canvas/AGENTS.mdandbrowser-tabs/AGENTS.mdhad noCLAUDE.mdsymlink beside them, andinbox/had the content inCLAUDE.mdwith noAGENTS.md— inverted from the root convention.Changes
Docs only — no source, dependency, or lint-config changes.
Root
AGENTS.mdgains a## UI Componentssection stating the ban outright: no@radix-ui/*import in any file, ever, with no "matching the surrounding code" exception. It carries two lookup tables agents can act on directly:<Flex align="center" gap="2">→<div className="flex items-center gap-2">; alsoBox,Grid,Section,Container,ScrollArea,Heading,Code,VisuallyHidden,Link.@posthog/quillequivalent (Text,Button,Input/Textarea,Select,Switch,Tooltip,Dialog,DropdownMenu, …), verified against quill's actual export surface as used in this repo.It also sets the replace-as-you-go expectation — migrate what your diff touches, leave the file no more Radix-dependent than you found it, no drive-by rewrites of untouched files — and spells out two carve-outs so the rule doesn't get over-applied:
text-(--gray-12),--radius-2) are the token layer, not components. They stay.<Theme>root stays pending a separate migration.Reinforced everywhere else an agent reads instructions:
features/canvas/AGENTS.md— "not Radix" preference hardened into a ban, with the swap spelled out.features/browser-tabs/AGENTS.md— new "Components & styling" section.features/inbox/AGENTS.md— note in UI Architecture + a "Things to Avoid" bullet.docs/conventions.md— its canonical component example was itself teaching<Box>; that's now a<div>, plus a pointer to the new section and a clarification on the CSS-variable line..claude/skills/storybook-stories/SKILL.md— its<Theme>mention now says explicitly that the root provider is the sanctioned exception, not license to use Radix components.Symlinks. Feature guides now follow the root convention (content in
AGENTS.md,CLAUDE.mdsymlinked beside it): added the missing symlinks forcanvas/andbrowser-tabs/, and flippedinbox/(git mv CLAUDE.md AGENTS.md+ symlink). RootAGENTS.mddocuments the convention so new guides get the symlink too.Enforcement is a natural follow-up but deliberately not in this PR — a Biome
noRestrictedImportsentry for@radix-ui/*would fail on the ~500 existing files until they're migrated, so it needs its own sequencing.How did you test this?
Nothing to run — the diff is 6 markdown files and 3 symlinks. Verified by inspection:
120000, not copied content.AGENTS.md#ui-componentsresolve from each file's depth, and the anchor matches the new heading.@posthog/quillacrosspackages/andapps/, so no row points at a component that doesn't exist.Automatic notifications
Generated by Claude Code