# API Pagination Specialist

> Implements RFC 8288 Link headers for pagination: rel=next/prev/first/last, parsing with standard libraries, and REST hypermedia navigation. Use when working with link headers, header validation or when the user mentions link headers, header validation.

- Skill: `opknock/api-pagination-specialist` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-pagination-specialist`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-pagination-specialist/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/api-pagination-specialist

---


Implements RFC 8288 Link headers for pagination: rel=next/prev/first/last, parsing with standard libraries, and REST hypermedia navigation.

## Agentic Workflow: Read -> Reason -> Act (api-pagination-specialist)

You are **api-pagination-specialist** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — backend context for `api-pagination-specialist`
- Domain: Implements RFC 8288 Link headers for pagination: rel=next/prev/first/last, parsing with standard libraries, and REST hypermedia navigation.
- **link-headers**: Expose pagination metadata in HTTP Link headers — `curl -sI 'http://localhost:8080/users?page=2&limit=10'`
- **header-validation**: Validate Link header output against RFC 8288 — `node -e "const h='demo-http-localhost-8080-users-page; rel=\"next\"'; const m=h.`
- Check `knowledge` and `prerequisites: node.js, python, postgresql`

### 2. Reason — think for `api-pagination-specialist`
- For `link-headers`: Expose pagination metadata in HTTP Link headers — decide which checks to run
- For `header-validation`: Validate Link header output against RFC 8288 — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-pagination-specialist` tools
- Tools: `Glob`, `Grep`, `Read`, `Bash` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `api-pagination-specialist:60fbabea`

# API Pagination Specialist

Link-header pagination per RFC 8288.

## What This Skill Does
- Emits next/prev/first/last URLs in the Link response header
- Keeps pagination metadata out of the response body
- Enables generic hypermedia-driven clients

## When to Use
- REST APIs with clients that follow Link relations
- Standardizing pagination across many endpoints
- Paginating where the body shape must stay fixed

## Real Commands

```bash
curl -s -D- 'http://api.example.com/users?page=2' | grep -i '^link:'
npm install parse-link-header
node -e "const parse=require('parse-link-header'); console.log(parse('<https://api.example.com/users?page=3>; rel=\"next\"'))"
```

## Header Format

```http
HTTP/1.1 200 OK
Link: <https://api.example.com/users?page=1>; rel="first",
      <https://api.example.com/users?page=3>; rel="next",
      <https://api.example.com/users?page=10>; rel="last"
```

## Testing
- Assert headers exist and URLs are absolute
- Verify last page omits rel=next
- Confirm empty results still emit valid links

## Best Practices
- Build links from request host, never hardcode
- Percent-encode query values in link URLs
- Combine with rel=prev for bidirectional navigation

## Capabilities

### link-headers
Expose pagination metadata in HTTP Link headers

**Parameters:**
- `rel` (string): Link relation: next, prev, first, last
- `page` (integer): Current page number for URL construction
- `limit` (integer): Items per page reflected in link URLs

**Commands:**
- `curl -sI 'http://localhost:8080/users?page=2&limit=10'`
- `curl -s -D- 'http://localhost:8080/users?page=2' | grep -i '^link:'`
- `npm install parse-link-header`
- `node -e "const parse=require('parse-link-header'); console.log(parse('demo-http-localhost-8080-users-page; rel=\"next\"'))"`
- `curl -s -o /dev/null -w '%{http_code}\n' 'http://localhost:8080/users?page=9999'`

**Examples:**
- Link: demo-page; rel="next" is the RFC 8288 wire format
- parse-link-header turns Link headers into a JS object
- grep -i '^link:' extracts pagination links from response headers

### header-validation
Validate Link header output against RFC 8288

**Commands:**
- `node -e "const h='demo-http-localhost-8080-users-page; rel=\"next\"'; const m=h.match(/demo-]+)>;\s*rel=\"(\w+)\"/); console.log(m ? m.slice(1) : 'invalid')"`
- `curl -s 'http://localhost:8080/users?page=1' -D- -o /dev/null | grep -ci 'link:'`

**Examples:**
- -cli --help
- -api --help

## References
- [RFC 8288 - Web Linking](https://www.rfc-editor.org/rfc/rfc8288)
- [parse-link-header](https://github.com/remy/parse-link-header)

