Claude Code Pwsh Guard — Development skill for Claude Code
Claude Code hook pack that stops the agent firing Bash-only syntax at a Windows PowerShell session.
How to install Claude Code Pwsh Guard
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open waseemnasir2k26/claude-code-pwsh-guard and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Pwsh Guard does
Claude Code hook pack that stops the agent firing Bash-only syntax at a Windows PowerShell session. Detects extglob, POSIX env refs, /dev/null, heredocs and more; auto-rewrites the safe ones and blocks the rest with the correct pwsh command so the agent self-corrects. Not affiliated with Anthropic.
Alternatives in Development
- Check 1: Cache Exists? — CLAUDE_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}" CACHE_EXISTS=$(ls -d "$CLAUDE_DIR/plugins/cache/claude-hud" 2 10.9k ★
- CORS — Scan an endpoint for CORS misconfiguration — arbitrary-origin reflection, null-origin trust, credential exposu 4.5k ★
- n8n Expression Syntax — n8n expression syntax with {{}} and $json/$node variables 3.6k ★
README
claude-code-pwsh-guard
A Claude Code hook pack that catches bash-only shell syntax before it reaches a Windows PowerShell session, and either rewrites it to the PowerShell equivalent or blocks it with the correct command in the error message.
Claude pwsh-guard Result
──────────────────────────────────────────────────────────────────────────────────────────────────
Bash("shopt -s extglob; ─▶ PreToolUse: deny ✗ never runs
rm -f !(keep.txt|keep2.txt)") [ERROR] shopt / extglob is a bash builtin
PowerShell: Get-ChildItem -Exclude ... |
Remove-Item
[ERROR] extglob pattern !(...)
Bash("Get-ChildItem -Exclude ─▶ (silent) ✓ runs
keep.txt,keep2.txt | Remove-Item")
Bash("export NODE_ENV=production; ─▶ PreToolUse: allow + updatedInput ✓ runs, fixed
echo $PATH > /dev/null") $env:NODE_ENV = "production";
echo $env:PATH > $null
Without the guard, that first command produces `The term 'shopt' is not recognized`, Claude tries a variation of the same bash syntax, and the loop repeats. That loop is [issue #28670](https://github.com/anthropics/claude-code/issues/28670).
   
Quick start
- Clone this repo anywhere:
git clone https://github.com//claude-code-pwsh-guard cd claude-code-pwsh-guardpowershell -ExecutionPolicy Bypass -File .\install.ps1
Related Skills
Port
Translate scripts between bash, POSIX sh, zsh, PowerShell, and Python
Mod Guard
Inspect guardrails policy, initialize a stack preset, dry-run POSIX AST bash safety checks, or view loop/lock
Connectorv1 V2
Claude Code skill that converts a HelloID provisioning target connector from PowerShell V1 to V2 in place. It
Narthex
Prompt-injection defenses for Claude Code. A PreToolUse Bash hook blocks compositional credential-exfiltration
Screen Intelligence
desk: Claude plans, Jev clicks. A macOS desktop agent that drives the mouse and keyboard from a plain-English
Actions Cache Restore Save Split On Success
Plan converting combined actions/cache@vN (which uses the action's built-in post-job save, firing unconditiona
Related Agents
Shell Scripting Pro
Write robust shell scripts with proper error handling, POSIX compliance, and automation patterns. Masters bash
Shell Pro
Writes or refactors shell scripts (bash or POSIX sh) matching the repo's portability posture, verifying with s
PowerShell Expert
Use this agent to RUN command-line work on a Windows host and return a distilled result, and to write, refacto