[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ACV56VGHYB8QWD8KMZTJZ9":3,"skill-same:01M6ACV56VGHYB8QWD8KMZTJZ9":58},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":40,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":6,"updatedAt":43,"install":44,"resources":57},"01M6ACV56VGHYB8QWD8KMZTJZ9","build-dashboard",null,"apache\u002Fskywalking-horizon-ui","apache","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47359?v=4","01M6AC83E6K4FDKK7HZ8WNMQKE","The Apache Software Foundation","01M6ACV2YS1FGZP4TNKNEXCRTY",23,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-horizon-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fbuild-dashboard\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000013","分析与可视化","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[28,29],"dashboard","build dashboard","2026-11-10 10:12:30",false,"---\nname: build-dashboard\ndescription: Build a NEW Horizon UI dashboard from scratch — either a cross-layer Overview dashboard (apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Foverviews\u002F*.json) or a per-layer dashboard widget set (apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Flayers\u002F*.json). Greenfield authoring, NOT migration: design the widgets, write the MQE, validate every expression against a live OAP, then render-check in the browser.\nuser-invocable: true\n---\n\n# Build a new Horizon dashboard\n\nTwo dashboard families live in the BFF as static JSON, loaded at boot and served to the SPA's generic renderers. You author JSON; you do not write Vue.\n\n| Family | JSON dir | TS shape | Served by | Rendered by |\n|---|---|---|---|---|\n| **Overview** (cross-layer landing) | `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Foverviews\u002F*.json` | `OverviewDashboard` — `packages\u002Fapi-client\u002Fsrc\u002Foverview.ts` | `GET \u002Fapi\u002Foverview\u002Fdashboards[\u002F:id]` (`apps\u002Fbff\u002Fsrc\u002Fhttp\u002Fconfig\u002Foverview.ts`) | `apps\u002Fui\u002Fsrc\u002Frender\u002Foverview\u002F` + `apps\u002Fui\u002Fsrc\u002Frender\u002Fwidgets\u002F` |\n| **Layer dashboard** (per-layer drill-down) | `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Flayers\u002F*.json` | `LayerTemplate` — `apps\u002Fbff\u002Fsrc\u002Flogic\u002Flayers\u002Floader.ts`; widgets are `DashboardWidget` — `packages\u002Fapi-client\u002Fsrc\u002Fdashboard.ts` | `GET \u002Fapi\u002Fadmin\u002Flayer-templates`, data via `POST \u002Fapi\u002Flayer\u002F:key\u002Fdashboard` | `apps\u002Fui\u002Fsrc\u002Frender\u002Flayer-dashboard\u002F` |\n\n**Always read the TS interface for the family you're touching before writing JSON** — fields change, and the interface (plus its comments) is the contract. The existing `general.json` (layer) and `services.json` (overview) are the canonical references; copy their shape and swap the metrics, don't invent a new structure.\n\n---\n\n## The non-negotiable rule: validate MQE against a live OAP\n\nA dashboard is only \"done\" when every expression has been run against a real OAP and returns the shape the widget expects. Type-checks prove nothing about whether a metric exists or is at the right scope. Boot a local env first:\n\n> Use the **`local-boot`** skill to start the BFF+UI against a local OAP (or the demo). UI on `:9091`, BFF on `:8081`, login `admin`\u002F`admin`.\n\nIf no OAP is available, **stop and ask for one**. Do not guess metric names, do not fabricate wire shapes.\n\n### How to validate one expression\n\n1. **Confirm the metric exists and its catalog scope + value type** — `listMetrics`:\n   ```bash\n   curl -s -H 'Content-Type: application\u002Fjson' -X POST http:\u002F\u002Flocalhost:12800\u002Fgraphql \\\n     -d '{\"query\":\"query{listMetrics(regex:\\\"^service_cpm$\\\"){name catalog type}}\"}'\n   ```\n   `catalog` is the entity scope (`SERVICE` \u002F `SERVICE_INSTANCE` \u002F `ENDPOINT` \u002F `SERVICE_RELATION` \u002F …). `type` is `REGULAR_VALUE` vs `LABELED_VALUE` — it decides whether `aggregate_labels(...)` is legal.\n2. **Run the MQE** at the scope the widget will render. The simplest path is to exercise the actual BFF route the widget uses (overview tile \u002F layer dashboard) once the env is up, and inspect the JSON. Confirm a `card`\u002Fscalar MQE returns one number and a `line`\u002Fseries MQE returns a time series.\n\n---\n\n## Entity scope is load-bearing (read this before picking metrics)\n\nEvery OAP metric lives under exactly ONE entity scope and OAP does **not** auto-rollup between scopes — querying at the wrong scope returns empty, no error. (CLAUDE.md: \"Metric entity-scope is load-bearing\".)\n\n- A `SERVICE_INSTANCE`-scope metric (e.g. `instance_jvm_cpu`) **cannot** be a bare `line`\u002F`card` in a SERVICE-scope dashboard. Options: aggregate to a scalar with `avg(...)`\u002F`sum(...)` for a card\u002Foverview tile, OR show per-instance trend as a `top` widget with `top_n(...)`, OR put the bare metric under `dashboards.instance`.\n- Same one level deeper for `ENDPOINT`-scope metrics in a service dashboard.\n- Never bridge a scope mismatch with a BFF-side rollup — move the metric to the right scope or leave the slot empty.\n\n## Widget type follows MQE shape (card vs line)\n\nVerbatim from CLAUDE.md:\n> A widget whose MQE collapses to a single scalar must be `type: \"card\"`, not `type: \"line\"`. The tell-tale is the outermost call: `latest(...)`, `max(...)`, `min(...)`, `avg(\u003Cplain-metric>)`, `sum(\u003Cplain-metric>)` all reduce the window to one number. Series-shaped wrappers (`relabels(...)`, `top_n(...)`, `histogram*(...)`, `aggregate_labels(...)` without an outer scalar collapse, `rate(...)`, `increase(...)`) stay `line`. Look at the outermost function first.\n\n`LABELED_VALUE`-only: `aggregate_labels(metric, sum)` is valid only for labeled metrics; for `REGULAR_VALUE` use plain `sum()` \u002F `avg()`. Mixing throws \"result is not a labeled result\".\n\n---\n\n## Building an OVERVIEW dashboard\n\n`OverviewDashboard` top-level: `id`, `title`, `description?`, `visibility?` (`'public'`|`'operate'`), `icon?`, `order?`, `layers?` (auto-hide when none of these layers report), `widgets[]`.\n\nWidget `type`s (`OverviewWidgetType`):\n- `section-break` — row header, layout only. `cols` sets the grid column count for the widgets that follow it. No data.\n- `kpi-tile` — one layer's health: `layer`, optional `showCount` (service count header), `kpis[]`. Each KPI: `{ label, mqe, unit?, aggregation?: 'sum'|'avg', style?: 'number'|'progress-bar', max? (required for progress-bar), source?: 'mqe'|'service-count' }`.\n- `metric-composite` — multi-KPI tile mixing numbers + progress bars (same `kpis[]` shape).\n- `metric` — a single scalar `mqe` (rarely needed; prefer kpi-tile).\n- `alarms` — active-alarm rail; layer-agnostic, `limit?`. Omit `layer`.\n- `topology` — embedded static service-map for a `layer`, click-through to the full map.\n- `calendar-heatmap` — one cell per OAP-local day over a FIXED window (`windowDays` 7–93, default 30) that ignores the time picker; `mqe` is a plain per-service metric (no `top_n`), `aggregation` sum|avg, `unit`, `compareTo` (footer line against a well-known book). Fetches on its own.\n- Grid: `span` (12-col) + `rowSpan`.\n\nProcedure:\n1. Decide the story the page tells (which layers, which 3-ish KPIs each). Overview tiles are a health-at-a-glance strip — prefer RPM \u002F latency \u002F SLA per layer.\n2. Author the JSON next to `services.json`. Group with `section-break`s.\n3. For each KPI `mqe`: validate scope+type, then confirm it reduces to a scalar (overview KPIs are scalar — the renderer shows one number or a bar). Use `aggregation` to pick sum (throughput) vs avg (everything else).\n4. Set `visibility`\u002F`order`\u002F`icon`\u002F`layers`. Boot and eyeball at `http:\u002F\u002Flocalhost:9091`.\n\n## Building a LAYER dashboard\n\nA `LayerTemplate` (file basename must match `key` UPPER_SNAKE) carries far more than widgets — read `apps\u002Fbff\u002Fsrc\u002Flogic\u002Flayers\u002Floader.ts` for the full interface. The widget sets live under `dashboards.{service,instance,endpoint,dependency,topology,trace,logs,traceProfiling,ebpfProfiling,asyncProfiling}`, each an array of `DashboardWidget`.\n\n`DashboardWidget`: `id`, `title`, `tip?`, `type` (`'card'|'line'|'top'|'record'`), `expressions[]` (MQE), `expressionLabels?` (legend \u002F `top` tabs), `expressionUnits?`, `expressionAxes?` (0=left,1=right for dual-axis line), `unit?`, `format?` (`'int'|'decimal'|'compact'`), `span?` (default 4, 12-col), `rowSpan?` (default 8), `visibleWhen?` (hide until a metric reports — e.g. for multi-runtime instance widgets), `layerScope?`.\n\nWidget-type cheatsheet:\n- `card` — one scalar (see the card-vs-line rule). Drop a redundant outer `avg()` if the renderer already averages, unless removing it changes shape.\n- `line` — one labeled series per expression. Multi-series → set `expressionLabels` (required for the legend); dual-axis → `expressionAxes` + `expressionUnits`.\n- `top` — sorted list, usually `top_n(metric, N, des)`. Fold several rankings of the same thing into ONE `top` with multiple `expressions`+`expressionLabels`+`expressionUnits` (rendered as in-widget tabs).\n- `record` — RECORD-typed MQE (slow statements\u002FSQL). Use `record`, not `top`.\n\nOther blocks you may need (each has its own config interface in loader.ts — read before use): `header.columns` (service-list picker columns + `orderBy`), `overview.groups` (hero tile above the picker), `topology` (node\u002Fedge metrics for the service map), `endpointDependency`, `processTopology`, `traces`, `log`, plus `components.*` feature flags that light up tabs.\n\nProcedure:\n1. Read `general.json` end-to-end as the reference, and the `LayerTemplate` interface.\n2. Decide which scopes the layer has data for (service always; instance\u002Fendpoint only if those scopes carry distinct metrics). Set `components.*`.\n3. Author widgets per scope. Apply the scope rule and the card-vs-line rule to every expression.\n4. Grid: `span` is the 12-col width; bump `rowSpan` for top-lists \u002F percentile charts.\n5. Validate every MQE against the live OAP, then render-check each scope in the browser.\n\n---\n\n## Add i18n overlays for every supported locale\n\nEvery layer template under `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Flayers\u002F` and every\noverview under `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Foverviews\u002F` ships with a\nsibling per-locale overlay catalog — `\u003Cname>.i18n.\u003Clocale>.json` — so the\nrenderer can serve translated copy without an OAP round-trip. **A new\ndashboard is not done until each supported locale has an overlay file.**\nHorizon ships eight locales: `en` (the source), plus `zh-CN`, `ja`, `ko`,\n`es`, `pt`, `de`, `fr`.\n\nWhat goes in an overlay file:\n\n- A JSON object whose shape **mirrors the translatable leaves of the\n  source template**. Walk the source and pick out every leaf the\n  operator actually reads: layer `alias`, every `slots.*` label,\n  `header.columns[].label`, `overview.groups[].title`\u002F`description`,\n  every widget's `title` \u002F `tip` \u002F `expressionLabels[]` \u002F\n  `expressionUnits[]` \u002F `tableHeaders[]`, every `traces.tagLabels[]`\n  and `log.tagLabels[]`. Skip OAP-supplied data, metric ids, MQE\n  function names, layer keys, scope enums, file extensions, status\n  enums — those stay verbatim across locales per CLAUDE.md.\n- A missing leaf in an overlay falls back to the English source at the\n  leaf (not the file), so a half-translated overlay is valid and\n  renders the rest of the page in English. The BFF's `i18n:validate`\n  warns about structural drift (an overlay key that doesn't exist in\n  the source); empty `{}` overlays are flagged.\n- The English source has no overlay file — the source IS the English\n  copy. Only non-English locales need overlay files.\n\nHow to seed the seven non-English overlays for a new dashboard:\n\n1. **English first.** Finish the source template in English and confirm\n   every translatable leaf is the operator-facing label you want\n   translated. Don't put metric ids or MQE expressions where a `title`\n   should go.\n2. **Seed each locale.** For each of the seven, create\n   `\u003Cname>.i18n.\u003Clocale>.json` containing the translatable-leaf map.\n   The safest pattern is to start from a copy of the source with\n   non-leaf keys stripped, then translate the leaf values in place.\n   Initial translations are AI-assisted per CLAUDE.md — native\n   speakers refine over time via PR.\n3. **Tech-term policy.** Product \u002F project \u002F protocol names\n   (`SkyWalking`, `OAP`, `Kubernetes`, `Envoy`, `Istio`,\n   `OpenTelemetry`, `Zipkin`, `gRPC`, `GraphQL`, `eBPF`, `pprof`,\n   `BanyanDB`, `Elasticsearch`, `JVM`, `Java`, `Go`, …), OAP scope\n   enums (`Service`, `ServiceInstance`, `Endpoint`, `Process`, `All`),\n   MQE function names, status enums, layer keys, HTTP \u002F SQL keywords\n   are NOT translated in any locale. Translate the prose AROUND the\n   term (`HTTP Connections` → `HTTP 连接` \u002F `HTTP 接続`), not the\n   term itself.\n4. **Validate.** `pnpm --filter @skywalking-horizon-ui\u002Fbff run\n   i18n:validate` — every source template must have a sibling overlay\n   per advertised locale.\n5. **Render-check per locale.** Boot the env, switch the top-bar locale\n   chip across all eight, confirm every widget header \u002F KPI label \u002F\n   tooltip \u002F `top` tab label renders translated.\n\nIf you change a translatable leaf in the English source later, every\noverlay file's key set drifts and the renderer falls back to English\nfor the stale leaves. Re-translate the affected key in each locale's\noverlay file.\n\n## Validate (code) then render-check (browser)\n\n```bash\n# from repo root\npnpm --filter @skywalking-horizon-ui\u002Fbff run type-check    # schema typechecks\npnpm --filter @skywalking-horizon-ui\u002Fbff run test:unit      # loaders still parse\npnpm --filter @skywalking-horizon-ui\u002Fbff run i18n:validate  # overlays present for every locale + structurally aligned with source\npnpm license:check                                          # headers (JSON is exempt, but vue\u002Fts edits aren't)\n```\n\nThen with the local env up (via `local-boot`):\n- Overview: open `http:\u002F\u002Flocalhost:9091`, find the dashboard in the sidebar (placement = `visibility`+`order`), confirm every tile shows a number (not `—`\u002Fblank).\n- Layer: navigate the layer's Service\u002FInstance\u002FEndpoint tabs; confirm each widget renders data and that cards are scalars, lines are series. A blank widget almost always means a scope mismatch or a metric that doesn't exist on this OAP — re-run `listMetrics`.\n\n## Pitfalls\n\n1. **Scope mismatch returns empty, not an error.** The #1 cause of a blank widget. Verify `catalog` with `listMetrics` and match it to the dashboard's scope.\n2. **Card MQE that's actually a series (or vice-versa).** Look at the outermost MQE function; pick the type from it.\n3. **`aggregate_labels` on a `REGULAR_VALUE` metric** → \"result is not a labeled result\". Check `type` first.\n4. **File\u002Fkey mismatch.** A layer file `foo.json` must declare `\"key\": \"FOO\"`.\n5. **Inventing fields\u002Fmetrics.** The OAP query-protocol and metric catalog are fixed and owned upstream. If a screen needs data the protocol doesn't expose, flag it — don't fabricate an MQE or a BFF rollup.\n6. **No `Co-Authored-By` \u002F AI footers** on commits or PRs (project rule).\n","# Build a new Horizon dashboard\n\nTwo dashboard families live in the BFF as static JSON, loaded at boot and served to the SPA's generic renderers. You author JSON; you do not write Vue.\n\n| Family | JSON dir | TS shape | Served by | Rendered by |\n|---|---|---|---|---|\n| **Overview** (cross-layer landing) | `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Foverviews\u002F*.json` | `OverviewDashboard` — `packages\u002Fapi-client\u002Fsrc\u002Foverview.ts` | `GET \u002Fapi\u002Foverview\u002Fdashboards[\u002F:id]` (`apps\u002Fbff\u002Fsrc\u002Fhttp\u002Fconfig\u002Foverview.ts`) | `apps\u002Fui\u002Fsrc\u002Frender\u002Foverview\u002F` + `apps\u002Fui\u002Fsrc\u002Frender\u002Fwidgets\u002F` |\n| **Layer dashboard** (per-layer drill-down) | `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Flayers\u002F*.json` | `LayerTemplate` — `apps\u002Fbff\u002Fsrc\u002Flogic\u002Flayers\u002Floader.ts`; widgets are `DashboardWidget` — `packages\u002Fapi-client\u002Fsrc\u002Fdashboard.ts` | `GET \u002Fapi\u002Fadmin\u002Flayer-templates`, data via `POST \u002Fapi\u002Flayer\u002F:key\u002Fdashboard` | `apps\u002Fui\u002Fsrc\u002Frender\u002Flayer-dashboard\u002F` |\n\n**Always read the TS interface for the family you're touching before writing JSON** — fields change, and the interface (plus its comments) is the contract. The existing `general.json` (layer) and `services.json` (overview) are the canonical references; copy their shape and swap the metrics, don't invent a new structure.\n\n---\n\n## The non-negotiable rule: validate MQE against a live OAP\n\nA dashboard is only \"done\" when every expression has been run against a real OAP and returns the shape the widget expects. Type-checks prove nothing about whether a metric exists or is at the right scope. Boot a local env first:\n\n> Use the **`local-boot`** skill to start the BFF+UI against a local OAP (or the demo). UI on `:9091`, BFF on `:8081`, login `admin`\u002F`admin`.\n\nIf no OAP is available, **stop and ask for one**. Do not guess metric names, do not fabricate wire shapes.\n\n### How to validate one expression\n\n1. **Confirm the metric exists and its catalog scope + value type** — `listMetrics`:\n   ```bash\n   curl -s -H 'Content-Type: application\u002Fjson' -X POST http:\u002F\u002Flocalhost:12800\u002Fgraphql \\\n     -d '{\"query\":\"query{listMetrics(regex:\\\"^service_cpm$\\\"){name catalog type}}\"}'\n   ```\n   `catalog` is the entity scope (`SERVICE` \u002F `SERVICE_INSTANCE` \u002F `ENDPOINT` \u002F `SERVICE_RELATION` \u002F …). `type` is `REGULAR_VALUE` vs `LABELED_VALUE` — it decides whether `aggregate_labels(...)` is legal.\n2. **Run the MQE** at the scope the widget will render. The simplest path is to exercise the actual BFF route the widget uses (overview tile \u002F layer dashboard) once the env is up, and inspect the JSON. Confirm a `card`\u002Fscalar MQE returns one number and a `line`\u002Fseries MQE returns a time series.\n\n---\n\n## Entity scope is load-bearing (read this before picking metrics)\n\nEvery OAP metric lives under exactly ONE entity scope and OAP does **not** auto-rollup between scopes — querying at the wrong scope returns empty, no error. (CLAUDE.md: \"Metric entity-scope is load-bearing\".)\n\n- A `SERVICE_INSTANCE`-scope metric (e.g. `instance_jvm_cpu`) **cannot** be a bare `line`\u002F`card` in a SERVICE-scope dashboard. Options: aggregate to a scalar with `avg(...)`\u002F`sum(...)` for a card\u002Foverview tile, OR show per-instance trend as a `top` widget with `top_n(...)`, OR put the bare metric under `dashboards.instance`.\n- Same one level deeper for `ENDPOINT`-scope metrics in a service dashboard.\n- Never bridge a scope mismatch with a BFF-side rollup — move the metric to the right scope or leave the slot empty.\n\n## Widget type follows MQE shape (card vs line)\n\nVerbatim from CLAUDE.md:\n> A widget whose MQE collapses to a single scalar must be `type: \"card\"`, not `type: \"line\"`. The tell-tale is the outermost call: `latest(...)`, `max(...)`, `min(...)`, `avg(\u003Cplain-metric>)`, `sum(\u003Cplain-metric>)` all reduce the window to one number. Series-shaped wrappers (`relabels(...)`, `top_n(...)`, `histogram*(...)`, `aggregate_labels(...)` without an outer scalar collapse, `rate(...)`, `increase(...)`) stay `line`. Look at the outermost function first.\n\n`LABELED_VALUE`-only: `aggregate_labels(metric, sum)` is valid only for labeled metrics; for `REGULAR_VALUE` use plain `sum()` \u002F `avg()`. Mixing throws \"result is not a labeled result\".\n\n---\n\n## Building an OVERVIEW dashboard\n\n`OverviewDashboard` top-level: `id`, `title`, `description?`, `visibility?` (`'public'`|`'operate'`), `icon?`, `order?`, `layers?` (auto-hide when none of these layers report), `widgets[]`.\n\nWidget `type`s (`OverviewWidgetType`):\n- `section-break` — row header, layout only. `cols` sets the grid column count for the widgets that follow it. No data.\n- `kpi-tile` — one layer's health: `layer`, optional `showCount` (service count header), `kpis[]`. Each KPI: `{ label, mqe, unit?, aggregation?: 'sum'|'avg', style?: 'number'|'progress-bar', max? (required for progress-bar), source?: 'mqe'|'service-count' }`.\n- `metric-composite` — multi-KPI tile mixing numbers + progress bars (same `kpis[]` shape).\n- `metric` — a single scalar `mqe` (rarely needed; prefer kpi-tile).\n- `alarms` — active-alarm rail; layer-agnostic, `limit?`. Omit `layer`.\n- `topology` — embedded static service-map for a `layer`, click-through to the full map.\n- `calendar-heatmap` — one cell per OAP-local day over a FIXED window (`windowDays` 7–93, default 30) that ignores the time picker; `mqe` is a plain per-service metric (no `top_n`), `aggregation` sum|avg, `unit`, `compareTo` (footer line against a well-known book). Fetches on its own.\n- Grid: `span` (12-col) + `rowSpan`.\n\nProcedure:\n1. Decide the story the page tells (which layers, which 3-ish KPIs each). Overview tiles are a health-at-a-glance strip — prefer RPM \u002F latency \u002F SLA per layer.\n2. Author the JSON next to `services.json`. Group with `section-break`s.\n3. For each KPI `mqe`: validate scope+type, then confirm it reduces to a scalar (overview KPIs are scalar — the renderer shows one number or a bar). Use `aggregation` to pick sum (throughput) vs avg (everything else).\n4. Set `visibility`\u002F`order`\u002F`icon`\u002F`layers`. Boot and eyeball at `http:\u002F\u002Flocalhost:9091`.\n\n## Building a LAYER dashboard\n\nA `LayerTemplate` (file basename must match `key` UPPER_SNAKE) carries far more than widgets — read `apps\u002Fbff\u002Fsrc\u002Flogic\u002Flayers\u002Floader.ts` for the full interface. The widget sets live under `dashboards.{service,instance,endpoint,dependency,topology,trace,logs,traceProfiling,ebpfProfiling,asyncProfiling}`, each an array of `DashboardWidget`.\n\n`DashboardWidget`: `id`, `title`, `tip?`, `type` (`'card'|'line'|'top'|'record'`), `expressions[]` (MQE), `expressionLabels?` (legend \u002F `top` tabs), `expressionUnits?`, `expressionAxes?` (0=left,1=right for dual-axis line), `unit?`, `format?` (`'int'|'decimal'|'compact'`), `span?` (default 4, 12-col), `rowSpan?` (default 8), `visibleWhen?` (hide until a metric reports — e.g. for multi-runtime instance widgets), `layerScope?`.\n\nWidget-type cheatsheet:\n- `card` — one scalar (see the card-vs-line rule). Drop a redundant outer `avg()` if the renderer already averages, unless removing it changes shape.\n- `line` — one labeled series per expression. Multi-series → set `expressionLabels` (required for the legend); dual-axis → `expressionAxes` + `expressionUnits`.\n- `top` — sorted list, usually `top_n(metric, N, des)`. Fold several rankings of the same thing into ONE `top` with multiple `expressions`+`expressionLabels`+`expressionUnits` (rendered as in-widget tabs).\n- `record` — RECORD-typed MQE (slow statements\u002FSQL). Use `record`, not `top`.\n\nOther blocks you may need (each has its own config interface in loader.ts — read before use): `header.columns` (service-list picker columns + `orderBy`), `overview.groups` (hero tile above the picker), `topology` (node\u002Fedge metrics for the service map), `endpointDependency`, `processTopology`, `traces`, `log`, plus `components.*` feature flags that light up tabs.\n\nProcedure:\n1. Read `general.json` end-to-end as the reference, and the `LayerTemplate` interface.\n2. Decide which scopes the layer has data for (service always; instance\u002Fendpoint only if those scopes carry distinct metrics). Set `components.*`.\n3. Author widgets per scope. Apply the scope rule and the card-vs-line rule to every expression.\n4. Grid: `span` is the 12-col width; bump `rowSpan` for top-lists \u002F percentile charts.\n5. Validate every MQE against the live OAP, then render-check each scope in the browser.\n\n---\n\n## Add i18n overlays for every supported locale\n\nEvery layer template under `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Flayers\u002F` and every\noverview under `apps\u002Fbff\u002Fsrc\u002Fbundled_templates\u002Foverviews\u002F` ships with a\nsibling per-locale overlay catalog — `\u003Cname>.i18n.\u003Clocale>.json` — so the\nrenderer can serve translated copy without an OAP round-trip. **A new\ndashboard is not done until each supported locale has an overlay file.**\nHorizon ships eight locales: `en` (the source), plus `zh-CN`, `ja`, `ko`,\n`es`, `pt`, `de`, `fr`.\n\nWhat goes in an overlay file:\n\n- A JSON object whose shape **mirrors the translatable leaves of the\n  source template**. Walk the source and pick out every leaf the\n  operator actually reads: layer `alias`, every `slots.*` label,\n  `header.columns[].label`, `overview.groups[].title`\u002F`description`,\n  every widget's `title` \u002F `tip` \u002F `expressionLabels[]` \u002F\n  `expressionUnits[]` \u002F `tableHeaders[]`, every `traces.tagLabels[]`\n  and `log.tagLabels[]`. Skip OAP-supplied data, metric ids, MQE\n  function names, layer keys, scope enums, file extensions, status\n  enums — those stay verbatim across locales per CLAUDE.md.\n- A missing leaf in an overlay falls back to the English source at the\n  leaf (not the file), so a half-translated overlay is valid and\n  renders the rest of the page in English. The BFF's `i18n:validate`\n  warns about structural drift (an overlay key that doesn't exist in\n  the source); empty `{}` overlays are flagged.\n- The English source has no overlay file — the source IS the English\n  copy. Only non-English locales need overlay files.\n\nHow to seed the seven non-English overlays for a new dashboard:\n\n1. **English first.** Finish the source template in English and confirm\n   every translatable leaf is the operator-facing label you want\n   translated. Don't put metric ids or MQE expressions where a `title`\n   should go.\n2. **Seed each locale.** For each of the seven, create\n   `\u003Cname>.i18n.\u003Clocale>.json` containing the translatable-leaf map.\n   The safest pattern is to start from a copy of the source with\n   non-leaf keys stripped, then translate the leaf values in place.\n   Initial translations are AI-assisted per CLAUDE.md — native\n   speakers refine over time via PR.\n3. **Tech-term policy.** Product \u002F project \u002F protocol names\n   (`SkyWalking`, `OAP`, `Kubernetes`, `Envoy`, `Istio`,\n   `OpenTelemetry`, `Zipkin`, `gRPC`, `GraphQL`, `eBPF`, `pprof`,\n   `BanyanDB`, `Elasticsearch`, `JVM`, `Java`, `Go`, …), OAP scope\n   enums (`Service`, `ServiceInstance`, `Endpoint`, `Process`, `All`),\n   MQE function names, status enums, layer keys, HTTP \u002F SQL keywords\n   are NOT translated in any locale. Translate the prose AROUND the\n   term (`HTTP Connections` → `HTTP 连接` \u002F `HTTP 接続`), not the\n   term itself.\n4. **Validate.** `pnpm --filter @skywalking-horizon-ui\u002Fbff run\n   i18n:validate` — every source template must have a sibling overlay\n   per advertised locale.\n5. **Render-check per locale.** Boot the env, switch the top-bar locale\n   chip across all eight, confirm every widget header \u002F KPI label \u002F\n   tooltip \u002F `top` tab label renders translated.\n\nIf you change a translatable leaf in the English source later, every\noverlay file's key set drifts and the renderer falls back to English\nfor the stale leaves. Re-translate the affected key in each locale's\noverlay file.\n\n## Validate (code) then render-check (browser)\n\n```bash\n# from repo root\npnpm --filter @skywalking-horizon-ui\u002Fbff run type-check    # schema typechecks\npnpm --filter @skywalking-horizon-ui\u002Fbff run test:unit      # loaders still parse\npnpm --filter @skywalking-horizon-ui\u002Fbff run i18n:validate  # overlays present for every locale + structurally aligned with source\npnpm license:check                                          # headers (JSON is exempt, but vue\u002Fts edits aren't)\n```\n\nThen with the local env up (via `local-boot`):\n- Overview: open `http:\u002F\u002Flocalhost:9091`, find the dashboard in the sidebar (placement = `visibility`+`order`), confirm every tile shows a number (not `—`\u002Fblank).\n- Layer: navigate the layer's Service\u002FInstance\u002FEndpoint tabs; confirm each widget renders data and that cards are scalars, lines are series. A blank widget almost always means a scope mismatch or a metric that doesn't exist on this OAP — re-run `listMetrics`.\n\n## Pitfalls\n\n1. **Scope mismatch returns empty, not an error.** The #1 cause of a blank widget. Verify `catalog` with `listMetrics` and match it to the dashboard's scope.\n2. **Card MQE that's actually a series (or vice-versa).** Look at the outermost MQE function; pick the type from it.\n3. **`aggregate_labels` on a `REGULAR_VALUE` metric** → \"result is not a labeled result\". Check `type` first.\n4. **File\u002Fkey mismatch.** A layer file `foo.json` must declare `\"key\": \"FOO\"`.\n5. **Inventing fields\u002Fmetrics.** The OAP query-protocol and metric catalog are fixed and owned upstream. If a screen needs data the protocol doesn't expose, flag it — don't fabricate an MQE or a BFF rollup.\n6. **No `Co-Authored-By` \u002F AI footers** on commits or PRs (project rule).\n",{},"main","e5e3bbc552ddcc65d15221621d94012f2eee19df",".claude\u002Fskills\u002Fbuild-dashboard",10,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-horizon-ui","https:\u002F\u002Fskywalking.apache.org\u002F","https:\u002F\u002Fgithub.com\u002Fapache","https:\u002F\u002Fwww.apache.org\u002F","2026-11-14 21:40:45",{"source":7,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add apache\u002Fskywalking-horizon-ui --skill build-dashboard",{"tool":50,"command":51},"bunx","bunx skills add apache\u002Fskywalking-horizon-ui --skill build-dashboard",{"tool":53,"command":54},"pnpm","pnpm dlx skills add apache\u002Fskywalking-horizon-ui --skill build-dashboard","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-horizon-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fbuild-dashboard\u002FSKILL.md",true,[],[59,84],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":68,"publishedAt":30},"01M6ACVB23NM9FCW05HZPNA2V1","pull-request","Open a pull request for the current Horizon UI branch the right way — run the full preflight gate first (changelog + docs updated, type-check + build \"compiling passed\", new UI strings translated across all 8 locales, license headers, lint + unit tests, live-OAP validation), commit with NO AI trailers, push, and open the PR against apache\u002Fskywalking-horizon-ui. After it merges, return to main, fast-forward to latest, and delete the merged local branch.","https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-horizon-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fpull-request\u002FSKILL.md",[65],{"categoryNo":66,"categoryName":67,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000007","代码审查",[69,70,71,72,73,74,8,75,76,77,78,79,80,81,82,83],"pull","pull request","docs","ui","validation","run","delete","changelog","unit tests","lint","commit","license","pr","skywalking","push",{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":30},"01M6ACV7ME2VDF1F60XFB5SMPP","local-boot","https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-horizon-ui\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Flocal-boot\u002FSKILL.md",[],[90,91,72,92,93,94,8,95,96,97],"local boot","boot","assistant","git","config","image","dev","auth"]