panel-component-aggregator
Skill này làm gì
Skill này hướng dẫn AI agent xây dựng một panel tổng hợp không tự lấy dữ liệu. Nó dành cho nhà phát triển muốn một panel kết hợp dữ liệu mà các panel khác đã tải.
Khi nào nên dùng
- ✓Khi một panel tổng hợp nên kết hợp dữ liệu mà các panel khác đã lấy.
- ✓Khi dữ liệu đến vào những thời điểm khác nhau và phần tổng hợp phải cập nhật mỗi lần.
- ✓Khi bạn muốn tránh các lệnh gọi mạng thừa từ một panel chỉ hiển thị tổng hoặc tóm tắt.
Liên kết skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/panel-component-aggregator/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xây dựng một panel tổng hợp cộng các số được đẩy vào từ panel cổ phiếu và panel bán hàng của tôi, và chỉ hiển thị khi đã có đủ dữ liệu.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent tạo một lớp cơ sở aggregator lưu dữ liệu từng phần được đẩy vào và theo dõi những trường nào đã đến. Nó chờ đến khi các trường bắt buộc có mặt rồi mới render lần đầu, và render lại mỗi khi có dữ liệu mới được đẩy vào.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Aggregator Panel Component Pattern
Create aggregator dashboard panel components using vanilla TypeScript (no framework, no JSX).
An aggregator panel does not fetch data itself. Instead, it receives partial data pushes from sibling panels (or a coordinator) via updateData(partial), defers its first render until enough data has arrived, and re-renders incrementally on each subsequent push.
This skill is self-contained. It covers the base Panel class, the AggregatorPanel generic base class, and a concrete example (SummaryPanel).
When to Use This Pattern
| Use case | Fetching Panel | Aggregator Panel |
|---|---|---|
| Panel owns its own API endpoint | yes | no |
| Panel summarises data from multiple sources | no | yes |
| Data arrives asynchronously from siblings | no | yes |
| Re-renders on each push without extra network calls | no | yes |
Architecture Overview
Panel (base class)
└── AggregatorPanel<TData> (generic aggregator base)
├── partialData: Partial<TData> — accumulated pushed fields
├── receivedKeys: Set<keyof TData> — tracks which keys have arrived
├── requiredKeys: (keyof TData)[] — keys needed before first render
├── lastUpdated: Map<keyof TData, number> — staleness timestamps
└── SummaryPanel (concrete example)
Data flow:
StockPanel ──pushes──► coordinator.push('stocks', quotes)
EmailPanel ──pushes──► coordinator.push('emails', messages)
│
AggregatorPanel.updateData({ stocks, emails })
│
┌──────────▼──────────┐
│ enough data yet? │
│ no → showPending │
│ yes → render() │
└─────────────────────┘
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;
constructor(options: PanelOptions) {
this.panelId = options.id;
this.element = document.createElement('div');
this.element.className = `panel ${options.className || ''}`.trim();
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);
if (options.showCount) {
this.countEl = document.createElement('span');
this.countEl.className = 'panel-count';
this.countEl.textContent = '0';
this.header.appendChild(this.countEl);
}
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);
}
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>`;
}
/** Show a "waiting for data" placeholder — softer than showLoading */
public showPending(message = 'Waiting for data\u2026'): void {
this.content.innerHTML = `
<div class="panel-pending">
<div class="panel-pending-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.c
Câu hỏi thường gặp
Panel tổng hợp có tự gọi API không?
Không, skill nói các panel aggregator nhận dữ liệu được đẩy từ panel anh em hoặc từ bộ điều phối.
Khi nào nó hiển thị lần đầu?
Nó chờ đến khi mọi trường dữ liệu bắt buộc đã đến, rồi render lần đầu.
Làm sao theo dõi độ mới của dữ liệu?
Skill giữ dấu thời gian cho từng trường, nên có thể nhận ra các giá trị đã cũ.
Chi tiết
Mô tả gốc của tác giả
Dashboard panel component pattern for aggregator/summary panels that accept pushed partial data updates via updateData(), defer rendering until first data arrives, and incrementally re-render metrics without re-fetching — ideal for panels that synthesize data already fetched by other panels.
repo: HKUDS/AgentPilot
Độ phổ biến
- Sao GitHub
- 7.8k
- Vị trí xếp hạng
- #13065
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agentpilot
7.8kGiúp agent của bạn cải thiện dự án từng bước bằng cách chuẩn bị tác vụ và chạy vòng lặp AgentPilot, gồm đề xuất, kiểm thử và chấm điểm thay đổi.
openspace
7.8kGiúp agent của bạn thiết lập OpenSpace, công cụ lưu và lấy lại skill của agent, rồi kết nối nó với ứng dụng AI của bạn qua MCP.
rsi-arena
7.8kGiúp agent của bạn thiết lập và chạy các bài kiểm thử benchmark AI chuẩn, như AIME và Terminal-Bench, để so sánh các phương pháp cải tiến khác nhau.
experiment-guide
7.8kGiúp agent của bạn lên kế hoạch các thí nghiệm nhỏ, đọc kết quả và ghi lại phát hiện khi tìm cách cải thiện một chương trình.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.