panel-base-advanced
यह क्या करती है
यह स्किल AI एजेंट को सादे TypeScript में पूरी डैशबोर्ड पैनल बेस क्लास बनाना सिखाती है। यह उन डेवलपर्स के लिए है जिन्हें रीसाइज़ हैंडल, सहेजा लेआउट, एरर काउंटडाउन और सही क्लीनअप वाले पैनल चाहिए।
कब इस्तेमाल करें
- ✓जब आप चाहते हैं कि डैशबोर्ड पैनल रीलोड के बाद अपना आकार और लेआउट याद रखें।
- ✓जब पैनल को एरर काउंटडाउन दिखाना हो और एक्सपोनेंशियल बैकऑफ़ के साथ रीट्राई करना हो।
- ✓जब हटाए जाने पर पैनल को साफ़ destroy चरण चाहिए जो टाइमर और लिसनर हटाए।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/panel-base-advanced/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“TypeScript में डैशबोर्ड पैनल की बेस क्लास बनाइए जो अपना आकार याद रखे, एरर पर रीट्राई काउंटडाउन दिखाए, और हटाए जाने पर साफ़ हो जाए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट एक Panel क्लास बनाता है जिसमें हेडर, कंटेंट क्षेत्र और दो रीसाइज़ हैंडल होते हैं। वह लेआउट localStorage में सहेजता है, विफल fetch को बढ़ते अंतराल पर दोबारा करता है, एरर काउंटडाउन दिखाता है, और destroy मेथड में टाइमर साफ़ करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Resilient Panel — Unified Pattern (v2)
Create dashboard panel components using vanilla TypeScript (no framework, no JSX).
Each panel is a class extending a Panel base class and optionally wraps its data source with a CircuitBreaker.
Architecture Overview
Panel (base class)
├── element: HTMLElement (.panel)
│ ├── header: HTMLElement (.panel-header)
│ │ ├── headerLeft (.panel-header-left)
│ │ │ ├── title (.panel-title)
│ │ │ └── newBadge (.panel-new-badge) [optional, via setNewBadge()]
│ │ ├── statusBadge (.panel-data-badge) [optional, via setDataBadge()]
│ │ └── countEl (.panel-count) [optional]
│ ├── content: HTMLElement (.panel-content)
│ ├── resizeHandleRow (.panel-resize-handle-row) [bottom edge]
│ └── resizeHandleCol (.panel-resize-handle-col) [right edge]
Resilience layers (choose what you need)
| Layer | File | When to use |
|---|---|---|
| isFetching guard | Panel base class |
Always — prevents concurrent duplicate requests |
| Exponential-backoff retry | Panel.fetchWithRetry() |
When you own the fetch call and want per-request retry before surfacing an error |
| Error countdown in showError() | Panel base class |
Automatic retry countdown rendered inside the error state UI |
| CircuitBreaker | src/utils/circuit-breaker.ts |
When a service may fail repeatedly; stops hammering the API and serves stale cache instead |
| localStorage persistence | Panel.saveMap() / loadMap() |
When you want grid-span (not pixel size) state to survive page reloads |
Wrapping an existing service call with CircuitBreaker is a one-liner:
// Before const data = await fetchStockQuotes(); // After — adds caching + cooldown with zero refactor const data = await breaker.execute(() => fetchStockQuotes(), []);
File 1 — src/components/Panel.ts
Authoritative implementation. Use this verbatim; do not revert to the older
saveState()/loadState()width/height approach.
export interface PanelOptions {
id: string;
title: string;
showCount?: boolean;
className?: string;
}
export class Panel {
protected element: HTMLElement;
protected content: HTMLElement;
protected header: HTMLElement;
protected headerLeft: HTMLElement;
protected countEl: HTMLElement | null = null;
protected statusBadge: HTMLElement | null = null;
protected newBadge: HTMLElement | null = null;
protected panelId: string;
private _fetching = false;
private _countdownInterval: ReturnType<typeof setInterval> | null = null;
private _resizeListeners: Array<{ target: EventTarget; type: string; fn: EventListenerOrEventListenerObject }> = [];
// Retry state (used by fetchWithRetry)
protected retryAttempts = 0;
protected retryDelay = 1000; // ms; doubles each attempt
private maxRetries = 3;
constructor(options: PanelOptions) {
this.panelId = options.id;
this.element = document.createElement('div');
this.element.className = `panel${options.className ? ' ' + options.className : ''}`;
this.element.dataset.panel = options.id;
// Header
this.header = document.createElement('div');
this.header.className = 'panel-header';
this.headerLeft = document.createElement('div');
this.headerLeft.className = 'panel-header-left';
const title = document.createElement('span');
title.className = 'panel-title';
title.textContent = options.title;
this.headerLeft.appendChild(title);
this.header.appendChild(this.headerLeft);
// Count badge (optional)
if (options.showCount) {
this.countEl = document.createElement('span');
this.countEl.className = 'panel-count';
this.countEl.textContent = '0';
this.header.appendChild(this.countEl);
}
// Content area
this.content = document.createElement('div');
this.content.className = 'panel-content';
this.content.id = `${options.id}Content`;
// Dual resize handles
const resizeHandleRow = document.createElement('div');
resizeHandleRow.className = 'panel-resize-handle-row';
const resizeHandleCol = document.createElement('div');
resizeHandleCol.className = 'panel-resize-handle-col';
this.element.appendChild(this.header);
this.element.appendChild(this.content);
this.element.appendChild(resizeHandleRow);
this.element.appendChild(resizeHandleCol);
this._initResizeHandles(resizeHandleRow, resizeHandleCol);
this.sh
अक्सर पूछे जाने वाले सवाल
destroy मेथड क्या करती है?
स्किल के अनुसार वह टाइमर और इवेंट हैंडलर साफ़ करती है, ताकि हटाए गए पैनल चलते न रहें।
रीट्राई कैसे काम करता है?
स्किल एक्सपोनेंशियल बैकऑफ़ इस्तेमाल करती है, इसलिए हर रीट्राई पिछले से ज़्यादा देर रुकता है।
लेआउट कहां सहेजा जाता है?
स्किल लेआउट की स्थिति localStorage में सहेजती है, जो उसी ब्राउज़र में पेज लोड के बीच बनी रहती है।
जानकारी
लेखक का मूल विवरण
Unified guide for authoring dashboard panel components in vanilla TypeScript — covers the authoritative Panel base class (grid-span persistence, dual resize handles, radar loading animation, exponential-backoff error countdown, data/new badge helpers, full destroy() cleanup), localStorage state via loadMap/saveMap, exponential-backoff retry, and CircuitBreaker integration. Shows how to wrap any existing fetchX() service call with CircuitBreaker.execute() as a one-liner and clarifies when each resilience layer is appropriate.
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #13062
- लाइसेंस
- 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 फॉलो करवाता है।