powershell-safe
Skill16 starsChanged 7 months agoMITView on GitHub
Enforce safe PowerShell string patterns before writing or editing any .ps1 file, or before passing PowerShell via the Bash tool. Triggers on "write a powershell script", "edit the .ps1", "run powershell", "powershell command", or any task that produces PowerShell content.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Leostruka/devin-bundletheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Leostruka/devin-bundle★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- actSkill
- security-checkSkill
- environment-checkSkill
- run-verificationSkill
- refactorSkill
- debug-session-archivedSkill
- generate-guardsSkill
- check-anthropicSkill
- code-reviewerSkill
- code-reviewSkill
- debug-sessionSkill
- end-sessionSkill
- evolve-checkSkill
- evolveSkill
- fix-bugSkill
- forgetSkill
- frontend-designSkill
- guardSkill
- kit-healthSkill
- learnSkill
- map-codebaseSkill
- modeSkill
- parallel-prototypesSkill
- planSkill
- product-riskSkill
- progress-reportSkill
- prototype-hypothesisSkill
- recallSkill
- refactoring-uiSkill
- scan-codebaseSkill
- scan-conventionsSkill
- search-firstSkill
- search-memorySkill
- shadow-codeSkill
- skill-creatorSkill
- smart-resumeSkill
- start-sessionSkill
- strategic-compactSkill
- tourSkill
- ux-heuristicsSkill
- verification-loopSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Never: use em dashes (—) — replace with hyphen-minus (-) or --
- Very specific: line 17
Never: use curly/smart quotes (" " ' ') — use straight quotes only
- Very specific: line 18
Never: use emoji in string literals or comments inside .ps1 files
- Very specific: line 24
When passing PowerShell through the Bash tool, $variables get expanded by the shell before PowerShell sees them:
- Very specific: line 27
Write to a .ps1 file first, then execute: powershell -File script.ps1
- Distinctive: line 42
Use single quotes for the outer Bash string when the PowerShell content contains backticks
- Distinctive: line 48
Prefer writing the script to a file and executing it instead
- Distinctive: line 55
Verify it prints cleanly before embedding in a larger command or script.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: powershell-safe
Auto-applies whenever writing, editing, or running PowerShell content.
Rules — apply every time, no exceptions
1. ASCII-only strings
- Never use em dashes (
—) — replace with hyphen-minus (-) or-- - Never use curly/smart quotes (
""'') — use straight quotes only - Never use emoji in string literals or comments inside
.ps1files - Never copy-paste text from markdown/chat that may contain Unicode punctuation
Em dashes silently corrupt
.ps1files — PowerShell parses them as unknown tokens, failing with no clear error message.
2. Variable interpolation via Bash tool
When passing PowerShell through the Bash tool, $variables get expanded by the shell before PowerShell sees them:
- Wrap the entire command in single quotes to prevent shell expansion, OR
- Escape every
$as`$inside double-quoted Bash strings, OR - Write to a
.ps1file first, then execute:powershell -File script.ps1
# WRONG — $name expanded by shell, PowerShell sees empty string
powershell -Command "Write-Output $name"
# RIGHT — single quotes prevent shell expansion
powershell -Command 'Write-Output $name'
# RIGHT — write file, execute file
echo 'Write-Output $name' > tmp.ps1 && powershell -File tmp.ps13. Backticks in strings
PowerShell uses backtick (`) as its escape character. Inside Bash double-quoted strings, backticks trigger command substitution:
- Use single quotes for the outer Bash string when the PowerShell content contains backticks
- Or escape as
\`in double-quoted contexts
4. Here-strings via Bash
PowerShell here-strings (@" "@ or @' '@) are fragile through Bash:
- The closing
"@or'@must be at the start of a line with no leading whitespace - Prefer writing the script to a file and executing it instead
5. Test before embedding
For any non-trivial PowerShell string, test with Write-Output first:
Write-Output "your string here"Verify it prints cleanly before embedding in a larger command or script.
Checklist — run before writing any PowerShell
- No em dashes, smart quotes, or emoji in string literals
$variablesprotected from shell expansion (single quotes or file-based execution)- Backticks handled correctly for context (Bash single-quoted or escaped)
- Here-string closers at column 0 if used
- Tested with
Write-Outputif any doubt about a string value
Common failures
| Symptom | Root cause | Fix |
Unexpected token with no obvious cause | Em dash in string | Replace — with - |
$variable always empty | Shell expanded it before PowerShell ran | Single-quote the Bash string |
| Here-string parse error | Closing "@ has leading whitespace | Move to column 0 |
| Backtick disappears | Bash swallowed it as command substitution | Single-quote the Bash wrapper |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

