writing-ui-components
БесплатноБез исполняемых скриптовНе проверенStructure and abstraction rules for PostHog UI code — any React component or frontend file under `frontend/src/` or `products/*/frontend/`. Use ALWAYS before…
от PostHog★ 41 278 звёзд на GitHubОб этом скилле
Writing UI components
How UI code is structured: which file a component lives in, when duplication becomes a shared
component, what a rename must sweep, and what every component renders before its data resolves.
Applies to everything under frontend/src/ and products/*/frontend/.
Each section leads with its gate question. If you can answer the gate honestly, the details below it usually follow on their own.
Use this skill when
- Creating a new component, scene, view, hook, or frontend module
- Splitting or restructuring an existing component file, or moving one between folders
- Extracting a repeated shape into a shared/generic component, or promoting one toward
lib/ - Renaming a frontend symbol, file, or feature vocabulary
- Adding loading/empty/error handling to a view
- Reviewing a PR that does any of the above
Companion rules (do not duplicate)
This skill owns structure. These own their own territory — link to them, don't restate them:
- frontend/src/AGENTS.md — Rule 1: reuse before you create (the Lemon/quill lookup table) and Rule 2 (generated API types). Both apply before anything here.
- writing-kea-logics — business logic lives in a logic, not in React; state container choice. using-kea-disposables for anything that needs cleanup.
- writing-user-facing-copy — every visible string.
- writing-code-comments — every comment, including the pinned-string comments below.
- building-product-empty-states — scene-level
first-run empty states (the
ProductEmptyStategate). - scene-menu-bar — scene action surfaces.
- working-with-storybook — rendering, writing and debugging stories.
Survey precedent before you build
Gate: which existing scene or component are you modeling this on — and does that model itself follow these rules?
Brand consistency comes from imitation, not invention. Before building any new UI, read how
2–3 comparable scenes or components are implemented — component choice, density, layout, file
structure, logic wiring, data-attr naming — and name the precedent you're following. A new
surface that matches its compliant neighbors is on-brand by construction.
But filter precedent through the conventions. The codebase carries legacy that predates
these rules — clickable divs, hand-rolled tables, new-style-banned LemonMenus, whole-scene
ProductIntroduction panels where the scene gate belongs, re-export shims, slop styling. An existing violation is
history, not license: this skill and frontend/src/AGENTS.md outrank precedent. When the
nearest example violates the rules, follow the rules — and if the violation is cheap to fix,
convert it while you're there (references/anti-patterns.md).
Telling good precedent from bad:
- Prefer reference implementations named in skills — e.g. MCP analytics for
empty states, the migrated scenes listed in
scene-menu-bar — and recently-touched code (
git log) over untouched corners. - Prefer current primitives: quill menus/comboboxes over
LemonMenu/Radix menus, theProductEmptyStategate over a whole-sceneProductIntroduction, generated*Apitypes over handwritten ones. - When they conflict, the priority order is conventions > compliant precedent > invention. Inventing a new pattern when a compliant precedent exists is itself a reuse violation.
Code organization
Gate: can a reader find this code by name, from the folder tree alone?
- One component per file. A file exports the component its name promises — nothing else. A
private sub-piece may stay only when it is unexported, has a single consumer in the same file,
is small (a few lines of markup, not a second real component), and is inseparable from the
parent (mode-variants of the same export). The moment it's exported, it moves to its own file.
Named exports only, never
default(handbook rule). - One concern per file. When a file accumulates a second concern, split it: pure decision functions come out of logics and components into a sibling module and get tested directly (see writing-tests — extract, don't escalate); a dialog opened by a button is not part of the button. Copy stays inline where reviewers see it in rendering context — extract only long-form copy blocks or copy shared across components.
- Folders mirror the feature. A flow is a shell plus a
steps/folder; reusable pieces incomponents/; shared helpers inutils.ts(or the layer's existinghelpers.ts). The tree should read like a table of contents. Files are named after their main
Установить writing-ui-components в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл writing-ui-components?
Structure and abstraction rules for PostHog UI code — any React component or frontend file under `frontend/src/` or `products/*/frontend/`. Use ALWAYS before creating, moving, splitting, or restructuring a component or frontend file, extracting a shared/generic component, promoting a component to `lib/`, renaming a frontend symbol or feature, or reviewing a diff that does any of these. Covers file and folder organization (one component per file, one home per symbol, no re-export shims or barrels), when duplication becomes a component and when a generic is premature, rename sweeps and the frozen-strings contract (event names, properties, flag keys, `data-attr` values are API), UI resolution states (loading, empty, and error are three different screens), and visual discipline (design tokens, on-brand custom components with no AI slop, real interactive elements, reduced motion, Storybook). Component choice (Lemon vs quill) lives in `frontend/src/AGENTS.md` Rule 1; state management in `/writing-kea-logics`.
Как установить скилл writing-ui-components?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл writing-ui-components запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic