creating-customer-analytics-account-widgets
Skill731 starsChanged 2 days agoMITView on GitHub
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.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- PostHog/posthogword for word, first seen Nov 15, 2026
Other versions1 project uses a version of this.
Word for word · 1
- PostHog/posthog★ 41k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository127 other files it gives its agents.
- AGENTS.mdAGENTS.md
- common/AGENTS.mdAGENTS.md
- hog/AGENTS.mdAGENTS.md
- proto/AGENTS.mdAGENTS.md
- rust/AGENTS.mdAGENTS.md
- .cursor/rules/django-python.mdcCursor rule
- .cursor/rules/react-typescript.mdcCursor rule
- .cursor/rules/rust.mdcCursor rule
- adding-activity-loggingSkill
- adding-api-scopesSkill
- adding-inbound-webhooksSkill
- adding-inbox-sourcesSkill
- adding-ingestion-warningsSkill
- adding-mcp-store-serversSkill
- adding-personhog-rpcSkill
- adding-product-alertingSkill
- adding-project-secret-api-key-authSkill
- adding-today-highlightsSkill
- adopting-generated-api-typesSkill
- analyzing-experiment-precompute-canarySkill
- analyzing-experiment-query-performanceSkill
- analyzing-insights-across-teamsSkill
- announcing-behavior-changesSkill
- auditing-llm-gateway-paritySkill
- auditing-warehouse-source-coverageSkill
- authenticating-to-clickhouseSkill
- authoring-ci-workflowsSkill
- building-product-empty-statesSkill
- building-the-toolbarSkill
- clickhouse-migrationsSkill
- debugging-ci-failuresSkill
- debugging-local-replaySkill
- debugging-local-task-agent-runsSkill
- debugging-mcp-analyticsSkill
- debugging-signals-pipelineSkill
- debugging-table-access-deniedSkill
- depot-ciSkill
- depot-container-buildsSkill
- depot-github-runnersSkill
- developing-subscriptionsSkill
- developing-the-cliSkill
- django-migrationsSkill
- django-startup-timeSkill
- documenting-warehouse-sourcesSkill
- editing-agents-mdSkill
- establishing-code-ownershipSkill
- extending-hobby-smoke-testsSkill
- extending-personhog-test-harnessSkill
- extending-the-admin-consoleSkill
- finding-llm-gateway-migration-candidatesSkill
- fixing-flaky-testsSkill
- formatting-slack-messagesSkill
- gating-production-deploysSkill
- gating-sensitive-actionsSkill
- generating-clickhouse-query-performance-reportsSkill
- hogliSkill
- implementing-mcp-toolsSkill
- implementing-mcp-ui-appsSkill
- implementing-warehouse-sourcesSkill
- improving-drf-endpointsSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 3 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Do not add a kind === branch to shared code.
- Very specific: line 26
When a widget needs something the others do not, add an optional field to AccountViewComponentBase and let shared code read it.
- Distinctive: line 32
Does it save settings?: If the widget has a filter, search, or sort worth keeping, it reads and writes tile config.
- Distinctive: line 33
Does it need a settings editor?: Only when the tile's own controls cannot set the config.
- Distinctive: line 34
Is it flag-gated?: Ask the user. Do not invent a flag.
- Very specific: line 38
Build the widget: Put the component and its logic in frontend/components/Accounts/.
- Very specific: line 41
Add the tag to the backend: Add tagName and its label to ACCOUNT_VIEW_COMPONENT_LABELS in backend/logic/account_views.py.
- Very specific: line 42
Add the test rows: Add the tag to the parameterized test_accepts_account_widget in backend/test/test_account_views.py.
- Very specific: line 50
If bad config can break the widget, add a validator to ACCOUNT_VIEW_CONFIG_VALIDATORS, keyed by tagName.
- Very specific: line 54
Add ConfigEditor to the entry.
- Very specific: line 61
Add the kind to AccountExpansionTab and ACCOUNT_EXPANSION_TABS in accountsExpansionLogic.ts.
- Very specific: line 63
Add the same id to ACCOUNT_DETAIL_SYSTEM_TAB_IDS in backend/logic/user_customer_analytics_config.py.
- Very specific: line 74
Never rename either one. A renamed tagName drops the tile from saved views without an error.
- Very specific: line 78
No shared file gained a kind === or tag_name == branch.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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, 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 is the one precedent.
- 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 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.
- Saved settings survive a reload, and a read-only viewer triggers no write.
- The backend accepts a view that holds the new tag.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

