agentleFS
nick-vasnick-vas/hyperdot/.agents/skills/modding/SKILL.md

modding

Skill1 starsChanged yesterdayApache-2.0View on GitHub

Use when a Godot game should accept player-made mods, levels, skins or data, when loading PCK or ZIP packs at run time, when adding Steam Workshop or mod.io, or when a mod fails to load or breaks the game.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Start with data mods: the game reads files it validates, like the C# example's data runner does with data.json.

    line 20
  2. Very specific:

    Every pack carries the mod project's project.binary, class-name list and UID cache.

    line 37
  3. Very specific:

    Write a mod policy: who owns mods, whether they may be sold, which game assets may be redistributed.

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Mod support in Godot 4 (C#)

Decide first what a mod may do: change data and assets (safe), or run code (full rights on the player's machine, desktop only). Everything below was tested on an exported Godot 4.7.2 mono game; sources: ${CLAUDE_PLUGIN_ROOT}/docs/modding.md.

1. Three levels

LevelWhat mods containRiskPlatforms
DataJSON or CSV tables, plain images (Image.LoadFromFile), audio (AudioStreamOggVorbis.LoadFromFile)None if validatedAll, consoles through a vetted service
Assets and scenesA PCK or ZIP of Godot resourcesCode: a .tres or .tscn can carry a script that runs on loadDesktop
ScriptsGDScript or C# in a packFull rights: files, network, OS.Execute; Godot has no sandboxDesktop only (C# needs JIT)
  • Start with data mods: the game reads files it validates, like the C# example's data runner does with data.json. Keep gameplay in data and scripts that can be replaced, and when rewriting internals, keep the old data contract working.
  • Loading a .tres from a mod or save folder runs any script embedded in it (tested). Never load Godot resources from user:// or a Workshop folder unless that mod is trusted as code; the architecture runner warns (untrusted-load).

2. Packs: PCK or ZIP

// In an autoload's constructor or _Init, before anything else is loaded.
bool ok = ProjectSettings.LoadResourcePack(modPath, replaceFiles: true);
  • Export a mod with the Godot editor: godot --headless --path mod_project --export-pack "Linux" coolmod.pck (no export templates needed). ZIP and PCK behave the same.
  • A mod file at a game path replaces it, but only for loads that happen after mounting: a resource already loaded or preloaded stays the old one. Mount mods first, or reload with ResourceLoader.Load(path, "", ResourceLoader.CacheMode.Replace), which also updates the copies already in use. Data read with FileAccess changes at once.
  • Every pack carries the mod project's project.binary, class-name list and UID cache. With replaceFiles: true the game's class list is replaced by the mod's (GetGlobalClassList() then lists only the mod's classes); with false, the mod's UIDs and class names do not resolve. So mods refer to their files by path, under their own folder, res://mods/<id>/..., never by class name or UID.
  • Load order is override order: make it explicit and fixed (sorted, not the order files happen to be found), and show it. Decide which game paths mods may replace; any file at the same path silently wins.
  • Official patches and DLC are packs too; sign them (Crypto with an asymmetric key) if they come from a launcher. Godot cannot stop a PCK being copied.

3. C# mods (desktop only)

The way the Godot docs show, Assembly.LoadFile, crashes an exported game (segfault, not catchable): the mod binds to a second, uninitialised copy of GodotSharp. So does AssemblyLoadContext.Default and a plain new context. Load mods into the game assembly's own context instead:

using System.Runtime.Loader;

var gameContext = AssemblyLoadContext.GetLoadContext(typeof(Main).Assembly)!;   // not Default in an export
var mod = gameContext.LoadFromAssemblyPath(dllPath);                            // or LoadFromStream(bytes) from a mod pack
Godot.Bridge.ScriptManagerBridge.LookupScriptsInAssembly(mod);                   // so scenes can load its scripts by path
  • For GD.Load("res://mods/x/Thing.cs") to work, each mod class sits in its own file named after the class (Godot's source generator only adds [ScriptPath] then).
  • A collectible context that hands back the game's own assemblies (GodotSharp, the game) also works, but unloading while mod objects are alive is untested: plan to restart the game to unload a mod.
  • A mod that needs NuGet packages the game lacks needs an AssemblyDependencyResolver.
  • .NET has no sandbox. A C# mod is a program the player chose to run.

4. Distribution

  • Steam Workshop (through a Steamworks binding): upload with CreateItem, then SetItemContent (a folder) and SubmitItemUpdate, sending players to the Workshop agreement when UserNeedsToAcceptWorkshopLegalAgreement; install with GetSubscribedItems and GetItemInstallInfo, and read a download only after DownloadItemResult_t.
  • mod.io: REST API or its C++ SDK (no official Godot plugin); moderation tools built in; consoles on paid tiers.
  • On consoles mods are user content: reporting or filtering is required (Xbox XR-018), and only data and asset mods through a vetted service are realistic.

5. Safety and support

  • Say plainly in the game that code mods run with full rights; show where each mod came from; never run downloaded code without the player choosing it; offer a "start without mods" mode.
  • Record the active mods (ids and versions) in saves and crash reports (game-telemetry fingerprints); mark saves that need mods.
  • Multiplayer: compare a hash of the mod list on joining, or refuse modded clients in ranked play (anti-cheat).
  • Write a mod policy: who owns mods, whether they may be sold, which game assets may be redistributed. Third-party assets in the game may forbid it (assets.json, asset-pipeline).

6. Prove it

  • an exported build loads a sample mod pack that replaces a texture, adds a scene and changes a data table, and the change shows (a smoke run with the mod in place)
  • a broken mod (bad JSON, missing file, a value out of range) is reported by name and skipped, never a crash
  • a .tres in a data-mod folder is not loaded
  • mods load in the order shown, and "start without mods" starts clean

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.