script-execute

Compile and execute C# code at runtime using Roslyn.

Updated Feb 4, 2024
One-click install
npx skills add https://github.com/sprillion/gem_td --skill script-execute-sprillion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: script-execute
Source: https://github.com/sprillion/gem_td/tree/main/SKILLS/script-execute
Command: npx skills add https://github.com/sprillion/gem_td --skill script-execute-sprillion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Compiles and executes C# code dynamically using Roslyn. The provided code must define a class with a static method to execute.

Core Features & Use Cases

  • Dynamic Roslyn-based compilation and execution of arbitrary C# code at runtime.
  • Enforces a class with a static entry-point method as the execution target.
  • Exposes an API-based execution path for direct tool usage and automation.

Quick Start

Provide a C# class with a static method and call the script-execute API to run it.

Frequently Asked Questions about script-execute

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I execute dynamic C# code at runtime?

You can execute dynamic C# code at runtime by providing a script that defines a public class with a static entry-point method. The code is compiled using Roslyn and the static method is invoked with optional parameters.

What is the required structure for C# scripts to run dynamically via Roslyn?

Dynamically executed C# scripts must define a public class containing a static method to act as the execution target. You must provide the C# code, class name, method name, and any optional parameters to trigger the run.

Can I use Roslyn compilation to add dynamic behavior to development tools?

Yes, you can use Roslyn compilation to add dynamic behavior to development tools, plugins, or tests. It provides an API-based execution path for on-demand scripting, allowing direct tool usage and automation.

What are the limitations of executing arbitrary C# scripts dynamically?

Executing arbitrary C# scripts dynamically requires your code to strictly define a public class with a static entry point. Scripts failing to meet this structural requirement or lacking proper method signatures cannot be compiled or run.

Do I need external dependencies to compile and run C# code dynamically?

Compiling and running C# code dynamically relies entirely on the built-in Roslyn compiler without requiring external dependencies. You simply pass the C# code, class name, method name, and optional parameters to the execution API.