# Read Reddit Thread

> Fetch a Reddit post or comment thread from a URL using Reddit's public JSON API (no authentication needed). Returns the post and full comment chain for context. Use when you have a reddit.com URL and need the thread context.

- Skill: `warpdotdev/read-reddit-thread` (Agent Skill)
- Install (CLI): `npx skillmds@latest add warpdotdev/read-reddit-thread`
- Raw SKILL.md: https://api.skillmd.com/api/skills/warpdotdev/read-reddit-thread/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: warpdotdev (https://skillmd.com/u/warpdotdev)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/warpdotdev/read-reddit-thread

---


# read-reddit-thread

## Purpose
Fetch a Reddit post or comment and its surrounding thread context using Reddit's public JSON API. No API key required.

## Inputs
- A `reddit.com` or `old.reddit.com` URL (post or comment)

## Workflow
1. Clean the URL: strip query params, remove trailing slashes, normalize `old.reddit.com` → `reddit.com`.
2. Append `.json` to the URL and fetch with a `User-Agent` header (Reddit blocks requests without one — use `Buzz/1.0`).
3. Parse the response:
   - **Post URL** (`/r/sub/comments/id/slug`): Returns `[listing, comments]`. The first listing contains the post, the second contains the comment tree.
   - **Comment URL** (`/r/sub/comments/id/slug/comment_id`): Same structure, but the comment tree is focused on the linked comment and its ancestors.
4. Extract the post: `data.children[0].data` from the first listing. Pull `title`, `selftext`, `author`, `score`, `num_comments`, `created_utc`, `subreddit_name_prefixed`.
5. Walk the comment tree from the second listing. For each comment, extract `author`, `body`, `score`, `created_utc`. Recurse into `replies` to get the full nested thread. Flatten into a list preserving depth (indent or number by depth level).
6. Return the full thread — post first, then all comments in tree order.

## Example request
```bash
curl -sS "https://www.reddit.com/r/commandline/comments/abc123/my_post_title.json" \
  -H "User-Agent: Buzz/1.0"
```

## Return
```
Post: "Post title here" by u/author (r/subreddit, 142 points, 37 comments)
---
Post body text here...
---

Comments:
[1] u/commenter1 (52 pts):
Top-level comment text...

  [1.1] u/replier (23 pts):
  Reply to commenter1...

    [1.1.1] u/deeper (8 pts):
    Deeper reply...

[2] u/commenter2 (31 pts):
Another top-level comment...
```

Use depth numbering (1, 1.1, 1.1.1) to show the thread structure.

## Failure handling
- Reddit returns 403/429 → report rate limit, suggest retrying later.
- URL doesn't match Reddit format → report invalid URL.
- Post is deleted/removed → report that the post is unavailable.
- If the response is very large (>100 comments), still return all of them — the caller needs the full context.

