custom-powershell-windows-automation

Writes safe PowerShell 7 automation for Windows tasks, config, and file operations.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/sciman-top/skills-manager --skill custom-powershell-windows-automation-sciman-top
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: custom-powershell-windows-automation
Source: https://github.com/sciman-top/skills-manager/tree/main/overrides/custom/custom-powershell-windows-automation
Command: npx skills add https://github.com/sciman-top/skills-manager --skill custom-powershell-windows-automation-sciman-top

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing durable Windows automation in PowerShell often leads to fragile scripts: unsafe recursive deletes, broken paths with spaces or Chinese characters, non-idempotent config writes, and accidental dependence on legacy Windows PowerShell 5.1. This Skill provides rules and patterns for building PowerShell 7 automation that is path-safe, idempotent, and verifiable. ## Core Features & Use Cases - Path and filesystem safety: Enforces -LiteralPath usage, absolute-path containment checks before recursive move/delete, and junction/symlink target verification. - Idempotent config and process management: Guides backup-aware config writes, hidden wrappers for scheduled tasks, correct native tool invocation with $LASTEXITCODE checks, and SupportsShouldProcess dry-run guards. - Verification discipline: Requires dry-run-first validation, idempotence re-runs, exit-code and receipt checks, and reporting of changed paths, rollback locations, and the lowest truth layer verified. - Use Case: When asked to write a scheduled task that syncs files between directories on Windows, the Skill produces a hidden-wrapper PowerShell 7 script with verified target paths, structured logging, and rollback evidence instead of a one-off shell snippet. ## Quick Start Use the PowerShell Windows automation skill to write a PowerShell 7 script that safely syncs a folder and registers it as a hidden scheduled task with idempotent config and rollback evidence.

Frequently Asked Questions about custom-powershell-windows-automation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write safe PowerShell 7 scripts for Windows automation?▼

Use native PowerShell cmdlets end-to-end, pass filesystem paths with -LiteralPath, and verify absolute target paths before recursive moves or deletes. Keep config writes idempotent and backup-aware, and validate with a dry run before mutating state.

How to safely delete or move files recursively in PowerShell?▼

Resolve the absolute target path and verify it is contained within the intended root, including junction or symbolic-link targets, before any recursive operation. A string prefix match alone does not establish containment and can delete the wrong tree.

Should I use powershell.exe or pwsh for new Windows scripts?▼

Use pwsh (PowerShell 7) by default for new automation. Only add a powershell.exe fallback when an explicitly scoped external consumer requires Windows PowerShell 5.1, and isolate and verify that legacy path separately.

When should I use Start-Process instead of calling a CLI directly in PowerShell?▼

Invoke native tools directly when ordinary argument passing is sufficient, checking $LASTEXITCODE immediately. Use Start-Process only when you need process-level control such as hidden windows, redirected streams, credentials, or a different working directory.

How do I add dry-run support to a PowerShell script?▼

Use SupportsShouldProcess and guard the actual mutation with $PSCmdlet.ShouldProcess(...) so -WhatIf works. Do not assume native executables or other modules inherit dry-run behavior; keep those calls behind the guard and verify previews leave state intact.