Overview
- Skill Key
- dalomeve/powershell-safe-chain
- Author
- dalomeve
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/dalomeve/powershell-safe-chain
- Latest Commit SHA
- ac05f94676d9cda258a57025b7820fdb82748823
Chain PowerShell commands safely without &&. Use try/catch, ErrorAction, and proper sequencing for reliable Windows execution.
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 powershell-safe-chain 技能。 若已安装,则直接安装 powershell-safe-chain 技能。
# PowerShell Safe Chain
Chain commands reliably on Windows PowerShell. No `&&` anti-patterns.
## Problem
PowerShell differs from bash:
- `&&` does NOT work for command chaining
- Parameter parsing is case-insensitive but strict
- Errors continue by default (no fail-fast)
- Path separators vary (`\` vs `/`)
## Workflow
### 1. Safe Chaining Pattern
**Wrong**:
```powershell
mkdir test && cd test && echo done
```
**Right**:
```powershell
$ErrorActionPreference = 'Stop'
try {
New-Item -ItemType Directory -Path test -Force
Set-Location test
Write-Host 'done'
} catch {
Write-Error "Failed at step: $_"
exit 1
}
```
### 2. Conditional Chaining
```powershell
# If-then pattern
if (Test-Path $file) {
Remove-Item $file
Write-Host "Deleted"
} else {
Write-Warning "File not found"
}
# Pipeline with error handling
Get-Process | Where-Object CPU -GT 100 | Stop-Process -WhatIf
```
### 3. Splatting for Complex Commands
```powershell
$params = @{
Path = $filePath
Encoding = 'UTF8'
Force = $true
}
Set-Content @params
```
## Executable Completion Criteria
| Criteria | Verification |
|----------|-------------|
| No `&&` in scripts | `Select-String '&&' *.ps1` returns nothing |
| ErrorAction set | `Select-String 'ErrorAction' *.ps1` matches |
| try/catch present | `Select-String 'try|catch' *.ps1` matches |
| Paths use Join-Path | `Select-String 'Join-Path' *.ps1` matches |
## Privacy/Safety
- No hardcoded credentials
- Use `[SecureString]` for passwords
- Environment variables via `$env:VAR`
## Self-Use Trigger
Use when:
- Writing any PowerShell script
- Chaining 2+ commands
- Executing file operations
---
**Chain safely. Fail explicitly.**
capt-marbles
Task Router
capncoconut
Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay, check marketplace stats, or manage agent credentials. Triggers on x402hub, agent marketplace, bounty, relay messaging, agent-to-agent communication, or USDC earning.
capevace
Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.
captchasco
OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.
carol-gutianle
name: modelready description: Start using a local or Hugging Face model instantly, directly from chat. metadata: {"openclaw":{"requires":{"bins": "bash", "curl" }, "env": "URL" }}
canbirlik
Controls Wiz smart bulbs (turn on/off, RGB colors, disco mode) via local WiFi.