mcpField
S
screenshot

screenshot

github.com/0xdarkmatter生产力7844 次安装2 周前更新
代码仓库

关于 screenshot

screenshot 是一项用于查找并展示 Windows、macOS 和 Linux 常见目录中近期截图的技能。它按修改时间排列支持的图像文件,并可指定显示数量。

主要功能

  1. 01检测常见截图目录
  2. 02按修改时间排列图片
  3. 03展示 PNG、JPG、GIF 和 WebP
  4. 04指定显示数量
  5. 05设置自定义目录

适用场景

  1. 01查看最近的截图
  2. 02检查截取的界面
  3. 03在自定义文件夹中查找截图

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/0xdarkmatter/claude-mods --skill screenshot

安装后在 Claude Code 中输入/screenshot确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

assets/
.gitkeep
references/
.gitkeep
scripts/
.gitkeep

详细介绍

截图查看器

快速查找并显示常见截图目录中的近期截图。

用法

/screenshot          # Show last 5 screenshots (default)
/screenshot 1        # Show only the most recent
/screenshot 10       # Show last 10 screenshots

工作原理

  1. 自动检测截图位置 - 按以下顺序检查常见目录:

    • Windows:Pictures\Screenshots、ShareX、Greenshot、OneDrive\Screenshots
    • macOS:~/Desktop、~/Screenshots
    • Linux:~/Pictures、~/Desktop
  2. 查找近期截图 - 使用 Glob 查找图像文件(png、jpg、jpeg、gif、webp),并按修改时间排序

  3. 以视觉方式显示 - 使用 Read 工具显示截图,以便你分析和讨论

实现

步骤 1:检测截图目录

检查常见位置,并使用第一个存在的目录:

Windows:

# Priority order
1. %USERPROFILE%\Pictures\Screenshots           # Windows 11 native
2. %USERPROFILE%\Documents\ShareX\Screenshots   # ShareX
3. %USERPROFILE%\Pictures\Greenshot             # Greenshot
4. %USERPROFILE%\OneDrive\Pictures\Screenshots  # OneDrive sync
5. %USERPROFILE%\Pictures                       # Fallback

macOS:

1. ~/Desktop              # Default macOS location
2. ~/Screenshots          # Custom folder
3. ~/Pictures             # Fallback

Linux:

1. ~/Pictures/Screenshots # GNOME/KDE
2. ~/Pictures             # Fallback
3. ~/Desktop              # Alternative
步骤 2:查找近期截图

使用 Glob 查找图像文件,并按修改时间排序:

# Find all image files in screenshot directory
fd -e png -e jpg -e jpeg -e gif -e webp . "$SCREENSHOT_DIR" --max-depth 1 -t f --exec stat --format="%Y %n" {} \; | sort -rn | head -n $COUNT

也可以使用原生工具:

Windows(PowerShell):

Get-ChildItem "$env:USERPROFILE\Pictures\Screenshots" -File |
  Where-Object {$_.Extension -match '\.(png|jpg|jpeg|gif|webp)$'} |
  Sort-Object LastWriteTime -Descending |
  Select-Object -First $COUNT

Unix(Bash):

find "$SCREENSHOT_DIR" -maxdepth 1 -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.gif" -o -iname "*.webp" \) -printf '%T@ %p\n' | sort -rn | head -n $COUNT | cut -d' ' -f2-
步骤 3:显示截图

对于找到的每张截图,使用 Read 工具以视觉方式显示:

Found 3 screenshots in C:\Users\...\Pictures\Screenshots

1. Screenshot_2026-01-28_14-32-10.png (45 KB, 2 minutes ago)
[Read tool displays image visually]

2. Screenshot_2026-01-28_14-15-03.png (128 KB, 19 minutes ago)
[Read tool displays image visually]

3. Screenshot_2026-01-28_13-58-22.png (67 KB, 36 minutes ago)
[Read tool displays image visually]

参数

参数默认值描述
count5要显示的截图数量

示例:

  • /screenshot - 显示最近 5 张
  • /screenshot 1 - 仅显示最新的一张
  • /screenshot 10 - 显示最近 10 张

输出格式

Screenshots from [directory]

## Screenshot 1 of N
**File**: [filename]
**Size**: [size] KB
**Modified**: [time ago]

[Visual display of screenshot via Read tool]

## Screenshot 2 of N
...

边界情况

未找到截图目录
No screenshot directory found.

Checked locations:
  - C:\Users\...\Pictures\Screenshots (not found)
  - C:\Users\...\Documents\ShareX\Screenshots (not found)
  - C:\Users\...\Pictures\Greenshot (not found)

To use this skill, either:
  1. Take a screenshot (Win+Shift+S on Windows)
  2. Specify a custom directory: /screenshot --dir="C:\path\to\screenshots"
未找到截图
No screenshots found in C:\Users\...\Pictures\Screenshots

Directory exists but contains no image files (.png, .jpg, .jpeg, .gif, .webp)
数量超过可用截图数
Found 3 screenshots (requested 10)

Showing all 3:
[displays all available screenshots]

性能

  • 快速 - 使用文件系统工具(fd 或原生工具),而不是读取所有文件
  • 高效 - 只读取请求的确切数量
  • 节省令牌 - Read 工具会自动缩小大型截图

自定义目录(可选)

要使用非标准目录:

/screenshot 5 --dir="C:\Custom\Path"

或者在 .claude/screenshot.json 中创建项目专属配置:

{
  "directory": "C:\\Custom\\Screenshots",
  "default_count": 3,
  "file_extensions": ["png", "jpg", "webp"]
}

集成

可与以下工具配合使用:

  • /explain - 解释截图内容
  • /review - 检查截图中的 UI/代码
  • 浏览器自动化工具 - 验证截图是否符合预期状态

说明

  • 按修改时间排序(最新优先)
  • 忽略子目录(仅检查顶层目录)
  • 支持常见图像格式(png、jpg、jpeg、gif、webp)
  • 通过针对各平台的路径支持 Windows、macOS 和 Linux

评论

支持 Markdown