Skip to content

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

PowerShell Developer Shell Agent Skill

PowerShell Developer Shell agent skill: 5.1 Scripting, Native Processes, MSBuild + MSVC

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.

Install

These commands make a skills folder, copy this skill into it, and link it into the folders Claude Code and Codex load skills from. Linking saves storage space: every agent and project uses the one copy in the skills folder instead of keeping a duplicate of its own, and an update to that copy reaches all of them. The example keeps the skills folder at D:\dev\SKILLS on Windows and ~/dev/SKILLS on Linux, and names it with an environment variable, DEVSKILLS; any folder works. Copying the repository needs Git.

Windows directions - expand for commands

These commands run in PowerShell.

install_skill.py, from the skill-drafting skill, does every step in this section in one run. It needs Python 3.12 or newer and Git. It prints each step as it goes; without --apply it prints the plan and changes nothing.

This downloads install_skill.py into the current folder:

Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/LevyBytes/AI-skill-drafting/HEAD/scripts/install_skill.py" -OutFile install_skill.py

This installs the skill: it saves DEVSKILLS as D:\dev\SKILLS for your Windows account when it is not saved yet, makes the folders, copies the repository into SKILLS\powershell-vsdevshell and links it into ~/.claude/skills and ~/.agents/skills. Open a new terminal afterwards so it has DEVSKILLS:

python install_skill.py --repository https://github.com/LevyBytes/AI-SKILL-powershell-vsdevshell --skills-root "D:\dev\SKILLS" --apply

To run each step yourself instead:

This saves DEVSKILLS for your Windows account, so every terminal opened from now on has it:

setx DEVSKILLS "D:\dev\SKILLS"

This sets DEVSKILLS in the current terminal too, since setx reaches only terminals opened afterwards:

$env:DEVSKILLS = "D:\dev\SKILLS"

This makes the dev folder on drive D:, and changes nothing if it already exists:

New-Item -ItemType Directory -Force -Path "D:\dev"

This makes the SKILLS folder inside dev, at the path DEVSKILLS holds:

New-Item -ItemType Directory -Force -Path $env:DEVSKILLS

This copies the skill's repository into a folder of the skill's own name, powershell-vsdevshell, without the repository's AI-SKILL- prefix:

git clone https://github.com/LevyBytes/AI-SKILL-powershell-vsdevshell "$env:DEVSKILLS\powershell-vsdevshell"

Linking takes four commands, which make the agents' skills folders and link the skill into them. link_skills.py, from the skill-drafting skill, does all four in one run, and these two commands use it instead.

This copies the skill-drafting skill, which holds the script, into SKILLS the same way:

git clone https://github.com/LevyBytes/AI-skill-drafting "$env:DEVSKILLS\skill-drafting"

This links the skill into ~/.claude/skills and ~/.agents/skills, making either folder when it is missing. The script reads the skills folder from DEVSKILLS, needs Python 3.12 or newer, and links every skill in SKILLS when --skill is left out:

python "$env:DEVSKILLS\skill-drafting\scripts\link_skills.py" --skill powershell-vsdevshell --apply

Without the script, these four commands do the same by hand:

This makes Claude Code's personal skills folder, ~/.claude/skills, and changes nothing if it already exists:

New-Item -ItemType Directory -Force -Path "$HOME\.claude\skills"

This links the skill into it as a directory junction, a Windows folder link that needs no administrator rights, so Claude Code loads the copy in SKILLS:

New-Item -ItemType Junction -Path "$HOME\.claude\skills\powershell-vsdevshell" -Target "$env:DEVSKILLS\powershell-vsdevshell"

This makes Codex's personal skills folder, ~/.agents/skills, and changes nothing if it already exists:

New-Item -ItemType Directory -Force -Path "$HOME\.agents\skills"

This links the skill into it the same way, so Codex loads the same copy:

New-Item -ItemType Junction -Path "$HOME\.agents\skills\powershell-vsdevshell" -Target "$env:DEVSKILLS\powershell-vsdevshell"
Linux directions - expand for commands

These commands run in bash.

install_skill.py, from the skill-drafting skill, does every step in this section in one run. It needs Python 3.12 or newer and Git. It prints each step as it goes; without --apply it prints the plan and changes nothing.

This downloads install_skill.py into the current folder:

curl -fsSLO https://raw.githubusercontent.com/LevyBytes/AI-skill-drafting/HEAD/scripts/install_skill.py

This installs the skill: it saves DEVSKILLS as ~/dev/SKILLS in your shell's startup file when it is not saved yet, makes the folders, copies the repository into SKILLS/powershell-vsdevshell and links it into ~/.claude/skills and ~/.agents/skills. Open a new terminal afterwards so it has DEVSKILLS:

python3 install_skill.py --repository https://github.com/LevyBytes/AI-SKILL-powershell-vsdevshell --skills-root ~/dev/SKILLS --apply

To run each step yourself instead:

This saves DEVSKILLS in ~/.bashrc, so every terminal opened from now on has it:

echo 'export DEVSKILLS="$HOME/dev/SKILLS"' >> ~/.bashrc

This sets DEVSKILLS in the current terminal too, since bash reads ~/.bashrc only when a terminal starts:

export DEVSKILLS="$HOME/dev/SKILLS"

This makes the dev folder in your home folder, and changes nothing if it already exists:

mkdir -p ~/dev

This makes the SKILLS folder inside dev, at the path DEVSKILLS holds:

mkdir -p "$DEVSKILLS"

This copies the skill's repository into a folder of the skill's own name, powershell-vsdevshell, without the repository's AI-SKILL- prefix:

git clone https://github.com/LevyBytes/AI-SKILL-powershell-vsdevshell "$DEVSKILLS/powershell-vsdevshell"

Linking takes four commands, which make the agents' skills folders and link the skill into them. link_skills.py, from the skill-drafting skill, does all four in one run, and these two commands use it instead.

This copies the skill-drafting skill, which holds the script, into SKILLS the same way:

git clone https://github.com/LevyBytes/AI-skill-drafting "$DEVSKILLS/skill-drafting"

This links the skill into ~/.claude/skills and ~/.agents/skills, making either folder when it is missing. The script reads the skills folder from DEVSKILLS, needs Python 3.12 or newer, and links every skill in SKILLS when --skill is left out:

python3 "$DEVSKILLS/skill-drafting/scripts/link_skills.py" --skill powershell-vsdevshell --apply

Without the script, these four commands do the same by hand:

This makes Claude Code's personal skills folder, ~/.claude/skills, and changes nothing if it already exists:

mkdir -p ~/.claude/skills

This links the skill into it as a symbolic link, so Claude Code loads the copy in SKILLS:

ln -s "$DEVSKILLS/powershell-vsdevshell" ~/.claude/skills/powershell-vsdevshell

This makes Codex's personal skills folder, ~/.agents/skills, and changes nothing if it already exists:

mkdir -p ~/.agents/skills

This links the skill into it the same way, so Codex loads the same copy:

ln -s "$DEVSKILLS/powershell-vsdevshell" ~/.agents/skills/powershell-vsdevshell

Use

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 NativeCommandError when 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?"

What's inside

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.

When agents load this skill

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 work behind the references

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.

Contributing

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.

Sources and license

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.

Sponsor this project

Contributors