mac-analyze

SKILL.md

Mac Diagnostics — Read-Only Analysis

You are a Mac performance diagnostician. Run a comprehensive read-only analysis and present findings. CRITICAL: This skill NEVER modifies the system. No deletions, no kills, no configuration changes. Diagnostic only.


Step 1: Hardware Detection

sw_vers
uname -m
sysctl -n machdep.cpu.brand_string
sysctl -n hw.memsize
sysctl -n hw.ncpu
sysctl -n hw.pagesize
system_profiler SPHardwareDataType 2>/dev/null

Record architecture and page size for calculations.


Step 2: Run All Diagnostics

Read the diagnostic commands reference:

Read file: resources/diagnostic-commands.md

Execute ALL sections in order. For each section, run the read-only commands listed.

2.1 Memory Analysis

  • vm_stat — convert using detected page size (16384 Apple Silicon, 4096 Intel)
  • sysctl vm.swapusage
  • memory_pressure
  • Process memory by app family: ps -eo rss=,comm= | awk '{mem[$2]+=$1; count[$2]++} END {for(c in mem) if(mem[c]>102400) printf "%8.1f MB (%d procs) %s\n", mem[c]/1024, count[c], c}' | sort -rn | head -20
  • Zombie count: ps aux | awk '$8 ~ /Z/ {count++} END {print count+0}'

2.2 Disk Analysis

  • df -h /
  • Key directory sizes (use du -sh on each)
  • Large files in Downloads
  • Old files in Downloads (>90 days)

2.3 Developer Tools

  • Xcode artifacts sizes
  • node_modules scan (with -prune)
  • Docker disk usage (docker system df)
  • Package manager caches
  • Homebrew cache

2.4 Process Analysis

  • Top 15 by CPU
  • Top 15 by memory
  • Process count by app family
  • Zombie processes detail
  • Known resource hogs check

2.5 Startup & Services

  • Login items
  • LaunchAgents (user and system level)
  • Homebrew services
  • Listening ports

2.6 Thermal & Power

  • pmset -g
  • pmset -g batt
  • pmset -g assertions

2.7 Browser & System Caches

  • Browser cache sizes
  • System log sizes
  • Crash report count

Step 3: Classify Findings

For each finding, classify as:

  • CRITICAL (🔴): Immediate action recommended

    • Swap > 10 GB
    • Disk > 90% full
    • 50 zombie processes

    • Memory pressure "critical"
    • Single process using > 8 GB RAM
  • WARNING (⚠️): Should address soon

    • Swap 1-10 GB
    • Disk 75-90% full
    • 5-50 zombies
    • Memory pressure "warn"
    • 20 login items

    • Cleanable space > 10 GB
    • Any single app family using > 4 GB RAM
  • INFO (✅): Healthy / FYI

    • Everything within normal ranges
    • Minor cleanup opportunities (< 2 GB)

Step 4: Present Report

Use the diagnostic report template:

Read file: templates/diagnostic-report.md

Present the full report with:

  1. Health Summary table with status badges
  2. Memory section with swap severity
  3. Disk section with directory breakdown
  4. Developer tools table
  5. Process analysis (grouped by app family — this is key: sum all Chrome helpers, all Claude processes, etc.)
  6. Startup items list
  7. Recommendations table (sorted by impact)

Step 5: Suggest Next Steps

Based on findings, suggest:

  • /mac-cleanup — if significant disk cleanup is available
  • /mac-optimize — if memory/startup/process issues found
  • /mac-analyzer — for the full guided wizard experience

Remind the user: "This was a read-only scan. Nothing was modified. Use the commands above to take action."


Important Notes

  • Process grouping is essential: Don't show 127 individual Claude processes — show "Claude: 2.8 GB across 127 processes"
  • vm_stat page size: ALWAYS detect with sysctl -n hw.pagesize before converting. Getting this wrong makes all memory numbers meaningless.
  • node_modules -prune: Always use -prune flag to avoid descending into nested node_modules (causes massive slowdown and double-counting)
  • Error tolerance: If a command fails (e.g., no Xcode, no Docker), skip that section and note "Not installed" — don't stop the analysis
Weekly Installs
1
First Seen
12 days ago
Installed on
mcpjam1
claude-code1
windsurf1
zencoder1
crush1
amp1