data-driven-panel
What it does
This skill shows the AI agent how to build a dashboard panel that loads and manages its own data. It is for developers who want panels that keep working when an API is flaky.
When to use it
- βWhen a dashboard panel must load its own data from an API.
- βWhen an API fails often and the panel should stop hammering it.
- βWhen you want caching and failure handling built into each panel.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/data-driven-panel/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βBuild a dashboard panel that fetches our sales numbers and falls back to cached data when the API is down.β
5 new skills a week. 1 minute to read.
How it works
The agent creates a base panel class with a header and content area. Each panel pairs with an internal data service that uses a circuit breaker and a cache, so repeated failures trigger a cooldown and the panel shows stored data.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Data-Driven Panel Pattern
Create dashboard panels that seamlessly integrate UI construction with resilient data fetching. Each panel is a self-contained component that manages its own data lifecycle.
Architecture Overview
Panel (base class)
βββ element: HTMLElement (outer container)
β βββ header (title, status indicators)
β βββ content (data display area)
βββ DataService (internal)
βββ Circuit Breaker (failure handling)
βββ Caching layer
Implementation
1. Base Panel with Integrated Data Service
Create src/components/DataPanel.ts:
import { createCircuitBreaker } from '../utils/circuit-breaker';
export interface PanelOptions<T> {
id: string;
title: string;
showCount?: boolean;
className?: string;
dataService: () => Promise<T>;
defaultValue: T;
serviceOptions?: {
maxFailures?: number;
cooldownMs?: number;
cacheTtlMs?: number;
};
}
export abstract class DataPanel<T> {
protected element: HTMLElement;
protected content: HTMLElement;
private breaker: CircuitBreaker<T>;
private refreshTimer: ReturnType<typeof setInterval> | null = null;
constructor(protected options: PanelOptions<T>) {
this.breaker = createCircuitBreaker<T>({
name: options.id,
maxFailures: options.serviceOptions?.maxFailures ?? 2,
cooldownMs: options.serviceOptions?.cooldownMs ?? 300_000,
cacheTtlMs: options.serviceOptions?.cacheTtlMs ?? 60_000,
});
this.element = document.createElement('div');
this.element.className = `panel ${options.className || ''}`;
this.element.dataset.panel = options.id;
// Initialize UI
this.initUI();
this.fetchData();
}
private initUI(): void {
// Header setup
const header = document.createElement('div');
header.className = 'panel-header';
const title = document.createElement('span');
title.className = 'panel-title';
title.textContent = this.options.title;
header.appendChild(title);
// Content area
this.content = document.createElement('div');
this.content.className = 'panel-content';
this.element.appendChild(header);
this.element.appendChild(this.content);
this.showLoading();
}
protected async fetchData(): Promise<void> {
try {
const data = await this.breaker.execute(
this.options.dataService,
this.options.defaultValue
);
this.render(data);
} catch (err) {
this.showError('Failed to load data', () => this.fetchData());
}
}
protected abstract render(data: T): void;
public showLoading(message = 'Loading...'): void {
this.content.innerHTML = `<div class="loading">${message}</div>`;
}
public showError(message: string, retryHandler: () => void): void {
this.content.innerHTML = `
<div class="error">
<p>${message}</p>
<button class="retry-btn">Retry</button>
</div>`;
this.content.querySelector('.retry-btn')?.addEventListener('click', retryHandler);
}
public setAutoRefresh(intervalMs: number): void {
this.refreshTimer = setInterval(() => this.fetchData(), intervalMs);
}
public destroy(): void {
if (this.refreshTimer) clearInterval(this.refreshTimer);
this.element.remove();
}
}
2. Concrete Panel Implementation Example
import { DataPanel } from './DataPanel';
interface StockData {
quotes: StockQuote[];
updatedAt: string;
}
export class StockPanel extends DataPanel<StockData> {
constructor() {
super({
id: 'stocks',
title: 'Stock Market',
dataService: fetchStockData,
defaultValue: { quotes: [], updatedAt: new Date().toISOString() },
serviceOptions: {
cacheTtlMs: 30_000 // Refresh cache every 30 seconds
}
});
this.setAutoRefresh(60_000); // Auto-refresh every minute
}
protected render(data: StockData): void {
const html = data.quotes.map(quote => `
<div class="stock-item">
<span class="symbol">${quote.symbol}</span>
<span class="price">$${quote.price?.toFixed(2) || 'β'}</span>
</div>
`).join('');
this.content.innerHTML = `
<div class="stock-list">
${html}
<div class="updated">Updated: ${new Date(data.updatedAt).toLocaleTimeString()}</div>
</div>`;
}
}
3. Data Service Implementation
// src/services/stockService.ts
interface StockQuote {
symbol: string;
price: number | null;
}
export async function fetchStock
FAQ
What is a circuit breaker here?
It is a safety switch that pauses calls to a failing API for a cooldown period and serves cached data instead.
How are the panel's defaults set?
The skill sets default values for max failures, cooldown and cache time, which can be changed in the options.
Does the panel refresh on a timer?
The base class includes a refresh timer for updating the data.
Details
Original description by the author
Create dashboard panel components with integrated resilient data services, combining UI construction and data fetching into a unified pattern.
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #13046
- License
- MIT
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.