[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71MDHE49ED2FAXYQHRWP25K":3,"skill-same:01M71MDHE49ED2FAXYQHRWP25K":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":15,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":54,"ownerHtmlUrl":55,"ownerBlogUrl":56,"ownerDescription":6,"updatedAt":57,"install":58,"resources":71},"01M71MDHE49ED2FAXYQHRWP25K","build-dashboard",null,"Build an interactive HTML dashboard with charts, filters, and tables. Use when creating an executive overview with KPI cards, turning query results into a shareable self-contained report, building a team monitoring snapshot, or needing multiple charts with filters in one browser-openable file.","monoes\u002Fmonomind","monoes","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F276744696?v=4","01M71KWF37AJ2NJBP3KWBVSDGT","01M71KWF4CSF8ADH0M6HA09VD2",23,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fbuild-dashboard\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fbuild-dashboard\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"build dashboard","build","dashboard","overview","kpi","tables","html","cards","data","snapshot","work","self","browser","monitoring","team","query","when","filters","knowledge","Charts","2026-11-10 10:56:23",false,"---\nname: build-dashboard\ndescription: \"Build an interactive HTML dashboard with charts, filters, and tables. Use when creating an executive overview with KPI cards, turning query results into a shareable self-contained report, building a team monitoring snapshot, or needing multiple charts with filters in one browser-openable file.\"\ntags: []\ntools: []\nlicense: Apache-2.0\nsource: https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fknowledge-work-plugins\nsource_path: \"data\u002Fskills\u002Fbuild-dashboard\"\nsource_commit: 8444efcd48f7012f09797778a36a33e73d0861f4\n---\n# \u002Fbuild-dashboard - Build Interactive Dashboards\n\n> If you see unfamiliar placeholders or need to check which tools are connected, see [CONNECTORS.md](..\u002F..\u002FCONNECTORS.md).\n\nBuild a self-contained interactive HTML dashboard with charts, filters, tables, and professional styling. Opens directly in a browser -- no server or dependencies required.\n\n## Usage\n\n```\n\u002Fbuild-dashboard \u003Cdescription of dashboard> [data source]\n```\n\n## Workflow\n\n### 1. Understand the Dashboard Requirements\n\nDetermine:\n\n- **Purpose**: Executive overview, operational monitoring, deep-dive analysis, team reporting\n- **Audience**: Who will use this dashboard?\n- **Key metrics**: What numbers matter most?\n- **Dimensions**: What should users be able to filter or slice by?\n- **Data source**: Live query, pasted data, CSV file, or sample data\n\n### 2. Gather the Data\n\n**If data warehouse is connected:**\n1. Query the necessary data\n2. Embed the results as JSON within the HTML file\n\n**If data is pasted or uploaded:**\n1. Parse and clean the data\n2. Embed as JSON in the dashboard\n\n**If working from a description without data:**\n1. Create a realistic sample dataset matching the described schema\n2. Note in the dashboard that it uses sample data\n3. Provide instructions for swapping in real data\n\n### 3. Design the Dashboard Layout\n\nFollow a standard dashboard layout pattern:\n\n```\n┌──────────────────────────────────────────────────┐\n│  Dashboard Title                    [Filters ▼]  │\n├────────────┬────────────┬────────────┬───────────┤\n│  KPI Card  │  KPI Card  │  KPI Card  │ KPI Card  │\n├────────────┴────────────┼────────────┴───────────┤\n│                         │                        │\n│    Primary Chart        │   Secondary Chart      │\n│    (largest area)       │                        │\n│                         │                        │\n├─────────────────────────┴────────────────────────┤\n│                                                  │\n│    Detail Table (sortable, scrollable)           │\n│                                                  │\n└──────────────────────────────────────────────────┘\n```\n\n**Adapt the layout to the content:**\n- 2-4 KPI cards at the top for headline numbers\n- 1-3 charts in the middle section for trends and breakdowns\n- Optional detail table at the bottom for drill-down data\n- Filters in the header or sidebar depending on complexity\n\n### 4. Build the HTML Dashboard\n\nGenerate a single self-contained HTML file using the base template below. The file includes:\n\n**Structure (HTML):**\n- Semantic HTML5 layout\n- Responsive grid using CSS Grid or Flexbox\n- Filter controls (dropdowns, date pickers, toggles)\n- KPI cards with values and labels\n- Chart containers\n- Data table with sortable headers\n\n**Styling (CSS):**\n- Professional color scheme (clean whites, grays, with accent colors for data)\n- Card-based layout with subtle shadows\n- Consistent typography (system fonts for fast loading)\n- Responsive design that works on different screen sizes\n- Print-friendly styles\n\n**Interactivity (JavaScript):**\n- Chart.js for interactive charts (included via CDN)\n- Filter dropdowns that update all charts and tables simultaneously\n- Sortable table columns\n- Hover tooltips on charts\n- Number formatting (commas, currency, percentages)\n\n**Data (embedded JSON):**\n- All data embedded directly in the HTML as JavaScript variables\n- No external data fetches required\n- Dashboard works completely offline\n\n### 5. Implement Chart Types\n\nUse Chart.js for all charts. Common dashboard chart patterns:\n\n- **Line chart**: Time series trends\n- **Bar chart**: Category comparisons\n- **Doughnut chart**: Composition (when \u003C6 categories)\n- **Stacked bar**: Composition over time\n- **Mixed (bar + line)**: Volume with rate overlay\n\nUse the Chart.js integration patterns below for each chart type.\n\n### 6. Add Interactivity\n\nUse the filter and interactivity implementation patterns below for dropdown filters, date range filters, combined filter logic, sortable tables, and chart updates.\n\n### 7. Save and Open\n\n1. Save the dashboard as an HTML file with a descriptive name (e.g., `sales_dashboard.html`)\n2. Open it in the user's default browser\n3. Confirm it renders correctly\n4. Provide instructions for updating data or customizing\n\n---\n\n## Base Template\n\nEvery dashboard follows this structure:\n\n```html\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    \u003Ctitle>Dashboard Title\u003C\u002Ftitle>\n    \u003Cscript src=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fchart.js@4.5.1\" integrity=\"sha384-jb8JQMbMoBUzgWatfe6COACi2ljcDdZQ2OxczGA3bGNeWe+6DChMTBJemed7ZnvJ\" crossorigin=\"anonymous\">\u003C\u002Fscript>\n    \u003Cscript src=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fchartjs-adapter-date-fns@3.0.0\" integrity=\"sha384-cVMg8E3QFwTvGCDuK+ET4PD341jF3W8nO1auiXfuZNQkzbUUiBGLsIQUE+b1mxws\" crossorigin=\"anonymous\">\u003C\u002Fscript>\n    \u003Cstyle>\n        \u002F* Dashboard styles go here *\u002F\n    \u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003Cdiv class=\"dashboard-container\">\n        \u003Cheader class=\"dashboard-header\">\n            \u003Ch1>Dashboard Title\u003C\u002Fh1>\n            \u003Cdiv class=\"filters\">\n                \u003C!-- Filter controls -->\n            \u003C\u002Fdiv>\n        \u003C\u002Fheader>\n\n        \u003Csection class=\"kpi-row\">\n            \u003C!-- KPI cards -->\n        \u003C\u002Fsection>\n\n        \u003Csection class=\"chart-row\">\n            \u003C!-- Chart containers -->\n        \u003C\u002Fsection>\n\n        \u003Csection class=\"table-section\">\n            \u003C!-- Data table -->\n        \u003C\u002Fsection>\n\n        \u003Cfooter class=\"dashboard-footer\">\n            \u003Cspan>Data as of: \u003Cspan id=\"data-date\">\u003C\u002Fspan>\u003C\u002Fspan>\n        \u003C\u002Ffooter>\n    \u003C\u002Fdiv>\n\n    \u003Cscript>\n        \u002F\u002F Embedded data\n        const DATA = [];\n\n        \u002F\u002F Dashboard logic\n        class Dashboard {\n            constructor(data) {\n                this.rawData = data;\n                this.filteredData = data;\n                this.charts = {};\n                this.init();\n            }\n\n            init() {\n                this.setupFilters();\n                this.renderKPIs();\n                this.renderCharts();\n                this.renderTable();\n            }\n\n            applyFilters() {\n                \u002F\u002F Filter logic\n                this.filteredData = this.rawData.filter(row => {\n                    \u002F\u002F Apply each active filter\n                    return true; \u002F\u002F placeholder\n                });\n                this.renderKPIs();\n                this.updateCharts();\n                this.renderTable();\n            }\n\n            \u002F\u002F ... methods for each section\n        }\n\n        const dashboard = new Dashboard(DATA);\n    \u003C\u002Fscript>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n## KPI Card Pattern\n\n```html\n\u003Cdiv class=\"kpi-card\">\n    \u003Cdiv class=\"kpi-label\">Total Revenue\u003C\u002Fdiv>\n    \u003Cdiv class=\"kpi-value\" id=\"kpi-revenue\">$0\u003C\u002Fdiv>\n    \u003Cdiv class=\"kpi-change positive\" id=\"kpi-revenue-change\">+0%\u003C\u002Fdiv>\n\u003C\u002Fdiv>\n```\n\n```javascript\nfunction renderKPI(elementId, value, previousValue, format = 'number') {\n    const el = document.getElementById(elementId);\n    const changeEl = document.getElementById(elementId + '-change');\n\n    \u002F\u002F Format the value\n    el.textContent = formatValue(value, format);\n\n    \u002F\u002F Calculate and display change\n    if (previousValue && previousValue !== 0) {\n        const pctChange = ((value - previousValue) \u002F previousValue) * 100;\n        const sign = pctChange >= 0 ? '+' : '';\n        changeEl.textContent = `${sign}${pctChange.toFixed(1)}% vs prior period`;\n        changeEl.className = `kpi-change ${pctChange >= 0 ? 'positive' : 'negative'}`;\n    }\n}\n\nfunction formatValue(value, format) {\n    switch (format) {\n        case 'currency':\n            if (value >= 1e6) return `$${(value \u002F 1e6).toFixed(1)}M`;\n            if (value >= 1e3) return `$${(value \u002F 1e3).toFixed(1)}K`;\n            return `$${value.toFixed(0)}`;\n        case 'percent':\n            return `${value.toFixed(1)}%`;\n        case 'number':\n            if (value >= 1e6) return `${(value \u002F 1e6).toFixed(1)}M`;\n            if (value >= 1e3) return `${(value \u002F 1e3).toFixed(1)}K`;\n            return value.toLocaleString();\n        default:\n            return value.toString();\n    }\n}\n```\n\n## Chart.js Integration\n\n### Chart Container Pattern\n\n```html\n\u003Cdiv class=\"chart-container\">\n    \u003Ch3 class=\"chart-title\">Monthly Revenue Trend\u003C\u002Fh3>\n    \u003Ccanvas id=\"revenue-chart\">\u003C\u002Fcanvas>\n\u003C\u002Fdiv>\n```\n\n### Line Chart\n\n```javascript\nfunction createLineChart(canvasId, labels, datasets) {\n    const ctx = document.getElementById(canvasId).getContext('2d');\n    return new Chart(ctx, {\n        type: 'line',\n        data: {\n            labels: labels,\n            datasets: datasets.map((ds, i) => ({\n                label: ds.label,\n                data: ds.data,\n                borderColor: COLORS[i % COLORS.length],\n                backgroundColor: COLORS[i % COLORS.length] + '20',\n                borderWidth: 2,\n                fill: ds.fill || false,\n                tension: 0.3,\n                pointRadius: 3,\n                pointHoverRadius: 6,\n            }))\n        },\n        options: {\n            responsive: true,\n            maintainAspectRatio: false,\n            interaction: {\n                mode: 'index',\n                intersect: false,\n            },\n            plugins: {\n                legend: {\n                    position: 'top',\n                    labels: { usePointStyle: true, padding: 20 }\n                },\n                tooltip: {\n                    callbacks: {\n                        label: function(context) {\n                            return `${context.dataset.label}: ${formatValue(context.parsed.y, 'currency')}`;\n                        }\n                    }\n                }\n            },\n            scales: {\n                x: {\n                    grid: { display: false }\n                },\n                y: {\n                    beginAtZero: true,\n                    ticks: {\n                        callback: function(value) {\n                            return formatValue(value, 'currency');\n                        }\n                    }\n                }\n            }\n        }\n    });\n}\n```\n\n### Bar Chart\n\n```javascript\nfunction createBarChart(canvasId, labels, data, options = {}) {\n    const ctx = document.getElementById(canvasId).getContext('2d');\n    const isHorizontal = options.horizontal || labels.length > 8;\n\n    return new Chart(ctx, {\n        type: 'bar',\n        data: {\n            labels: labels,\n            datasets: [{\n                label: options.label || 'Value',\n                data: data,\n                backgroundColor: options.colors || COLORS.map(c => c + 'CC'),\n                borderColor: options.colors || COLORS,\n                borderWidth: 1,\n                borderRadius: 4,\n            }]\n        },\n        options: {\n            responsive: true,\n            maintainAspectRatio: false,\n            indexAxis: isHorizontal ? 'y' : 'x',\n            plugins: {\n                legend: { display: false },\n                tooltip: {\n                    callbacks: {\n                        label: function(context) {\n                            return formatValue(context.parsed[isHorizontal ? 'x' : 'y'], options.format || 'number');\n                        }\n                    }\n                }\n            },\n            scales: {\n                x: {\n                    beginAtZero: true,\n                    grid: { display: isHorizontal },\n                    ticks: isHorizontal ? {\n                        callback: function(value) {\n                            return formatValue(value, options.format || 'number');\n                        }\n                    } : {}\n                },\n                y: {\n                    beginAtZero: !isHorizontal,\n                    grid: { display: !isHorizontal },\n                    ticks: !isHorizontal ? {\n                        callback: function(value) {\n                            return formatValue(value, options.format || 'number');\n                        }\n                    } : {}\n                }\n            }\n        }\n    });\n}\n```\n\n### Doughnut Chart\n\n```javascript\nfunction createDoughnutChart(canvasId, labels, data) {\n    const ctx = document.getElementById(canvasId).getContext('2d');\n    return new Chart(ctx, {\n        type: 'doughnut',\n        data: {\n            labels: labels,\n            datasets: [{\n                data: data,\n                backgroundColor: COLORS.map(c => c + 'CC'),\n                borderColor: '#ffffff',\n                borderWidth: 2,\n            }]\n        },\n        options: {\n            responsive: true,\n            maintainAspectRatio: false,\n            cutout: '60%',\n            plugins: {\n                legend: {\n                    position: 'right',\n                    labels: { usePointStyle: true, padding: 15 }\n                },\n                tooltip: {\n                    callbacks: {\n                        label: function(context) {\n                            const total = context.dataset.data.reduce((a, b) => a + b, 0);\n                            const pct = ((context.parsed \u002F total) * 100).toFixed(1);\n                            return `${context.label}: ${formatValue(context.parsed, 'number')} (${pct}%)`;\n                        }\n                    }\n                }\n            }\n        }\n    });\n}\n```\n\n### Updating Charts on Filter Change\n\n```javascript\nfunction updateChart(chart, newLabels, newData) {\n    chart.data.labels = newLabels;\n\n    if (Array.isArray(newData[0])) {\n        \u002F\u002F Multiple datasets\n        newData.forEach((data, i) => {\n            chart.data.datasets[i].data = data;\n        });\n    } else {\n        chart.data.datasets[0].data = newData;\n    }\n\n    chart.update('none'); \u002F\u002F 'none' disables animation for instant update\n}\n```\n\n## Filter and Interactivity Implementation\n\n### Dropdown Filter\n\n```html\n\u003Cdiv class=\"filter-group\">\n    \u003Clabel for=\"filter-region\">Region\u003C\u002Flabel>\n    \u003Cselect id=\"filter-region\" onchange=\"dashboard.applyFilters()\">\n        \u003Coption value=\"all\">All Regions\u003C\u002Foption>\n    \u003C\u002Fselect>\n\u003C\u002Fdiv>\n```\n\n```javascript\nfunction populateFilter(selectId, data, field) {\n    const select = document.getElementById(selectId);\n    const values = [...new Set(data.map(d => d[field]))].sort();\n\n    \u002F\u002F Keep the \"All\" option, add unique values\n    values.forEach(val => {\n        const option = document.createElement('option');\n        option.value = val;\n        option.textContent = val;\n        select.appendChild(option);\n    });\n}\n\nfunction getFilterValue(selectId) {\n    const val = document.getElementById(selectId).value;\n    return val === 'all' ? null : val;\n}\n```\n\n### Date Range Filter\n\n```html\n\u003Cdiv class=\"filter-group\">\n    \u003Clabel>Date Range\u003C\u002Flabel>\n    \u003Cinput type=\"date\" id=\"filter-date-start\" onchange=\"dashboard.applyFilters()\">\n    \u003Cspan>to\u003C\u002Fspan>\n    \u003Cinput type=\"date\" id=\"filter-date-end\" onchange=\"dashboard.applyFilters()\">\n\u003C\u002Fdiv>\n```\n\n```javascript\nfunction filterByDateRange(data, dateField, startDate, endDate) {\n    return data.filter(row => {\n        const rowDate = new Date(row[dateField]);\n        if (startDate && rowDate \u003C new Date(startDate)) return false;\n        if (endDate && rowDate > new Date(endDate)) return false;\n        return true;\n    });\n}\n```\n\n### Combined Filter Logic\n\n```javascript\napplyFilters() {\n    const region = getFilterValue('filter-region');\n    const category = getFilterValue('filter-category');\n    const startDate = document.getElementById('filter-date-start').value;\n    const endDate = document.getElementById('filter-date-end').value;\n\n    this.filteredData = this.rawData.filter(row => {\n        if (region && row.region !== region) return false;\n        if (category && row.category !== category) return false;\n        if (startDate && row.date \u003C startDate) return false;\n        if (endDate && row.date > endDate) return false;\n        return true;\n    });\n\n    this.renderKPIs();\n    this.updateCharts();\n    this.renderTable();\n}\n```\n\n### Sortable Table\n\n```javascript\nfunction renderTable(containerId, data, columns) {\n    const container = document.getElementById(containerId);\n    let sortCol = null;\n    let sortDir = 'desc';\n\n    function render(sortedData) {\n        let html = '\u003Ctable class=\"data-table\">';\n\n        \u002F\u002F Header\n        html += '\u003Cthead>\u003Ctr>';\n        columns.forEach(col => {\n            const arrow = sortCol === col.field\n                ? (sortDir === 'asc' ? ' ▲' : ' ▼')\n                : '';\n            html += `\u003Cth onclick=\"sortTable('${col.field}')\" style=\"cursor:pointer\">${col.label}${arrow}\u003C\u002Fth>`;\n        });\n        html += '\u003C\u002Ftr>\u003C\u002Fthead>';\n\n        \u002F\u002F Body\n        html += '\u003Ctbody>';\n        sortedData.forEach(row => {\n            html += '\u003Ctr>';\n            columns.forEach(col => {\n                const value = col.format ? formatValue(row[col.field], col.format) : row[col.field];\n                html += `\u003Ctd>${value}\u003C\u002Ftd>`;\n            });\n            html += '\u003C\u002Ftr>';\n        });\n        html += '\u003C\u002Ftbody>\u003C\u002Ftable>';\n\n        container.innerHTML = html;\n    }\n\n    window.sortTable = function(field) {\n        if (sortCol === field) {\n            sortDir = sortDir === 'asc' ? 'desc' : 'asc';\n        } else {\n            sortCol = field;\n            sortDir = 'desc';\n        }\n        const sorted = [...data].sort((a, b) => {\n            const aVal = a[field], bVal = b[field];\n            const cmp = aVal \u003C bVal ? -1 : aVal > bVal ? 1 : 0;\n            return sortDir === 'asc' ? cmp : -cmp;\n        });\n        render(sorted);\n    };\n\n    render(data);\n}\n```\n\n## CSS Styling for Dashboards\n\n### Color System\n\n```css\n:root {\n    \u002F* Background layers *\u002F\n    --bg-primary: #f8f9fa;\n    --bg-card: #ffffff;\n    --bg-header: #1a1a2e;\n\n    \u002F* Text *\u002F\n    --text-primary: #212529;\n    --text-secondary: #6c757d;\n    --text-on-dark: #ffffff;\n\n    \u002F* Accent colors for data *\u002F\n    --color-1: #4C72B0;\n    --color-2: #DD8452;\n    --color-3: #55A868;\n    --color-4: #C44E52;\n    --color-5: #8172B3;\n    --color-6: #937860;\n\n    \u002F* Status colors *\u002F\n    --positive: #28a745;\n    --negative: #dc3545;\n    --neutral: #6c757d;\n\n    \u002F* Spacing *\u002F\n    --gap: 16px;\n    --radius: 8px;\n}\n```\n\n### Layout\n\n```css\n* {\n    margin: 0;\n    padding: 0;\n    box-sizing: border-box;\n}\n\nbody {\n    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n    background: var(--bg-primary);\n    color: var(--text-primary);\n    line-height: 1.5;\n}\n\n.dashboard-container {\n    max-width: 1400px;\n    margin: 0 auto;\n    padding: var(--gap);\n}\n\n.dashboard-header {\n    background: var(--bg-header);\n    color: var(--text-on-dark);\n    padding: 20px 24px;\n    border-radius: var(--radius);\n    margin-bottom: var(--gap);\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    flex-wrap: wrap;\n    gap: 12px;\n}\n\n.dashboard-header h1 {\n    font-size: 20px;\n    font-weight: 600;\n}\n```\n\n### KPI Cards\n\n```css\n.kpi-row {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n    gap: var(--gap);\n    margin-bottom: var(--gap);\n}\n\n.kpi-card {\n    background: var(--bg-card);\n    border-radius: var(--radius);\n    padding: 20px 24px;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n}\n\n.kpi-label {\n    font-size: 13px;\n    color: var(--text-secondary);\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    margin-bottom: 4px;\n}\n\n.kpi-value {\n    font-size: 28px;\n    font-weight: 700;\n    color: var(--text-primary);\n    margin-bottom: 4px;\n}\n\n.kpi-change {\n    font-size: 13px;\n    font-weight: 500;\n}\n\n.kpi-change.positive { color: var(--positive); }\n.kpi-change.negative { color: var(--negative); }\n```\n\n### Chart Containers\n\n```css\n.chart-row {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));\n    gap: var(--gap);\n    margin-bottom: var(--gap);\n}\n\n.chart-container {\n    background: var(--bg-card);\n    border-radius: var(--radius);\n    padding: 20px 24px;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n}\n\n.chart-container h3 {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--text-primary);\n    margin-bottom: 16px;\n}\n\n.chart-container canvas {\n    max-height: 300px;\n}\n```\n\n### Filters\n\n```css\n.filters {\n    display: flex;\n    gap: 12px;\n    align-items: center;\n    flex-wrap: wrap;\n}\n\n.filter-group {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n}\n\n.filter-group label {\n    font-size: 12px;\n    color: rgba(255, 255, 255, 0.7);\n}\n\n.filter-group select,\n.filter-group input[type=\"date\"] {\n    padding: 6px 10px;\n    border: 1px solid rgba(255, 255, 255, 0.2);\n    border-radius: 4px;\n    background: rgba(255, 255, 255, 0.1);\n    color: var(--text-on-dark);\n    font-size: 13px;\n}\n\n.filter-group select option {\n    background: var(--bg-header);\n    color: var(--text-on-dark);\n}\n```\n\n### Data Table\n\n```css\n.table-section {\n    background: var(--bg-card);\n    border-radius: var(--radius);\n    padding: 20px 24px;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n    overflow-x: auto;\n}\n\n.data-table {\n    width: 100%;\n    border-collapse: collapse;\n    font-size: 13px;\n}\n\n.data-table thead th {\n    text-align: left;\n    padding: 10px 12px;\n    border-bottom: 2px solid #dee2e6;\n    color: var(--text-secondary);\n    font-weight: 600;\n    font-size: 12px;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    white-space: nowrap;\n    user-select: none;\n}\n\n.data-table thead th:hover {\n    color: var(--text-primary);\n    background: #f8f9fa;\n}\n\n.data-table tbody td {\n    padding: 10px 12px;\n    border-bottom: 1px solid #f0f0f0;\n}\n\n.data-table tbody tr:hover {\n    background: #f8f9fa;\n}\n\n.data-table tbody tr:last-child td {\n    border-bottom: none;\n}\n```\n\n### Responsive Design\n\n```css\n@media (max-width: 768px) {\n    .dashboard-header {\n        flex-direction: column;\n        align-items: flex-start;\n    }\n\n    .kpi-row {\n        grid-template-columns: repeat(2, 1fr);\n    }\n\n    .chart-row {\n        grid-template-columns: 1fr;\n    }\n\n    .filters {\n        flex-direction: column;\n        align-items: flex-start;\n    }\n}\n\n@media print {\n    body { background: white; }\n    .dashboard-container { max-width: none; }\n    .filters { display: none; }\n    .chart-container { break-inside: avoid; }\n    .kpi-card { border: 1px solid #dee2e6; box-shadow: none; }\n}\n```\n\n## Performance Considerations for Large Datasets\n\n### Data Size Guidelines\n\n| Data Size | Approach |\n|---|---|\n| \u003C1,000 rows | Embed directly in HTML. Full interactivity. |\n| 1,000 - 10,000 rows | Embed in HTML. May need to pre-aggregate for charts. |\n| 10,000 - 100,000 rows | Pre-aggregate server-side. Embed only aggregated data. |\n| >100,000 rows | Not suitable for client-side dashboard. Use a BI tool or paginate. |\n\n### Pre-Aggregation Pattern\n\nInstead of embedding raw data and aggregating in the browser:\n\n```javascript\n\u002F\u002F DON'T: embed 50,000 raw rows\nconst RAW_DATA = [\u002F* 50,000 rows *\u002F];\n\n\u002F\u002F DO: pre-aggregate before embedding\nconst CHART_DATA = {\n    monthly_revenue: [\n        { month: '2024-01', revenue: 150000, orders: 1200 },\n        { month: '2024-02', revenue: 165000, orders: 1350 },\n        \u002F\u002F ... 12 rows instead of 50,000\n    ],\n    top_products: [\n        { product: 'Widget A', revenue: 45000 },\n        \u002F\u002F ... 10 rows\n    ],\n    kpis: {\n        total_revenue: 1980000,\n        total_orders: 15600,\n        avg_order_value: 127,\n    }\n};\n```\n\n### Chart Performance\n\n- Limit line charts to \u003C500 data points per series (downsample if needed)\n- Limit bar charts to \u003C50 categories\n- For scatter plots, cap at 1,000 points (use sampling for larger datasets)\n- Disable animations for dashboards with many charts: `animation: false` in Chart.js options\n- Use `Chart.update('none')` instead of `Chart.update()` for filter-triggered updates\n\n### DOM Performance\n\n- Limit data tables to 100-200 visible rows. Add pagination for more.\n- Use `requestAnimationFrame` for coordinated chart updates\n- Avoid rebuilding the entire DOM on filter change -- update only changed elements\n\n```javascript\n\u002F\u002F Efficient table pagination\nfunction renderTablePage(data, page, pageSize = 50) {\n    const start = page * pageSize;\n    const end = Math.min(start + pageSize, data.length);\n    const pageData = data.slice(start, end);\n    \u002F\u002F Render only pageData\n    \u002F\u002F Show pagination controls: \"Showing 1-50 of 2,340\"\n}\n```\n\n## Examples\n\n```\n\u002Fbuild-dashboard Monthly sales dashboard with revenue trend, top products, and regional breakdown. Data is in the orders table.\n```\n\n```\n\u002Fbuild-dashboard Here's our support ticket data [pastes CSV]. Build a dashboard showing volume by priority, response time trends, and resolution rates.\n```\n\n```\n\u002Fbuild-dashboard Create a template executive dashboard for a SaaS company showing MRR, churn, new customers, and NPS. Use sample data.\n```\n\n## Tips\n\n- Dashboards are fully self-contained HTML files -- share them with anyone by sending the file\n- For real-time dashboards, consider connecting to a BI tool instead. These dashboards are point-in-time snapshots\n- Request \"dark mode\" or \"presentation mode\" for different styling\n- You can request a specific color scheme to match your brand\n","# \u002Fbuild-dashboard - Build Interactive Dashboards\n\n> If you see unfamiliar placeholders or need to check which tools are connected, see [CONNECTORS.md](..\u002F..\u002FCONNECTORS.md).\n\nBuild a self-contained interactive HTML dashboard with charts, filters, tables, and professional styling. Opens directly in a browser -- no server or dependencies required.\n\n## Usage\n\n```\n\u002Fbuild-dashboard \u003Cdescription of dashboard> [data source]\n```\n\n## Workflow\n\n### 1. Understand the Dashboard Requirements\n\nDetermine:\n\n- **Purpose**: Executive overview, operational monitoring, deep-dive analysis, team reporting\n- **Audience**: Who will use this dashboard?\n- **Key metrics**: What numbers matter most?\n- **Dimensions**: What should users be able to filter or slice by?\n- **Data source**: Live query, pasted data, CSV file, or sample data\n\n### 2. Gather the Data\n\n**If data warehouse is connected:**\n1. Query the necessary data\n2. Embed the results as JSON within the HTML file\n\n**If data is pasted or uploaded:**\n1. Parse and clean the data\n2. Embed as JSON in the dashboard\n\n**If working from a description without data:**\n1. Create a realistic sample dataset matching the described schema\n2. Note in the dashboard that it uses sample data\n3. Provide instructions for swapping in real data\n\n### 3. Design the Dashboard Layout\n\nFollow a standard dashboard layout pattern:\n\n```\n┌──────────────────────────────────────────────────┐\n│  Dashboard Title                    [Filters ▼]  │\n├────────────┬────────────┬────────────┬───────────┤\n│  KPI Card  │  KPI Card  │  KPI Card  │ KPI Card  │\n├────────────┴────────────┼────────────┴───────────┤\n│                         │                        │\n│    Primary Chart        │   Secondary Chart      │\n│    (largest area)       │                        │\n│                         │                        │\n├─────────────────────────┴────────────────────────┤\n│                                                  │\n│    Detail Table (sortable, scrollable)           │\n│                                                  │\n└──────────────────────────────────────────────────┘\n```\n\n**Adapt the layout to the content:**\n- 2-4 KPI cards at the top for headline numbers\n- 1-3 charts in the middle section for trends and breakdowns\n- Optional detail table at the bottom for drill-down data\n- Filters in the header or sidebar depending on complexity\n\n### 4. Build the HTML Dashboard\n\nGenerate a single self-contained HTML file using the base template below. The file includes:\n\n**Structure (HTML):**\n- Semantic HTML5 layout\n- Responsive grid using CSS Grid or Flexbox\n- Filter controls (dropdowns, date pickers, toggles)\n- KPI cards with values and labels\n- Chart containers\n- Data table with sortable headers\n\n**Styling (CSS):**\n- Professional color scheme (clean whites, grays, with accent colors for data)\n- Card-based layout with subtle shadows\n- Consistent typography (system fonts for fast loading)\n- Responsive design that works on different screen sizes\n- Print-friendly styles\n\n**Interactivity (JavaScript):**\n- Chart.js for interactive charts (included via CDN)\n- Filter dropdowns that update all charts and tables simultaneously\n- Sortable table columns\n- Hover tooltips on charts\n- Number formatting (commas, currency, percentages)\n\n**Data (embedded JSON):**\n- All data embedded directly in the HTML as JavaScript variables\n- No external data fetches required\n- Dashboard works completely offline\n\n### 5. Implement Chart Types\n\nUse Chart.js for all charts. Common dashboard chart patterns:\n\n- **Line chart**: Time series trends\n- **Bar chart**: Category comparisons\n- **Doughnut chart**: Composition (when \u003C6 categories)\n- **Stacked bar**: Composition over time\n- **Mixed (bar + line)**: Volume with rate overlay\n\nUse the Chart.js integration patterns below for each chart type.\n\n### 6. Add Interactivity\n\nUse the filter and interactivity implementation patterns below for dropdown filters, date range filters, combined filter logic, sortable tables, and chart updates.\n\n### 7. Save and Open\n\n1. Save the dashboard as an HTML file with a descriptive name (e.g., `sales_dashboard.html`)\n2. Open it in the user's default browser\n3. Confirm it renders correctly\n4. Provide instructions for updating data or customizing\n\n---\n\n## Base Template\n\nEvery dashboard follows this structure:\n\n```html\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    \u003Ctitle>Dashboard Title\u003C\u002Ftitle>\n    \u003Cscript src=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fchart.js@4.5.1\" integrity=\"sha384-jb8JQMbMoBUzgWatfe6COACi2ljcDdZQ2OxczGA3bGNeWe+6DChMTBJemed7ZnvJ\" crossorigin=\"anonymous\">\u003C\u002Fscript>\n    \u003Cscript src=\"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fchartjs-adapter-date-fns@3.0.0\" integrity=\"sha384-cVMg8E3QFwTvGCDuK+ET4PD341jF3W8nO1auiXfuZNQkzbUUiBGLsIQUE+b1mxws\" crossorigin=\"anonymous\">\u003C\u002Fscript>\n    \u003Cstyle>\n        \u002F* Dashboard styles go here *\u002F\n    \u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003Cdiv class=\"dashboard-container\">\n        \u003Cheader class=\"dashboard-header\">\n            \u003Ch1>Dashboard Title\u003C\u002Fh1>\n            \u003Cdiv class=\"filters\">\n                \u003C!-- Filter controls -->\n            \u003C\u002Fdiv>\n        \u003C\u002Fheader>\n\n        \u003Csection class=\"kpi-row\">\n            \u003C!-- KPI cards -->\n        \u003C\u002Fsection>\n\n        \u003Csection class=\"chart-row\">\n            \u003C!-- Chart containers -->\n        \u003C\u002Fsection>\n\n        \u003Csection class=\"table-section\">\n            \u003C!-- Data table -->\n        \u003C\u002Fsection>\n\n        \u003Cfooter class=\"dashboard-footer\">\n            \u003Cspan>Data as of: \u003Cspan id=\"data-date\">\u003C\u002Fspan>\u003C\u002Fspan>\n        \u003C\u002Ffooter>\n    \u003C\u002Fdiv>\n\n    \u003Cscript>\n        \u002F\u002F Embedded data\n        const DATA = [];\n\n        \u002F\u002F Dashboard logic\n        class Dashboard {\n            constructor(data) {\n                this.rawData = data;\n                this.filteredData = data;\n                this.charts = {};\n                this.init();\n            }\n\n            init() {\n                this.setupFilters();\n                this.renderKPIs();\n                this.renderCharts();\n                this.renderTable();\n            }\n\n            applyFilters() {\n                \u002F\u002F Filter logic\n                this.filteredData = this.rawData.filter(row => {\n                    \u002F\u002F Apply each active filter\n                    return true; \u002F\u002F placeholder\n                });\n                this.renderKPIs();\n                this.updateCharts();\n                this.renderTable();\n            }\n\n            \u002F\u002F ... methods for each section\n        }\n\n        const dashboard = new Dashboard(DATA);\n    \u003C\u002Fscript>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n## KPI Card Pattern\n\n```html\n\u003Cdiv class=\"kpi-card\">\n    \u003Cdiv class=\"kpi-label\">Total Revenue\u003C\u002Fdiv>\n    \u003Cdiv class=\"kpi-value\" id=\"kpi-revenue\">$0\u003C\u002Fdiv>\n    \u003Cdiv class=\"kpi-change positive\" id=\"kpi-revenue-change\">+0%\u003C\u002Fdiv>\n\u003C\u002Fdiv>\n```\n\n```javascript\nfunction renderKPI(elementId, value, previousValue, format = 'number') {\n    const el = document.getElementById(elementId);\n    const changeEl = document.getElementById(elementId + '-change');\n\n    \u002F\u002F Format the value\n    el.textContent = formatValue(value, format);\n\n    \u002F\u002F Calculate and display change\n    if (previousValue && previousValue !== 0) {\n        const pctChange = ((value - previousValue) \u002F previousValue) * 100;\n        const sign = pctChange >= 0 ? '+' : '';\n        changeEl.textContent = `${sign}${pctChange.toFixed(1)}% vs prior period`;\n        changeEl.className = `kpi-change ${pctChange >= 0 ? 'positive' : 'negative'}`;\n    }\n}\n\nfunction formatValue(value, format) {\n    switch (format) {\n        case 'currency':\n            if (value >= 1e6) return `$${(value \u002F 1e6).toFixed(1)}M`;\n            if (value >= 1e3) return `$${(value \u002F 1e3).toFixed(1)}K`;\n            return `$${value.toFixed(0)}`;\n        case 'percent':\n            return `${value.toFixed(1)}%`;\n        case 'number':\n            if (value >= 1e6) return `${(value \u002F 1e6).toFixed(1)}M`;\n            if (value >= 1e3) return `${(value \u002F 1e3).toFixed(1)}K`;\n            return value.toLocaleString();\n        default:\n            return value.toString();\n    }\n}\n```\n\n## Chart.js Integration\n\n### Chart Container Pattern\n\n```html\n\u003Cdiv class=\"chart-container\">\n    \u003Ch3 class=\"chart-title\">Monthly Revenue Trend\u003C\u002Fh3>\n    \u003Ccanvas id=\"revenue-chart\">\u003C\u002Fcanvas>\n\u003C\u002Fdiv>\n```\n\n### Line Chart\n\n```javascript\nfunction createLineChart(canvasId, labels, datasets) {\n    const ctx = document.getElementById(canvasId).getContext('2d');\n    return new Chart(ctx, {\n        type: 'line',\n        data: {\n            labels: labels,\n            datasets: datasets.map((ds, i) => ({\n                label: ds.label,\n                data: ds.data,\n                borderColor: COLORS[i % COLORS.length],\n                backgroundColor: COLORS[i % COLORS.length] + '20',\n                borderWidth: 2,\n                fill: ds.fill || false,\n                tension: 0.3,\n                pointRadius: 3,\n                pointHoverRadius: 6,\n            }))\n        },\n        options: {\n            responsive: true,\n            maintainAspectRatio: false,\n            interaction: {\n                mode: 'index',\n                intersect: false,\n            },\n            plugins: {\n                legend: {\n                    position: 'top',\n                    labels: { usePointStyle: true, padding: 20 }\n                },\n                tooltip: {\n                    callbacks: {\n                        label: function(context) {\n                            return `${context.dataset.label}: ${formatValue(context.parsed.y, 'currency')}`;\n                        }\n                    }\n                }\n            },\n            scales: {\n                x: {\n                    grid: { display: false }\n                },\n                y: {\n                    beginAtZero: true,\n                    ticks: {\n                        callback: function(value) {\n                            return formatValue(value, 'currency');\n                        }\n                    }\n                }\n            }\n        }\n    });\n}\n```\n\n### Bar Chart\n\n```javascript\nfunction createBarChart(canvasId, labels, data, options = {}) {\n    const ctx = document.getElementById(canvasId).getContext('2d');\n    const isHorizontal = options.horizontal || labels.length > 8;\n\n    return new Chart(ctx, {\n        type: 'bar',\n        data: {\n            labels: labels,\n            datasets: [{\n                label: options.label || 'Value',\n                data: data,\n                backgroundColor: options.colors || COLORS.map(c => c + 'CC'),\n                borderColor: options.colors || COLORS,\n                borderWidth: 1,\n                borderRadius: 4,\n            }]\n        },\n        options: {\n            responsive: true,\n            maintainAspectRatio: false,\n            indexAxis: isHorizontal ? 'y' : 'x',\n            plugins: {\n                legend: { display: false },\n                tooltip: {\n                    callbacks: {\n                        label: function(context) {\n                            return formatValue(context.parsed[isHorizontal ? 'x' : 'y'], options.format || 'number');\n                        }\n                    }\n                }\n            },\n            scales: {\n                x: {\n                    beginAtZero: true,\n                    grid: { display: isHorizontal },\n                    ticks: isHorizontal ? {\n                        callback: function(value) {\n                            return formatValue(value, options.format || 'number');\n                        }\n                    } : {}\n                },\n                y: {\n                    beginAtZero: !isHorizontal,\n                    grid: { display: !isHorizontal },\n                    ticks: !isHorizontal ? {\n                        callback: function(value) {\n                            return formatValue(value, options.format || 'number');\n                        }\n                    } : {}\n                }\n            }\n        }\n    });\n}\n```\n\n### Doughnut Chart\n\n```javascript\nfunction createDoughnutChart(canvasId, labels, data) {\n    const ctx = document.getElementById(canvasId).getContext('2d');\n    return new Chart(ctx, {\n        type: 'doughnut',\n        data: {\n            labels: labels,\n            datasets: [{\n                data: data,\n                backgroundColor: COLORS.map(c => c + 'CC'),\n                borderColor: '#ffffff',\n                borderWidth: 2,\n            }]\n        },\n        options: {\n            responsive: true,\n            maintainAspectRatio: false,\n            cutout: '60%',\n            plugins: {\n                legend: {\n                    position: 'right',\n                    labels: { usePointStyle: true, padding: 15 }\n                },\n                tooltip: {\n                    callbacks: {\n                        label: function(context) {\n                            const total = context.dataset.data.reduce((a, b) => a + b, 0);\n                            const pct = ((context.parsed \u002F total) * 100).toFixed(1);\n                            return `${context.label}: ${formatValue(context.parsed, 'number')} (${pct}%)`;\n                        }\n                    }\n                }\n            }\n        }\n    });\n}\n```\n\n### Updating Charts on Filter Change\n\n```javascript\nfunction updateChart(chart, newLabels, newData) {\n    chart.data.labels = newLabels;\n\n    if (Array.isArray(newData[0])) {\n        \u002F\u002F Multiple datasets\n        newData.forEach((data, i) => {\n            chart.data.datasets[i].data = data;\n        });\n    } else {\n        chart.data.datasets[0].data = newData;\n    }\n\n    chart.update('none'); \u002F\u002F 'none' disables animation for instant update\n}\n```\n\n## Filter and Interactivity Implementation\n\n### Dropdown Filter\n\n```html\n\u003Cdiv class=\"filter-group\">\n    \u003Clabel for=\"filter-region\">Region\u003C\u002Flabel>\n    \u003Cselect id=\"filter-region\" onchange=\"dashboard.applyFilters()\">\n        \u003Coption value=\"all\">All Regions\u003C\u002Foption>\n    \u003C\u002Fselect>\n\u003C\u002Fdiv>\n```\n\n```javascript\nfunction populateFilter(selectId, data, field) {\n    const select = document.getElementById(selectId);\n    const values = [...new Set(data.map(d => d[field]))].sort();\n\n    \u002F\u002F Keep the \"All\" option, add unique values\n    values.forEach(val => {\n        const option = document.createElement('option');\n        option.value = val;\n        option.textContent = val;\n        select.appendChild(option);\n    });\n}\n\nfunction getFilterValue(selectId) {\n    const val = document.getElementById(selectId).value;\n    return val === 'all' ? null : val;\n}\n```\n\n### Date Range Filter\n\n```html\n\u003Cdiv class=\"filter-group\">\n    \u003Clabel>Date Range\u003C\u002Flabel>\n    \u003Cinput type=\"date\" id=\"filter-date-start\" onchange=\"dashboard.applyFilters()\">\n    \u003Cspan>to\u003C\u002Fspan>\n    \u003Cinput type=\"date\" id=\"filter-date-end\" onchange=\"dashboard.applyFilters()\">\n\u003C\u002Fdiv>\n```\n\n```javascript\nfunction filterByDateRange(data, dateField, startDate, endDate) {\n    return data.filter(row => {\n        const rowDate = new Date(row[dateField]);\n        if (startDate && rowDate \u003C new Date(startDate)) return false;\n        if (endDate && rowDate > new Date(endDate)) return false;\n        return true;\n    });\n}\n```\n\n### Combined Filter Logic\n\n```javascript\napplyFilters() {\n    const region = getFilterValue('filter-region');\n    const category = getFilterValue('filter-category');\n    const startDate = document.getElementById('filter-date-start').value;\n    const endDate = document.getElementById('filter-date-end').value;\n\n    this.filteredData = this.rawData.filter(row => {\n        if (region && row.region !== region) return false;\n        if (category && row.category !== category) return false;\n        if (startDate && row.date \u003C startDate) return false;\n        if (endDate && row.date > endDate) return false;\n        return true;\n    });\n\n    this.renderKPIs();\n    this.updateCharts();\n    this.renderTable();\n}\n```\n\n### Sortable Table\n\n```javascript\nfunction renderTable(containerId, data, columns) {\n    const container = document.getElementById(containerId);\n    let sortCol = null;\n    let sortDir = 'desc';\n\n    function render(sortedData) {\n        let html = '\u003Ctable class=\"data-table\">';\n\n        \u002F\u002F Header\n        html += '\u003Cthead>\u003Ctr>';\n        columns.forEach(col => {\n            const arrow = sortCol === col.field\n                ? (sortDir === 'asc' ? ' ▲' : ' ▼')\n                : '';\n            html += `\u003Cth onclick=\"sortTable('${col.field}')\" style=\"cursor:pointer\">${col.label}${arrow}\u003C\u002Fth>`;\n        });\n        html += '\u003C\u002Ftr>\u003C\u002Fthead>';\n\n        \u002F\u002F Body\n        html += '\u003Ctbody>';\n        sortedData.forEach(row => {\n            html += '\u003Ctr>';\n            columns.forEach(col => {\n                const value = col.format ? formatValue(row[col.field], col.format) : row[col.field];\n                html += `\u003Ctd>${value}\u003C\u002Ftd>`;\n            });\n            html += '\u003C\u002Ftr>';\n        });\n        html += '\u003C\u002Ftbody>\u003C\u002Ftable>';\n\n        container.innerHTML = html;\n    }\n\n    window.sortTable = function(field) {\n        if (sortCol === field) {\n            sortDir = sortDir === 'asc' ? 'desc' : 'asc';\n        } else {\n            sortCol = field;\n            sortDir = 'desc';\n        }\n        const sorted = [...data].sort((a, b) => {\n            const aVal = a[field], bVal = b[field];\n            const cmp = aVal \u003C bVal ? -1 : aVal > bVal ? 1 : 0;\n            return sortDir === 'asc' ? cmp : -cmp;\n        });\n        render(sorted);\n    };\n\n    render(data);\n}\n```\n\n## CSS Styling for Dashboards\n\n### Color System\n\n```css\n:root {\n    \u002F* Background layers *\u002F\n    --bg-primary: #f8f9fa;\n    --bg-card: #ffffff;\n    --bg-header: #1a1a2e;\n\n    \u002F* Text *\u002F\n    --text-primary: #212529;\n    --text-secondary: #6c757d;\n    --text-on-dark: #ffffff;\n\n    \u002F* Accent colors for data *\u002F\n    --color-1: #4C72B0;\n    --color-2: #DD8452;\n    --color-3: #55A868;\n    --color-4: #C44E52;\n    --color-5: #8172B3;\n    --color-6: #937860;\n\n    \u002F* Status colors *\u002F\n    --positive: #28a745;\n    --negative: #dc3545;\n    --neutral: #6c757d;\n\n    \u002F* Spacing *\u002F\n    --gap: 16px;\n    --radius: 8px;\n}\n```\n\n### Layout\n\n```css\n* {\n    margin: 0;\n    padding: 0;\n    box-sizing: border-box;\n}\n\nbody {\n    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n    background: var(--bg-primary);\n    color: var(--text-primary);\n    line-height: 1.5;\n}\n\n.dashboard-container {\n    max-width: 1400px;\n    margin: 0 auto;\n    padding: var(--gap);\n}\n\n.dashboard-header {\n    background: var(--bg-header);\n    color: var(--text-on-dark);\n    padding: 20px 24px;\n    border-radius: var(--radius);\n    margin-bottom: var(--gap);\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    flex-wrap: wrap;\n    gap: 12px;\n}\n\n.dashboard-header h1 {\n    font-size: 20px;\n    font-weight: 600;\n}\n```\n\n### KPI Cards\n\n```css\n.kpi-row {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n    gap: var(--gap);\n    margin-bottom: var(--gap);\n}\n\n.kpi-card {\n    background: var(--bg-card);\n    border-radius: var(--radius);\n    padding: 20px 24px;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n}\n\n.kpi-label {\n    font-size: 13px;\n    color: var(--text-secondary);\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    margin-bottom: 4px;\n}\n\n.kpi-value {\n    font-size: 28px;\n    font-weight: 700;\n    color: var(--text-primary);\n    margin-bottom: 4px;\n}\n\n.kpi-change {\n    font-size: 13px;\n    font-weight: 500;\n}\n\n.kpi-change.positive { color: var(--positive); }\n.kpi-change.negative { color: var(--negative); }\n```\n\n### Chart Containers\n\n```css\n.chart-row {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));\n    gap: var(--gap);\n    margin-bottom: var(--gap);\n}\n\n.chart-container {\n    background: var(--bg-card);\n    border-radius: var(--radius);\n    padding: 20px 24px;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n}\n\n.chart-container h3 {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--text-primary);\n    margin-bottom: 16px;\n}\n\n.chart-container canvas {\n    max-height: 300px;\n}\n```\n\n### Filters\n\n```css\n.filters {\n    display: flex;\n    gap: 12px;\n    align-items: center;\n    flex-wrap: wrap;\n}\n\n.filter-group {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n}\n\n.filter-group label {\n    font-size: 12px;\n    color: rgba(255, 255, 255, 0.7);\n}\n\n.filter-group select,\n.filter-group input[type=\"date\"] {\n    padding: 6px 10px;\n    border: 1px solid rgba(255, 255, 255, 0.2);\n    border-radius: 4px;\n    background: rgba(255, 255, 255, 0.1);\n    color: var(--text-on-dark);\n    font-size: 13px;\n}\n\n.filter-group select option {\n    background: var(--bg-header);\n    color: var(--text-on-dark);\n}\n```\n\n### Data Table\n\n```css\n.table-section {\n    background: var(--bg-card);\n    border-radius: var(--radius);\n    padding: 20px 24px;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n    overflow-x: auto;\n}\n\n.data-table {\n    width: 100%;\n    border-collapse: collapse;\n    font-size: 13px;\n}\n\n.data-table thead th {\n    text-align: left;\n    padding: 10px 12px;\n    border-bottom: 2px solid #dee2e6;\n    color: var(--text-secondary);\n    font-weight: 600;\n    font-size: 12px;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    white-space: nowrap;\n    user-select: none;\n}\n\n.data-table thead th:hover {\n    color: var(--text-primary);\n    background: #f8f9fa;\n}\n\n.data-table tbody td {\n    padding: 10px 12px;\n    border-bottom: 1px solid #f0f0f0;\n}\n\n.data-table tbody tr:hover {\n    background: #f8f9fa;\n}\n\n.data-table tbody tr:last-child td {\n    border-bottom: none;\n}\n```\n\n### Responsive Design\n\n```css\n@media (max-width: 768px) {\n    .dashboard-header {\n        flex-direction: column;\n        align-items: flex-start;\n    }\n\n    .kpi-row {\n        grid-template-columns: repeat(2, 1fr);\n    }\n\n    .chart-row {\n        grid-template-columns: 1fr;\n    }\n\n    .filters {\n        flex-direction: column;\n        align-items: flex-start;\n    }\n}\n\n@media print {\n    body { background: white; }\n    .dashboard-container { max-width: none; }\n    .filters { display: none; }\n    .chart-container { break-inside: avoid; }\n    .kpi-card { border: 1px solid #dee2e6; box-shadow: none; }\n}\n```\n\n## Performance Considerations for Large Datasets\n\n### Data Size Guidelines\n\n| Data Size | Approach |\n|---|---|\n| \u003C1,000 rows | Embed directly in HTML. Full interactivity. |\n| 1,000 - 10,000 rows | Embed in HTML. May need to pre-aggregate for charts. |\n| 10,000 - 100,000 rows | Pre-aggregate server-side. Embed only aggregated data. |\n| >100,000 rows | Not suitable for client-side dashboard. Use a BI tool or paginate. |\n\n### Pre-Aggregation Pattern\n\nInstead of embedding raw data and aggregating in the browser:\n\n```javascript\n\u002F\u002F DON'T: embed 50,000 raw rows\nconst RAW_DATA = [\u002F* 50,000 rows *\u002F];\n\n\u002F\u002F DO: pre-aggregate before embedding\nconst CHART_DATA = {\n    monthly_revenue: [\n        { month: '2024-01', revenue: 150000, orders: 1200 },\n        { month: '2024-02', revenue: 165000, orders: 1350 },\n        \u002F\u002F ... 12 rows instead of 50,000\n    ],\n    top_products: [\n        { product: 'Widget A', revenue: 45000 },\n        \u002F\u002F ... 10 rows\n    ],\n    kpis: {\n        total_revenue: 1980000,\n        total_orders: 15600,\n        avg_order_value: 127,\n    }\n};\n```\n\n### Chart Performance\n\n- Limit line charts to \u003C500 data points per series (downsample if needed)\n- Limit bar charts to \u003C50 categories\n- For scatter plots, cap at 1,000 points (use sampling for larger datasets)\n- Disable animations for dashboards with many charts: `animation: false` in Chart.js options\n- Use `Chart.update('none')` instead of `Chart.update()` for filter-triggered updates\n\n### DOM Performance\n\n- Limit data tables to 100-200 visible rows. Add pagination for more.\n- Use `requestAnimationFrame` for coordinated chart updates\n- Avoid rebuilding the entire DOM on filter change -- update only changed elements\n\n```javascript\n\u002F\u002F Efficient table pagination\nfunction renderTablePage(data, page, pageSize = 50) {\n    const start = page * pageSize;\n    const end = Math.min(start + pageSize, data.length);\n    const pageData = data.slice(start, end);\n    \u002F\u002F Render only pageData\n    \u002F\u002F Show pagination controls: \"Showing 1-50 of 2,340\"\n}\n```\n\n## Examples\n\n```\n\u002Fbuild-dashboard Monthly sales dashboard with revenue trend, top products, and regional breakdown. Data is in the orders table.\n```\n\n```\n\u002Fbuild-dashboard Here's our support ticket data [pastes CSV]. Build a dashboard showing volume by priority, response time trends, and resolution rates.\n```\n\n```\n\u002Fbuild-dashboard Create a template executive dashboard for a SaaS company showing MRR, churn, new customers, and NPS. Use sample data.\n```\n\n## Tips\n\n- Dashboards are fully self-contained HTML files -- share them with anyone by sending the file\n- For real-time dashboards, consider connecting to a BI tool instead. These dashboards are point-in-time snapshots\n- Request \"dark mode\" or \"presentation mode\" for different styling\n- You can request a specific color scheme to match your brand\n",{"name":5,"tags":44,"tools":45,"source":46,"license":14,"description":7,"source_path":47,"source_commit":48},[],[],"https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fknowledge-work-plugins","data\u002Fskills\u002Fbuild-dashboard","8444efcd48f7012f09797778a36a33e73d0861f4","main","f7cd4595d0f8959822163e14f9787117765c931a","packages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fbuild-dashboard",2,"https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind","https:\u002F\u002Fmonoes.github.io\u002Fmonomind\u002F","https:\u002F\u002Fgithub.com\u002Fmonoes","https:\u002F\u002Fmonoes.me","2026-11-14 03:30:52",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add monoes\u002Fmonomind --skill build-dashboard",{"tool":64,"command":65},"bunx","bunx skills add monoes\u002Fmonomind --skill build-dashboard",{"tool":67,"command":68},"pnpm","pnpm dlx skills add monoes\u002Fmonomind --skill build-dashboard","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fbuild-dashboard\u002FSKILL.md",true,[72],{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":15},"LICENSE.txt","LICENSE","许可证",11607,[78,88,96,104,112,120],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":82,"licenseFileUrl":83,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":87},"01M73YHAZDWV4ZVTGSKMWQ4Z1S","isms-audit-expert","Use when planning or running an ISO 27001 ISMS audit: risk-based audit schedules, Annex A control assessment, Statement of Applicability and nonconformities. Auditor-side procedures, versus compliance-auditor, which is org role guidance across SOC 2, HIPAA and PCI-DSS.","MIT","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fisms-audit-expert\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fisms-audit-expert\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":87},"01M73YGBS2APTY71Y4CYA2DKSQ","instrument-data-to-allotrope","Convert laboratory instrument output files (PDF, CSV, Excel, TXT) to Allotrope Simple Model (ASM) JSON format or flattened 2D CSV. Use this skill when scientists need to standardize instrument data for LIMS systems, data lakes, or downstream analysis. Supports auto-detection of instrument types. Outputs include full ASM JSON, flattened CSV for easy import, and exportable Python code for data engineers. Common triggers include converting instrument files, standardizing lab data, preparing data for upload to LIMS\u002FELN systems, or generating parser code for production pipelines.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Finstrument-data-to-allotrope\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Finstrument-data-to-allotrope\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":82,"licenseFileUrl":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":87},"01M73YB23X4NP40R73TS6YY8TX","experiment-designer","Use when planning a product A\u002FB or multivariate test: If\u002FThen\u002FBecause hypotheses, primary and guardrail metrics, sample size and MDE, ICE prioritization. For logging and reproducing ML runs use experiment-tracker; for scientific study design use experimental-design.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fexperiment-designer\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fexperiment-designer\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":108,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":87},"01M73Y8ETSB9072G5ZGPPR0X6E","digest","Generate a daily or weekly digest of activity across all connected sources. Use when catching up after time away, starting the day and wanting a summary of mentions and action items, or reviewing a week's decisions and document updates grouped by project.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdigest\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdigest\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":116,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":87},"01M73Y7XJJBH0QXCM5GKJW6N21","design-critique","Get structured design feedback on usability, hierarchy, and consistency. Trigger with \"review this design\", \"critique this mockup\", \"what do you think of this screen?\", or when sharing a Figma link or screenshot for feedback at any stage from exploration to final polish.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdesign-critique\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdesign-critique\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":82,"licenseFileUrl":124,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":87},"01M73Y7SM786ZEMNXGPT595AM3","deployment-pipeline-design","Use when architecting a multi-stage CI\u002FCD pipeline with approval gates, SAST and DAST scans, environment promotion, canary rollout and automated rollback. Design-level; for concrete Dockerfile and health check patterns use deployment-patterns.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdeployment-pipeline-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdeployment-pipeline-design\u002FSKILL.md",[],[]]