Repo Scraper
Scrape card data from limitlesstcg.com and propagate updates through the entire stack.
Commands
bun run scrape # Incremental (only new sets/cards)
bun run scrape:full # Full refresh from scratch (~6-7 min)
Both run from repo root. The scraper lives in scraper/src/scraper.ts.
How It Works
- Auto-discovers sets from
https://pocket.limitlesstcg.com/cards
- Falls back to hardcoded
FALLBACK_SETS list if discovery fails
- Scrapes each set in parallel (concurrency=20)
- Each card page parsed for: name, type, HP, attacks, abilities, weakness, retreat, rarity
- Incremental: skips cards already in CSV (matched by
set_code:card_number)
- Detects evolution metadata (Mega ↔ base Pokemon)
- Validates every card via Zod schema
- Exports to
data/pokemon_pocket_cards.csv
After Scraping — Propagation Checklist
New data doesn't auto-propagate. Run these after every scrape:
- Build MCP server —
bun run build (copies CSV via prebuild script)
- Run tests —
bun run test
- Update card counts — check
wc -l data/pokemon_pocket_cards.csv and update any hardcoded counts in:
CLAUDE.md (references "2,077 cards" — may be stale)
skills/*/SKILL.md frontmatter descriptions (should NOT have hardcoded counts)
skills/*/REFERENCE.md (update if referenced)
- Update skills if new mechanics — new sets may introduce mechanics that require updates to:
skills/pokemon-card-analysis/REFERENCE.md — new tier placements
skills/pokemon-deck-building/REFERENCE.md — new deck archetypes
skills/pokemon-meta-analysis/REFERENCE.md — meta shifts
Data Validation
After scraping, spot-check the CSV:
# Count cards per set
cut -d',' -f2 data/pokemon_pocket_cards.csv | sort | uniq -c | sort -rn
# Check for empty names
awk -F',' '$5==""' data/pokemon_pocket_cards.csv
# Verify no duplicate set:number keys
awk -F',' 'NR>1{print $2":"$4}' data/pokemon_pocket_cards.csv | sort | uniq -d
File Locations
| File |
Purpose |
scraper/src/scraper.ts |
Scraper source (~920 lines) |
data/pokemon_pocket_cards.csv |
Output database |
scraper/package.json |
Scraper deps (axios, cheerio, zod, uuid) |
CSV Schema
21 columns: id, set_code, set_name, card_number, name, type, hp, rarity, abilities, attacks, weakness, resistance, retreat_cost, image_url, card_url, evolution_stage, evolves_from, evolves_to, evolution_type, base_pokemon_id, is_evolution, evolution_method
Troubleshooting
- Timeout: 30s per request; 10s per card detail. Retries with exponential backoff (1s, 2s, 4s).
- Rate limiting: User-Agent set to Chrome. If blocked, wait and retry.
- Partial data: Re-run
bun run scrape to pick up missed sets.
- Corrupt CSV:
bun run scrape:full regenerates from scratch.
- Validation errors: Zod logs the issue + field. Check scraper parsing logic for that set's HTML structure.
1---2name: repo-scraper3description: Use when managing the Pokemon TCG Pocket card data scraper or updating card data. Activates when user mentions scraping, updating cards, refreshing data, card database, limitlesstcg, or new sets. Covers running the scraper, validating output, and propagating new data to MCP server and skills.4---56# Repo Scraper78Scrape card data from limitlesstcg.com and propagate updates through the entire stack.910## Commands1112```bash13bun run scrape # Incremental (only new sets/cards)14bun run scrape:full # Full refresh from scratch (~6-7 min)15```1617Both run from repo root. The scraper lives in `scraper/src/scraper.ts`.1819## How It Works20211. Auto-discovers sets from `https://pocket.limitlesstcg.com/cards`222. Falls back to hardcoded `FALLBACK_SETS` list if discovery fails233. Scrapes each set in parallel (concurrency=20)244. Each card page parsed for: name, type, HP, attacks, abilities, weakness, retreat, rarity255. Incremental: skips cards already in CSV (matched by `set_code:card_number`)266. Detects evolution metadata (Mega ↔ base Pokemon)277. Validates every card via Zod schema288. Exports to `data/pokemon_pocket_cards.csv`2930## After Scraping — Propagation Checklist3132New data doesn't auto-propagate. Run these after every scrape:33341. **Build MCP server** — `bun run build` (copies CSV via `prebuild` script)352. **Run tests** — `bun run test`363. **Update card counts** — check `wc -l data/pokemon_pocket_cards.csv` and update any hardcoded counts in:37 - `CLAUDE.md` (references "2,077 cards" — may be stale)38 - `skills/*/SKILL.md` frontmatter descriptions (should NOT have hardcoded counts)39 - `skills/*/REFERENCE.md` (update if referenced)404. **Update skills if new mechanics** — new sets may introduce mechanics that require updates to:41 - `skills/pokemon-card-analysis/REFERENCE.md` — new tier placements42 - `skills/pokemon-deck-building/REFERENCE.md` — new deck archetypes43 - `skills/pokemon-meta-analysis/REFERENCE.md` — meta shifts4445## Data Validation4647After scraping, spot-check the CSV:4849```bash50# Count cards per set51cut -d',' -f2 data/pokemon_pocket_cards.csv | sort | uniq -c | sort -rn5253# Check for empty names54awk -F',' '$5==""' data/pokemon_pocket_cards.csv5556# Verify no duplicate set:number keys57awk -F',' 'NR>1{print $2":"$4}' data/pokemon_pocket_cards.csv | sort | uniq -d58```5960## File Locations6162| File | Purpose |63| ------------------------------- | ---------------------------------------- |64| `scraper/src/scraper.ts` | Scraper source (~920 lines) |65| `data/pokemon_pocket_cards.csv` | Output database |66| `scraper/package.json` | Scraper deps (axios, cheerio, zod, uuid) |6768## CSV Schema697021 columns: `id, set_code, set_name, card_number, name, type, hp, rarity, abilities, attacks, weakness, resistance, retreat_cost, image_url, card_url, evolution_stage, evolves_from, evolves_to, evolution_type, base_pokemon_id, is_evolution, evolution_method`7172## Troubleshooting7374- **Timeout**: 30s per request; 10s per card detail. Retries with exponential backoff (1s, 2s, 4s).75- **Rate limiting**: User-Agent set to Chrome. If blocked, wait and retry.76- **Partial data**: Re-run `bun run scrape` to pick up missed sets.77- **Corrupt CSV**: `bun run scrape:full` regenerates from scratch.78- **Validation errors**: Zod logs the issue + field. Check scraper parsing logic for that set's HTML structure.