Skip to content

1181652815-hub/clean-windows-c-drive-skill / skills/clean-windows-c-drive

clean-windows-c-drive

Verified

Provide a standalone Simplified Chinese Windows app and CLI workflows to assess C: drive health, clean a fixed allowlist of regenerable junk, find large user files, detect exact duplicates with SHA-256, and relocate or recycle explicitly approved ordinary user files without breaking Windows or installed applications. Use for the C: cleanup app, safe or deep cleanup, large-file or duplicate cleanup, health checks, space diagnosis, or moving ordinary files off C:. Always run the health gate and preview, protect system/personal/configuration data, keep one duplicate per group, and require explicit approval before changes.

scripts/UserFileSafety.ps1

View on GitHub
Set-StrictMode -Version 2

function Get-ApprovedCDriveUserRoots {
    $profile = [Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)
    $candidates = @(
        (Join-Path $profile 'Downloads'),
        [Environment]::GetFolderPath([Environment+SpecialFolder]::Desktop),
        [Environment]::GetFolderPath([Environment+SpecialFolder]::MyDocuments),
        [Environment]::GetFolderPath([Environment+SpecialFolder]::MyPictures),
        [Environment]::GetFolderPath([Environment+SpecialFolder]::MyVideos),
        [Environment]::GetFolderPath([Environment+SpecialFolder]::MyMusic)
    )

    @($candidates | Where-Object {
        -not [string]::IsNullOrWhiteSpace($_) -and
        (Test-Path -LiteralPath $_ -PathType Container) -and
        ([IO.Path]::GetPathRoot([IO.Path]::GetFullPath($_)) -ieq 'C:\')
    } | ForEach-Object { [IO.Path]::GetFullPath($_).TrimEnd('\') } | Select-Object -Unique)
}

function Test-IsChildPath {
    param([Parameter(Mandatory)][string]$Root, [Parameter(Mandatory)][string]$Candidate)
    $rootFull = [IO.Path]::GetFullPath($Root).TrimEnd('\') + '\'
    $candidateFull = [IO.Path]::GetFullPath($Candidate)
    return $candidateFull.StartsWith($rootFull, [StringComparison]::OrdinalIgnoreCase)
}

function Test-IsApprovedCDriveUserFile {
    param([Parameter(Mandatory)][string]$Path)
    if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) { return $false }
    $full = [IO.Path]::GetFullPath($Path)
    $inside = @((Get-ApprovedCDriveUserRoots) | Where-Object { Test-IsChildPath -Root $_ -Candidate $full }).Count -gt 0
    if (-not $inside) { return $false }
    $item = Get-Item -LiteralPath $full -Force -ErrorAction Stop
    $blocked = [IO.FileAttributes]::ReparsePoint -bor [IO.FileAttributes]::Offline -bor [IO.FileAttributes]::System
    return (($item.Attributes -band $blocked) -eq 0)
}

function Get-CDriveUserFileCategory {
    param([Parameter(Mandatory)][string]$Path)
    $extension = [IO.Path]::GetExtension($Path).ToLowerInvariant()
    if ($extension -in @('.jpg','.jpeg','.png','.gif','.bmp','.webp','.heic','.raw')) { return '图片' }
    if ($extension -in @('.mp4','.mkv','.mov','.avi','.wmv','.flv','.webm','.m4v')) { return '视频' }
    if ($extension -in @('.mp3','.wav','.flac','.aac','.m4a','.ogg','.wma')) { return '音频' }
    if ($extension -in @('.zip','.7z','.rar','.tar','.gz','.iso','.img','.exe','.msi','.msix','.appx')) { return '压缩包与安装包' }
    if ($extension -in @('.doc','.docx','.xls','.xlsx','.ppt','.pptx','.pdf','.txt','.md')) { return '文档' }
    return '其他'
}

function Get-SafeCDriveUserFiles {
    param([int]$MaximumFiles = 200000)
    $found = 0
    foreach ($root in Get-ApprovedCDriveUserRoots) {
        $rootItem = Get-Item -LiteralPath $root -Force -ErrorAction SilentlyContinue
        if (-not $rootItem -or ($rootItem.Attributes -band [IO.FileAttributes]::ReparsePoint)) { continue }
        $pending = [System.Collections.Generic.Stack[string]]::new()
        $pending.Push($root)
        while ($pending.Count -gt 0 -and $found -lt $MaximumFiles) {
            $current = $pending.Pop()
            foreach ($item in @(Get-ChildItem -LiteralPath $current -Force -ErrorAction SilentlyContinue)) {
                if ($item.PSIsContainer) {
                    if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -eq 0) { $pending.Push($item.FullName) }
                    continue
                }
                $blocked = [IO.FileAttributes]::ReparsePoint -bor [IO.FileAttributes]::Offline -bor [IO.FileAttributes]::System
                if (($item.Attributes -band $blocked) -ne 0) { continue }
                $found++
                $item
                if ($found -ge $MaximumFiles) { break }
            }
        }
    }
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall