playground
它能做什么
这个技能让你的 AI 制作一个单文件网页,你可以通过控件调整设置并即时看到预览。适合以可视化方式探索某个主题。
适用场景
- ✓当你想为某个设计、数据集或文档制作交互式探索页面的时候。
- ✓当一个主题通过点击和调整比阅读文字更容易理解的时候。
- ✓当你想要一个结尾带有可复制提示词、可以粘贴回 AI 的页面的时候。
技能链接
https://github.com/anthropics/claude-plugins-official/blob/main/plugins/playground/skills/playground/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我做一个交互式 playground,让我调整布局设置并实时看到结果?”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会从一组模板中选出匹配的布局,生成一个独立的 HTML 文件,并在底部添加一个方框,里面是可复制的提示词。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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 Claude.
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
- Identify the playground type from the user's request
- 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)
- Follow the template to build the playground. If the topic doesn't fit any template cleanly, use the one closest and adapt.
- Open in browser. After writing the HTML file, run
open <filename>.htmlto launch it in the user's default browser.
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.
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
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
常见问题
要打开 playground 需要安装什么吗?
不需要。结果是一个 HTML 文件,用网页浏览器即可打开。
哪些主题适合做 playground?
有许多可视化或结构化选项的主题,例如设计选择、查询或代码架构。
复制的提示词要怎么用?
把它粘贴回 AI 聊天中,就能基于你所做的选择继续。
详情
作者的原始描述
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.
热度
- GitHub 星标
- 46k
- 排名
- #6343
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …