powershell-for-agents
仓库创建 2026年7月28日最近提交 1 天前SkillHot 收录 1 天前
▸ 精选理由
包含执行策略、错误处理与兼容性要点,便于自动化与迁移。
▸ 风险提示
生成可执行脚本可能导致高权限操作风险
这个 Skill 做什么
为 AI 代理生成正确安全的 PowerShell 脚本并处理常见 Windows 陷阱。
为 AI 代理产出正确且安全的 PowerShell 脚本,处理 .ps1、单行命令、安装器、CI 步骤、模块、错误处理、JSON 解析和 REST 调用等场景。主要面向 PowerShell 7+(遇不到时回退到 Windows PowerShell 5.1),并提供脚本模版和错误策略建议以避免常见坑。能把常见的 bash 思维平滑迁移到 PowerShell,同时规避 Windows 下的陷阱。
▸ 展开 SKILL.md 英文原文
Write correct, safe PowerShell for AI coding agents on Windows. Use when authoring .ps1 scripts, one-liners, installers, CI steps, modules, error handling, JSON parsing, REST calls, or replacing bash scripts with PowerShell.
1
Stars
0
Forks
7
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/javeckbila/windows-agent-skills/master/skills/powershell-for-agents/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/javeckbila/windows-agent-skills/master/skills/powershell-for-agents/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# PowerShell for coding agents
## Target edition
- **Primary:** PowerShell 7+ (`pwsh`) — cross-platform, modern syntax
- **Fallback:** Windows PowerShell 5.1 — still default on many corporate images
At the top of scripts:
```powershell
#Requires -Version 5.1
$ErrorActionPreference = 'Stop'
```
## Script skeleton
```powershell
#Requires -Version 5.1
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[string]$Path = '.'
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
function Write-Info([string]$Message) {
Write-Host "[info] $Message"
}
try {
$resolved = Resolve-Path -LiteralPath $Path
Write-Info "Working in $resolved"
# ...
}
catch {
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有