# Hn Summarize

Fetch and summarize Hacker News / hckrnews.com top stories, articles, and their comment...

- Repository: https://github.com/ykdojo/claude-code-tips (10298 stars)
- Category: Engineering
- License: see repository
- Last updated: 2026-09-25
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add ykdojo/claude-code-tips --skill hn-summarize -g -a claude-code -y`
Codex: `npx skills add ykdojo/claude-code-tips --skill hn-summarize -g -a codex -y`
Cursor: `npx skills add ykdojo/claude-code-tips --skill hn-summarize -g -a cursor -y`
Gemini CLI: `npx skills add ykdojo/claude-code-tips --skill hn-summarize -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add ykdojo/claude-code-tips`

## Description

Fetch and summarize Hacker News / hckrnews.com top stories, articles, and their comment threads. Use when asked to summarize HN front-page stories, a specific HN story plus its discussion, or "the top N from hckrnews".

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# HN Summarize

`hckrnews.com` is a JavaScript-rendered front end - curling it returns an empty shell, so **do not scrape it**. Instead use the official Hacker News APIs (Firebase + Algolia), which give the same stories with points, comment counts, and full comment trees. These APIs return plain JSON, so plain `curl` works fine.

## 1. Current top stories (the "top 10")

`topstories.json` returns 500 story IDs in front-page rank order. Take the first N and look up each item.

```bash
curl -sL 'https://hacker-news.firebaseio.com/v0/topstories.json' -o /tmp/top.json
python3 -c "
import json,urllib.request
ids=json.load(open('/tmp/top.json'))[:10]
for i,sid in enumerate(ids,1):
    d=json.load(urllib.request.urlopen(f'https://hacker-news.firebaseio.com/v0/item/{sid}.json'))
    print(f\"{i}. {d.get('title')} | {d.get('score')} pts | {d.get('descendants',0)} comments | id {sid}\")
    print(f\"   {d.get('url','(text post)')}\")
"
```

## 2. Find a specific story by topic (Algolia search)

```bash
curl -sL 'https://hn.algolia.com/api/v1/search?query=YOUR+QUERY&tags=story' -o /tmp/s.json
python3 -c "
import json
for h in json.load(open('/tmp/s.json'))['hits'][:8]:
    print(h['objectID'], '|', h.get('points'), 'pts |', h.get('num_comments'), 'comments |', h['title'])
    print('   ', h.get('url'))
"
```

- Add `&numericFilters=created_at_i>UNIXTS` to restrict to recent stories (avoids matching an old duplicate of the same headline).
- `search` ranks by relevance; `search_by_date` ranks by recency.
- Pick the `objectID` with the highest points/comments - that's the live front-page discussion.

## 3. Fetch a story + its comment tree

```bash
curl -sL 'https://hn.algolia.com/api/v1/items/OBJECT_ID' -o /tmp/hn.json
```

The response is a nested tree: top-level `children` are root comments, each with their own `children`. Flatten and print root comments in thread order (HN's default ranking ≈ this order):

The rest: https://github.com/ykdojo/claude-code-tips/blob/HEAD/skills/hn-summarize/SKILL.md
