Playground

作者 cline26378461e978無授權條款34 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 個月前更新

Creates interactive HTML playgrounds — self-contained single-file explorers that let users configure something visually through controls, see a live preview, and copy out a prompt. Use when the user asks to make a playground, explorer, or interactive tool for a topic.

AI 產生的概覽

建立自帶內容的互動式 HTML 遊樂場,包含控制項、即時預覽與可複製的提示詞輸出。

功能
此技能引導代理產生單一自帶內容的 HTML 檔案,把互動控制項、即時預覽與自動產生的自然語言提示詞結合在一起。它會從六個內建範本(設計、資料探索、概念圖、文件審閱、差異檢視、程式碼地圖)中挑選一個,並依使用者主題調整。產出是一個深色主題、沒有外部相依性的檔案,可在瀏覽器中開啟,具備預設組合、合理預設值與剪貼簿複製按鈕。
適用情境
當使用者要求針對某個主題製作互動式遊樂場、探索工具或視覺化工具時使用,尤其是當輸入空間龐大、偏視覺或結構化、難以用純文字表達時。它適合視覺設計決策、查詢建構、概念梳理、文件審閱、程式碼審閱與程式庫架構探索。
執行需求
此技能不附帶指令碼,只有指示文件與 Markdown 範本。代理需要寫入檔案的能力,並可選擇能否在瀏覽器中開啟產生的 HTML 檔案。產生的遊樂場必須是單一 HTML 檔案,內嵌 CSS 與 JS,且沒有外部相依性。

Playground Builder

A playground is a self-contained HTML file with interactive controls on one side, a live preview on the other, and a prompt output at the bottom with a copy button. The user adjusts controls, explores visually, then copies the generated prompt back into their agent.

When to use this skill

When the user asks for an interactive playground, explorer, or visual tool for a topic — especially when the input space is large, visual, or structural and hard to express as plain text.

How to use this skill

  1. Identify the playground type from the user's request
  2. Load the matching template from templates/:
    • templates/design-playground.md — Visual design decisions (components, layouts, spacing, color, typography)
    • templates/data-explorer.md — Data and query building (SQL, APIs, pipelines, regex)
    • templates/concept-map.md — Learning and exploration (concept maps, knowledge gaps, scope mapping)
    • templates/document-critique.md — Document review (suggestions with approve/reject/comment workflow)
    • templates/diff-review.md — Code review (git diffs, commits, PRs with line-by-line commenting)
    • templates/code-map.md — Codebase architecture (component relationships, data flow, layer diagrams)
  3. Follow the template to build the playground. If the topic doesn't fit any template cleanly, use the one closest and adapt.
  4. Open in browser when available. After writing the HTML file, launch it in the user's default browser if the environment supports that; otherwise provide the file path.

Core requirements (every playground)

  • Single HTML file. Inline all CSS and JS. No external dependencies.
  • Live preview. Updates instantly on every control change. No "Apply" button.
  • Prompt output. Natural language, not a value dump. Only mentions non-default choices. Includes enough context to act on without seeing the playground. Updates live.
  • Copy button. Clipboard copy with brief "Copied!" feedback.
  • Sensible defaults + presets. Looks good on first load. Include 3-5 named presets that snap all controls to a cohesive combination.
  • Dark theme. System font for UI, monospace for code/values. Minimal chrome.

State management pattern

Keep a single state object. Every control writes to it, every render reads from it.

javascript
const state = { /* all configurable values */ };
function updateAll() {  renderPreview(); // update the visual  updatePrompt();  // rebuild the prompt text}// Every control calls updateAll() on change

Prompt output pattern

javascript
function updatePrompt() {  const parts = [];
  // Only mention non-default values  if (state.borderRadius !== DEFAULTS.borderRadius) {    parts.push(`border-radius of ${state.borderRadius}px`);  }
  // Use qualitative language alongside numbers  if (state.shadowBlur > 16) parts.push('a pronounced shadow');  else if (state.shadowBlur > 0) parts.push('a subtle shadow');
  prompt.textContent = `Update the card to use ${parts.join(', ')}.`;}

Common mistakes to avoid

  • Prompt output is just a value dump → write it as a natural instruction
  • Too many controls at once → group by concern, hide advanced in a collapsible section
  • Preview doesn't update instantly → every control change must trigger immediate re-render
  • No defaults or presets → starts empty or broken on load
  • External dependencies → if CDN is down, playground is dead
  • Prompt lacks context → include enough that it's actionable without the playground

來源與署名

來源:cline/skills位於skills/playground提交2637846

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架