data-driven-panel
यह क्या करती है
यह स्किल AI एजेंट को ऐसा डैशबोर्ड पैनल बनाना सिखाती है जो अपना डेटा खुद लोड और मैनेज करता है। यह उन डेवलपर्स के लिए है जिन्हें ऐसे पैनल चाहिए जो API अस्थिर होने पर भी चलते रहें।
कब इस्तेमाल करें
- ✓जब डैशबोर्ड पैनल को किसी API से अपना डेटा खुद लोड करना हो।
- ✓जब कोई API बार-बार फेल होती है और पैनल को उसे लगातार कॉल नहीं करना चाहिए।
- ✓जब आप हर पैनल में कैशिंग और विफलता संभालना चाहते हैं।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/data-driven-panel/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक डैशबोर्ड पैनल बनाइए जो हमारे बिक्री आंकड़े लाए, और API बंद होने पर कैश्ड डेटा दिखाए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट हेडर और कंटेंट क्षेत्र वाली एक बेस पैनल क्लास बनाता है। हर पैनल एक आंतरिक डेटा सर्विस से जुड़ता है जो सर्किट ब्रेकर और कैश इस्तेमाल करती है, ताकि बार-बार फेल होने पर कूलडाउन लगे और पैनल सहेजा हुआ डेटा दिखाए।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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
अक्सर पूछे जाने वाले सवाल
यहां सर्किट ब्रेकर क्या है?
यह एक सुरक्षा स्विच है जो फेल होती API की कॉल कूलडाउन अवधि के लिए रोकता है और उसके बजाय कैश्ड डेटा देता है।
पैनल की डिफ़ॉल्ट सेटिंग क्या हैं?
स्किल अधिकतम विफलताओं, कूलडाउन और कैश समय के डिफ़ॉल्ट मान तय करती है, जिन्हें विकल्पों में बदला जा सकता है।
क्या पैनल टाइमर पर रिफ़्रेश होता है?
हां, बेस क्लास में डेटा अपडेट करने के लिए रिफ़्रेश टाइमर शामिल है।
जानकारी
लेखक का मूल विवरण
Create dashboard panel components with integrated resilient data services, combining UI construction and data fetching into a unified pattern.
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #13046
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।