bundled-skills/powershell/SKILL.md
Run PowerShell (pwsh) commands and scripts. Use when the user asks to automate Windows tasks, manage files/processes/services, query system info, or run .ps1 scripts. Also covers cross-platform pwsh on macOS/Linux.
npx skillsauth add ruilisi/lsbot powershellInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use pwsh (PowerShell Core 7+) for all commands — not powershell.exe (Windows PowerShell 5).
Run a one-liner:
pwsh -Command "Get-Date"
Run a script file:
pwsh -File ./script.ps1
Run with no profile (faster, avoids profile side-effects):
pwsh -NoProfile -Command "..."
$name = "world"
Write-Output "Hello, $name"
# Suppress output
$null = Some-Command
# Capture output
$result = Get-Process | Where-Object { $_.CPU -gt 10 }
# List files
Get-ChildItem -Path C:\Users -Recurse -Filter "*.log"
Get-ChildItem | Sort-Object LastWriteTime -Descending | Select-Object -First 10
# Copy / Move / Delete
Copy-Item src.txt dst.txt
Move-Item old.txt new.txt
Remove-Item file.txt
Remove-Item folder -Recurse -Force
# Read / Write files
Get-Content file.txt
Set-Content file.txt "content"
Add-Content file.txt "appended line"
"line1", "line2" | Out-File output.txt -Encoding UTF8
# List processes
Get-Process
Get-Process -Name chrome
# Kill a process
Stop-Process -Name notepad
Stop-Process -Id 1234
# Start a process
Start-Process notepad.exe
Start-Process pwsh -ArgumentList "-File script.ps1" -Wait
Get-Service
Get-Service -Name wuauserv
Start-Service -Name Spooler
Stop-Service -Name Spooler
Restart-Service -Name Spooler
Set-Service -Name Spooler -StartupType Automatic
# OS / hardware
Get-ComputerInfo | Select-Object WindowsVersion, TotalPhysicalMemory
[System.Environment]::OSVersion
$env:COMPUTERNAME; $env:USERNAME
# Disk usage
Get-PSDrive -PSProvider FileSystem
# Network
Get-NetIPAddress
Test-NetConnection google.com -Port 443
Resolve-DnsName google.com
# Read
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName
# Write
Set-ItemProperty -Path "HKCU:\Software\MyApp" -Name "Setting" -Value "Value"
# Create key
New-Item -Path "HKCU:\Software\MyApp" -Force
# GET request
$resp = Invoke-WebRequest -Uri "https://api.example.com/data" -UseBasicParsing
$resp.Content
# POST JSON
$body = @{ key = "value" } | ConvertTo-Json
Invoke-RestMethod -Uri "https://api.example.com" -Method POST -Body $body -ContentType "application/json"
# Download file
Invoke-WebRequest -Uri "https://example.com/file.zip" -OutFile "file.zip"
# Parse JSON
$data = '{"name":"Alice","age":30}' | ConvertFrom-Json
$data.name
# Build JSON
@{ name = "Alice"; scores = @(95, 87) } | ConvertTo-Json -Depth 5
# Filter objects
Get-Process | Where-Object { $_.WorkingSet -gt 100MB }
# Select columns
Get-Process | Select-Object Name, Id, CPU | Sort-Object CPU -Descending
# Group and count
Get-ChildItem -Recurse | Group-Object Extension | Sort-Object Count -Descending
# First / Last
Get-EventLog -LogName System -Newest 20 | Select-Object -First 5
try {
Get-Item "nonexistent" -ErrorAction Stop
} catch {
Write-Error "Failed: $_"
}
# Suppress non-terminating errors
Get-Item "missing" -ErrorAction SilentlyContinue
# List tasks
Get-ScheduledTask | Where-Object { $_.State -eq "Ready" }
# Create task
$action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument "-File C:\scripts\backup.ps1"
$trigger = New-ScheduledTaskTrigger -Daily -At "02:00AM"
Register-ScheduledTask -TaskName "NightlyBackup" -Action $action -Trigger $trigger -RunLevel Highest
# Check current policy
Get-ExecutionPolicy
# Allow local scripts (run once as admin)
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Bypass for a single run
pwsh -ExecutionPolicy Bypass -File script.ps1
# Find large files (>100 MB)
Get-ChildItem C:\ -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Length -gt 100MB } |
Sort-Object Length -Descending |
Select-Object FullName, @{n="MB";e={[math]::Round($_.Length/1MB,1)}}
# Kill all processes matching a name
Get-Process chrome -ErrorAction SilentlyContinue | Stop-Process -Force
# Get public IP
(Invoke-RestMethod https://api.ipify.org?format=json).ip
# Measure command time
Measure-Command { Get-ChildItem C:\ -Recurse }
-ErrorAction SilentlyContinue to suppress non-fatal errors-WhatIf on destructive commands to preview without executing$_ is the current pipeline object; $? is last command success boolInvoke-RestMethod over Invoke-WebRequest for JSON APIs (auto-parses)databases
日程管理与日历。用户提到日程、会议、提醒、安排、行程、约会、deadline、什么时候有空时触发。使用本地 SQLite(~/.lsbot/calendar/calendar.db)存储,通过 sqlite3 命令操作,无需任何外部服务。
development
Get current weather and forecasts (no API key required).
tools
Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
tools
Use when you need to control Slack from OpenClaw via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.