incremental-fetch
Ensures reliable data pipelines using a two-watermark system to prevent duplicates and data gaps.
Install
mkdir -p .claude/skills/incremental-fetch && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15524" && unzip -o skill.zip -d .claude/skills/incremental-fetch && rm skill.zipInstalls to .claude/skills/incremental-fetch
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Build resilient data ingestion pipelines from APIs. Use when creating scripts that fetch paginated data from external APIs (Twitter, exchanges, any REST API) and need to track progress, avoid duplicates, handle rate limits, and support both incremental updates and historical backfills. Triggers: 'ingest data from API', 'pull tweets', 'fetch historical data', 'sync from X', 'build a data pipeline', 'fetch without re-downloading', 'resume the download', 'backfill older data'. NOT for: simple one-shot API calls, websocket/streaming connections, file downloads, or APIs without pagination.Key capabilities
- →Track progress using two watermarks for forward and backward fetching
- →Save data records after each page fetch
- →Update watermarks only at the end of a successful run
- →Handle API rate limits gracefully
- →Adapt to different pagination types like cursor or timestamp
How it works
This skill builds resilient data ingestion pipelines from APIs by using a two-watermark pattern to track progress and manage data fetching.
Inputs & outputs
When to use incremental-fetch
- →Ingesting paginated data from REST APIs
- →Syncing tweets or feed data
- →Building a resilient backfill pipeline
About this skill
Incremental Fetch
Build data pipelines that never lose progress and never re-fetch existing data.
The Two Watermarks Pattern
Track TWO cursors to support both forward and backward fetching:
| Watermark | Purpose | API Parameter |
|---|---|---|
newest_id | Fetch new data since last run | since_id |
oldest_id | Backfill older data | until_id |
A single watermark only fetches forward. Two watermarks enable:
- Regular runs: fetch NEW data (since
newest_id) - Backfill runs: fetch OLD data (until
oldest_id) - No overlap, no gaps
Critical: Data vs Watermark Saving
These are different operations with different timing:
| What | When to Save | Why |
|---|---|---|
| Data records | After EACH page | Resilience: interrupted on page 47? Keep 46 pages |
| Watermarks | ONCE at end of run | Correctness: only commit progress after full success |
fetch page 1 → save records → fetch page 2 → save records → ... → update watermarks
Workflow Decision Tree
First run (no watermarks)?
├── YES → Full fetch (no since_id, no until_id)
└── NO → Backfill flag set?
├── YES → Backfill mode (until_id = oldest_id)
└── NO → Update mode (since_id = newest_id)
Implementation Checklist
- Database: Create ingestion_state table (see patterns.md)
- Fetch loop: Insert records immediately after each API page
- Watermark tracking: Track newest/oldest IDs seen in this run
- Watermark update: Save watermarks ONCE at end of successful run
- Retry: Exponential backoff with jitter
- Rate limits: Wait for reset or skip and record for next run
Pagination Types
This pattern works best with ID-based pagination (numeric IDs that can be compared). For other pagination types:
| Type | Adaptation |
|---|---|
| Cursor/token | Store cursor string instead of ID; can't compare numerically |
| Timestamp | Use last_timestamp column; compare as dates |
| Offset/limit | Store page number; resume from last saved page |
See references/patterns.md for schemas and code examples.
When not to use it
- →For simple one-shot API calls
- →For websocket/streaming connections
- →For file downloads
Limitations
- →The skill is not for APIs without pagination
- →The skill focuses on ID-based pagination
- →The skill requires a database for state management
How it compares
This skill implements a persistent fetching pipeline that prevents data loss and re-fetching, which is more reliable than simple API calls.
Compared to similar skills
incremental-fetch side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| incremental-fetch (this skill) | 0 | 6mo | No flags | Advanced |
| crawl4ai | 21 | 8mo | Review | Intermediate |
| apify | 9 | 4mo | Review | Intermediate |
| douyin-scraper-skill | 0 | 3mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by xiangteng007
View all by xiangteng007 →You might also like
crawl4ai
basher83
This skill should be used when users need to scrape websites, extract structured data, handle JavaScript-heavy pages, crawl multiple URLs, or build automated web data pipelines. Includes optimized extraction patterns with schema generation for efficient, LLM-free extraction.
apify
vm0-ai
Web scraping and automation platform with pre-built Actors for common tasks
douyin-scraper-skill
orange-suli
douyin-scraper-skill — an agent skill by orange-suli.
web-scraper
KevanPatira
Web scraping inteligente multi-estrategia. Extrai dados estruturados de paginas web (tabelas, listas, precos). Paginacao, monitoramento e export CSV/JSON.
apify-ultimate-scraper
Anhvu1107
ALWAYS use this when the request matches Apify Ultimate Scraper: AI-driven data extraction from 55+ Actors across all major platforms.
ax
yusukebe
Use the ax CLI instead of curl + throwaway parsing scripts whenever you fetch a URL, explore an unknown web page, or extract structured data from HTML. Trigger whenever you are about to write an inline script (python3 heredoc, node -e, regex over HTML) or a bare curl for one-off web fetching, scrapi