Agent Skill

Twitter/X Screenshot for AI Agents

Paste any tweet URL in your AI chat and the agent instantly generates a pixel-perfect, share-ready screenshot. Works in Cursor, Claude, ChatGPT, and every agent that reads skill files.

What's Included

  • Tweet URL → PNG / SVG / HTML screenshot
  • Dark & light theme support
  • Multiple aspect ratios (1:1, 4:5, 9:16, 16:9)

Copy this in agent chat and install skill

Follow the guide https://github.com/twittershots/skills and install twittershots skill

Works with

Cursor
Claude

v1.0.0 — Install in 60 seconds · GPL-3.0 license

how to install twittershots skill

OpenClaw

#Skills live in ~/.openclaw/skills/. Clone this repo:

git clone https://github.com/twittershots/skills.git \
  ~/.openclaw/skills/twittershots

#Set the API key:

export TWITTERSHOTS_API_KEY="your_api_key_here"

#OpenClaw auto-discovers skills in ~/.openclaw/skills/ by reading their SKILL.md frontmatter.

#Get your API key from twittershots.com/settings/keys

Manual / Other Agents

#Clone anywhere and point your agent's skill path to the directory:

git clone https://github.com/twittershots/skills.git \
  /path/to/your/skills/twittershots
export TWITTERSHOTS_API_KEY="your_api_key_here"

#The only required file is SKILL.md — load it into your agent's context and it will know how to use the TwitterShots API.

Skill Files

Browse the core files that power the TwitterShots agent skill. The SKILL.md defines the API interface and the Python script provides a standalone CLI tool.

SKILL.md

SKILL.md

GitHub
---
name: twittershots
description: |
  Generate high-quality screenshots of Twitter/X posts using the TwitterShots API.
  Use when the user wants to: capture a tweet as an image, screenshot a tweet,
  generate tweet image, convert tweet to PNG/SVG/HTML, create tweet screenshot
  for social media (Instagram, TikTok), or mentions "TwitterShots", "tweet screenshot",
  "capture tweet", "tweet image". Triggers on tweet URLs (twitter.com/*/status/* or x.com/*/status/*)
  or tweet IDs. Default to format=png and theme=light without asking follow-up questions;
  if the user explicitly provides format and/or theme, use the user-provided values.
homepage: https://github.com/twittershots/skills
source: https://github.com/twittershots/skills
credentials:
  - name: TWITTERSHOTS_API_KEY
    description: API key from https://twittershots.com/settings/keys
    required: true
dependencies:
  python:
    - requests
---

# TwitterShots Skill

Generate high-quality screenshots of Twitter/X posts via REST API.

## Prerequisites

- API key from [TwitterShots Account Settings](https://twittershots.com/settings/keys)
- Store the key securely (environment variable `TWITTERSHOTS_API_KEY` recommended)

## Extract Tweet ID

Parse tweet ID from various URL formats:

```
https://twitter.com/username/status/1617979122625712128
https://x.com/username/status/1617979122625712128
https://twitter.com/username/status/1617979122625712128?s=20
```

Extract pattern: `/status/(\d+)` → Tweet ID is the numeric part af

# ... (truncated, click "Expand" to see full file)

CLI Script

scripts/screenshot_tweet.py

GitHub
#!/usr/bin/env python3
"""
TwitterShots API - Tweet Screenshot Generator

Generate high-quality screenshots of Twitter/X posts.

Usage:
    python screenshot_tweet.py <tweet_id_or_url> [options]

Environment:
    TWITTERSHOTS_API_KEY: Your API key (required)

Examples:
    python screenshot_tweet.py 1617979122625712128
    python screenshot_tweet.py https://twitter.com/user/status/1617979122625712128
    python screenshot_tweet.py 1617979122625712128 --format png --theme dark
    python screenshot_tweet.py 1617979122625712128 --aspect-ratio 4:5 --output tweet.png
"""

import argparse
import os
import re
import sys
from urllib.parse import urlencode

try:
    import requests
except ImportError:
    print("Error: requests library required. Install with: pip install requests")
    sys.exit(1)


API_BASE = "https://api.twittershots.com/api/v1/screenshot"


def extract_tweet_id(input_str: str) -> str:
    """Extract tweet ID from URL or return as-is if already numeric."""
    if input_str.isdigit():
        return input_str

    match = re.search(r'/status/(d+)', input_str)
    if match:
        return match.group(1)

    raise ValueError(f"Could not extract tweet ID from: {input_str}")


def screenshot_tweet(
    tweet_id: str,
    api_key: str,
    format: str = "png",
    theme: str = "light",
    aspect_ratio: str = "auto",
    return_type: str = "buffer",
    show_stats: bool = True,
    show_views: bool = True,
    show_timestamp: bool = True,
    show_media: bool = True,
  

# ... (truncated, click "Expand" to see full file)

About These Files

The SKILL.md file is the heart of the TwitterShots agent skill. It uses the Skill format with YAML frontmatter that defines the skill metadata, required credentials, and dependencies. The markdown body contains comprehensive documentation including API endpoint details, parameter reference tables, curl examples for various use cases (basic screenshot, dark theme, Instagram-ready 4:5 ratio, URL-only return), and Python code examples. This file is read by AI agents to understand how to use the TwitterShots API effectively.

The screenshot_tweet.py script is a production-ready Python CLI that wraps the TwitterShots API. It handles tweet ID extraction from various URL formats (twitter.com and x.com), provides a full-featured command-line interface with argparse, supports all API parameters including format selection (PNG/SVG/HTML), theme (light/dark), aspect ratios, and visibility toggles for stats/views/timestamps/media. The script includes proper error handling, quota monitoring via response headers, and can output either direct image buffers or signed URLs. It is designed for both interactive use and automation workflows.