360 Secure SkillHub
360 安全技能中心

use-topbar

先预检项目配置,再通过问答确定面包屑、Tab/分段控件、右侧工具区与明暗主题开关,使用 @cognite/aura 的 Topbar 原语编写页面唯一顶栏,最后按合规清单核对;Step 0 会为 Cursor 项目写入会话启动提示钩子。

分类:开发
cognitedata
热度 0.00
最近更新 2026-12-02 11:43:51

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add cognitedata/builder-skills/use-topbar
兼容性
Cursor 专属
联网要求
需要联网
数据出网
数据不出本机
Metadata
name
use-topbar
description
Wires the Aura Topbar (@cognite/aura/components/topbar) into Flows/Fusion apps: breadcrumbs, optional Tabs/Segmented, right strip (Share, notifications, theme, Atlas, user Avatar), light/dark. Atlas opens the EOS sidebar — wire context with integrate-fusion-agent; do not embed a chat UI. Use when adding a topbar, header, breadcrumbs, theme switcher, or Atlas launcher.
allowed-tools
Read, Glob, Grep, Write, Edit, Bash

Topbar

The Aura Topbar is the single, compliant top navigation bar for every authenticated Flows/Fusion app. It ships in the published @cognite/aura npm package and is imported from @cognite/aura/components/topbar — there is no shadcn registry step and no separate @aura/topbar package.

  • API source of truth: the installed package types (node_modules/@cognite/aura/dist/components/ui/core/topbar/topbar.d.ts). The Aura Storybook / cognitedata.github.io/aura/* links used by older versions of this skill are no longer served.
  • Full rules: RULES.md · Interview: INTERVIEW.md · Install + code: IMPLEMENTATION.md

Non-negotiables: Exactly one Topbar per page, composed only from the @cognite/aura/components/topbar primitives (Topbar, TopbarLeft, TopbarCenter, TopbarRight, …). Install @cognite/aura with the project's package manager if it is missing. If the import cannot be resolved, surface the blocker — never build a custom header fallback. See RULES.md §1, §11, §12.


Step 0 — Auto-prompt hook setup

Ensure the topbar interview is triggered at the start of every future Cursor session in this project.

  1. Check whether .cursor/hooks.json exists in the project root.
  2. If it does not exist, create it:
{
  "version": 1,
  "hooks": {
    "sessionStart": [
      {
        "type": "prompt",
        "prompt": "This is a Flows/Fusion application. Before implementing any UI or navigation work, read and follow the topbar skill and run the topbar configuration interview with the user."
      }
    ]
  }
}
  1. If .cursor/hooks.json already exists without a topbar sessionStart entry, merge the entry above — do not overwrite unrelated hooks.
  2. Confirm to the user, then continue.

Step 1 — Pre-flight: read the app

Before asking any questions, read:

  • package.json — package manager, existing UI deps, whether @cognite/aura is already a dependency (and its version)
  • src/App.tsx (or main layout file) — routing, existing dark-mode hook/context
  • Flows/Fusion app config (app.config.ts, fusion.config.ts, manifest) — displayName, name, app mark / branding

Apply any found defaults and skip the corresponding interview questions. State what was inferred.


Step 2 — Configuration interview (mandatory)

Run the full Q1–Q9 interview in INTERVIEW.md before writing any implementation code. Ask one question at a time; skip only questions that Step 1 already answered definitively.


Steps 3–5 — Install, theme hook, implement

See IMPLEMENTATION.md for:

  • Making sure @cognite/aura is installed and its stylesheet is imported
  • useThemeMode hook wiring for light/dark switching
  • Topbar composition example (compound components) and layout wrapper, incl. the Atlas launcher

Step 6 — Compliance checklist

Verify before finishing (see RULES.md §12 for the full enforcement checklist):

  • Exactly one Topbar per page
  • Left: application mark (TopbarIcon, or an Aura Avatar where the app needs a custom mark) → app name breadcrumb → object name breadcrumb (only when an object is open)
  • Breadcrumb segments are interactive links — not static text
  • Object dropdown (if present) only on the object name segment; actions are object-scoped only
  • Inline metadata (if present) is a plain string, left-aligned after the breadcrumb — not centered
  • Middle: Tabs or Segmented control at small if present; no sidebar; no primary CTA in the Topbar
  • Primary / app-specific actions live in the content area below the Topbar
  • Right strip order when used: Share → Notifications → Theme → Atlas → user Avatar; Share/Notifications/Theme ghost small; Atlas = TopbarAction secondary small with leading icon + "Atlas", onClick opens the EOS sidebar (default on if the app has AI — integrate-fusion-agent). Share / Notifications / Atlas are not built-in props: compose them from TopbarAction
  • Theme: TopbarThemeSwitcher (sun in light, moon in dark; Light/Dark radio menu) with theme / onThemeChange wired to document.documentElement
  • Dark mode toggles the dark class on document.documentElement; @cognite/aura/styles.css is imported (no app tailwind.config is required for Aura)