fix(skills): make pre-resolution commands shell-portable so skills load under PowerShell#1078
Merged
tmchow merged 1 commit intoJul 9, 2026
Conversation
…ad under PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1066
Summary
The
!backtick pre-resolution lines in eight skills use bash-only syntax (2>/dev/null || true,|| echo 'SENTINEL',|| pwd). The harness executes these through the user's shell at skill load, and on Windows installs where that shell is PowerShell every one of these lines fails, even inside a git repo, so the skill breaks at load (#1066). This PR reduces each guarded line to a bare single command and moves the failure handling into the adjacent prose, which already told the agent what to do when a line does not resolve.Current behavior
From #1066, invoking
/ce-compoundon Windows with a PowerShell-shelled harness:Two independent failures: PowerShell resolves
/dev/nullas a literal file path (D:\dev\null), andtrueis not a command on Windows. PowerShell 5.1 additionally cannot parse||at all. So the guarded shape fails for these users on the happy path (inside a git repo), not just in the edge case the guard was written for.Root cause
The
2>/dev/null || trueguards were added for issue #730, when a failing pre-resolution aborted skill load on POSIX shells. The guard itself is bash-only syntax, so it trades a POSIX edge-case failure (outside a git repo) for a hard failure on every PowerShell-shelled Windows install.Fix
!`git rev-parse --show-toplevel`. A bare command parses and runs in bash, PowerShell 5.1, and PowerShell 7.ghmissing,origin/HEADunset, PowerShell error text).tests/skill-shell-safety.test.ts: replace the superseded "pair2>/dev/nullwith|| true" checker, whose failure message now instructs contributors to write the exact shape that breaks PowerShell, with a checker that rejects redirects and||/&&chains in pre-resolution commands outright. The policy header documents the incident and the succession from the [compound-engineering] Bug: ce-compound and ce-sessions fail with "Shell command failed for pattern" outside git repos #730 guidance.The bare shape is not new to this repo. ce-commit and ce-commit-push-pr already ship bare pre-resolution lines (
!`git status`,!`git diff HEAD`,!`git branch --show-current`,!`git log --oneline -10`) that fail outside a git repo the same way a baregit rev-parsedoes, and no #730-style reports have come in against them. Guarded and bare currently coexist across the skills; this PR converges on the shape that runs in every shell.Verification
!`git rev-parse --abbrev-ref HEAD`resolves to the branch name.bun testbaseline diff against main on this machine: zero new failures.!lines through git-bash, so the PowerShell execution path itself was not reproduced locally. The PowerShell claim rests on the reporter's error output in Cannot use /ce-compund on windows system for claude code, after upgrade to 3.17.1 version #1066 plus PowerShell semantics, each verifiable independently.Scope notes
printfchains with2>/dev/null) are deliberately unchanged: agents run those adaptively through a shell tool at runtime and can translate per platform, unlike load-time pre-resolution, which the user cannot avoid.