bilibili-page-reader
Get content from Bilibili videos: official subtitles, danmaku (density/peaks/sample), comments. When no subtitles exist (no…
Use when writing or running PowerShell on Windows, especially native programs, quoted paths, escaping, pwsh, Start-Process, file operations, or shell troubleshooting.
$ npx -y skills add Misaka-Mikoto-Tech/agent-skills --skill powershell-safe-invocation --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/powershell-safe-invocationContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when writing or running PowerShell on Windows, especially native programs, quoted paths, escaping, pwsh, Start-Process, file operations, or shell troubleshooting.
name: powershell-safe-invocation description: Use when writing or running PowerShell on Windows, especially native programs, quoted paths, escaping, pwsh, Start-Process, file operations, or shell troubleshooting.
Use PowerShell 7 through `pwsh.exe` unless Windows PowerShell 5.1 is explicitly required.
When the active shell is uncertain, verify:
$PSVersionTable.PSVersion $PSNativeCommandArgumentPassing
Do not assume installing PowerShell 7 makes `powershell.exe` use PowerShell 7:
Never construct one large command string when arguments can be passed separately.
Use:
$exe = 'C:\Path With Spaces\tool.exe'
$argList = @(
'--input'
'C:\Data Folder\input.json'
'--flag'
)
& $exe @argList
$exitCode = $LASTEXITCODE
if ($exitCode -ne 0) {
throw "$exe failed with exit code $exitCode"
}Rules:
Use hashtable splatting for PowerShell cmdlets:
$params = @{
LiteralPath = 'C:\Data[1]\input.txt'
Destination = 'C:\Output'
Force = $true
ErrorAction = 'Stop'
}
Copy-Item @paramsUse `-LiteralPath` for concrete paths when the cmdlet supports it. For cmdlets that expose only `-Path`, such as `New-Item`, use `-Path`; when unsure, check `Get-Command <cmdlet> -Syntax`.
Do not use `$LASTEXITCODE` to test a PowerShell cmdlet. Use terminating errors:
$ErrorActionPreference = 'Stop'
Wrap expressions passed as parameter values in parentheses or assign them first: use `Select-Object -Index (100..120)`, not `-Index 100..120`.
Do not pipe directly from statement syntax such as `foreach (...) { ... } | ...`; assign the statement output first or use the pipeline cmdlet `ForEach-Object`.
Avoid deeply quoted commands such as:
cmd.exe /c pwsh.exe -Command "..."
For multiline code, nested quotes, JSON, XML, regular expressions, pipelines, redirection, or non-ASCII paths:
1. Write a temporary `.ps1` file. 2. Execute it with:
pwsh.exe -NoLogo -NoProfile -NonInteractive -File script.ps1
Prefer `-File` over `-Command` for anything beyond a short, simple expression.
Do not add `-ExecutionPolicy Bypass` unless execution policy is actually blocking a trusted script.
When you must pass a script through `-Command` from an outer PowerShell process, remember that the outer shell expands `$variables` first. Use an outer single-quoted script string when the inner script contains `$p`, `$env:...`, `$PSVersionTable`, or similar:
pwsh.exe -NoLogo -NoProfile -Command '$p = "C:\Data Folder\input.txt"; Test-Path -LiteralPath $p'
If the command has to cross multiple interpreters or wrappers, stop and write a `.ps1` file instead of stacking more quoting.
PowerShell 7 defaults to UTF-8 without BOM for text output; Windows PowerShell 5.1 defaults vary by cmdlet.
For normal foreground execution, use:
& $exe @argList
Use `Start-Process` only for elevation, new/hidden windows, detached launch, or shell behavior.
`Start-Process -ArgumentList` joins values into a command-line string and is not a reliable structured-argument API. Prefer `ProcessStartInfo.ArgumentList` when exact argument boundaries matter.
When a separate process is required and arguments are complex, use:
$psi = [System.Diagnostics.ProcessStartInfo]::new()
$psi.FileName = $exe
$psi.UseShellExecute = $false
foreach ($arg in $argList) {
$psi.ArgumentList.Add($arg)
}
$process = [System.Diagnostics.Process]::Start($psi)
$process.WaitForExit()
if ($process.ExitCode -ne 0) {
throw "Process failed with exit code $($process.ExitCode)"
}Before recursive delete, move, or overwrite:
Mapped drives are per user/session. If `Test-Path X:\...` fails under an automation or sandbox account but works interactively, check the current identity with `whoami` and inspect `Get-
A personal collection of reusable AI agent skills and MCP-related utilities. 这个仓库用于收集个人日常使用中沉淀下来的 agent skills,包括网页读取、命令行调用规范、自动化流程、工具集成经验等。内容以可直接复制使用的 SKILL.md 为主,后续也可能加入 MCP server 配置和示例。
Get content from Bilibili videos: official subtitles, danmaku (density/peaks/sample), comments. When no subtitles exist (no…
Use when an agent needs to inspect or control a real Unity Editor through Locus, especially when Unity MCP is unavailable,…