xinetzone/SpecWeave / .agents/skills/dashboard-page
Dashboard Page
UnverifiedUse when the user wants to create a stable local/offline ECharts dashboard with KPI panels, time controls, auditable source modals, and optional daily data snapshots produced by automations.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.2 KB |
| assets/dashboard_runtime.js | script | 8.6 KB |
| assets/dashboard_template.py | script | 42.7 KB |
| assets/echarts.min.js | script | 1006.7 KB |
| references/dashboard-structure.md | markdown | 2.5 KB |
| references/data-and-automation.md | markdown | 3.2 KB |
| references/output-layout.md | markdown | 2.2 KB |
| references/visual-interactions.md | markdown | 7.3 KB |
| scripts/validate-echarts-dashboard.mjs | script | 3.0 KB |
SKILL.md
View on GitHub---
source: "镜像自 Trae IDE builtin(源镜像已清理,原镜像标识 dashboard-page)"
name: Dashboard Page
description: Use when the user wants to create a stable local/offline ECharts dashboard with KPI panels, time controls, auditable source modals, and optional daily data snapshots produced by automations.
---
# Dashboard Page
## Overview
Generate a polished single-folder dashboard app for recurring business metrics: an offline-capable `index.html`, reusable ECharts panels, KPI tiles, time-range controls, data freshness indicators, source/debug modals, and a durable data snapshot folder that automations can append to every day.
This skill is for operating dashboards and data screens, not document-style reports, slide decks, card feeds, landing pages, or narrative memos. It should feel like a dense but calm internal analytics tool: scannable, filterable, and designed for repeated use.
Use the bundled template first. Keep this file lightweight: put dashboard folder rules in `references/output-layout.md`, dashboard structure rules in `references/dashboard-structure.md`, data snapshot and automation rules in `references/data-and-automation.md`, shared visual interaction rules in `references/visual-interactions.md`, reusable browser behavior in `assets/dashboard_runtime.js`, and static checks in `scripts/validate-echarts-dashboard.mjs`.
## Workflow
1. Inspect the input data or metric sources first. Confirm date columns, grain, timezone, units, metric definitions, owner, refresh cadence, late-arriving data behavior, and source freshness before building the dashboard.
2. Read `references/output-layout.md`, create one folder for the dashboard, and keep all dashboard-specific files inside that folder.
3. Copy `assets/dashboard_template.py` to `dashboard-slug/dashboard.py`, then copy `assets/dashboard_runtime.js` and `assets/echarts.min.js` into the same folder.
4. Put reviewed source data in `dashboard-slug/data/`. For recurring dashboards, store daily automation outputs in `dashboard-slug/data/snapshots/`.
5. Read `references/dashboard-structure.md` before changing dashboard panels, shell markup, or the dashboard block model.
6. Read `references/data-and-automation.md` before changing snapshot schemas, ingest behavior, time filtering, or automation instructions.
7. Read `references/visual-interactions.md` before changing CSS, filter behavior, panel actions, source modals, or mobile layout.
8. Adapt the Python data layer: input/output constants, `read_sources()`, `normalize_snapshots()`, metric summarization, panel builders, and `make_dashboard_payload()`.
9. Make an explicit dashboard plan before writing panels. Decide the job of each view, required filters, KPI definitions, chart payloads, and freshness warnings.
10. Compose the dashboard in `build_dashboard_blocks(payload)`. Do not put block assembly inside `build_html(payload)`.
11. Adapt dashboard-specific ECharts option builders and `sourceMap` entries in the JavaScript section of `dashboard.py`.
12. Keep the visual and interaction contract intact unless the user explicitly asks to redesign the dashboard system.
13. Generate `dashboard-slug/index.html` and `dashboard-slug/dashboard_data.json`. Confirm `index.html` starts with `<!-- Generated by Trae Work -->`, then run `node <SKILL_ROOT>/scripts/validate-echarts-dashboard.mjs dashboard-slug/index.html`.
## Dashboard Contract
Read `references/dashboard-structure.md` when planning controls, panels, charts, tables, or changing the rendered dashboard DOM.
## Block Contract
The canonical block kinds are `kpi`, `chart`, `table`, and `note`. Keep block semantics separate from rendered markup: `build_dashboard_blocks(payload)` composes dashboard structure, render helpers emit dashboard markup, and `build_html(payload)` wraps the final HTML shell. See `references/dashboard-structure.md` for the full contract.
## Template Architecture
Start from `assets/dashboard_template.py`. For a new dashboard, replace:
- input and output constants near the top;
- `read_sources()`;
- `normalize_snapshots()`;
- summarization and time-window helpers;
- `make_dashboard_payload()`;
- table-builder functions when evidence tables change;
- `build_dashboard_blocks(payload)`;
- dashboard-specific ECharts option builders;
- `chartFactories`, `sourceMap`, and initial chart registrations.
Keep reusable browser behavior in `assets/dashboard_runtime.js`: time-range controls, chart initialization, panel menus, Data Source modal behavior, code copy actions, and resize handling. Change this file only when the shared dashboard interaction model changes. See `references/visual-interactions.md` before doing so.
Keep `assets/echarts.min.js` bundled or otherwise provide a vetted local ECharts build. The final dashboard should inline both ECharts and `dashboard_runtime.js` so the HTML opens locally/offline.
## Automation Contract
Read `references/data-and-automation.md` before designing recurring data capture. The dashboard should work with:
- manually reviewed local source files;
- daily JSON/JSONL/CSV snapshots written by an automation;
- regeneration through `python dashboard.py` after new snapshots land.
Automation should append immutable daily snapshots instead of overwriting historical data. The dashboard should expose a visible data freshness timestamp and should let users select a date range from available snapshot dates.
## Output Standard
The default deliverables are:
- one single-file local HTML dashboard;
- one JSON dashboard payload for review/debugging;
- one dashboard generator script;
- optional `data/snapshots/` files used by automations.
All files should live inside the dashboard's own folder, not in the workspace root.
In the final response, include the dashboard `index.html` path with a `computer://` prefix so Trae can render it.
## Assets
- `assets/dashboard_template.py`: executable reference generator for an operating dashboard.
- `assets/dashboard_runtime.js`: shared browser runtime for time controls, chart controls, Data Source modal, copy actions, and resize.
- `assets/echarts.min.js`: bundled ECharts runtime.
- `references/output-layout.md`: one-dashboard-one-folder deliverable layout and naming rules.
- `references/dashboard-structure.md`: shell, filter model, panel model, and template layer contract.
- `references/data-and-automation.md`: snapshot schemas, recurring ingest rules, time filtering, and automation handoff.
- `references/visual-interactions.md`: styling, controls, panel actions, and modal behavior.
- `scripts/validate-echarts-dashboard.mjs`: static validator for required dashboard structure and interactions.
- `agents/openai.yaml`: optional model/runtime configuration for this skill.
## Final Checks
Before responding to the user:
- Run the generator and confirm the HTML and JSON payload were written.
- Confirm the dashboard output lives in its own folder, with `index.html` as the main dashboard file.
- Confirm `index.html` starts with `<!-- Generated by Trae Work -->` on line 1.
- Run `node <SKILL_ROOT>/scripts/validate-echarts-dashboard.mjs dashboard-slug/index.html`.
- Confirm the final response includes the dashboard `index.html` path with a `computer://` prefix.
- Confirm visible output uses dashboard structure, not document-report, card-feed, slide, or landing-page abstractions.
- Search for placeholder text, stale sample titles, stale dates, and visible debug labels.
- Confirm all time controls map to available payload ranges.
- Confirm business date formatting preserves local `YYYY-MM-DD` dates and does not use UTC conversion such as `toISOString().slice(0, 10)`.
- Confirm every chart container has a registered chart factory and initial chart type.
- Confirm panel menus include working `View Data Source` actions, and chart panels with alternates include `Edit`.
- Confirm Data Source modal shows the panel transform snippet and analysis logic only, without exposing HTML/CSS/JS rendering or dashboard-shell generation code.
- Confirm charts, KPI tiles, and tables show units, freshness, and source context.
- Confirm mobile and desktop layouts do not create text overlap or broken chart sizing when browser inspection is available.
- For current financial, market, legal, regulatory, or source-freshness-sensitive dashboards, confirm data dates, source dates, and refresh timestamps are explicit and current.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |