← 返回 Skills 市场
panchenbo

Code Runner Local

作者 panchenbo · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
318
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install code-runner-local
功能描述
Run code snippets in 30+ programming languages including JavaScript, Python, TypeScript, Java, C, C++, Go, Rust, Ruby, PHP, and more. Use when the user wants...
使用说明 (SKILL.md)

\r \r

Code Runner Skill\r

\r This skill enables you to run code snippets in multiple programming languages directly from the command line.\r \r

When to Use This Skill\r

\r Use this skill when:\r

  • The user wants to run or execute a code snippet\r
  • Testing algorithm implementations or logic\r
  • Verifying expected output of code\r
  • Running quick scripts or one-liners\r
  • Checking syntax or runtime behavior\r
  • Demonstrating code functionality\r \r

Supported Languages\r

\r The following languages are supported (requires the interpreter/compiler to be installed):\r \r | Language | Command | File Extension |\r |----------|---------|----------------|\r | JavaScript | node | .js |\r | TypeScript | ts-node | .ts |\r | Python | python | .py |\r | Java | java (compile & run) | .java |\r | C | gcc (compile & run) | .c |\r | C++ | g++ (compile & run) | .cpp |\r | Go | go run | .go |\r | Rust | rustc (compile & run) | .rs |\r | Ruby | ruby | .rb |\r | PHP | php | .php |\r | Perl | perl | .pl |\r | Lua | lua | .lua |\r | R | Rscript | .r |\r | Swift | swift | .swift |\r | Kotlin | kotlin | .kts |\r | Scala | scala | .scala |\r | Groovy | groovy | .groovy |\r | Dart | dart | .dart |\r | Julia | julia | .jl |\r | Haskell | runhaskell | .hs |\r | Clojure | clojure | .clj |\r | F# | dotnet fsi | .fsx |\r | C# | dotnet script | .csx |\r | PowerShell | pwsh | .ps1 |\r | Bash | bash | .sh |\r | Batch | cmd /c | .bat |\r | CoffeeScript | coffee | .coffee |\r | Crystal | crystal | .cr |\r | Elixir | elixir | .exs |\r | Nim | nim compile --run | .nim |\r | OCaml | ocaml | .ml |\r | Racket | racket | .rkt |\r | Scheme | scheme | .scm |\r | Lisp | sbcl --script | .lisp |\r \r See references/LANGUAGES.md for detailed language configuration.\r \r

How to Run Code\r

\r

Step 1: Identify the Language\r

\r Determine the programming language from:\r

  • User's explicit request (e.g., "run this Python code")\r
  • File extension if provided\r
  • Code syntax patterns\r \r

Step 2: Execute Using the Runner Script\r

\r ⚠️ Important for AI Agents: Use stdin to avoid escaping issues with quotes, backslashes, and special characters.\r \r Recommended Method (stdin):\r

echo "\x3Ccode>" | node scripts/run-code.cjs \x3ClanguageId>\r
```\r
\r
**Alternative Method (CLI argument - for simple code only):**\r
```bash\r
node scripts/run-code.cjs \x3ClanguageId> "\x3Ccode>"\r
```\r
\r
**Example - JavaScript:**\r
```bash\r
echo "console.log('Hello, World!')" | node scripts/run-code.cjs javascript\r
```\r
\r
**Example - Python:**\r
```bash\r
echo "print('Hello, World!')" | node scripts/run-code.cjs python\r
```\r
\r
**Example - Java (multi-line):**\r
```bash\r
echo "public class Test {\r
    public static void main(String[] args) {\r
        System.out.println(\"Hello from Java!\");\r
    }\r
}" | node scripts/run-code.cjs java\r
```\r
\r
**Example - Multi-line code from variable:**\r
```bash\r
# In bash\r
CODE='import math\r
print("Pi:", math.pi)\r
print("Result:", math.factorial(5))'\r
echo "$CODE" | node scripts/run-code.cjs python\r
\r
# In PowerShell (inline here-string)\r
@"\r
import math\r
print("Pi:", math.pi)\r
print("Result:", math.factorial(5))\r
"@ | node scripts/run-code.cjs python\r
```\r
\r
### Step 3: Return Results\r
\r
- Show the output (stdout) to the user\r
- If there are errors (stderr), explain what went wrong\r
- Suggest fixes for common errors\r
\r
## Platform Notes\r
\r
### Windows\r
- Use `cmd /c` for batch scripts\r
- PowerShell scripts require `pwsh` or `powershell`\r
- Path separators use backslash `\`\r
\r
### macOS / Linux\r
- Bash scripts work natively\r
- Swift available on macOS\r
- Use `#!/usr/bin/env` shebang for portable scripts\r
\r
## Error Handling\r
\r
Common issues and solutions:\r
\r
1. **Command not found**: The language interpreter is not installed or not in PATH\r
   - Suggest installing the required runtime\r
   - Provide installation instructions\r
\r
2. **Syntax errors**: Code has syntax issues\r
   - Show the error message\r
   - Point to the line number if available\r
\r
3. **Runtime errors**: Code runs but fails during execution\r
   - Display the stack trace\r
   - Explain the error type\r
\r
4. **Timeout**: Code takes too long (default: 30 seconds)\r
   - Warn about infinite loops\r
   - Suggest optimizations\r
\r
## Security Considerations\r
\r
⚠️ **Important**: Running arbitrary code can be dangerous. Always:\r
\r
1. Review the code before execution\r
2. Be cautious with code that:\r
   - Accesses the file system\r
   - Makes network requests\r
   - Executes system commands\r
   - Modifies environment variables\r
3. Consider running in a sandboxed environment for untrusted code\r
\r
## Examples\r
\r
### Example 1: Run a JavaScript calculation\r
```bash\r
echo "console.log(Array.from({length: 10}, (_, i) => i * i))" | node scripts/run-code.cjs javascript\r
```\r
Output: `[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]`\r
\r
### Example 2: Run Python with imports\r
```bash\r
echo "import math; print(math.factorial(10))" | node scripts/run-code.cjs python\r
```\r
Output: `3628800`\r
\r
### Example 3: Test a Go function\r
```bash\r
echo 'package main; import "fmt"; func main() { fmt.Println("Hello from Go!") }' | node scripts/run-code.cjs go\r
```\r
Output: `Hello from Go!`\r
安全使用建议
This skill appears to do what it claims, but it executes code on the host — treat it like running programs locally. Before installing/using: 1) Do not run untrusted code. Review snippets before execution or run the skill inside an isolated sandbox/container or VM. 2) Ensure interpreters/compilers you expect are installed and kept up to date. 3) Be aware temp files and compiled binaries are written to the system temp directory (shared with other processes); sensitive data in code could be recoverable. 4) The included script uses child_process.exec and spawns compilers/interpreters (normal for this tool) and sets a 30s default timeout; long-running or resource-heavy code may be killed or may consume host resources — consider stricter time/resource limits if needed. 5) Implementation notes for reviewers: the script contains a minor bug where outputFile uses Date.now without invoking it (Date.now instead of Date.now()), which may lead to odd filenames; cleanup attempts are limited to files created by the script and may not cover all side-effects of executed code. If you need safer execution of untrusted code, run the skill only inside a dedicated sandbox with network and filesystem restrictions.
功能分析
Type: OpenClaw Skill Name: code-runner-local Version: 1.0.0 The skill provides a broad capability to execute arbitrary code in over 30 programming languages, including shell scripts (bash, powershell, cmd), using child_process.exec in scripts/run-code.cjs. While this aligns with its stated purpose as a 'Code Runner', the inherent risk of arbitrary command execution without built-in sandboxing makes it a high-risk tool. Although SKILL.md includes security warnings, the script provides a direct path for potential system compromise or data exfiltration if the AI agent is manipulated into running malicious snippets.
能力评估
Purpose & Capability
The name/description (run code in many languages) matches the included script and instructions. The skill only relies on local interpreters/compilers (described in LANGUAGES.md) and does not request unrelated services or credentials.
Instruction Scope
The SKILL.md correctly instructs the agent to send code via stdin or CLI args to the included Node script, and describes expected outputs and security cautions. The instructions and code explicitly write temporary files to the system temp directory and spawn compilers/interpreters, which is expected for this purpose. Note: the runtime script will execute whatever code is provided (including filesystem/network/system commands) — that is inherent to the skill and is a security risk for untrusted input. Also the script has a minor bug/oddity (see user guidance) and does not implement strong sandboxing or resource isolation.
Install Mechanism
There is no external install spec and the package is instruction-only with a single local Node script; no remote downloads or archives are fetched during install. This is low-risk from an installation standpoint.
Credentials
The skill does not request environment variables, credentials, or config paths. It uses process.platform and standard Node APIs only; no secret access is required or requested.
Persistence & Privilege
The skill is user-invocable and not always-enabled. It does not try to persist credentials or modify other skills. It creates temporary files in the system temp directory during execution, which is expected but means the executed code runs with the agent's host privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install code-runner-local
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /code-runner-local 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the Code Runner skill. - Run code snippets in over 30 programming languages, including JavaScript, Python, Java, C/C++, Go, Rust, and more. - Supports both interpreted and compiled languages via command line. - Provides guidelines for identifying language, executing code, and handling output/errors. - Includes detailed instructions and examples for running code in different environments (Windows, macOS, Linux). - Emphasizes security with recommendations for running untrusted code. - Offers troubleshooting tips for common issues like missing interpreters or code errors.
元数据
Slug code-runner-local
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Code Runner Local 是什么?

Run code snippets in 30+ programming languages including JavaScript, Python, TypeScript, Java, C, C++, Go, Rust, Ruby, PHP, and more. Use when the user wants... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 318 次。

如何安装 Code Runner Local?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install code-runner-local」即可一键安装,无需额外配置。

Code Runner Local 是免费的吗?

是的,Code Runner Local 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Code Runner Local 支持哪些平台?

Code Runner Local 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Code Runner Local?

由 panchenbo(@panchenbo)开发并维护,当前版本 v1.0.0。

💬 留言讨论