---
name: screenshot-latest
description: Find and analyze the most recent screenshot without typing paths
---

# Screenshot Latest

Automatically locates the most recent screenshot file so the user doesn't have to type `~/Pictures/Screenshots/filename.png` every time.

## When to Use

Invoke this skill when the user requests:
- "Look at my last screenshot"
- "Analyze my latest screenshot"
- "What's in my recent screenshot"
- "Show me my screenshot"
- Any variation referencing "screenshot" + "latest/last/recent"

## Context Gathering

Verify the screenshot directory exists and contains files:
```bash
ls -t ~/Pictures/Screenshots/*.{png,jpg,jpeg} 2>/dev/null | head -5
```

If the directory doesn't exist or is empty, inform the user clearly.

## Process

1. **Find Latest Screenshot**
   - Run the helper script: `./scripts/find-latest.sh`
   - The script returns the absolute path to the most recent screenshot file
   - Handle errors gracefully (missing directory, no files, permission issues)

2. **Analyze the Screenshot**
   - Use the returned file path with your image analysis capability
   - Read and analyze the image content
   - Respond to the user's specific question about the screenshot

3. **Error Handling**
   - No screenshots found: "No screenshots found in ~/Pictures/Screenshots/"
   - Directory doesn't exist: "Screenshots directory not found at ~/Pictures/Screenshots/"
   - Permission denied: "Cannot access screenshots directory (permission denied)"

## Helper Scripts

### find-latest.sh

**Purpose**: Finds the most recent screenshot file by modification time

**Usage**:
```bash
./scripts/find-latest.sh
```

**Output**: Absolute path to the most recent screenshot, or empty string if none found

## Guidelines

1. **Simplicity**: This skill does one thing - finds the latest screenshot file
2. **No Configuration**: Uses hardcoded ~/Pictures/Screenshots (can be enhanced later if needed)
3. **Fast Execution**: Should complete in <1 second even with many files
4. **Clear Errors**: Always explain why screenshot couldn't be found

## Requirements

- Bash 4.0+
- Standard Unix tools (ls, head)
- Screenshots directory at ~/Pictures/Screenshots
- Supported formats: PNG, JPG, JPEG

## Output Format

- Returns: Absolute file path to latest screenshot
- No terminal output except errors
- Agent uses returned path for image analysis

## Notes

- Uses file modification time to determine "latest"
- Does not support custom directories (intentionally simple)
- Does not support "Nth screenshot" or time filtering (YAGNI)
- Future enhancement: Support custom directories if users request it
