home / skills / splitleaseteam / splitlease_monorepo / screenshot-to-slack

screenshot-to-slack skill

/.claude/skills/screenshot-to-slack

This skill captures a webpage screenshot via Playwright and uploads it to Slack with an optional comment for context.

npx playbooks add skill splitleaseteam/splitlease_monorepo --skill screenshot-to-slack

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.2 KB
---
name: screenshot-to-slack
description: |
  Capture screenshots with Playwright and send them to Slack with context.
  Use this skill when you need to:
  (1) Share visual evidence of a bug, UI state, or test result
  (2) Document the current state of a page for review
  (3) Send automated screenshot reports during E2E testing
  (4) Provide visual context for debugging discussions
  Triggers: "screenshot to slack", "send screenshot", "capture and share", "share this page"
---

# Screenshot to Slack

Capture a screenshot using Playwright MCP and upload it to Slack with an optional comment.

## Usage

```
/screenshot-to-slack <url> [channel] [comment]
```

**Arguments:**
- `url` (required): The URL to capture OR "current" to use the current page
- `channel` (optional): Slack channel (defaults to `SLACK_DEFAULT_CHANNEL` from .env)
- `comment` (optional): Message to accompany the screenshot

## Workflow

### Step 1: Determine Target

Parse the arguments:
- If URL is "current" or empty, use the already-open Playwright page
- Otherwise, navigate to the specified URL first

### Step 2: Capture Screenshot

Use Playwright MCP to take a screenshot. Save to a temp file:

```
Screenshot filename pattern: screenshot-{timestamp}.png
Location: C:/Users/Split Lease/Documents/Split Lease/slack-api/tmp/
```

Use the appropriate Playwright MCP based on context:
- `playwright-host-dev` for development/localhost URLs
- `playwright-host-live` for production URLs
- `playwright-guest-dev` for unauthenticated dev testing
- `playwright-guest-live` for unauthenticated production testing

**MCP Call Pattern:**
```
mcp__playwright-host-dev__browser_take_screenshot({
  filename: "C:/Users/Split Lease/Documents/Split Lease/slack-api/tmp/screenshot-{timestamp}.png",
  fullPage: false
})
```

### Step 3: Upload to Slack

Run the upload script:

```bash
cd "C:/Users/Split Lease/Documents/Split Lease/slack-api" && bun run scripts/upload-screenshot.ts "<filepath>" "<channel>" "<comment>"
```

### Step 4: Report Result

Return the Slack message permalink and confirm success.

## Examples

### Basic - Current Page
```
/screenshot-to-slack current
```
→ Screenshots the current Playwright page, uploads to default channel

### With URL
```
/screenshot-to-slack https://splitlease.com #test-bed "Homepage state"
```
→ Navigates to URL, screenshots, uploads to #test-bed with comment

### Development Testing
```
/screenshot-to-slack http://localhost:8000/search #dev-alerts "Search page after fix"
```
→ Uses playwright-host-dev, screenshots localhost, sends to #dev-alerts

## Environment Requirements

| Variable | Required | Description |
|----------|----------|-------------|
| `SLACK_BOT_TOKEN` | Yes | Slack Bot OAuth token (xoxb-...) |
| `SLACK_DEFAULT_CHANNEL` | No | Fallback channel if not specified |

## Error Handling

| Error | Action |
|-------|--------|
| No URL and no open page | Ask user for URL |
| Invalid channel | Report error, suggest checking channel name |
| Upload failed | Report Slack API error message |
| Screenshot failed | Report Playwright error |

## Notes

- Screenshots are saved temporarily and can be cleaned up after upload
- Full-page screenshots available with `--fullpage` flag
- Bot must be invited to target channel (`/invite @BotName`)

Overview

This skill captures screenshots with Playwright and uploads them to Slack with an optional comment and target channel. It supports capturing the current open page or navigating to a specified URL before taking the screenshot. The skill picks the appropriate Playwright MCP for dev vs. live and authenticated vs. guest contexts. After upload it returns the Slack message permalink for quick reference.

How this skill works

The skill parses a command with a URL (or "current"), optional channel, and optional comment. It selects the correct Playwright MCP based on the URL environment, takes a screenshot saved to a temp filename including a timestamp, and runs a script to upload the file to Slack. On success it reports the Slack message permalink; on failure it returns a clear error message and suggested remediation.

When to use it

  • Share visual evidence of a bug found during testing or QA.
  • Document the current page state for design or product review.
  • Send automated screenshot reports as part of end-to-end test runs.
  • Provide visual context during debugging discussions or incident triage.
  • Quickly share a UI regression or layout issue with remote teams.

Best practices

  • Specify channel explicitly to avoid posting to an unexpected default channel.
  • Use the keyword "current" when you want to capture the already-open Playwright page without navigation.
  • Include a brief, actionable comment describing what to look for in the screenshot.
  • Choose the correct Playwright MCP for the environment: host vs guest and dev vs live.
  • Clean up temporary screenshots after successful upload to free disk space.

Example use cases

  • /screenshot-to-slack current — capture the active test page and post to the default Slack channel.
  • /screenshot-to-slack https://example.com #qa "Header misalignment on Chrome" — navigate, capture, and comment.
  • Automated test hook: run the skill after a failing E2E test to post visual evidence to #dev-alerts.
  • Local dev check: /screenshot-to-slack http://localhost:8000 #dev "Search results after fix" using playwright-host-dev.

FAQ

What environment variables are required?

SLACK_BOT_TOKEN is required. SLACK_DEFAULT_CHANNEL is optional and used if you don’t specify a channel.

What if I pass no URL and no page is open?

The skill will return an error asking you to provide a URL or open the target page first.

How do I get full-page screenshots?

Use the full-page option (e.g., --fullpage) when invoking the capture so Playwright saves the entire page.

What happens if upload fails?

The skill surfaces the Slack API error message and suggests checking the bot token, channel name, and network access.