EliasOulkadi/shokunin / .pack/skills/windows-powershell
windows-powershell
FlaggedWindows 11 system administration with PowerShell — system info reporting, hardware monitoring, package management (winget/scoop), disk cleanup, performance optimization, environment configuration, PowerShell profile setup with aliases and autocomplete, and Task Scheduler automation. Use when user asks to check system info, install tools on Windows, clean up disk space, set up PowerShell profile, or automate Windows tasks. Do NOT use for Linux administration, cross-platform scripting, or network infrastructure management.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.1 KB |
| assets/Microsoft.PowerShell_profile.ps1 | script | 8.5 KB |
| references/powershell-mastery.md | markdown | 8.3 KB |
| scripts/cleanup-system.ps1 | script | 5.4 KB |
| scripts/install-tools.ps1 | script | 3.4 KB |
| scripts/system-info.ps1 | script | 3.8 KB |
scripts/cleanup-system.ps1
View on GitHub<#
.SYNOPSIS
Cleans up Windows temporary files, caches, and reclaims disk space.
.DESCRIPTION
Targets: temp files, recycle bin, Windows update cache, npm/yarn cache,
Docker unused data, old Windows versions, prefetch.
Shows space recovered per step.
.EXAMPLE
.\cleanup-system.ps1
.\cleanup-system.ps1 -DryRun
.PARAMETER DryRun
Show what would be deleted without actually deleting.
#>
param(
[switch]$DryRun
)
$ErrorActionPreference = 'Continue'
$totalRecovered = [long]0
function Write-Phase {
param([string]$Title)
Write-Host "`n" ("─" * 50) -ForegroundColor DarkGray
Write-Host " $Title" -ForegroundColor Cyan
Write-Host ("─" * 50) -ForegroundColor DarkGray
}
function Export-Space {
param([long]$Bytes)
if ($Bytes -ge 1TB) { return '{0:N2} GB' -f ($Bytes / 1TB) }
return '{0:N2} MB' -f ($Bytes / 1MB)
}
function Remove-WithSize {
param(
[string]$Path,
[string]$Label
)
if (-not (Test-Path $Path)) {
Write-Host " $Label : not found" -ForegroundColor DarkGray
return
}
$size = (Get-ChildItem $Path -Recurse -Force -ErrorAction SilentlyContinue |
Measure-Object -Property Length -Sum).Sum
$sizeStr = Export-Space $size
Write-Host " $Label : $sizeStr" -ForegroundColor Yellow
if (-not $DryRun) {
try {
Remove-Item "$Path\*" -Recurse -Force -ErrorAction SilentlyContinue
$totalRecovered += $size
Write-Host " → cleaned" -ForegroundColor Green
} catch {
Write-Host " → error (files in use)" -ForegroundColor Red
}
} else {
Write-Host " → would remove $sizeStr" -ForegroundColor DarkGray
}
}
Write-Host "╔══════════════════════════════════════════════════╗" -ForegroundColor Cyan
Write-Host "║ SYSTEM CLEANUP UTILITY ║" -ForegroundColor Cyan
Write-Host "║ $(if ($DryRun) {'DRY RUN'} else {'LIVE MODE'}) ║" -ForegroundColor Cyan
Write-Host "╚══════════════════════════════════════════════════╝" -ForegroundColor Cyan
# 1. Windows Temp
Write-Phase "[1 / 7] Windows Temporary Files"
Remove-WithSize -Path "$env:TEMP" -Label "User Temp"
# 2. Windows Temp (system)
Remove-WithSize -Path "$env:SystemRoot\Temp" -Label "System Temp"
# 3. Recycle Bin
Write-Phase "[2 / 7] Recycle Bin"
if (-not $DryRun) {
try {
$rbSize = (Get-CimInstance Win32_LogicalDisk | ForEach-Object {
$d = $_.DeviceID
$s = (Get-CimInstance -ClassName Win32_Volume -Filter "DriveLetter='$d'" -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty Size -ErrorAction SilentlyContinue)
if (-not $s) { $s = 0 }
[long]$s
} | Measure-Object -Sum).Sum
Clear-RecycleBin -Force -ErrorAction SilentlyContinue
Write-Host " → recycled cleared" -ForegroundColor Green
} catch {
Write-Host " → requires admin or nothing to clear" -ForegroundColor DarkGray
}
} else {
Write-Host " → would empty Recycle Bin" -ForegroundColor DarkGray
}
# 4. Windows Update cache
Write-Phase "[3 / 7] Windows Update Cache"
$wuPath = "$env:SystemRoot\SoftwareDistribution\Download"
Remove-WithSize -Path $wuPath -Label "Update Cache"
# 5. npm / yarn / pnpm cache
Write-Phase "[4 / 7] npm / yarn / pnpm Cache"
Remove-WithSize -Path "$env:USERPROFILE\.npm" -Label "npm cache"
Remove-WithSize -Path "$env:LOCALAPPDATA\Yarn\Cache" -Label "Yarn cache"
Remove-WithSize -Path "$env:LOCALAPPDATA\pnpm\store" -Label "pnpm store"
# 6. Docker unused data
Write-Phase "[5 / 7] Docker Unused Data"
if (Get-Command 'docker' -ErrorAction SilentlyContinue) {
if (-not $DryRun) {
try {
$output = docker system df --format '{{.Size}}' 2>$null
$output = docker system prune -f 2>$null
Write-Host " → docker prune completed" -ForegroundColor Green
} catch {
Write-Host " → docker not running" -ForegroundColor DarkGray
}
} else {
Write-Host " → would run docker system prune -f" -ForegroundColor DarkGray
}
} else {
Write-Host " → Docker not installed" -ForegroundColor DarkGray
}
# 7. Old Windows versions (Windows.old)
Write-Phase "[6 / 7] Old Windows Versions"
$oldWin = "$env:SystemDrive\Windows.old"
if (Test-Path $oldWin) {
$sizeOld = (Get-ChildItem $oldWin -Recurse -Force -ErrorAction SilentlyContinue |
Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue).Sum
$sizeStr = Export-Space $sizeOld
Write-Host " Windows.old : $sizeStr" -ForegroundColor Yellow
if (-not $DryRun) {
try {
# Uses DISM to remove Windows.old properly
& dism /online /Remove-Package /PackagePath:$oldWin /Quiet /NoRestart 2>$null
Write-Host " → Windows.old removal initiated" -ForegroundColor Green
} catch {
Write-Host " → requires admin elevation" -ForegroundColor Red
}
}
} else {
Write-Host " Windows.old : not found" -ForegroundColor DarkGray
}
# 8. Prefetch
Write-Phase "[7 / 7] Prefetch Cache"
Remove-WithSize -Path "$env:SystemRoot\Prefetch" -Label "Prefetch"
# Summary
Write-Phase "SUMMARY"
if ($DryRun) {
Write-Host " Dry run complete — no files were deleted." -ForegroundColor Yellow
} else {
Write-Host " Cleanup complete." -ForegroundColor Green
Write-Host " Estimated space recovered: $(Export-Space $totalRecovered)" -ForegroundColor Green
}
Write-Host "`n Restart recommended for full effect." -ForegroundColor DarkGray
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |