agentleFS
nainishshafinainishshafi/developer-productivity-skills/.github/skills/nodejs-executor/SKILL.md

nodejs-executor

Skill1 starsChanged 4 days agoMITView on GitHub

Use when the user asks to "run nodejs code", "execute javascript", "execute typescript", "run js snippet", "run node script", "evaluate expression", "execute node file", "run package script", "test node snippet", or wants to execute JavaScript/TypeScript code safely using the nodejs-executor MCP server with multi-layered sandbox security.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    execute_file: Run an existing .js, .mjs, .cjs, or .ts file on disk with command-line arguments.

    line 17
  2. Very specific:

    Every execution defaults to strict mode for defense-in-depth protection:

    line 25
  3. Very specific:

    Use execute_file with filePath: "path/to/script.ts"

    line 47
  4. Very specific:

    Use run_package_script with script: "build" or script: "test"

    line 50
  5. Very specific:

    Ensure arguments do not contain shell metacharacters (&, |, ;, >, $).

    line 51
  6. Very specific:

    When connected to the nodejs-executor MCP server in Claude Code, Claude Desktop, Cursor, Copilot, or Antigravity:

    line 58
  7. Distinctive:

    If code attempts an unauthorized operation:

    line 91

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Node.js Executor Skill

Execute JavaScript and TypeScript code, evaluate expressions, run script files, and automate package scripts using the nodejs-executor MCP server with multi-layered security sandboxing.


Capabilities

  • execute_code: Execute multi-line JavaScript (ESM) or TypeScript snippets with top-level await and Node standard modules.
  • evaluate_expression: Evaluate a single expression or async expression with deep object introspection and type detection.
  • execute_file: Run an existing .js, .mjs, .cjs, or .ts file on disk with command-line arguments.
  • run_package_script: Execute npm, pnpm, or yarn run scripts from any package.json with argument injection protections.
  • get_runtime_info: Inspect Node.js version, V8 version, platform, architecture, memory usage, CPU count, and permission model support.

Security Sandbox Policies

Every execution defaults to strict mode for defense-in-depth protection:

ModeFilesystem PermissionsProcess SpawningEnvironment VariablesIntended Use
strict (default)Writes/deletes locked to OS temp folder (--allow-fs-write=<tempDir>). Host files cannot be modified or deleted.BLOCKED (child_process disabled).Sensitive keys scrubbed (*KEY*, *TOKEN*, *SECRET*, AWS_*, GITHUB_*, etc.).Safe execution of untrusted snippets, calculations, tests, and data parsing.
workspace-writeWrites/deletes permitted in temp and current working directory. Files outside workspace remain protected.BLOCKED (child_process disabled).Sensitive keys scrubbed.File generation tasks, building artifacts, or transforming project files.
unrestrictedFull host permissions (Node permission model disabled).Allowed.Full host process.env.Only when user explicitly requests full host system management or shell execution.

Workflow

Step 1 — Select the Right Tool and Sandbox Mode

  1. Quick expression inspection (e.g., Math.hypot(3, 4), crypto.randomUUID()):
    • Use evaluate_expression
    • Mode: sandboxMode: "strict"
  2. Multi-line code snippet / async algorithm / data processing:
    • Use execute_code
    • Set language: "typescript" if type annotations or TypeScript syntax are used (native Node 22+ type stripping).
    • Mode: sandboxMode: "strict" (default)
  3. Running an existing script file:
    • Use execute_file with filePath: "path/to/script.ts"
    • Pass optional args: ["arg1", "arg2"]
  4. Running npm / pnpm / yarn lifecycle scripts:
    • Use run_package_script with script: "build" or script: "test"
    • Ensure arguments do not contain shell metacharacters (&, |, ;, >, $).

Step 2 — Invocation Methods

Method A: Direct MCP Tool Invocation (inside AI sessions)

When connected to the nodejs-executor MCP server in Claude Code, Claude Desktop, Cursor, Copilot, or Antigravity:

{
  "name": "execute_code",
  "arguments": {
    "code": "const res = await fetch('https://api.github.com/zen'); console.log(await res.text());",
    "language": "javascript",
    "sandboxMode": "strict"
  }
}

Method B: Automated Runner Script

You can trigger execution programmatically from terminal or scripts:

node mcp/nodejs-executor/scripts/invoke.mjs

Step 3 — Handling Results and Security Errors

Responses return structured JSON:

  • success: boolean indicating if the execution succeeded.
  • stdout: Captured standard output stream (capped at 512 KB).
  • stderr: Captured standard error stream.
  • durationMs: Process run duration in milliseconds.
  • timedOut: true if the 30-second timeout was triggered.
  • sandboxMode: Sandbox policy applied during execution.

Security Policy Errors

If code attempts an unauthorized operation:

  • Unauthorized write/delete outside temp:
    Error: Access to this API has been restricted (code: 'ERR_ACCESS_DENIED', permission: 'FileSystemWrite')
  • Unauthorized process spawning:
    Error: Access to this API has been restricted (code: 'ERR_ACCESS_DENIED', permission: 'ChildProcess')
  • Pre-execution safety rejection:
    Security policy violation: Blocked by pre-execution safety policy: broad destructive root filesystem operation detected.

Prerequisites & Setup

  • Node.js: >= 20.0.0 (Node 22+ recommended for native TypeScript support)
  • Server build:
    cd mcp/nodejs-executor
    npm install
    npm run build
    npm test
  • MCP Registration:
    claude mcp add nodejs-executor node <path-to-repo>/mcp/nodejs-executor/dist/index.js

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.