2e14873f2d
Track application source and tests; exclude local env, user workspaces, and runtime data via .gitignore. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
1.0 KiB
Markdown
34 lines
1.0 KiB
Markdown
---
|
|
name: code-playground
|
|
description: 代码展示与运行技能:在聊天中展示代码并支持 JavaScript 沙盒执行(需启用 codeplayground 扩展)
|
|
---
|
|
|
|
# 代码演练场
|
|
|
|
使用 `codeplayground` MCP 扩展在聊天中展示可运行的代码片段。
|
|
|
|
## 何时使用
|
|
|
|
- 生成代码示例后,让用户直接在聊天里运行验证
|
|
- 展示算法、数据处理逻辑
|
|
- JavaScript 演示(可执行);其他语言(展示+复制)
|
|
|
|
## 前提
|
|
|
|
Settings → Extensions 中启用 **Code Playground** 扩展。
|
|
|
|
## 工具
|
|
|
|
`show_playground(title, code, language, description?)` — 展示代码并可选执行
|
|
|
|
## 支持语言
|
|
|
|
- **JavaScript** — 有「运行」按钮,`console.log` 输出显示在下方
|
|
- 其他语言(`rust`、`python`、`typescript` 等)— 展示+语法高亮+复制按钮
|
|
|
|
## 规则
|
|
|
|
1. JS 执行在沙盒 iframe 中,无网络访问,无 DOM 操作
|
|
2. 代码不超过 200 行,超出拆分展示
|
|
3. 有副作用(写文件、网络请求)的代码标注「仅供参考,不可直接运行」
|