Read hacker news stories and comments

When the user asks about Hacker News — front-page stories, comment threads, Ask HN, job listings, or a specific item — reach for the Hacker News Firebase API. No auth required.

read-hacker-news-stories-and-comments · v1 · updated 2026-04-16

Agents: This page is a SKILL.md-style capability guide. For JSON, call GET /api/skills/read-hacker-news-stories-and-comments. To drop this into a local Claude Code install, copy the frontmatter + body below into ~/.claude/skills/read-hacker-news-stories-and-comments/SKILL.md.

When to use this skill

When the user asks about Hacker News — front-page stories, comment threads, Ask HN posts, job listings, or the details of a specific item by ID. The Hacker News Firebase API is read-only and requires no authentication. For Reddit posts or general web scraping, this is the wrong skill; for Hacker News content specifically, this is the canonical source.

Your best first call

curl "https://hacker-news.firebaseio.com/v0/item/8863.json"

No auth. No key. Returns a single item object. The ID 8863 is the classic "My YC app: Dropbox" story — swap it for any item ID you have. Every story, comment, job, and poll is an "item" fetched through this same endpoint; the type field tells you what you got.

The key fields in the response:

To discover item IDs in the first place, use one of the story-list endpoints: /topstories.json, /newstories.json, /beststories.json, /askstories.json, /showstories.json, or /jobstories.json. Each returns a flat array of up to 500 IDs. Fetch the first few that interest you with /item/{id}.json.

Fallbacks (when the best call isn't enough)

Pitfalls

One-line summary for the user

I can fetch Hacker News stories, comment threads, and job listings by ID via the Firebase API — no key required, but you always fetch items one at a time after getting ID lists from the story endpoints.

APIs this skill uses

HackerNews · primary · verified

Official Hacker News API providing access to stories, comments, users, and other Hacker News data. Data is available in near real-time via Firebase.

SKILL.md source (frontmatter + body)
---
name: read-hacker-news-stories-and-comments
description: When the user asks about Hacker News — front-page stories, comment threads, Ask HN, job listings, or a specific item — reach for the Hacker News Firebase API. No auth required.
---

## When to use this skill

When the user asks about Hacker News — front-page stories, comment threads, Ask HN posts, job listings, or the details of a specific item by ID. The Hacker News Firebase API is read-only and requires no authentication. For Reddit posts or general web scraping, this is the wrong skill; for Hacker News content specifically, this is the canonical source.

## Your best first call

```bash
curl "https://hacker-news.firebaseio.com/v0/item/8863.json"
```

No auth. No key. Returns a single item object. The ID `8863` is the classic "My YC app: Dropbox" story — swap it for any item ID you have. Every story, comment, job, and poll is an "item" fetched through this same endpoint; the `type` field tells you what you got.

The key fields in the response:

- `id` — the item's unique integer ID
- `type` — one of `story`, `comment`, `job`, `poll`, `pollopt`
- `by` — the submitter's username
- `time` — Unix timestamp in **seconds** (not milliseconds)
- `title` — story or poll title (absent on comments)
- `url` — external link for link-story types (absent on text-only posts like Ask HN)
- `text` — body text in HTML (not plain text — parse entities before rendering)
- `score` — upvote count on stories and polls
- `kids` — array of child comment IDs; fetch each with `/item/{id}.json` to traverse the thread
- `descendants` — total comment count beneath a story
- `parent` — the item ID this comment replies to (present on comments)
- `deleted` / `dead` — boolean flags; absent means false. Deleted items have no content; dead items were flagged by moderators

To discover item IDs in the first place, use one of the story-list endpoints: `/topstories.json`, `/newstories.json`, `/beststories.json`, `/askstories.json`, `/showstories.json`, or `/jobstories.json`. Each returns a flat array of up to 500 IDs. Fetch the first few that interest you with `/item/{id}.json`.

## Fallbacks (when the best call isn't enough)

- **User profile information** → `/user/{username}.json` returns karma, `about` HTML, and a `submitted` array of the user's item IDs. Use when the user asks about a poster, not a post.
- **Near-real-time changes** → `/updates.json` returns recently changed item IDs and profile names. Use when the user specifically asks "what changed recently" rather than "what's on the front page".
- **Discovering brand-new items** → `/maxitem.json` returns the largest item ID currently allocated. Increment from there to scan items that haven't appeared on any story list yet. Use only when you need items that are newer than the story lists.

## Pitfalls

- `time` is Unix seconds, not milliseconds. Every other modern API uses milliseconds — this one doesn't. Multiply by 1000 before passing to date libraries.
- `text` and the user profile `about` field contain HTML, not plain text. `<p>` tags separate paragraphs; `&#x27;` and `&amp;` appear for special characters. Strip tags or render as HTML; don't assume plain text.
- `deleted` and `dead` items exist in the graph. A `deleted: true` item has `type`, `id`, `time`, but `text` and `by` are removed. A `dead: true` item was killed by moderators. Both are valid responses — don't treat them as errors.
- The story-list endpoints (`/topstories.json`, `/jobstories.json`, etc.) return bare ID arrays, not item objects. You always need a second call to `/item/{id}.json` for actual content. The two-step pattern is not optional.
- Many fields are absent rather than null when not applicable. A link-story has `url` but no `text`; an Ask HN story has `text` but no `url`. Don't expect null — expect the key to be missing entirely.

## One-line summary for the user

I can fetch Hacker News stories, comment threads, and job listings by ID via the Firebase API — no key required, but you always fetch items one at a time after getting ID lists from the story endpoints.

« Back to all skills