Build a dashboard with an agent
[⏱️ ~12 min] Guided tutorial: use the agent skill flow to ship a statistics lab dashboard with charts and tables, no mining domain required
This tutorial walks a realistic agent session end to end, using the same flow every MDK agent session uses: put mdk on your PATH,
install the skill suite once, then state what you want in plain language.
Overview
MDK's React UI Devkit's library of presentational and composable building blocks can be used wherever suits you.
Mining is one of many disciplines that benefits from charts, tables, tabs, and stat cards. Your telemetry; your dash.
You bring your labels, your mock data, and your layout.
The first thing we built was a mining dashboard. What will you build?
IoT fleet backend reporting, workout metrics motivation app, weather stats? Your data; your choice.
You'll ask for a statistics tutorial page so students can explore distributions, trends, and raw grades, and see every:
- Lookup the agent makes against the skill suite
- Resulting page code
- Run instructions
We use mock JSON in the browser. No Kernel, Worker, pool API, or fleet backend is required. Presentational imports from
@tetherto/mdk-react-devkit/primitives, plus SingleStatCard from @tetherto/mdk-react-devkit/domain, are enough for a
highly visual, shippable UI.
What you'll learn
- Domain is yours. Component contracts describe shape and behavior (chart datasets, table columns), not industry vocabulary.
- The agent path carries over. Install the CLI → install the skills → plain-language intent → local registry lookup → build →
typecheck. The skill is written for an MDK App or an
mdk create dashboardapp, so the prompt states what changes for a standalone Vite app. - Visual density is supported. Bar charts, line trends, sortable tables, and stat cards compose into a dashboard that looks like a product, not a wireframe.
The demo app is Stats Lab: a fictional intro statistics course where Teaching Assistants review quiz score histograms, weekly class averages, and per-student grades.
Prerequisites
mdkon your PATH: Install the CLI
Agent session walkthrough
Install the skill suite (once per project)
cd to your app or monorepo project root. Do not run this from the CLI checkout:
mdk skill add --client cursorThis installs the MDK Developer Skill suite into .cursor/skills/ (use --client claude for .claude/skills/, or omit
--client for both), so the session knows MDK's conventions and carries the component registry. Full flag list:
Agent skills.
State a non-mining intent
Paste a prompt that names the domain explicitly so the agent does not reach for hashrate widgets:
Build a statistics tutorial dashboard for students in
stats-lab. Include:
- A histogram of final exam scores (bar chart buckets 50–59 through 90–100)
- A line chart of weekly class average over six weeks
- A sortable table of students with midterm, final, and section
- Three summary stat cards: mean final, median final, enrollment count
This is a standalone Vite app, not an MDK App or dashboard: there is no route, no
mdkFetch, and nomdk run. Use mock data in the repo. Import only from@tetherto/mdk-react-devkit/primitivesand@tetherto/mdk-react-devkit/domainwhere needed. No mining APIs. Verify withnpx tsc -bandnpm run build.
The mdk-ui-component skill is written for two hosts: an MDK App's ui-src/ or an mdk create dashboard app. Its
prerequisites ask for a route and a host, its rules send every request through mdkFetch and import from the devkit
package root, and its verify step opens the page in a running dashboard. The prompt overrides those parts: it names the
host (a standalone Vite app), the data (mock only, so no requests), the import subpaths, and the verify commands. The
agent keeps the rest of the skill, the registry lookups and the component contracts, whatever the domain.
Lookups the agent makes
Behind the prompt, the mdk-ui-component skill activates and a well-behaved session reads its bundled
references/ui-registry.json — a deterministic file lookup, no model or network calls. A representative pass:
Full skill reference: Agent skills.
Review the generated page
After the agent edits App.tsx, a Stats Lab dashboard might look like this:
Nothing in this file references pools, workers, or TH/s. The same components appear on mining pages because the data model is generic.
Run Stats Lab locally
Stats Lab is a standalone Vite project. It needs no MDK checkout: the three React packages come from npm, and the page runs on mock data in the browser.
Scaffold stats-lab
Run this in any directory:
npm create vite@latest stats-lab -- --template react-ts
cd stats-lab
npm installInstall the MDK React packages
npm install \
@tetherto/mdk-react-devkit \
@tetherto/mdk-react-adapter \
@tetherto/mdk-ui-foundationWrap with MdkProvider
Replace the whole of stats-lab/src/main.tsx with this file, which mirrors
Wrap your app in MdkProvider:
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { MdkProvider } from '@tetherto/mdk-react-adapter'
import { noAuth } from '@tetherto/mdk-ui-foundation'
import '@tetherto/mdk-react-devkit/styles.css'
import '@tetherto/mdk-react-devkit/styles-domain.css'
import App from './App.tsx'
// Stats Lab renders fixtures, so it signs in to nothing: noAuth() says so
// explicitly. A dashboard against a real stack passes passwordAuth() instead.
createRoot(document.getElementById('root')!).render(
<StrictMode>
<MdkProvider apiBaseUrl="https://example.invalid" auth={noAuth()}>
<App />
</MdkProvider>
</StrictMode>,
)Mock data does not call the API, so noAuth() is accurate here rather than a placeholder. A dashboard against a
real stack passes passwordAuth() instead, which
Install and wire the React packages covers.
The file leaves out the scaffold's import './index.css'. Delete src/index.css and src/App.css as well: the Vite
template's styles draw the Stats Lab title and chart headings in near-black on the devkit's dark background, and add
borders and centering to #root.
Run the app
From the stats-lab folder:
npm run devOpen the URL Vite prints (typically http://localhost:5173). You should see Stats Lab with histogram, trend line, stat cards,
and a sortable roster tab.
The MDK component catalogue lives in the monorepo, not in a published package. To browse those mining-oriented examples
alongside Stats Lab, clone the monorepo using the from-source path in the install guide, then run
npm --prefix ui run dev:catalog from the monorepo root. It serves under the /mdk base path, at
http://localhost:5173/mdk: same primitives, different story.
Why the agent stays accurate
The registry lists real exports with their prop types and usage docs, so the agent can't invent props that don't exist.
npx tsc -b remains the final verification against the real component APIs, and the app build catches the rest.
The scaffold's own build script runs the same command, and it is build mode that follows the project
references: a plain tsc --noEmit at the project root checks an empty file set and passes regardless.
Next steps
- Install and wire the React packages: the provider, hooks, and theming your generated pages rely on, and the manual path if you'd rather not use an agent
- Agent skills: the skill suite behind the lookups above
- Chart components:
BarChart,LineChart, and related data shapes - Tables:
DataTablesorting and pagination