Token导航 LogoToken导航

Agent Skill · 开发

macbook-desktop-mode(Macbook 桌面模式)

macbook-desktop-mode 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

macbook-desktop-mode 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描有未通过项,按安装量在开发类的 21,746 个 Skill 里排第 16,013。

总安装 541周安装 23GitHub Stars 38下载 190核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:macbook-desktop-mode(Macbook 桌面模式)
来源仓库:https://github.com/terrylica/cc-skills
仓库路径:skills/macbook-desktop-mode
安装命令:
npx skills add https://github.com/terrylica/cc-skills --skill macbook-desktop-mode
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/terrylica/cc-skills --skill macbook-desktop-mode

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

macbook-desktop-mode 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合围绕仓库状态和代码变更进行整理。适用于开发协作场景,可在 Codex、Claude、Cursor、Gemini CLI 中辅助代码审查和项目管理。

通过 npx skills add 命令从指定 GitHub 仓库安装,需确认权限范围和是否触发联网或文件读写。建议在使用前检查维护状态和实际功能,避免依赖未经验证的自动化行为。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/macbook-desktop-mode

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/terrylica/cc-skills --skill macbook-desktop-mo…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

macbook-desktop-mode 怎么安装?

在终端执行 npx skills add https://github.com/terrylica/cc-skills --skill macbook-desktop-mode。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

macbook-desktop-mode 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

macbook-desktop-mode 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/terrylica/cc-skills --skill macbook-desktop-mode 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

macbook-desktop-mode 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

macbook-desktop-mode 用的人多吗?

公开数据是累计安装 541 次,近一周安装 23 次,下载 190 次,GitHub 38 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

macbook-desktop-mode 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
macbook-desktop-mode

Macbook 桌面模式 · 本页

54138执行命令未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

MacBook Desktop Mode

A holistic configuration guide for running a MacBook as an always-on-AC desktop workstation. Solves two interconnected problems: USB devices (especially USB 1.1 audio) disappearing during sleep/wake cycles, and unnecessary battery degradation from constant charge cycling.

Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

When to Use This Skill

  • USB microphone or audio device disappears after sleep/wake
  • Battery is cycling unnecessarily on a plugged-in Mac
  • Setting up a MacBook as a permanent desktop workstation
  • Configuring pmset for always-on-AC use
  • Setting up a powered USB hub with uhubctl for software-controlled USB resets
  • Enhancing the AudioDeviceMonitor Swift daemon with self-healing recovery

Root Cause Diagnosis Framework

Before applying fixes, diagnose the specific failure mode. This framework was developed from empirical analysis of a MacBook Pro M3 Max with an Antlion USB Microphone (VID 0x2F96, PID 0x0200).

DarkWake Cycling

macOS performs frequent DarkWake (partial maintenance wake) cycles — typically every 15 minutes overnight. During DarkWake:

  • CPU wakes for Power Nap, network keepalive, Siri
  • USB bus is partially powered but devices aren't fully re-enumerated
  • USB 1.1 Full Speed devices lack Link Power Management (LPM) and can't negotiate graceful resume
  • After multiple cycles, the XHCI controller drops the device from the IO registry

Diagnostic command — check sleep/wake history:

pmset -g log | grep -E "Sleep |Wake |DarkWake" | tail -30

USB 1.1 Device Limitations

USB 1.1 devices (12 Mbps, USBSpeed = 1) are the most fragile across sleep/wake:

  • No Link Power Management protocol
  • No USB selective suspend negotiation
  • Often lack serial numbers (iSerialNumber = 0), making re-identification after bus reset unreliable

Diagnostic command — check device properties:

ioreg -r -c IOUSBHostDevice -l | grep -A 20 "DEVICE_NAME"

Key fields: USBSpeed (1=Full, 2=High, 3=Super), iSerialNumber (0 = no serial), IOPowerManagement.DriverPowerState.

USB Handle Contention

Applications like Chrome hold direct USB user client handles (AppleUSBHostDeviceUserClient) for WebRTC/WebAudio. These stale handles prevent clean re-initialization after sleep.

Diagnostic command — check who has USB handles:

ioreg -r -c IOUSBHostDevice -l | grep -B5 "IOUserClientCreator"

Battery Micro-Cycling

On an always-AC Mac with no charge limit, the battery cycles between the ML-predicted level and actual charge. DarkWake cycles consume power, causing repeated charge/discharge micro-cycles.

Diagnostic command — check daily charge range:

ioreg -r -c AppleSmartBattery -l | grep -E "DailyMinSoc|DailyMaxSoc|Temperature|CycleCount"
  • Temperature is in centidegrees (divide by 100 for Celsius)
  • DailyMinSoc/DailyMaxSoc show today's charge swing range

Phase 1: Power Configuration for Desktop Mode

1.1 Set Charge Limit to 80%

System Settings → Battery → Charging Optimization → "Limit to 80%"

On Apple Silicon, once at the limit the Mac enters AC bypass mode — power flows directly from charger to system board. The battery sits electrically disconnected, eliminating both calendar aging and cycle aging.

1.2 Set sleep=0 on AC

For an always-on-AC desktop, system sleep creates more problems than it solves:

# Disable system sleep on AC only (battery settings unchanged)
sudo pmset -c sleep 0

# Verify
pmset -g custom | grep -A1 "AC Power" | grep sleep

What this preserves:

  • Display sleep still works (displaysleep=10 on AC)
  • Battery sleep settings unchanged (sleep=1 for travel)
  • ttyskeepawake=1 still honored

What this eliminates:

  • DarkWake cycling (root cause of USB dropout)
  • Battery micro-cycling during maintenance wakes
  • Thermal cycling (repeated cold↔warm transitions)

Cost: ~5-8W idle draw on Apple Silicon. No fan spin. ~$5-8/year in electricity.

1.3 Verify Power Configuration

# Full power settings
pmset -g custom

# Battery health snapshot
ioreg -r -c AppleSmartBattery -l | grep -E "Temperature|CycleCount|DailyMinSoc|DailyMaxSoc|MaxCapacity|IsCharging"

# Active power assertions
pmset -g assertions

Phase 2: Hardware Layer — Powered USB Hub

2.1 Why a Powered Hub

A powered USB hub creates a USB session boundary. The Mac's XHCI controller maintains a session with the hub (a robust USB 2.0+ device with serial number). The hub independently maintains sessions with connected devices. Sleep/wake only stresses the Mac↔Hub link.

Additionally, the hub enables software-controlled USB port reset via uhubctl — the equivalent of a physical unplug/replug without touching hardware.

2.2 Hub Selection Criteria

Requirements:

  • Externally powered (not bus-powered) — must have its own power supply
  • uhubctl-compatible chipset — supports per-port power switching
  • USB 2.0+ hub with serial number for reliable re-identification

Compatible chipsets (from the uhubctl project):

  • VIA VL805/VL812/VL817
  • Realtek RTS5411
  • Genesys Logic GL850G/GL3510

2.3 uhubctl Setup

# Install
brew install uhubctl

# List compatible hubs (must have powered hub connected)
uhubctl

# Cycle all ports (2-second off period)
uhubctl -a cycle -d 2

# Cycle specific port on specific hub
uhubctl -a cycle -p 1 -l 1-1 -d 2

Phase 3: Software Layer — AudioDeviceMonitor Enhancement

The reference implementation is a Swift daemon (AudioDeviceMonitorRunner.swift) deployed as a macOS launchd KeepAlive agent. It combines:

  1. Priority enforcement (original) — sets default input/output to highest-priority available device
  2. Device guardian (v2) — state machine tracking, disappearance detection, recovery cascade
  3. Wake detection — IOKit power notifications via IORegisterForSystemPower
  4. Heartbeat — 60-second periodic check for silent drops
  5. Recovery cascade — uhubctl port cycle → retry → Telegram notification

3.1 State Machine

                    ┌──────────┐
          ┌────────▶│ PRESENT  │◀──────────────┐
          │         └────┬─────┘               │
          │              │ device gone          │
          │              ▼                      │
          │     ┌──────────────┐               │
          │     │ DISAPPEARED  │               │
          │     │  (3s debounce)│               │
          │     └──────┬───────┘               │
          │            │ still missing          │
          │            ▼                        │
          │     ┌──────────────┐     found     │
          │     │  RECOVERING  │───────────────┘
          │     │ uhubctl cycle│
          │     └──────┬───────┘
          │            │ max attempts
          │            ▼
          │     ┌──────────────┐
          │     │     DEAD     │
          └─────│  (Telegram)  │
          replug└──────────────┘

3.2 Key Architecture Decisions

  • IOKit power callbacks instead of NSWorkspace — no AppKit dependency, works in headless launchd daemons
  • IOKit message constants defined manually — Swift can't import iokit_common_msg() C macros; values computed from sys_iokit (0xe0000000) | message_code
  • Synchronous uhubctl/curl calls — acceptable because the main RunLoop queues CoreAudio callbacks during blocking; no events lost, just delayed by recovery time
  • Telegram via curl subprocess — no library dependency; credentials loaded from a dotenv file at startup
  • Single-threaded via main queue — all CoreAudio callbacks, heartbeat, and power notifications dispatch to .main; no locks needed

3.3 Build and Deploy

The daemon is a single-file Swift program compiled into a self-contained binary:

# Compile
swiftc -O -framework CoreAudio -framework IOKit \
    -o /path/to/output/audio-device-monitor \
    AudioDeviceMonitorRunner.swift

# Codesign for launchd (ad-hoc, no Apple Developer account needed)
codesign -s - -f -i com.yourorg.audio-device-monitor /path/to/output/audio-device-monitor

Deploy as a launchd agent (user-level, KeepAlive):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.yourorg.audio-device-monitor</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/output/audio-device-monitor</string>
    </array>
    <key>KeepAlive</key>
    <true/>
    <key>RunAtLoad</key>
    <true/>
    <key>ProcessType</key>
    <string>Background</string>
    <key>EnvironmentVariables</key>
    <dict>
        <key>HOME</key>
        <string>/Users/yourusername</string>
    </dict>
    <key>StandardOutPath</key>
    <string>/path/to/logs/audio-device-monitor-stdout.log</string>
    <key>StandardErrorPath</key>
    <string>/path/to/logs/audio-device-monitor-stderr.log</string>
</dict>
</plist>

Load: launchctl load ~/Library/LaunchAgents/com.yourorg.audio-device-monitor.plist

3.4 Configuration (in Swift source)

Priority lists and guarded devices are defined as constants at the top of the Swift source:

  1. inputPriorities / outputPriorities — ordered arrays, highest priority first
  2. guardedDevices — array of GuardedDevice(name:, isInput:) for disappearance monitoring
  3. Tuning constants: heartbeatInterval (60s), disappearDebounce (3s), maxRecoveryAttempts (3)
  4. Notification credentials: loaded from a dotenv file (path configured in loadCredentials())

After changes, recompile and restart the launchd agent.

Phase 4: Verification and Monitoring

4.1 Battery Health Monitoring

# Quick battery snapshot
ioreg -r -c AppleSmartBattery -l | grep -E "Temperature|CycleCount|DailyMinSoc|DailyMaxSoc|MaxCapacity"

# Full power state
pmset -g batt
system_profiler SPPowerDataType | grep -E "Cycle|Condition|Maximum|Charging"

With the 80% charge limit set and sleep=0 on AC:

  • DailyMinSoc and DailyMaxSoc should converge (no swing)
  • Temperature should stay under 3500 (35°C) at steady state
  • CycleCount accumulation should slow dramatically

4.2 USB Device Health

# Current USB device tree
system_profiler SPUSBDataType

# IOKit details for a specific device
ioreg -r -c IOUSBHostDevice -l | grep -A 25 "DEVICE_NAME"

# Kernel USB assertions (shows which devices prevent sleep)
pmset -g assertions | grep USB

4.3 Audio Monitor Logs

# Tail live logs (adjust path to your log location)
tail -50 /path/to/logs/audio-device-monitor-stderr.log

# Key log patterns to watch for:
# "Starting v2 — device guardian mode"     → v2 features active
# "System woke — checking devices"         → wake detection working
# "ALERT: '<device>' disappeared"          → device dropout detected
# "recovered via uhubctl!"                 → automated recovery succeeded
# "recovery FAILED"                        → manual replug needed

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Changing powernap=0 to reduce DarkWakeTrades USB stability for missed iCloud sync, Find My, etc.Set sleep=0 on AC — eliminates DarkWake entirely
Disabling Optimized Battery ChargingAllows battery to charge to 100% — worse for longevitySet explicit 80% charge limit
Killing Chrome to release USB handlesWhack-a-mole; any WebRTC app can grab handlesPowered hub creates session boundary
Polling system_profiler for USB statusExpensive subprocess, 2-3 second latencyCoreAudio property listeners are instant
Using NSWorkspace.didWakeNotificationRequires AppKit/NSApplication — won't work in launchd daemonIORegisterForSystemPower callback
Resetting USB via IOKit when device goneCan't reset a device that's already dropped from IO registryuhubctl power-cycles the physical port

See Also

  • kokoro-tts:realtime-audio-architecture — Complementary skill covering audio *playback* patterns (PortAudio, GIL contention, jitter elimination, device hot-switching). This skill handles the system/USB layer; that one handles the application/playback layer.

Post-Execution Reflection

After this skill completes, reflect before closing the task:

  1. Locate yourself. — Find this SKILL.md's canonical path before editing.
  2. What failed? — Fix the instruction that caused it.
  3. What worked better than expected? — Promote to recommended practice.
  4. What drifted? — Fix any script, reference, or dependency that no longer matches reality.
  5. Log it. — Evolution-log entry with trigger, fix, and evidence.

Do NOT defer. The next invocation inherits whatever you leave behind.

平台分布

Codex

31.78%
按下载量换算60

Claude

31.36%
按下载量换算60

Cursor

17.99%
按下载量换算34

Gemini CLI

10.15%
按下载量换算19

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/terrylica/cc-skills --skill macbook-desktop-mode 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills