Gives Claude Code, Codex and other coding agents 12 focused references for Windows PowerShell 5.1 build scripts and wrappers: 5.1-safe syntax, quoting and native commands, stdout, stderr and exit codes, text encoding and BOMs, loading and verifying the Visual Studio Developer Shell, and calling MSBuild and MSVC. It is guidance for scripting and build wrappers, not a complete PowerShell or Visual Studio reference.
Status: early draft. The reference pages are in place; scripts, assets and evaluations will be added over time.
npx skills add LevyBytes/AI-SKILL-powershell-vsdevshell -gThis installs the skill as powershell-vsdevshell for each coding agent it finds on your computer; without -g it goes into the current project only. The command needs Node.js 22.20 or later.
Install without Node.js
Clone the repository into your agent's skills folder:
| Agent | Command |
|---|---|
| Claude Code | git clone https://github.com/LevyBytes/AI-SKILL-powershell-vsdevshell ~/.claude/skills/powershell-vsdevshell |
| Codex | git clone https://github.com/LevyBytes/AI-SKILL-powershell-vsdevshell ~/.agents/skills/powershell-vsdevshell |
Ask your agent about Windows PowerShell scripts and builds as usual; it loads the skill when a task matches. You can also call it by name with /powershell-vsdevshell in Claude Code or $powershell-vsdevshell in Codex.
- "Why does my script stop with
NativeCommandErrorwhen the tool exits with code 0?" - "Load the Visual Studio Developer Shell for an x64 build from a script, and check that it loaded."
- "Rewrite this script without
??and&&so it runs in Windows PowerShell 5.1." - "Why can't Python read the JSON my 5.1 script wrote with
Set-Content -Encoding UTF8?"
| Reference | Covers |
|---|---|
| Windows PowerShell 5.1 compatibility | PowerShell 7 syntax missing from 5.1 and the 5.1-safe alternative for each, #Requires, behavior differences, parser checks |
| Quoting and native commands | Calling executables with &, argument arrays, 5.1 argument limits, the --% stop-parsing token, $LASTEXITCODE |
| Native process output capture | Capturing stdout, stderr and the exit code with a process object instead of redirection that raises NativeCommandError |
| Arrays, hashtables and functions | Arrays, lists, ordered hashtables, function output, joins, splits, null comparisons |
| Errors, exit codes and logging | Terminating errors, native exit codes, stderr, logging phases, final status |
| Files, paths and encoding | Literal paths, long paths, explicit -Encoding, the 5.1 UTF-8 BOM, BOM-less writes, line endings |
| Visual Studio Developer Shell | Finding an installation with vswhere, Launch-VsDevShell.ps1, VsDevCmd.bat and vcvarsall.bat architectures, VSCMD_VER, what to verify after loading |
| MSBuild and MSVC build tools | MSBuild with explicit target, configuration and platform, compiler checks, reporting and recovery |
| Embedded Python in PowerShell | Generating and running Python from PowerShell, passing values through arguments, environment or JSON, encoding, py_compile |
| Validation and AST checks | Parsing scripts with the intended engine, generated scripts, JSON and JSONL checks, smoke tests, output files |
| VS Code PowerShell sessions and tasks | Choosing the PowerShell engine in VS Code, task arguments, working directories |
| PowerShell 5.1 pitfalls checklist | A pre-change checklist for syntax, native commands, Visual Studio tools, files, generated scripts and reporting |
Examples use placeholders such as <VSINSTALLDIR> and <WORK_ROOT>; substitute the repository's paths and check the prerequisites each page lists before running them.
Use when writing, generating, reviewing, or debugging Windows PowerShell 5.1 scripts, setup or build wrappers, native executable invocations, Visual Studio Developer Shell setup, MSBuild or MSVC workflows, Python generation, file paths and encoding, logs, reports, or script validation in a Windows repository.
The material has been interpreted and organized into task-focused references with descriptive filenames, explicit loading conditions and linked prerequisites. References keep the distinctions that matter in automation: native exit codes versus PowerShell errors, a child process's environment versus the calling shell's, and file encoding versus console output. Each reference stays within 100 lines, including code and navigation.
Pull requests are accepted from approved contributors only. To propose a fix or a feature, first open an issue that describes the change your pull request would make, such as an example that fails under Windows PowerShell 5.1 or a Developer Shell switch that changed, and the Microsoft documentation it should match. The maintainer reviews the issue and your GitHub account, then approves or declines. New maintainers are approved the same way. See CONTRIBUTING.
Skill reference documentation is interpreted content for use in open source projects. Check against official documentation sources when dealing with defects or issues that may come up from interpreting this skill's references.
Licensed under Apache-2.0; see LICENSE. Part of the Agent Kaizen skill library.
