SC

script-execute

Compiles and runs C# code dynamically, including support for Unity objects and scripting modes.

Install

mkdir -p .claude/skills/script-execute && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17710" && unzip -o skill.zip -d .claude/skills/script-execute && rm skill.zip

Installs to .claude/skills/script-execute

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Compiles and executes C# code dynamically using Roslyn. Supports two modes: full code mode (default) requires a complete class definition, while body-only mode (isMethodBody=true) auto-generates the boilerplate so you only provide the method body. Unity objects (GameObject, Component, etc.) can be passed as parameters using their Ref types (GameObjectRef, ComponentRef, etc.) or directly by type.
398 charsno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Compile and execute C# code dynamically
  • Support full code mode for complete class definitions
  • Support body-only mode for method body statements
  • Pass Unity objects as parameters using Ref types
  • Pass Unity objects directly by type

How it works

The skill compiles and executes C# code dynamically using Roslyn. It supports two modes: full code mode for complete class definitions and body-only mode where it auto-generates boilerplate for method body statements. Unity objects can be passed as parameters.

Inputs & outputs

You give it
C# code (full class or method body) and optional parameters
You get back
Result of the C# code execution

When to use script-execute

  • Running C# scripts dynamically
  • Executing Unity object operations
  • Testing logic snippets
  • Automating Unity tasks

About this skill

Script / Execute

How to Call

unity-mcp-cli run-tool script-execute --input '{
  "csharpCode": "string_value",
  "className": "string_value",
  "methodName": "string_value",
  "parameters": "string_value",
  "isMethodBody": false
}'

For complex input (multi-line strings, code), save the JSON to a file and use:

unity-mcp-cli run-tool script-execute --input-file args.json

Or pipe via stdin (recommended):

unity-mcp-cli run-tool script-execute --input-file - <<'EOF'
{"param": "value"}
EOF

Troubleshooting

If unity-mcp-cli is not found, either install it globally (npm install -g unity-mcp-cli) or use npx unity-mcp-cli instead. Read the /unity-initial-setup skill for detailed installation instructions.

Input

NameTypeRequiredDescription
csharpCodestringYesC# code to compile and execute. In full code mode (default, isMethodBody=false): must define a complete class with a static method. Example: 'using UnityEngine; public class Script { public static void Main() { Debug.Log("Hello"); } }'. Do NOT use top-level statements. In body-only mode (isMethodBody=true): provide only the method body statements. The tool auto-generates usings, class, and method header. Example body: 'go.SetActive(false);'. Custom helper classes can still be defined inline in the body-only string after the main logic, but for complex additional class definitions use full code mode instead.
classNamestringNoThe name of the class containing the method to execute. In body-only mode this becomes the generated class name.
methodNamestringNoThe name of the method to execute. Must be a static method. In body-only mode this becomes the generated method name.
parametersanyNoSerialized parameters to pass to the method. Each entry must specify 'name' and 'typeName'. Supported parameter types include primitives, strings, and Unity object references: - 'UnityEngine.GameObject': resolves an actual GameObject from value '{"instanceID": N}', '{"name": "..."}', or '{"path": "..."}'. - 'UnityEngine.Component' (or any component subtype): resolves from '{"instanceID": N}'. - 'com.IvanMurzak.Unity.MCP.Runtime.Data.GameObjectRef': passes a GameObjectRef POCO directly; the method body calls goRef.FindGameObject() to resolve it. - 'com.IvanMurzak.Unity.MCP.Runtime.Data.ComponentRef': passes a ComponentRef POCO. - 'com.IvanMurzak.Unity.MCP.Runtime.Data.ObjectRef': passes a base ObjectRef POCO. If the method does not require parameters, leave this empty.
isMethodBodybooleanNoWhen true, 'csharpCode' is treated as just the method body. The tool auto-generates standard using directives (System, UnityEngine, com.IvanMurzak.Unity.MCP.Runtime.Data, com.IvanMurzak.Unity.MCP.Runtime.Extensions, UnityEditor), the class definition, and the method signature (void return type). Parameters from the 'parameters' list are automatically added to the method signature using their typeName and name. When false (default), 'csharpCode' must be a complete C# compilation unit with class and method definitions.

Input JSON Schema

{
  "type": "object",
  "properties": {
    "csharpCode": {
      "type": "string"
    },
    "className": {
      "type": "string"
    },
    "methodName": {
      "type": "string"
    },
    "parameters": {
      "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMemberList"
    },
    "isMethodBody": {
      "type": "boolean"
    }
  },
  "$defs": {
    "com.IvanMurzak.ReflectorNet.Model.SerializedMemberList": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember"
      }
    },
    "com.IvanMurzak.ReflectorNet.Model.SerializedMember": {
      "type": "object",
      "properties": {
        "typeName": {
          "type": "string",
          "description": "Full type name. Eg: 'System.String', 'System.Int32', 'UnityEngine.Vector3', etc."
        },
        "name": {
          "type": "string",
          "description": "Object name."
        },
        "value": {
          "description": "Value of the object, serialized as a non stringified JSON element. Can be null if the value is not set. Can be default value if the value is an empty object or array json."
        },
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
            "description": "Nested field value."
          },
          "description": "Fields of the object, serialized as a list of 'SerializedMember'."
        },
        "props": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
            "description": "Nested property value."
          },
          "description": "Properties of the object, serialized as a list of 'SerializedMember'."
        }
      },
      "required": [
        "typeName"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "csharpCode"
  ]
}

Output

Output JSON Schema

{
  "type": "object",
  "properties": {
    "result": {
      "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember"
    }
  },
  "$defs": {
    "com.IvanMurzak.ReflectorNet.Model.SerializedMemberList": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember"
      }
    },
    "com.IvanMurzak.ReflectorNet.Model.SerializedMember": {
      "type": "object",
      "properties": {
        "typeName": {
          "type": "string",
          "description": "Full type name. Eg: 'System.String', 'System.Int32', 'UnityEngine.Vector3', etc."
        },
        "name": {
          "type": "string",
          "description": "Object name."
        },
        "value": {
          "description": "Value of the object, serialized as a non stringified JSON element. Can be null if the value is not set. Can be default value if the value is an empty object or array json."
        },
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
            "description": "Nested field value."
          },
          "description": "Fields of the object, serialized as a list of 'SerializedMember'."
        },
        "props": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/com.IvanMurzak.ReflectorNet.Model.SerializedMember",
            "description": "Nested property value."
          },
          "description": "Properties of the object, serialized as a list of 'SerializedMember'."
        }
      },
      "required": [
        "typeName"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "result"
  ]
}

When not to use it

  • When the task does not involve dynamic C# code execution
  • When Unity objects are not relevant to the execution

Prerequisites

unity-mcp-cli

Limitations

  • Full code mode requires a complete class definition with a static method
  • Body-only mode auto-generates boilerplate and assumes a void return type
  • Custom helper classes in body-only mode should be defined inline after the main logic

How it compares

This skill allows for dynamic execution of C# code within a Unity context, including passing Unity-specific objects, which is more flexible than compiling and running a standalone C# application.

Compared to similar skills

script-execute side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
script-execute (this skill)02moReviewIntermediate
vvvv-node-libraries01moNo flagsAdvanced
csharp-developer432moNo flagsAdvanced
csharp-pro93moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

vvvv-node-libraries

tebjan

Helps set up C# library projects that provide nodes to vvvv gamma — project directory structure, Initialization.cs with AssemblyInitializer, service registration via RegisterService, IResourceProvider factories, ImportAsIs / ImportNamespace / ImportType selection, category organization, .csproj setu

00

csharp-developer

zenobi-us

Expert C# developer specializing in modern .NET development, ASP.NET Core, and cloud-native applications. Masters C# 12 features, Blazor, and cross-platform development with emphasis on performance and clean architecture.

43151

csharp-pro

sickn33

Write modern C# code with advanced features like records, pattern matching, and async/await. Optimizes .NET applications, implements enterprise patterns, and ensures comprehensive testing. Use PROACTIVELY for C# refactoring, performance optimization, or complex .NET solutions.

953

dotnet-backend-patterns

wshobson

Master C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.

722

azure-servicebus-dotnet

microsoft

Azure Service Bus SDK for .NET. Enterprise messaging with queues, topics, subscriptions, and sessions. Use for reliable message delivery, pub/sub patterns, dead letter handling, and background processing. Triggers: "Service Bus", "ServiceBusClient", "ServiceBusSender", "ServiceBusReceiver", "ServiceBusProcessor", "message queue", "pub/sub .NET", "dead letter queue".

316

backend-testing

exceptionless

Backend testing with xUnit, Foundatio.Xunit, integration tests with AppWebHostFactory, FluentClient, ProxyTimeProvider for time manipulation, and test data builders. Keywords: xUnit, Fact, Theory, integration tests, AppWebHostFactory, FluentClient, ProxyTimeProvider, TimeProvider, Foundatio.Xunit, TestWithLoggingBase, test data builders

316

Search skills

Search the agent skills registry