[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HX7F9Y5SP6X104JY37YZMJ":3,"skill-same:01M6HX7F9Y5SP6X104JY37YZMJ":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":6,"updatedAt":48,"install":49,"resources":62},"01M6HX7F9Y5SP6X104JY37YZMJ","data-driven-panel",null,"Create dashboard panel components with integrated resilient data services, combining UI construction and data fetching into a unified pattern.","HKUDS\u002FAgentPilot","HKUDS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118165258?v=4","01M6HW8VRNZP64G0P4MVJW2KKQ","✨Data Intelligence Lab@HKU✨","01M6HW8VWZVHBRHYH3T330PFWV",8029,"MIT","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Fdata-driven-panel\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[24,25,26,27,28,29,30,31,32,33,34,35],"data","driven","panel","data driven panel","dashboard","components","create","ui","services","pattern","with","data fetching","2026-11-10 10:12:30",false,"---\nname: data-driven-panel\ndescription: Create dashboard panel components with integrated resilient data services, combining UI construction and data fetching into a unified pattern.\n---\n\n# Data-Driven Panel Pattern\n\nCreate dashboard panels that seamlessly integrate UI construction with resilient data fetching. Each panel is a self-contained component that manages its own data lifecycle.\n\n## Architecture Overview\n\n```\nPanel (base class)\n├── element: HTMLElement (outer container)\n│   ├── header (title, status indicators)\n│   └── content (data display area)\n└── DataService (internal)\n    ├── Circuit Breaker (failure handling)\n    └── Caching layer\n```\n\n## Implementation\n\n### 1. Base Panel with Integrated Data Service\n\nCreate `src\u002Fcomponents\u002FDataPanel.ts`:\n\n```typescript\nimport { createCircuitBreaker } from '..\u002Futils\u002Fcircuit-breaker';\n\nexport interface PanelOptions\u003CT> {\n  id: string;\n  title: string;\n  showCount?: boolean;\n  className?: string;\n  dataService: () => Promise\u003CT>;\n  defaultValue: T;\n  serviceOptions?: {\n    maxFailures?: number;\n    cooldownMs?: number;\n    cacheTtlMs?: number;\n  };\n}\n\nexport abstract class DataPanel\u003CT> {\n  protected element: HTMLElement;\n  protected content: HTMLElement;\n  private breaker: CircuitBreaker\u003CT>;\n  private refreshTimer: ReturnType\u003Ctypeof setInterval> | null = null;\n\n  constructor(protected options: PanelOptions\u003CT>) {\n    this.breaker = createCircuitBreaker\u003CT>({\n      name: options.id,\n      maxFailures: options.serviceOptions?.maxFailures ?? 2,\n      cooldownMs: options.serviceOptions?.cooldownMs ?? 300_000,\n      cacheTtlMs: options.serviceOptions?.cacheTtlMs ?? 60_000,\n    });\n\n    this.element = document.createElement('div');\n    this.element.className = `panel ${options.className || ''}`;\n    this.element.dataset.panel = options.id;\n\n    \u002F\u002F Initialize UI\n    this.initUI();\n    this.fetchData();\n  }\n\n  private initUI(): void {\n    \u002F\u002F Header setup\n    const header = document.createElement('div');\n    header.className = 'panel-header';\n    \n    const title = document.createElement('span');\n    title.className = 'panel-title';\n    title.textContent = this.options.title;\n    header.appendChild(title);\n\n    \u002F\u002F Content area\n    this.content = document.createElement('div');\n    this.content.className = 'panel-content';\n\n    this.element.appendChild(header);\n    this.element.appendChild(this.content);\n    this.showLoading();\n  }\n\n  protected async fetchData(): Promise\u003Cvoid> {\n    try {\n      const data = await this.breaker.execute(\n        this.options.dataService,\n        this.options.defaultValue\n      );\n      this.render(data);\n    } catch (err) {\n      this.showError('Failed to load data', () => this.fetchData());\n    }\n  }\n\n  protected abstract render(data: T): void;\n\n  public showLoading(message = 'Loading...'): void {\n    this.content.innerHTML = `\u003Cdiv class=\"loading\">${message}\u003C\u002Fdiv>`;\n  }\n\n  public showError(message: string, retryHandler: () => void): void {\n    this.content.innerHTML = `\n      \u003Cdiv class=\"error\">\n        \u003Cp>${message}\u003C\u002Fp>\n        \u003Cbutton class=\"retry-btn\">Retry\u003C\u002Fbutton>\n      \u003C\u002Fdiv>`;\n    this.content.querySelector('.retry-btn')?.addEventListener('click', retryHandler);\n  }\n\n  public setAutoRefresh(intervalMs: number): void {\n    this.refreshTimer = setInterval(() => this.fetchData(), intervalMs);\n  }\n\n  public destroy(): void {\n    if (this.refreshTimer) clearInterval(this.refreshTimer);\n    this.element.remove();\n  }\n}\n```\n\n### 2. Concrete Panel Implementation Example\n\n```typescript\nimport { DataPanel } from '.\u002FDataPanel';\n\ninterface StockData {\n  quotes: StockQuote[];\n  updatedAt: string;\n}\n\nexport class StockPanel extends DataPanel\u003CStockData> {\n  constructor() {\n    super({\n      id: 'stocks',\n      title: 'Stock Market',\n      dataService: fetchStockData,\n      defaultValue: { quotes: [], updatedAt: new Date().toISOString() },\n      serviceOptions: {\n        cacheTtlMs: 30_000 \u002F\u002F Refresh cache every 30 seconds\n      }\n    });\n    this.setAutoRefresh(60_000); \u002F\u002F Auto-refresh every minute\n  }\n\n  protected render(data: StockData): void {\n    const html = data.quotes.map(quote => `\n      \u003Cdiv class=\"stock-item\">\n        \u003Cspan class=\"symbol\">${quote.symbol}\u003C\u002Fspan>\n        \u003Cspan class=\"price\">$${quote.price?.toFixed(2) || '—'}\u003C\u002Fspan>\n      \u003C\u002Fdiv>\n    `).join('');\n    \n    this.content.innerHTML = `\n      \u003Cdiv class=\"stock-list\">\n        ${html}\n        \u003Cdiv class=\"updated\">Updated: ${new Date(data.updatedAt).toLocaleTimeString()}\u003C\u002Fdiv>\n      \u003C\u002Fdiv>`;\n  }\n}\n```\n\n### 3. Data Service Implementation\n\n```typescript\n\u002F\u002F src\u002Fservices\u002FstockService.ts\ninterface StockQuote {\n  symbol: string;\n  price: number | null;\n}\n\nexport async function fetchStockData(): Promise\u003CStockData> {\n  const response = await fetch('\u002Fapi\u002Fstocks');\n  if (!response.ok) throw new Error(`HTTP ${response.status}`);\n  const quotes: StockQuote[] = await response.json();\n  return {\n    quotes,\n    updatedAt: new Date().toISOString()\n  };\n}\n```\n\n## Key Benefits\n\n1. **Unified Pattern**: Combines UI and data logic in one coherent pattern\n2. **Resilient Data Fetching**: Built-in circuit breaker and caching\n3. **Simplified Implementation**: Concrete panels only need to implement rendering\n4. **Consistent Behavior**: All panels share the same loading\u002Ferror states\n5. **Flexible Configuration**: Service options customizable per panel\n\n## Best Practices\n\n1. **Service Composition**: Create small, focused services for each data type\n2. **Default Values**: Always provide meaningful fallback data\n3. **Error Boundaries**: Use the built-in error handling for consistency\n4. **Memory Management**: Clean up timers and event listeners in destroy()\n5. **Type Safety**: Maintain strong typing throughout the data flow\n","# Data-Driven Panel Pattern\n\nCreate dashboard panels that seamlessly integrate UI construction with resilient data fetching. Each panel is a self-contained component that manages its own data lifecycle.\n\n## Architecture Overview\n\n```\nPanel (base class)\n├── element: HTMLElement (outer container)\n│   ├── header (title, status indicators)\n│   └── content (data display area)\n└── DataService (internal)\n    ├── Circuit Breaker (failure handling)\n    └── Caching layer\n```\n\n## Implementation\n\n### 1. Base Panel with Integrated Data Service\n\nCreate `src\u002Fcomponents\u002FDataPanel.ts`:\n\n```typescript\nimport { createCircuitBreaker } from '..\u002Futils\u002Fcircuit-breaker';\n\nexport interface PanelOptions\u003CT> {\n  id: string;\n  title: string;\n  showCount?: boolean;\n  className?: string;\n  dataService: () => Promise\u003CT>;\n  defaultValue: T;\n  serviceOptions?: {\n    maxFailures?: number;\n    cooldownMs?: number;\n    cacheTtlMs?: number;\n  };\n}\n\nexport abstract class DataPanel\u003CT> {\n  protected element: HTMLElement;\n  protected content: HTMLElement;\n  private breaker: CircuitBreaker\u003CT>;\n  private refreshTimer: ReturnType\u003Ctypeof setInterval> | null = null;\n\n  constructor(protected options: PanelOptions\u003CT>) {\n    this.breaker = createCircuitBreaker\u003CT>({\n      name: options.id,\n      maxFailures: options.serviceOptions?.maxFailures ?? 2,\n      cooldownMs: options.serviceOptions?.cooldownMs ?? 300_000,\n      cacheTtlMs: options.serviceOptions?.cacheTtlMs ?? 60_000,\n    });\n\n    this.element = document.createElement('div');\n    this.element.className = `panel ${options.className || ''}`;\n    this.element.dataset.panel = options.id;\n\n    \u002F\u002F Initialize UI\n    this.initUI();\n    this.fetchData();\n  }\n\n  private initUI(): void {\n    \u002F\u002F Header setup\n    const header = document.createElement('div');\n    header.className = 'panel-header';\n    \n    const title = document.createElement('span');\n    title.className = 'panel-title';\n    title.textContent = this.options.title;\n    header.appendChild(title);\n\n    \u002F\u002F Content area\n    this.content = document.createElement('div');\n    this.content.className = 'panel-content';\n\n    this.element.appendChild(header);\n    this.element.appendChild(this.content);\n    this.showLoading();\n  }\n\n  protected async fetchData(): Promise\u003Cvoid> {\n    try {\n      const data = await this.breaker.execute(\n        this.options.dataService,\n        this.options.defaultValue\n      );\n      this.render(data);\n    } catch (err) {\n      this.showError('Failed to load data', () => this.fetchData());\n    }\n  }\n\n  protected abstract render(data: T): void;\n\n  public showLoading(message = 'Loading...'): void {\n    this.content.innerHTML = `\u003Cdiv class=\"loading\">${message}\u003C\u002Fdiv>`;\n  }\n\n  public showError(message: string, retryHandler: () => void): void {\n    this.content.innerHTML = `\n      \u003Cdiv class=\"error\">\n        \u003Cp>${message}\u003C\u002Fp>\n        \u003Cbutton class=\"retry-btn\">Retry\u003C\u002Fbutton>\n      \u003C\u002Fdiv>`;\n    this.content.querySelector('.retry-btn')?.addEventListener('click', retryHandler);\n  }\n\n  public setAutoRefresh(intervalMs: number): void {\n    this.refreshTimer = setInterval(() => this.fetchData(), intervalMs);\n  }\n\n  public destroy(): void {\n    if (this.refreshTimer) clearInterval(this.refreshTimer);\n    this.element.remove();\n  }\n}\n```\n\n### 2. Concrete Panel Implementation Example\n\n```typescript\nimport { DataPanel } from '.\u002FDataPanel';\n\ninterface StockData {\n  quotes: StockQuote[];\n  updatedAt: string;\n}\n\nexport class StockPanel extends DataPanel\u003CStockData> {\n  constructor() {\n    super({\n      id: 'stocks',\n      title: 'Stock Market',\n      dataService: fetchStockData,\n      defaultValue: { quotes: [], updatedAt: new Date().toISOString() },\n      serviceOptions: {\n        cacheTtlMs: 30_000 \u002F\u002F Refresh cache every 30 seconds\n      }\n    });\n    this.setAutoRefresh(60_000); \u002F\u002F Auto-refresh every minute\n  }\n\n  protected render(data: StockData): void {\n    const html = data.quotes.map(quote => `\n      \u003Cdiv class=\"stock-item\">\n        \u003Cspan class=\"symbol\">${quote.symbol}\u003C\u002Fspan>\n        \u003Cspan class=\"price\">$${quote.price?.toFixed(2) || '—'}\u003C\u002Fspan>\n      \u003C\u002Fdiv>\n    `).join('');\n    \n    this.content.innerHTML = `\n      \u003Cdiv class=\"stock-list\">\n        ${html}\n        \u003Cdiv class=\"updated\">Updated: ${new Date(data.updatedAt).toLocaleTimeString()}\u003C\u002Fdiv>\n      \u003C\u002Fdiv>`;\n  }\n}\n```\n\n### 3. Data Service Implementation\n\n```typescript\n\u002F\u002F src\u002Fservices\u002FstockService.ts\ninterface StockQuote {\n  symbol: string;\n  price: number | null;\n}\n\nexport async function fetchStockData(): Promise\u003CStockData> {\n  const response = await fetch('\u002Fapi\u002Fstocks');\n  if (!response.ok) throw new Error(`HTTP ${response.status}`);\n  const quotes: StockQuote[] = await response.json();\n  return {\n    quotes,\n    updatedAt: new Date().toISOString()\n  };\n}\n```\n\n## Key Benefits\n\n1. **Unified Pattern**: Combines UI and data logic in one coherent pattern\n2. **Resilient Data Fetching**: Built-in circuit breaker and caching\n3. **Simplified Implementation**: Concrete panels only need to implement rendering\n4. **Consistent Behavior**: All panels share the same loading\u002Ferror states\n5. **Flexible Configuration**: Service options customizable per panel\n\n## Best Practices\n\n1. **Service Composition**: Create small, focused services for each data type\n2. **Default Values**: Always provide meaningful fallback data\n3. **Error Boundaries**: Use the built-in error handling for consistency\n4. **Memory Management**: Clean up timers and event listeners in destroy()\n5. **Type Safety**: Maintain strong typing throughout the data flow\n",{"name":5,"description":7},"main","6b84b0689ca0d9e7b1e4061188ff6b60758e0f8a","openspace\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Fdata-driven-panel",944,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot","https:\u002F\u002Fgithub.com\u002FHKUDS","https:\u002F\u002Fsites.google.com\u002Fview\u002Fchaoh","2026-11-12 22:26:39",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add HKUDS\u002FAgentPilot --skill data-driven-panel",{"tool":55,"command":56},"bunx","bunx skills add HKUDS\u002FAgentPilot --skill data-driven-panel",{"tool":58,"command":59},"pnpm","pnpm dlx skills add HKUDS\u002FAgentPilot --skill data-driven-panel","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Fdata-driven-panel\u002FSKILL.md",true,[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},".skill_id","OTHER","其他",36,"https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fexamples\u002Fmy-daily-monitor\u002Fskills\u002Fdata-driven-panel\u002F.skill_id",[70,89,108,133,157,180],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":36},"01M6HYB297NDABRERJRVG0K8R0","agentpilot","Set up AgentPilot and use its single entry to prepare missing inputs and run configured RSI experiments. Use when the user requests AgentPilot installation or work with AgentPilot.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fplugins\u002Fagentpilot\u002Fskills\u002Fagentpilot\u002FSKILL.md",[],[72,77,78,34,79,80,81,82,83,84,85,86,87,88],"prepare","requests","missing","installation","rsi","up","use","user","work","SET","run","experiments",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":36},"01M6HYAYWXTTE1J7DJM0MFNQ4H","remember","Review auto-memory entries and propose promotions to OPENSPACE.md, OPENSPACE.local.md, or retained auto-memory topics; detect duplicates, stale facts, conflicts, and ambiguous entries before making changes.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fskills\u002Fremember\u002FSKILL.md",[],[91,96,97,98,99,100,101,102,103,104,105,106,107],"memory","review","auto","openspace","changes","facts","detect","entries","local","conflicts","stale","duplicates",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":119,"publishedAt":36},"01M6HYAVMPM4SBDV60R2B5HPV8","skill-discovery","Search reusable OpenSpace skills locally, and browse cloud packages step by step when a cloud skill may help. Reusing proven skills saves tokens, improves reliability, and extends your capabilities beyond built-in tools.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fskill-discovery\u002FSKILL.md",[114],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[120,121,122,99,123,124,125,126,127,128,129,130,131,132],"skill discovery","discovery","reusable","step by step","tokens","packages","help","cloud","reliability","capabilities","browse","search","Tools",{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":140,"publishedAt":36},"01M6HYAR811B3RB0M50RBEDGN6","delegate-task","Delegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Fopenspace\u002Fhost_skills\u002Fdelegate-task\u002FSKILL.md",[139],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},[141,142,143,99,144,145,146,147,148,122,98,83,149,150,151,152,153,154,155,156],"delegate","task","delegate task","time","improve","desktop automation","worker","community","autonomous","tool","stack","for","share","tasks","automation","MCP",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":36},"01M6HYAM9FSGV6E52AYENDQXYH","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[164,165,166,167,168,169,170,171,172,173,174,175,176,177,152,178,179],"write special chars ts check","write","check","type","files","filters","only","template","file","python","typescript","output","Existing","type-checking","errors","script",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":36},"01M6HYAH05HGV7SVWSVR8PJRQD","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FHKUDS\u002FAgentPilot\u002Fblob\u002Fmain\u002Fopenspace\u002Flegacy\u002Fv1\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[187,188,165,34,152,179,189,190,191,192,193,171,172,194,195,173],"write special chars readback","readback","helper","post","via","scripts","read","verification","cleanup"]