This skill enables you to run code snippets in multiple programming languages directly from the command line.
Use this skill when:
The following languages are supported (requires the interpreter/compiler to be installed):
LanguageCommandFile ExtensionJavaScriptnode``.jsTypeScriptts-node``.tsPythonpython``.pyJavajava (compile & run).javaCgcc (compile & run).cC++g++ (compile & run).cppGogo run``.goRustrustc (compile & run).rsRubyruby``.rbPHPphp``.phpPerlperl``.plLualua``.luaRRscript``.rSwiftswift``.swiftKotlinkotlin``.ktsScalascala``.scalaGroovygroovy``.groovyDartdart``.dartJuliajulia``.jlHaskellrunhaskell``.hsClojureclojure``.cljF#dotnet fsi``.fsxC#dotnet script``.csxPowerShellpwsh``.ps1Bashbash``.shBatchcmd /c``.batCoffeeScriptcoffee``.coffeeCrystalcrystal``.crElixirelixir``.exsNimnim compile --run``.nimOCamlocaml``.mlRacketracket``.rktSchemescheme``.scmLispsbcl --script``.lisp
See references/LANGUAGES.md for detailed language configuration.
Determine the programming language from:
⚠️ Important for AI Agents: Use stdin to avoid escaping issues with quotes, backslashes, and special characters.
Recommended Method (stdin):
bash
echo "<code>" | node scripts/run-code.cjs <languageId>
Alternative Method (CLI argument - for simple code only):
bash
node scripts/run-code.cjs <languageId> "<code>"
Example - JavaScript:
bash
echo "console.log('Hello, World!')" | node scripts/run-code.cjs javascript
Example - Python:
bash
echo "print('Hello, World!')" | node scripts/run-code.cjs python
Example - Java (multi-line):
bash
echo "public class Test {
public static void main(String[] args) {
System.out.println(\"Hello from Java!\");
}
}" | node scripts/run-code.cjs java
Example - Multi-line code from variable:
bash
# In bash
CODE='import math
print("Pi:", math.pi)
print("Result:", math.factorial(5))'
echo "$CODE" | node scripts/run-code.cjs python
# In PowerShell (inline here-string)
@"
import math
print("Pi:", math.pi)
print("Result:", math.factorial(5))
"@ | node scripts/run-code.cjs python
cmd /c for batch scriptspwsh or powershell\#!/usr/bin/env shebang for portable scriptsCommon issues and solutions:
⚠️ Important: Running arbitrary code can be dangerous. Always:
bash
echo "console.log(Array.from({length: 10}, (_, i) => i * i))" | node scripts/run-code.cjs javascript
Output: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
bash
echo "import math; print(math.factorial(10))" | node scripts/run-code.cjs python
Output: 3628800
bash
echo 'package main; import "fmt"; func main() { fmt.Println("Hello from Go!") }' | node scripts/run-code.cjs go
Output: Hello from Go!