SE Dev Script Skill
In-game (programmable block, aka PB) script development for Space Engineers version 1.
⚠️ CRITICAL: Commands run in UNIX shell. Use bash syntax. On Windows this is BusyBox; on Linux use native shell.
Examples:
- ✅
test -f file.txt && echo exists - ✅
ls -la | head -10 - ❌
if exist file.txt (echo exists)- Will NOT work
Actions:
- prepare: Run one-time preparation (
Prepare.baton Windows,prepare.shon Linux) - bash: Run UNIX shell commands via busybox
- search: Search script code using
search_scripts.py
Routing Decision
Check these patterns in order - first match wins:
| Priority | Pattern | Example | Route |
|----------|---------|---------|-------|
| 1 | Empty or bare invocation | se-dev-script | Show this help |
| 2 | Prepare keywords | se-dev-script prepare, se-dev-script setup, se-dev-script init | prepare |
| 3 | Bash/shell keywords | se-dev-script bash, se-dev-script grep, se-dev-script cat | bash |
| 4 | Search keywords | se-dev-script search, se-dev-script find class, se-dev-script lookup | search |
Getting Started
⚠️ CRITICAL: Before running ANY commands, read CommandExecution.md to avoid common mistakes that cause command failures.
If Prepare.DONE file missing in this folder, you MUST run one-time preparation steps first. See the prepare action.
Essential Documentation
- CommandExecution.md - ⚠️ READ THIS FIRST - Windows command execution details; on Linux keep bash syntax and use
prepare.sh
Script Development
Use only names matching the PB API whitelist: PBApiWhitelist.txt
Whitelist was exported from game version 1.208.015 using MDK2's Mdk.Extractor.
In-game (PB) scripts released on Steam Workshop or Mod.IO, mostly on former. In-game scripts compiled by game on loading into PB or world loading (if PB has script loaded) with PB Script API whitelist enforced, which guarantees safety and security. Scripts cannot crash game, since any exception caught and script killed by game. Scripts can still lag game if no specific resource usage enforcement set up by player or server admin.
Script's source code size limited to 100,000 bytes when player loads it. ScriptDev plugin can load more from local file into offline (local) games for testing, so scripts can be tested without source code compression, useful to get fully detailed exception tracebacks.
Use the se-dev-game-code skill to search game's decompiled code. You may need this to
understand how game's internals work and how to script it properly. Stick to game code
searches corresponding to names on PB API whitelist for efficiency.
Graphify Graph
Preparation builds a separate Graphify graph for the local PB script folder (or
SE_DEV_SCRIPT_PROJECT_ROOT). With the fast Rust clustering backend (Python 3.12 via uv,
provisioned automatically) prepare builds it automatically; this corpus is tiny so it is
quick either way. Where the fast backend is unavailable it stays opt-in with
SE_DEV_GRAPHIFY=1; SE_DEV_GRAPHIFY=0 disables it. Read on demand — skip for normal
search work: build via GraphifyPrepare.md, query via
GraphifyUsage.md.
Folder Structure
Data/— junction/symlink to per-user persistent script data folder (%USERPROFILE%\.se-dev\scripton Windows,~/.se-dev/scripton Linux). Persistent skill data lives here:Data/scripts.json— quick inventory of all installed PB scripts.Data/script_hashes.json— per-script aggregate sha1 used by indexer for change detection.Data/CodeIndex/— full Tree-sitter C# index (one CSV per category, plus hierarchy trees).
LocalScripts/— junction/symlink to game's local-script folder (%AppData%\SpaceEngineers\IngameScripts\localon Windows, Proton appdata equivalent on Linux), game's local-PB-script folder.- Steam Workshop content read in-place from Steam folder; it is not copied or symlinked
into skill. PB scripts detected by presence of top-level
Script.csfile inside each numeric workshop folder. Workshop folder resolved fromSE_GAME_ROOT(env var) or Steam registry entry for app id 244850.
References
- Script Template repo PB script template repository to start new project. See ScriptTemplate.md
- Script Merge tool Merging PB scripts from C# projects into single file with optional code compression. See ScriptMerge.md
- Script Dev plugin Automatic script loading into PB in-game for easier testing. See ScriptDev.md
- Mod Development Kit (MDK2)
- Programmable Block API
- Wiki on Scripting
Script Code Search
Search source code of Steam and local PB scripts for examples and patterns:
# Search for patterns
uv run search_scripts.py class declaration Program
uv run search_scripts.py method usage Main
uv run search_scripts.py class children MyGridProgram
# Count results before viewing (useful for large result sets)
uv run search_scripts.py class usage Program --count
# Limit number of results
uv run search_scripts.py class usage GridTerminalSystem --limit 30
Before searching, ensure index exists. If Data/CodeIndex/ missing, run:
uv run list_scripts.py # quick inventory (always cheap)
uv run index_scripts.py # full code index (incremental: only changed scripts reparsed)
Re-indexing after new subscriptions: When you subscribe to new scripts on Steam Workshop,
load them in world once (so game downloads them), then re-run the two commands above
(or Prepare.bat). Indexer hashes each script's .cs files and only reparses
scripts whose hash changed since previous run, so reruns are fast.
See search action for complete documentation.
Action References
Follow the detailed instructions in:
- prepare action - One-time preparation
- bash action - Running UNIX shell commands via busybox
- search action - Search script code for examples
Remarks
Original source of this skill: https://github.com/CometWorks/skills