creating-customer-analytics-account-widgets
БесплатноБез исполняемых скриптовНе проверенCreates or changes a Customer analytics account widget: a tile on an account detail view, or an account detail tab. Use when adding a widget, tile, or tab to…
от PostHog★ 41 278 звёзд на GitHubОб этом скилле
Creating Customer analytics account widgets
Account view widgets follow the composition pattern.
A view is an ordered list of independent widgets.
Shared code knows a widget only through its entry in ACCOUNT_VIEW_COMPONENTS.
The Accounts guide states the rules. Read that section first. This skill holds the steps.
Paths below are relative to products/customer_analytics/.
The rule that decides most questions
Do not add a kind === branch to shared code.
Shared code is AccountViewComponent, AccountViewTile, AccountViewTileEditorModal, AccountViewRenderer, accountViewsLogic, and validate_account_view_content.
When a widget needs something the others do not, add an optional field to AccountViewComponentBase and let shared code read it.
ConfigEditor, getConfigError, onConfigSaved, and tileInsetClassName are the precedent.
Decide first
- Tile only, or also a tab? A tile-only widget has no
systemTabId. A tab also appears in the account detail tabs. - Does it save settings? If the widget has a filter, search, or sort worth keeping, it reads and writes tile config.
- Does it need a settings editor? Only when the tile's own controls cannot set the config. Properties and SQL query are the precedents.
- Is it flag-gated? Ask the user. Do not invent a flag.
Steps
- Build the widget. Put the component and its logic in
frontend/components/Accounts/. Model them onAccountMeetingsExpansionandaccountMeetingsLogic. Key the logic by account andinstanceId, as in`${props.accountId}:${props.instanceId ?? 'default'}`. WithoutinstanceId, two tiles of one kind share state. - Add the kind. For a tile-only widget, add it to both unions in
accountViewComponents.tsx. For a tab, see Tabs. - Add the registry entry. Set
kind,tagName,label, andComponent.ComponenttakesAccountViewWidgetPropsand maps them to the widget. PassgetTileLogicProps(props)when the widget saves settings. - Add the tag to the backend. Add
tagNameand its label toACCOUNT_VIEW_COMPONENT_LABELSinbackend/logic/account_views.py. Without it, the API rejects every view that holds the widget. - Add the test rows. Add the tag to the parameterized
test_accepts_account_widgetinbackend/test/test_account_views.py. Invoke/writing-testsbefore you add anything more. - Update the Accounts guide. It asks for this in the same change.
Saved settings
- The widget's logic reads
props.initialConfigonce, as reducer defaults. UsegetTileString,getTileStringArray, andgetTileRecordfromaccountViewTileConfig.ts, because saved config is untyped and can be stale. - The logic calls
props.onConfigChange?.(config)from a listener with the whole config, not a patch. A read-only viewer gets noonConfigChange. - Config never holds an account identity. A view is reused across accounts, so the backend rejects
accountId,externalId,projectId,teamId, and their snake_case forms at any depth. It also rejects config over 16 KB. - If bad config can break the widget, add a validator to
ACCOUNT_VIEW_CONFIG_VALIDATORS, keyed bytagName.validate_properties_widget_configis the model.
Settings editor
Add ConfigEditor to the entry. It takes AccountViewTileConfigEditorProps and does not save. AccountViewTileEditorModal renders it under the tile name, and accountViewsLogic.saveTileEditor saves the name and the config in one queued write.
To block a save on bad config, add getConfigError to the entry. It returns the reason, and the modal shows that reason on the save button.
To track a save, add onConfigSaved to the entry. Do not capture the event in accountViewsLogic.
Tabs
A tab needs these on top of the steps above:
- Add the kind to
AccountExpansionTabandACCOUNT_EXPANSION_TABSinaccountsExpansionLogic.ts. - Set
systemTabId: 'system:<kind>'on the entry. - Add the same id to
ACCOUNT_DETAIL_SYSTEM_TAB_IDSinbackend/logic/user_customer_analytics_config.py. Without it, a user cannot save the tab's order or visibility.
Feature flags
Set featureFlag on the entry. That hides the widget from the picker, the renderer, and the tabs.
A flag-gated tab also needs a line in getVisibleAccountExpansionTab, so a direct link falls back to the default tab.
Extend the flag cases in accountTabs.test.ts and AccountViewRenderer.test.tsx.
Frozen strings
tagName is stored in every saved view. systemTabId is stored in every user's tab settings.
Never rename either one. A renamed tagName drops the tile from saved views without an error.
Before you report done
- No shared file gained a
kind ===ortag_name ==branch. - The widget renders as a tile at a narrow span, and as a tab if it has
systemTabId. - Two tiles of the new kind on one view keep separate state.
- Save
Установить creating-customer-analytics-account-widgets в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл creating-customer-analytics-account-widgets?
Creates or changes a Customer analytics account widget: a tile on an account detail view, or an account detail tab. Use when adding a widget, tile, or tab to the account page, giving a widget saved settings or a settings editor, or reviewing a diff that touches accountViewComponents.tsx, AccountViewComponent, AccountViewTile, AccountViewTileEditorModal, or account_views.py. Account view widgets follow the composition pattern: each widget is one entry in the ACCOUNT_VIEW_COMPONENTS registry, and shared code never branches on a widget kind. Covers the registry entry, the widget props contract, saved tile config, the backend tag and config validator, system tabs, and feature flags.
Как установить скилл creating-customer-analytics-account-widgets?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл creating-customer-analytics-account-widgets запускает скрипты?
Нет, скилл состоит только из инструкций (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