[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ADSFWN2GS13YNW0CTDT46G":3,"skill-same:01M7ADSFWN2GS13YNW0CTDT46G":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7ADSFWN2GS13YNW0CTDT46G","powershell-safe",null,"Leostruka\u002Fdevin-bundle","Leostruka","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F81370685?v=4","01M7AD8MAK63VDNAWRDRRRW04N","leandro ostruka","01M7AD8MBS65YDS1KMMV7YPM07",0,"MIT","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fpowershell-safe\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: powershell-safe\ndescription: Use whenever running powershell.exe\u002Fpwsh, writing .ps1 scripts, or doing file I\u002FO via shell on Windows. Prevents blanked files, encoding corruption, and accidental deletion: read-modify-write pipeline trap, UTF-16\u002FBOM redirection pitfalls, JSON depth truncation, dangerous aliases, empty-variable deletes, verify-after-write discipline.\ntriggers: [user, model]\nallowed-tools: [read, exec, write, edit, grep]\n---\n\n# PowerShell Safe\n\nPowerShell footguns silently blank files and corrupt encoding. Targets Windows PowerShell 5.1 (`powershell.exe`), the default on Windows machines without `pwsh`.\n\n## Rule zero: file content does not go through the shell\n\nUse `write`\u002F`edit` tools to create or edit real files. Never:\n\n- `echo \"...\" > file.ps1` for real files.\n- `Set-Content`\u002F`Out-File`\u002F`Add-Content` for code or config.\n- Redirect (`>`, `>>`) is only acceptable for disposable output (logs, temp dumps).\n\nRedirect re-encodes, may emit BOM, does no surgical diff, and if the left side produces `$null` the existing file becomes blank.\n\n## The classic bug: read and write the same file in one pipeline\n\n```powershell\nGet-Content $f | ForEach-Object { $_ -replace 'a','b' } | Set-Content $f\n# RESULT: $f BLANKED. Set-Content opens for write before Get-Content finishes.\n```\n\nEqually fatal variants: `type $f | ... > $f`, `Import-Csv $f | ... | Export-Csv $f`.\n\nCorrect patterns, in order:\n\n```powershell\n# 1. Read fully into memory BEFORE writing\n$c = [IO.File]::ReadAllText($f)\n$c = $c -replace 'a','b'\n[IO.File]::WriteAllText($f, $c)   # UTF-8 no BOM\n\n# 2. Temp + move (safer: original survives mid-failure)\n$tmp = \"$f.tmp\"\n# ...generate content into $tmp...\nif ((Get-Item $tmp).Length -eq 0) { throw \"tmp empty, aborting\" }\nMove-Item -Force $tmp $f\n```\n\n## Encoding: PS 5.1 silent corruption\n\n- `>`\u002F`>>` are `Out-File`: in 5.1 they write **UTF-16LE with BOM**. Git sees binary, diff dies, parsers break.\n- `Out-File -Encoding utf8` \u002F `Set-Content -Encoding utf8` in 5.1 write **UTF-8 with BOM**. BOM breaks shebang, some JSON\u002FYAML parsers, diff tools.\n- UTF-8 without BOM in 5.1: `[IO.File]::WriteAllText($path, $text)`.\n- Detect BOM: `Get-Content -Encoding Byte -TotalCount 3 $f` -> `239 187 191` = UTF-8 BOM; `255 254` = UTF-16LE.\n- PS7 (`pwsh`) defaults to utf8NoBOM; check `$PSVersionTable.PSVersion` before relying on it.\n- Never pipe `.exe` output via `>`: re-encodes to UTF-16. Capture in a variable + `WriteAllText`, or `cmd \u002Fc \"foo.exe > out.txt\"`.\n\n## $null blanks files\n\n```powershell\n$content = Get-Something     # failed, returned $null\n$content | Out-File $f       # $f is now BLANK\n```\n\nBefore any write: `if ([string]::IsNullOrEmpty($content)) { throw \"empty content\" }`.\n\n## JSON round-trip is destructive\n\n- `ConvertTo-Json` defaults `-Depth 2`: deeper objects become `\"System.Collections.Hashtable\"` strings. Always `-Depth 32`.\n- `ConvertFrom-Json` in 5.1 loses comments and may reorder keys. For point edits, use `edit` tool or surgical regex instead of deserialize->modify->serialize.\n- After writing JSON programmatically, validate: `Get-Content $f -Raw | ConvertFrom-Json` must parse.\n- `Test-Json` only exists in PS7; in 5.1 the try\u002Fcatch around `ConvertFrom-Json` is the test.\n\n## Destructive ops: Remove-Item, empty variables, -LiteralPath\n\n```powershell\n$p = Get-TargetDir                     # returned $null or \"\"\nRemove-Item -Recurse -Force \"$p\\sub\"   # becomes \"\\sub\" or cwd!\n```\n\n- Check path variables: `if ([string]::IsNullOrWhiteSpace($p)) { throw }`.\n- `Test-Path -LiteralPath $p` before deleting; if absent, stop.\n- Use `-LiteralPath` (not `-Path`) when the path may contain `[ ] * ?` (wildcards delete neighbors).\n- `-WhatIf` first on `-Recurse` when the target isn't obviously disposable.\n\n## Quoting and escapes\n\n- Single quotes = literal; double quotes interpolate `$var` and `` `n `` (backtick is the PS escape, not `\\`).\n- `&&` does not exist in PS 5.1. Chain with `;` or `cmd1; if ($LASTEXITCODE -eq 0) { cmd2 }`.\n- `$?` = last cmdlet bool; `$LASTEXITCODE` = last `.exe` exit code. Do not mix.\n- Inside the exec tool (Git Bash), `$` is eaten by bash. For anything beyond one line, write a `.ps1` with the `write` tool and run `powershell -NoProfile -ExecutionPolicy Bypass -File x.ps1`.\n\n## Aliases that lie\n\n| Alias | Actually is | Trap |\n|---|---|---|\n| `curl` | `Invoke-WebRequest` | Not curl.exe: no `-k`, different output, slow `.Content` download |\n| `wget` | `Invoke-WebRequest` | same |\n| `sc` | `Set-Content` | `sc file x` BLANKS the file; `sc.exe` is services |\n| `iex` | `Invoke-Expression` | never with external input |\n| `rm`,`ls`,`cat`,`cp`,`mv`,`echo` | PS cmdlets | Unix flags missing or change meaning |\n\nIn scripts write full cmdlet names or explicit `.exe` (`curl.exe`, `sc.exe`).\n\n## Errors: try\u002Fcatch catches almost nothing\n\n- try\u002Fcatch only catches **terminating errors**. Use `-ErrorAction Stop` on critical cmdlets or `$ErrorActionPreference = 'Stop'` at the top.\n- `-NoProfile` when invoking scripts: user profiles inject unpredictable behavior.\n\n## Post-write verification (mandatory)\n\n```powershell\nGet-Item $f | Select-Object Length\nGet-Content $f -TotalCount 5\n# JSON: Get-Content $f -Raw | ConvertFrom-Json | Out-Null\n```\n\nSize 0 or unexpected encoding = stop and investigate. \"The command ran without error\" is NOT verification.\n\n## Checklist before writing\u002Fdeleting via PowerShell\n\n1. Target exists? `Test-Path` done?\n2. Backup if a real file? `Copy-Item $f \"$f.bak\"`.\n3. Content validated (non-null, parses)?\n4. Explicit correct encoding? (UTF-8 no BOM = `WriteAllText`)\n5. Reading and writing the same file? (forbidden in one pipeline)\n6. Path variable checked non-empty? `-LiteralPath`?\n7. After writing, read back and confirmed?\n\n## Cascade\n\n- `edge-cases`: what if $var is empty \u002F file missing \u002F BOM present.\n- `shell-safe`: sibling skill, same class of disaster in bash.\n","# PowerShell Safe\n\nPowerShell footguns silently blank files and corrupt encoding. Targets Windows PowerShell 5.1 (`powershell.exe`), the default on Windows machines without `pwsh`.\n\n## Rule zero: file content does not go through the shell\n\nUse `write`\u002F`edit` tools to create or edit real files. Never:\n\n- `echo \"...\" > file.ps1` for real files.\n- `Set-Content`\u002F`Out-File`\u002F`Add-Content` for code or config.\n- Redirect (`>`, `>>`) is only acceptable for disposable output (logs, temp dumps).\n\nRedirect re-encodes, may emit BOM, does no surgical diff, and if the left side produces `$null` the existing file becomes blank.\n\n## The classic bug: read and write the same file in one pipeline\n\n```powershell\nGet-Content $f | ForEach-Object { $_ -replace 'a','b' } | Set-Content $f\n# RESULT: $f BLANKED. Set-Content opens for write before Get-Content finishes.\n```\n\nEqually fatal variants: `type $f | ... > $f`, `Import-Csv $f | ... | Export-Csv $f`.\n\nCorrect patterns, in order:\n\n```powershell\n# 1. Read fully into memory BEFORE writing\n$c = [IO.File]::ReadAllText($f)\n$c = $c -replace 'a','b'\n[IO.File]::WriteAllText($f, $c)   # UTF-8 no BOM\n\n# 2. Temp + move (safer: original survives mid-failure)\n$tmp = \"$f.tmp\"\n# ...generate content into $tmp...\nif ((Get-Item $tmp).Length -eq 0) { throw \"tmp empty, aborting\" }\nMove-Item -Force $tmp $f\n```\n\n## Encoding: PS 5.1 silent corruption\n\n- `>`\u002F`>>` are `Out-File`: in 5.1 they write **UTF-16LE with BOM**. Git sees binary, diff dies, parsers break.\n- `Out-File -Encoding utf8` \u002F `Set-Content -Encoding utf8` in 5.1 write **UTF-8 with BOM**. BOM breaks shebang, some JSON\u002FYAML parsers, diff tools.\n- UTF-8 without BOM in 5.1: `[IO.File]::WriteAllText($path, $text)`.\n- Detect BOM: `Get-Content -Encoding Byte -TotalCount 3 $f` -> `239 187 191` = UTF-8 BOM; `255 254` = UTF-16LE.\n- PS7 (`pwsh`) defaults to utf8NoBOM; check `$PSVersionTable.PSVersion` before relying on it.\n- Never pipe `.exe` output via `>`: re-encodes to UTF-16. Capture in a variable + `WriteAllText`, or `cmd \u002Fc \"foo.exe > out.txt\"`.\n\n## $null blanks files\n\n```powershell\n$content = Get-Something     # failed, returned $null\n$content | Out-File $f       # $f is now BLANK\n```\n\nBefore any write: `if ([string]::IsNullOrEmpty($content)) { throw \"empty content\" }`.\n\n## JSON round-trip is destructive\n\n- `ConvertTo-Json` defaults `-Depth 2`: deeper objects become `\"System.Collections.Hashtable\"` strings. Always `-Depth 32`.\n- `ConvertFrom-Json` in 5.1 loses comments and may reorder keys. For point edits, use `edit` tool or surgical regex instead of deserialize->modify->serialize.\n- After writing JSON programmatically, validate: `Get-Content $f -Raw | ConvertFrom-Json` must parse.\n- `Test-Json` only exists in PS7; in 5.1 the try\u002Fcatch around `ConvertFrom-Json` is the test.\n\n## Destructive ops: Remove-Item, empty variables, -LiteralPath\n\n```powershell\n$p = Get-TargetDir                     # returned $null or \"\"\nRemove-Item -Recurse -Force \"$p\\sub\"   # becomes \"\\sub\" or cwd!\n```\n\n- Check path variables: `if ([string]::IsNullOrWhiteSpace($p)) { throw }`.\n- `Test-Path -LiteralPath $p` before deleting; if absent, stop.\n- Use `-LiteralPath` (not `-Path`) when the path may contain `[ ] * ?` (wildcards delete neighbors).\n- `-WhatIf` first on `-Recurse` when the target isn't obviously disposable.\n\n## Quoting and escapes\n\n- Single quotes = literal; double quotes interpolate `$var` and `` `n `` (backtick is the PS escape, not `\\`).\n- `&&` does not exist in PS 5.1. Chain with `;` or `cmd1; if ($LASTEXITCODE -eq 0) { cmd2 }`.\n- `$?` = last cmdlet bool; `$LASTEXITCODE` = last `.exe` exit code. Do not mix.\n- Inside the exec tool (Git Bash), `$` is eaten by bash. For anything beyond one line, write a `.ps1` with the `write` tool and run `powershell -NoProfile -ExecutionPolicy Bypass -File x.ps1`.\n\n## Aliases that lie\n\n| Alias | Actually is | Trap |\n|---|---|---|\n| `curl` | `Invoke-WebRequest` | Not curl.exe: no `-k`, different output, slow `.Content` download |\n| `wget` | `Invoke-WebRequest` | same |\n| `sc` | `Set-Content` | `sc file x` BLANKS the file; `sc.exe` is services |\n| `iex` | `Invoke-Expression` | never with external input |\n| `rm`,`ls`,`cat`,`cp`,`mv`,`echo` | PS cmdlets | Unix flags missing or change meaning |\n\nIn scripts write full cmdlet names or explicit `.exe` (`curl.exe`, `sc.exe`).\n\n## Errors: try\u002Fcatch catches almost nothing\n\n- try\u002Fcatch only catches **terminating errors**. Use `-ErrorAction Stop` on critical cmdlets or `$ErrorActionPreference = 'Stop'` at the top.\n- `-NoProfile` when invoking scripts: user profiles inject unpredictable behavior.\n\n## Post-write verification (mandatory)\n\n```powershell\nGet-Item $f | Select-Object Length\nGet-Content $f -TotalCount 5\n# JSON: Get-Content $f -Raw | ConvertFrom-Json | Out-Null\n```\n\nSize 0 or unexpected encoding = stop and investigate. \"The command ran without error\" is NOT verification.\n\n## Checklist before writing\u002Fdeleting via PowerShell\n\n1. Target exists? `Test-Path` done?\n2. Backup if a real file? `Copy-Item $f \"$f.bak\"`.\n3. Content validated (non-null, parses)?\n4. Explicit correct encoding? (UTF-8 no BOM = `WriteAllText`)\n5. Reading and writing the same file? (forbidden in one pipeline)\n6. Path variable checked non-empty? `-LiteralPath`?\n7. After writing, read back and confirmed?\n\n## Cascade\n\n- `edge-cases`: what if $var is empty \u002F file missing \u002F BOM present.\n- `shell-safe`: sibling skill, same class of disaster in bash.\n",{},"main","02b95ddb62959a00b3c31442c2046aca0d19563c","skills\u002Fpowershell-safe",1,"https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle","https:\u002F\u002Fleostruka.github.io\u002Fdevin-bundle\u002F","https:\u002F\u002Fgithub.com\u002FLeostruka","2026-11-15 05:19:58",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add Leostruka\u002Fdevin-bundle --skill powershell-safe",{"tool":37,"command":38},"bunx","bunx skills add Leostruka\u002Fdevin-bundle --skill powershell-safe",{"tool":40,"command":41},"pnpm","pnpm dlx skills add Leostruka\u002Fdevin-bundle --skill powershell-safe","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fpowershell-safe\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":18},"01M7E0K3MG2XC4FSRV0MK6SFR1","montador-de-ideias","Use when assembling, expanding, or elevating a raw project idea or initial prompt into an ultra-detailed, first-principles dossier and compiled master prompt with journalistic OSINT market research, Tech Lead and Staff Architect justifications, atomic and modular hardening\u002Foptimization, and high-impact contact surfaces.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fmontador-de-ideias\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M7E0J7JJWZ8QMK01RZ3B3C9Z","git-github-adaptive-engineering","Use when any task touches git history, GitHub issues\u002FPRs\u002Freleases\u002FCI, repo governance, or branch and merge decisions. Runs the Fase Zero situational-awareness battery, picks one of five delivery flows via the adaptive decision engine, and enforces commit\u002FPR information-density standards. Orchestrates the gh, git-workflows, github-actions, pr, and debug\u002Ffinish skills.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fgit-github-adaptive-engineering\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M7E0GJFRPFEVQQMXEM58EWDM","adaptive-agenda-calendar-routine-engine","Use when planning or executing work across hours, days, weeks, or sprints. Turns the calendar into a strict time-blocked agenda (HH:MM-HH:MM blocks carrying a routine profile, expected inputs, and a handoff output artifact), runs the 5-stage cognitive flow (Radar and Hunt -> Triage plus Steve Jobs conception -> workbench manifest -> >=32-cycle loop -> Close plus Open-Minded Scrum), and unfolds macro calendar milestones into micro agenda blocks through extensions\u002Fgcal\u002Fwrapper.py.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Fskills\u002Fadaptive-agenda-calendar-routine-engine\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7AE2K9FTY0BVS48N0A9JFKF","demo","Use when demonstrating a skill in a fixture project.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Fdemo\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M7AE2G3DP38PTV3B1N7MW5TS","duplicate-skill","Use when testing duplicate skill name detection.","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Fbeta\u002FSKILL.md",[],[],{"skillNo":82,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M7AE2DBR8ZHT6T875MJ392GK","https:\u002F\u002Fgithub.com\u002FLeostruka\u002Fdevin-bundle\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fdevin-config\u002Fproject\u002F.devin\u002Fskills\u002Falpha\u002FSKILL.md",[],[]]