power-analyzer

Cross-platform PC power consumption management tool. Automatically detects power plan, battery health, hardware power-share, background power-consuming processes and six omitted factors; offers one-click power-saving actions, standby mode and remote shutdown. Works across three platforms and is ready to use.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "power-analyzer" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-e191ef1e45416d50e1f83f3f69f593eb42e28360af348f67ca33b195b9ed0b51. Verify the upstream source and version against https://skillhub.cn/skills/user_91b99089/power-analyzer before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Cross-platform PC power consumption management tool. Automatically detects power plan, battery health, hardware power-share, background power-consuming processes and six omitted factors; offers one-click power-saving actions, standby mode and remote shutdown. Works across three platforms and is ready to use.

0 Downloads

Introduction source: third_party · user_91b99089 · 1.8.1 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Software, accounts and paid services
Translation pending; see source documentation.
Limits and differences
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: "power-analyzer"
description: 跨平台电脑能耗管理工具。自动检测电源方案、电池健康度、硬件耗电比、后台耗电进程及6项遗漏因素,支持一键执行省电操作、值守模式与远程关机。三平台通用,即开即用。

权限说明:无需管理员即可使用诊断分析(报告模式)。以下功能需要管理员权限:

  • --apply 一键执行省电(调亮度/设计时/停索引)
  • --keepalive 值守模式开关
  • --shutdown 远程关机
  • 读取电源方案列表(非管理员方案名显示为 GUID)

普通用户可直接运行 python3 power-analyzer.py 查看完整分析报告。

电脑能耗管理

跨平台电脑能耗管理工具。自动检测当前操作系统(Windows / macOS / Linux),调用对应的系统命令分析电源方案、电池健康度、硬件耗电比、后台耗电进程及6项遗漏因素,支持一键执行省电操作与远程关机。

触发词

当用户提到以下任意内容时自动加载本 Skill:

  • "电脑耗电突然变大"
  • "帮我分析一下耗电情况"
  • "有没有省电建议"
  • "电池续航太短了"
  • "电源优化"
  • "功耗分析"
  • "power analysis"
  • "帮我省电" ← 触发一键执行模式
  • "执行省电" ← 触发一键执行模式
  • "直接省电" ← 触发一键执行模式
  • "开启值守模式" ← 触发值守模式
  • "保持运行不睡眠" ← 触发值守模式
  • "恢复省电" ← 触发值守模式关闭

执行模式

该 Skill 支持两种模式:

模式 命令 效果
诊断模式(默认) python3 power-analyzer.py 仅分析并输出报告,不动系统设置
一键执行模式 python3 power-analyzer.py --apply 直接执行省电操作:调亮度 → 设计时 → 停索引
值守模式 python3 power-analyzer.py --keepalive [on/off] 开:保持运行+允许熄屏,后台任务不断/关:恢复常规省电
远程关机 python3 power-analyzer.py --shutdown [秒] 延迟关机(默认 60s 后),留时间保存工作

Claw 远程调度模式

通过 WorkBuddy Claw(微信小程序遥控电脑),本 Skill 支持以下远程指令:

Claw 触发短语 执行行为
"分析耗电" / "省电报告" 执行诊断模式,提取关键结论返回移动端
"帮我省电" / "执行省电" 执行 --apply 模式,完成后发送操作摘要
"开启值守" / "保持运行" 执行 --keepalive on,后台任务持续运行
"恢复省电" 执行 --keepalive off,恢复正常省电设置
"关机" / "关闭电脑" 执行 --shutdown 60,60 秒后安全关机,手机端收到确认

Claw 模式下输出格式要点:

  • 先出结论:一句话总结(如"电池健康 90%,无需更换。发现 2 项可优化:亮度过高、蓝牙未关。")
  • 再列要点:每条优化项用 · 开头,每项不超过 15 字
  • 附命令:如需用户手动操作,以 $ 前缀提供可复制命令
  • 不输出完整报告:手机屏幕有限,只给摘要
  • 关机确认:远程关机时回复"关机指令已发出,60 秒后关闭,请保存工作"

工具位置

本技能的分析脚本位于:

~/.workbuddy/skills/power-analyzer/assets/power-analyzer.py

⚠️ 限制与边界(Adaptability)

使用前请知悉以下边界:

场景 能否处理 说明
笔记本电脑(有电池) ✅ 完整分析电源方案 + 电池 + 进程 + 个性化建议
台式机/一体机(无电池) ✅ 部分 可分析电源方案和后台进程,但无电池信息
Windows/macOS/Linux ✅ 脚本自动识别平台,分发对应分支
虚拟机环境 ⚠️ 有限 仅能读取宿主机暴露的电源状态,通常不完整
服务器(无屏幕无电池) ✅ 部分 可分析 CPU 调频策略和后台进程,无显示器省电建议
手机/平板/iPadOS ❌ 不支持。移动端无 powercfg/pmset/ps 等系统命令
鸿蒙 PC(HarmonyOS) ❌ 微内核不暴露 Linux sysfs 接口,无对应系统命令
远程桌面(无本地硬件) ⚠️ 有限 可分析远程会话的进程,但电源信息不可用

执行步骤

Step 1:确认系统环境

脚本自动检测当前操作系统(sys.platform),按平台分发执行。无需人工判断。

平台 检测值 使用的系统命令
Windows win32 powercfg, wmic, tasklist
macOS darwin pmset, system_profiler, ps
Linux linux powerprofilesctl, /sys/class/power_supply/, ps

Step 2:运行省电分析脚本

诊断模式(分析不操作):

python3 ~/.workbuddy/skills/power-analyzer/assets/power-analyzer.py

一键执行模式(分析+直接省电操作):

python3 ~/.workbuddy/skills/power-analyzer/assets/power-analyzer.py --apply

建议以管理员身份运行,否则部分操作会失败。 执行内容:调低屏幕亮度至 80% → 设适中省电计时 → 暂停 Search Indexer。

脚本自动执行以下操作:

  1. 环境预检(命令可用性 + 管理员权限检测)
  2. 获取电源方案 / 节能模式 / CPU 调频策略
  3. 分析电池状态(剩余电量、预估续航、循环次数、电池健康度)
  4. 扫描后台高耗电进程(跨平台 30+ 常见应用)
  5. 个性化省电潜力估算(基于实际检测结果计算百分比)
  6. 生成平台专属的一键省电命令
  7. 深度分析与针对性建议

Step 3:解读分析结果

向用户呈现报告,重点关注:

发现 严重程度 建议措施
使用"高性能"电源方案 🔴 严重 切换到"平衡"或"节能"模式(省电 20-30%)
屏幕亮度 > 60% 🟡 中 调至 30-50%(最直观的省电手段)
CPU 调频策略为"performance" 🟡 中 切换为"powersave"或"ondemand"
长时间空闲不睡眠 🟡 中 缩短睡眠超时至 5 分钟
后台运行已知高耗电应用 🟡 中 关闭不用的标签页和应用(省电 10-20%)
电量低于 20% 🔴 严重 尽快连接电源

Step 4:给出平台省电指令

根据操作系统提供对应的省电命令:

Windows:

powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e              # 切换到平衡
powercfg /change monitor-timeout-dc 3                                    # 显示器3分钟关闭
powercfg /change standby-timeout-dc 5                                    # 5分钟睡眠
powercfg /energy                                                         # 完整诊断报告(需管理员)

macOS:

sudo pmset -b displaysleep 3     # 电池模式下显示器3分钟关闭
sudo pmset -b sleep 5            # 电池模式下5分钟睡眠
sudo pmset -a powernap 0         # 禁用 Power Nap
pmset -g batt                    # 查看电池状态

Linux:

powerprofilesctl set power-saver                                         # 切换到省电模式
echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor  # CPU省电策略
sudo powertop                                                            # 深度能耗分析
upower -i /org/freedesktop/UPower/devices/battery_BAT0                   # 电池信息

📋 报告样例

运行后输出的典型报告摘要:

==============================================================
  省电诊断报告
  平台: Windows  |  时间: 2026-07-29 14:30:00
==============================================================

【0】环境预检
----------------------------------------
  [OK] 所有依赖命令可用
  [OK] 权限检查通过

【1】电源方案
----------------------------------------
  当前电源方案: 平衡
  可用方案: 高性能, 平衡, 节能

【2】电池状态
----------------------------------------
  • 剩余电量: 67%
  [OK] 电量充足
  • 电池状态: 放电中

【3】后台高耗电应用检测
----------------------------------------
  发现 3 个已知高耗电应用正在运行:
    - Google Chrome(多标签页高耗电)
    - VS Code(大型项目)
    - 微信

【4】个性化省电潜力估算
----------------------------------------
  基于当前检测结果,以下措施可提升续航:
  关闭检测到的高耗电后台应用
    └ 预期节省: 10-20%  ████
  → 综合建议: 以上措施预计总计可延长续航约 15%

【5】深度分析与建议
----------------------------------------
  🟡 后台高耗电应用
  检测到 Chrome, VS Code, 微信 在运行中。
  → 每个 Electron/浏览器标签页约消耗 200-500mW
  → 关闭不用的标签页和后台同步软件可显著降低功耗

  💡 Windows 省电技巧
  • 开启「电池保护」:设置 → 系统 → 电源
  • 关闭「后台应用刷新」:设置 → 隐私
  • 禁用「透明效果」:设置 → 个性化 → 颜色

==============================================================
  报告结束  |  省电诊断师 v1.2.0
==============================================================

❓ 常见问题(FAQ)

Q1: 为什么脚本运行后显示"命令未找到"?

不同平台的常见原因与解决:

平台 缺失命令 原因 解决方法
Windows powercfg 未以管理员身份运行 右键 CMD → 以管理员身份运行
Windows wmic Win10 1803+ 已弃用 使用 PowerShell: Get-CimInstance Win32_Battery
macOS pmset 系统异常 macOS 应内置此命令,检查 /usr/bin/pmset
Linux powerprofilesctl 未安装 sudo apt install power-profiles-daemon
Linux upower 未安装 sudo apt install upower

Q2: 为什么我的电池信息读不到?

3 种常见情况:

  • 台式机/无电池设备:正常现象,脚本会提示"未检测到电池信息"
  • 权限不足:Windows 需管理员、Linux 需 root 权限读 /sys/class/power_supply/
  • 驱动问题:部分笔记本电池驱动未正确安装,检查设备管理器中是否有异常

Q3: 报告中的省电百分比准吗?

是基于经验值的保守估算,仅供参考:

  • 高性能→平衡:20-30%(实验室实测均值)
  • 关闭高耗电后台:10-20%(取决于进程数量和负载)
  • 实际效果取决于硬件配置和使用习惯

Q4: 为什么需要管理员权限?

脚本需要访问系统级的电源管理接口:

  • Windows: powercfg 读取/修改电源方案
  • macOS: pmset 的某些设置需要 sudo
  • Linux: /sys/devices/system/cpu/ 需要 root

非管理员也能运行,但电源方案读取和省电命令部分功能受限,脚本会自动检测并进入降级模式。

Q5: 耗电突然变大,有什么快速排查方法?

按顺序检查:

  1. 任务管理器 → 看 CPU/GPU/磁盘是否有进程持续 ≥ 20%
  2. 最近安装的软件 → 控制面板 → 按安装日期排序
  3. 散热 → 风扇是否全速运转不停?可能是积灰导致过热
  4. Windows 更新 → 是否有更新在后台下载/安装
  5. 外设 → 拔掉不用的 USB 设备(外接硬盘、RGB 键盘等)

Q6: 多久运行一次合适?

  • 日常检查:每月一次,跟踪电池健康度变化
  • 耗电异常时:立即运行,对照上次报告找变化
  • 系统更新后:系统更新可能重置电源计划,建议运行检查

参考

变更记录

  • 1.0.0 (2026-07-28):初始版本,仅支持 Windows
  • 1.1.0 (2026-07-28):跨平台适配,支持 Windows / macOS / Linux
  • 1.3.0 (2026-07-29):省电命令改为适中模式 + 新增硬件耗电分析
  • 1.4.0 (2026-07-29):新增一键执行模式(--apply 参数),可直接降亮度/停索引/设省电计时
  • 1.5.0 (2026-07-29):新增电池健康度检测与更换建议
  • 1.6.0 (2026-07-29):补充 6 项额外耗电因素检测
  • 1.7.0 (2026-07-29):新增远程关机(--shutdown)+ Claw 触发词
  • 1.8.0 (2026-08-01):新增值守模式(--keepalive on/off),保持运行+允许熄屏
  • 1.8.1 (2026-08-01):值守模式支持合盖不睡眠(自动取消 OEM 隐藏的 LIDACTION 设置)

Current listing version

1.8.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 提供跨平台电脑能耗分析与省电优化,解决用户明确的续航痛点
  • 支持一键执行省电操作、值守模式与远程关机,功能闭环完整
  • 覆盖 Windows/macOS/Linux 三平台,适用场景广泛
Trigger Precision95/100

Highlights

  • 触发词覆盖多种变体(中英文、口语化表达),边界清晰
  • 区分诊断模式与一键执行模式,减少误触风险
Structure and Standards98/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层frontmatter中description为空,实际描述内容在skill_body内部

    Recommendation: 建议将description内容移至顶层frontmatter,保持规范统一

Highlights

  • Phase/步骤清晰,有完整执行流程和端到端示例
  • 包含FAQ和限制说明,提升用户体验
Execution Reliability94/100

Highlights

  • 工具来源明确(系统命令),参数正确
  • 覆盖主要异常(权限不足、命令缺失、无电池设备)
  • 不可逆操作(关机)有延迟确认机制
Evidence Verifiability (mean of the first four)95/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • learn.microsoft.com
  • support.apple.com
  • wiki.archlinux.org

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Translation pending; see source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.