panel-component-with-push-sidebar
What it does
This skill guides the AI agent to build two kinds of dashboard UI in plain TypeScript. It is for developers who need some panels to fetch their own data and other components to receive data pushed from outside.
When to use it
- βWhen a panel should fetch its own data on a timer.
- βWhen a sidebar component receives data pushed in by another part of the app.
- βWhen you want retries, saved state and safe CSS injection in these components.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/panel-component-with-push-sidebar/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 self-refreshing panel for prices and a sidebar that shows alerts pushed in from my app. Use plain TypeScript.β
5 new skills a week. 1 minute to read.
How it works
The agent builds a Panel class for components that fetch on their own, with retries, saved state and layout. For push-driven components it builds a functional module that the app calls with new data, and it injects CSS only once.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Panel & Push-Update Sidebar Patterns
Two complementary patterns for building dashboard UI in vanilla TypeScript (no framework, no JSX):
| Pattern | Use when⦠|
|---|---|
Panel class (extends Panel) |
The component fetches its own data on a timer |
| Push-update sidebar module | Data arrives from outside (caller pushes it in) |
Part 1 β Panel Class Pattern
Architecture Overview
Panel (base class)
βββ element: HTMLElement (outer container, .panel)
β βββ header: HTMLElement (.panel-header)
β β βββ headerLeft (.panel-header-left)
β β β βββ title (.panel-title)
β β β βββ newBadge (.panel-new-badge) [optional]
β β βββ statusBadge (.panel-data-badge) [optional]
β β βββ countEl (.panel-count) [optional]
β βββ content: HTMLElement (.panel-content)
β βββ resizeHandle (.panel-resize-handle)
Base Panel Class
Create src/components/Panel.ts:
export interface PanelOptions {
id: string;
title: string;
showCount?: boolean;
className?: string;
}
export class Panel {
protected element: HTMLElement;
protected content: HTMLElement;
protected header: HTMLElement;
protected countEl: HTMLElement | null = null;
protected panelId: string;
private _fetching = false;
// --- Retry state (reset before each logical fetch sequence) ---
private retryAttempts = 0;
private maxRetries = 3;
private retryDelay = 1000; // ms; doubles on each attempt
constructor(options: PanelOptions) {
this.panelId = options.id;
this.element = document.createElement('div');
this.element.className = `panel ${options.className || ''}`;
this.element.dataset.panel = options.id;
// Header
this.header = document.createElement('div');
this.header.className = 'panel-header';
const headerLeft = document.createElement('div');
headerLeft.className = 'panel-header-left';
const title = document.createElement('span');
title.className = 'panel-title';
title.textContent = options.title;
headerLeft.appendChild(title);
this.header.appendChild(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`;
this.element.appendChild(this.header);
this.element.appendChild(this.content);
this.showLoading();
}
// ----------------------------------------------------------------
// Public API
// ----------------------------------------------------------------
public getElement(): HTMLElement { return this.element; }
public showLoading(message = 'Loading...'): void {
this.content.innerHTML = `
<div class="panel-loading">
<div class="panel-loading-spinner"></div>
<div class="panel-loading-text">${message}</div>
</div>`;
}
public showError(message = 'Failed to load', onRetry?: () => void): void {
this.content.innerHTML = `
<div class="panel-error-state">
<div class="panel-error-msg">${message}</div>
${onRetry ? '<button class="panel-retry-btn" data-panel-retry>Retry</button>' : ''}
</div>`;
if (onRetry) {
this.content.querySelector('[data-panel-retry]')
?.addEventListener('click', onRetry);
}
}
public setContent(html: string): void { this.content.innerHTML = html; }
public setCount(count: number): void {
if (this.countEl) this.countEl.textContent = count.toString();
}
public show(): void { this.element.classList.remove('hidden'); }
public hide(): void { this.element.classList.add('hidden'); }
public destroy(): void { this.element.remove(); }
// ----------------------------------------------------------------
// Protected API β available in subclasses
// ----------------------------------------------------------------
protected setFetching(v: boolean): void { this._fetching = v; }
protected get isFetching(): boolean { return this._fetching; }
/**
* Fetch a URL with exponential-backoff retry.
* Call resetRetry() before each new fetch sequence.
*/
protected async fetchWithRetry(url: string): Promise<unknown> {
while (this.retryAttempts < this.maxRetries) {
try {
const res = await fetc
FAQ
What is the difference between the two?
Panels fetch their own data, while push-update modules wait for the app to send them data.
Why inject CSS only once?
The skill uses a guard so the same styles are not added to the page more than once.
Does this use a framework?
No, the skill uses the vanilla TypeScript DOM API with no framework.
Details
Original description by the author
Dashboard panel components (class-based, self-fetching) and push-update sidebar modules (functional, externally-driven) using vanilla TypeScript DOM API, with retry logic, localStorage persistence, and guarded CSS injection.
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #13067
- 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.