PromptShop

Build Dashboard

It's designed for users who need to visualize data and share insights without requiring a server or dependencies.

Install

npx promptshop add build-dashboard

Details

What This Skill Does

This skill builds self-contained, interactive HTML dashboards with charts, filters, tables, and professional styling. It's designed for users who need to visualize data and share insights without requiring a server or dependencies.

When to Use

  • Create an executive overview dashboard.
  • Build a dashboard for operational monitoring.
  • Develop a dashboard for deep-dive analysis.
  • Generate a team reporting dashboard.
  • Visualize key performance indicators (KPIs).Provide interactive data exploration for users.

Key Features

  • Understands the dashboard requirements.
  • Gathers data from various sources.
  • Designs the dashboard layout.
  • Embeds data as JSON within the HTML file.
  • Creates interactive charts and filters.
  • Generates a self-contained HTML file.

/build-dashboard - Build Interactive Dashboards

If you see unfamiliar placeholders or need to check which tools are connected, see CONNECTORS.md.

Build a self-contained interactive HTML dashboard with charts, filters, tables, and professional styling. Opens directly in a browser -- no server or dependencies required.

Usage

/build-dashboard <description of dashboard> [data source]

Workflow

1. Understand the Dashboard Requirements

Determine:

Purpose: Executive overview, operational monitoring, deep-dive analysis, team reporting Audience: Who will use this dashboard? Key metrics: What numbers matter most? Dimensions: What should users be able to filter or slice by? Data source: Live query, pasted data, CSV file, or sample data

2. Gather the Data

If data warehouse is connected: Query the necessary data Embed the results as JSON within the HTML file

If data is pasted or uploaded: Parse and clean the data Embed as JSON in the dashboard

If working from a description without data: Create a realistic sample dataset matching the described schema Note in the dashboard that it uses sample data Provide instructions for swapping in real data

3. Design the Dashboard Layout

Follow a standard dashboard layout pattern:

┌──────────────────────────────────────────────────┐ │ Dashboard Title [Filters ▼] │ ├────────────┬────────────┬────────────┬───────────┤ │ KPI Card │ KPI Card │ KPI Card │ KPI Card │ ├────────────┴────────────┼────────────┴───────────┤ │ │ │ │ Primary Chart │ Secondary Chart │ │ (largest area) │ │ │ │ │ ├─────────────────────────┴────────────────────────┤ │ │ │ Detail Table (sortable, scrollable) │ │ │ └──────────────────────────────────────────────────┘

Adapt the layout to the content: 2-4 KPI cards at the top for headline numbers 1-3 charts in the middle section for trends and breakdowns Optional detail table at the bottom for drill-down data Filters in the header or sidebar depending on complexity

4. Build the HTML Dashboard

Generate a single self-contained HTML file using the base template below. The file includes:

Structure (HTML): Semantic HTML5 layout Responsive grid using CSS Grid or Flexbox Filter controls (dropdowns, date pickers, toggles) KPI cards with values and labels Chart containers Data table with sortable headers

Styling (CSS): Professional color scheme (clean whites, grays, with accent colors for data) Card-based layout with subtle shadows Consistent typography (system fonts for fast loading) Responsive design that works on different screen sizes Print-friendly styles

Interactivity (Java Script): Chart.js for interactive charts (included via CDN) Filter dropdowns that update all charts and tables simultaneously Sortable table columns Hover tooltips on charts Number formatting (commas, currency, percentages)

Data (embedded JSON): All data embedded directly in the HTML as Java Script variables No external data fetches required Dashboard works completely offline

5. Implement Chart Types

Use Chart.js for all charts. Common dashboard chart patterns:

Line chart: Time series trends Bar chart: Category comparisons Doughnut chart: Composition (when <6 categories) Stacked bar: Composition over time Mixed (bar + line): Volume with rate overlay

Use the Chart.js integration patterns below for each chart type.

6. Add Interactivity

Use the filter and interactivity implementation patterns below for dropdown filters, date range filters, combined filter logic, sortable tables, and chart updates.

7. Save and Open

Save the dashboard as an HTML file with a descriptive name (e.g., sales_dashboard.html) Open it in the user's default browser Confirm it renders correctly Provide instructions for updating data or customizing

Base Template

Every dashboard follows this structure:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dashboard Title</title> <script src="https://cdn.jsdelivr.net/npm/chart.js@4.5.1" integrity="sha384-jb8JQMb Mo BUzg Watfe6COACi2ljc Dd ZQ2Oxcz GA3b GNe We+6DCh MTBJemed7Znv J" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@3.0.0" integrity="sha384-c VMg8E3QFw Tv GCDu K+ET4PD341j F3W8n O1aui Xfu ZNQkzb UUi BGLs IQUE+b1mxws" crossorigin="anonymous"></script> <style> / Dashboard styles go here / </style> </head> <body> <div class="dashboard-container"> <header class="dashboard-header"> <h1>Dashboard Title</h1> <div class="filters"> <!-- Filter controls --> </div> </header> <section class="kpi-row"> <!-- KPI cards --> </section> <section class="chart-row"> <!-- Chart containers --> </section> <section class="table-section"> <!-- Data table --> </section> <footer class="dashboard-footer"> <span>Data as of: <span id="data-date"></span></span> </footer> </div> <script> // Embedded data const DATA = []; // Dashboard logic class Dashboard { constructor(data) { this.raw Data = data; this.filtered Data = data; this.charts = {}; this.init(); } init() { this.setup Filters(); this.render KPIs(); this.render Charts(); this.render Table(); } apply Filters() { // Filter logic this.filtered Data = this.raw Data.filter(row => { // Apply each active filter return true; // placeholder }); this.render KPIs(); this.update Charts(); this.render Table(); } // ... methods for each section } const dashboard = new Dashboard(DATA); </script> </body> </html>

KPI Card Pattern

<div class="kpi-card"> <div class="kpi-label">Total Revenue</div> <div class="kpi-value" id="kpi-revenue">$0</div> <div class="kpi-change positive" id="kpi-revenue-change">+0%</div> </div>

function render KPI(element Id, value, previous Value, format = 'number') { const el = document.get Element By Id(element Id); const change El = document.get Element By Id(element Id + '-change');

// Format the value el.text Content = format Value(value, format);

// Calculate and display change if (previous Value && previous Value !== 0) { const pct Change = ((value - previous Value) / previous Value) * 100; const sign = pct Change >= 0 ? '+' : ''; change El.text Content = ${sign}${pct Change.to Fixed(1)}% vs prior period;