본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)7.8k · #13062

panel-base-advanced

하는 일

이 스킬은 순수 TypeScript로 완전한 대시보드 패널 기본 클래스를 만드는 방법을 AI 에이전트에게 보여 줍니다. 크기 조절 핸들, 저장된 레이아웃, 오류 카운트다운, 올바른 정리 기능을 갖춘 패널을 원하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓새로고침 뒤에도 패널 크기와 레이아웃을 기억하는 대시보드 패널을 원할 때.
  • ✓패널이 오류 카운트다운을 보여 주고 지수 백오프로 재시도해야 할 때.
  • ✓패널을 제거할 때 타이머와 리스너를 지우는 깔끔한 정리 단계가 필요할 때.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/panel-base-advanced/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/panel-base-advanced/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“크기를 기억하고, 오류가 나면 재시도 카운트다운을 보여 주고, 제거될 때 정리하는 TypeScript 대시보드 패널 기본 클래스를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 헤더, 콘텐츠 영역, 두 개의 크기 조절 핸들이 있는 Panel 클래스를 만듭니다. 레이아웃을 localStorage에 저장하고, 실패한 가져오기는 점점 길어지는 지연 후 재시도하며, 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
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬