/bgs-modding-superpowers:using-bgs-papyrusfrom bgs-modding-superpowers
Compiles Papyrus PSC to PEX and decompiles PEX to PSC for Skyrim, Fallout 4, and Starfield. Detects Creation Kit toolchains and handles Starfield Guard syntax.
Ships in bgs-modding-superpowers. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
bgs-papyrus is the agent-native CLI for Papyrus compile and decompile work. It detects official Creation Kit compilers, compiles .psc to .pex, decompiles .pex to .psc through Champollion, and returns JSON envelopes for agent workflows.
Use this skill for:
Do not use this skill for plugin record edits, load-order edits, or BA2/BSA packing. Route those through the xEdit, load-order, or archive skills.
Always query the live CLI before choosing a backend or game path:
bgs-papyrus capabilities --json
bgs-papyrus detect-toolchain --json --game starfield
The official Creation Kit must be installed by the user from Steam. Bethesda's PapyrusCompiler.exe is not bundled with this plugin and must not be copied into the repo or plugin tree. bgs-papyrus detects and drives the installed compiler.
Champollion is used for decompile. bgs-papyrus detects Champollion; it does not download it automatically. Install Champollion.exe at:
~/.bgs-modding-superpowers/tools/champollion/Champollion.exe
or the user can set BGS_PAPYRUS_CHAMPOLLION to an existing executable.
One PowerShell install shape for Champollion v1.3.2 from Orvid/Champollion releases:
$root = "$HOME\.bgs-modding-superpowers\tools\champollion"; New-Item -ItemType Directory -Force -Path $root | Out-Null; $zip = Join-Path $root "Champollion.v1.3.2.zip"; Invoke-WebRequest "https://github.com/Orvid/Champollion/releases/download/v1.3.2/Champollion.v1.3.2.zip" -OutFile $zip; Expand-Archive -Force $zip $root
Human manuals:
tools/bgs-papyrus/USER-GUIDE.en.mdtools/bgs-papyrus/USER-GUIDE.zh-cn.md.pex output into the game's Data folder or any Stock-Game tree.<MO2_Root>/mods/<mod-name>/Scripts/.--json for agent workflows and branch on the envelope, not human text.Check bgs-papyrus --help and <subcommand> --help for the current option surface. The examples below are templates.
capabilitiesDiscover supported games, subcommands, backends, flags files, and Starfield syntax behavior.
bgs-papyrus capabilities --json
detect-toolchain [--game G]Find installed official CK compilers and the Champollion decompiler.
bgs-papyrus detect-toolchain --json --game fallout4
bgs-papyrus detect-toolchain --json
Supported game arguments are skyrimle, skyrimse, fallout4, and starfield. Fallout 3, Fallout: New Vegas, and Oblivion do not use Papyrus and are out of scope.
compile <src> --game GCompile one .psc file, or use --all for a directory.
bgs-papyrus compile "D:\work\Scripts\Source\MyQuestScript.psc" --json --game starfield --out "D:\work\compiled" --import "D:\work\Scripts\Source"
Useful options:
--out <dir>: output directory.--import <dir>: source import directory; repeat for multiple roots.--backend ck|caprica|russo|auto: compiler backend.--flags <file>: explicit flags file.--optimize, --release, --final, --all: compile options.For final game use, copy the resulting .pex into an MO2 overlay:
<MO2_Root>/mods/<mod-name>/Scripts/
Never write the result to <game>/Data/Scripts/ directly.
decompile <src> --game GDecompile one .pex file, or use --recursive for a directory.
bgs-papyrus decompile "D:\mods\Example\Scripts\MyQuestScript.pex" --json --game starfield --out "D:\work\decompiled"
Useful options:
--out <dir>: output directory.--recursive: decompile a directory tree.--threaded: use Champollion threaded mode where supported.--sf-syntax-fix / --no-sf-syntax-fix: enable or disable Starfield syntax post-processing.The official Starfield CK compiler handles Guard syntax natively. Champollion v1.3.2 guesses some Guard syntax in a form that the CK does not accept, so bgs-papyrus applies a validated Starfield syntax post-process during decompile:
Guard ... EndGuard -> LockGuard ... EndLockGuard
TryGuard ... EndGuard -> TryLockGuard ... EndTryLockGuard
This Guard rewrite was checked by recompiling the decompiled output through the real Starfield CK compiler.
Known limitation: Champollion v1.3.2 has unrelated decompile bugs, such as remote-event casts, that can stop complex vanilla scripts from recompiling cleanly. Treat decompiled output as a strong starting point and manually fix compiler-rejected constructs. The Guard post-processor is validated; this limitation is upstream Champollion.
bgs-papyrus capabilities --json.bgs-papyrus detect-toolchain --json --game <game>.--json..pex files only under <MO2_Root>/mods/<mod-name>/Scripts/.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bb-84c/bgs-modding-superpowers --plugin bgs-modding-superpowers16 skills in this plugin
/curating-bgs-modpackUse when planning or building the whole Bethesda modpack incrementally — batch strategy, rollback point, naming convention, separator discipline, attribution, and declaring 风格 before adding mods. Triggers - "build a modpack", "plan the pack", "batch strategy", "rollback point", "naming convention", "declare 风格", "策展整合包", "整合包规划". NOT for deciding whether one mod belongs (evaluating-bgs-mods), installing one mod from author instructions (interpreting-mod-author-instructions), load order mechanics (writing-bgs-load-order), or record conflicts (xedit-conflict-audit)./diagnosing-bgs-problemsUse when a BGS modded game has CTD, crash log, FPS drop, stuttering, freeze, performance, won't start, 崩溃, 掉帧, 卡顿 symptoms and the user needs a symptom-first diagnostic ladder. NOT for proactive post-install testing; use testing-bgs-modpack./evaluating-bgs-modsUse when deciding whether a mod belongs in a modpack — judging mod quality, fit, risk, and pack-value BEFORE download/install. Triggers - "should I add this mod", "is this mod good", "评估这个mod", "这个mod值得装吗", "is this mod worth it", "this mod looks too good to be true", "compare these mods", "does this mod fit my pack". NOT for how to install a mod (use interpreting-mod-author-instructions), load order (writing-bgs-load-order), or conflict resolution (xedit-conflict-audit)./interpreting-mod-author-instructionsUse when deciding how to correctly download/install a Bethesda mod per the author's instructions — triggers "how do I install", "FOMOD choices", "which file to download", "author说明", "install instructions", "which variant", "按作者说明安装", "这个mod怎么装". NOT for deciding whether to include the mod (use evaluating-bgs-mods), load order editing (writing-bgs-load-order), record conflicts (xedit-conflict-audit), archive operations (using-bgs-archive), Papyrus work (using-bgs-papyrus), or translation/export tasks (using-bgs-translator)./maintaining-modding-environmentsUse after first-run for ongoing modpack maintenance: update/install KB packs, author or register custom/mod KB packs, maintain localization glossary KBs for translator use, prune KB cache, health-check the environment, version-pin KB/tooling, or handle recurring BGS modding environment care./setting-up-bgs-modding-environmentUse on first install of this plugin, when MO2 or xEdit is not yet detected, when starting a new modpack project, or when the user says 'set up', 'install', 'bootstrap', 'configure', or 'initialize' the BGS modding environment. Orchestrates: MO2 detection and control-plane install, MO2 visible launch, optional xEdit download from BB-84C/TES5Edit, optional bgs-translator/xtl PyPI install, dev-log and release-changelog initialization, and end-to-end semantic smoke verification.Other plugins' skills for the same job