agentleFS
GetStreamGetStream/Agents/.claude/skills/pagination/SKILL.md

pagination

Skill8.2k starsChanged 58 days agoApache-2.0View on GitHub

How list endpoints page through results. Read before adding a list endpoint or a limit parameter.

5 other projects use a version of this.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projectsWeek of Nov 22: 0 new projects
Oct 2026Nov 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Most recently taken up by

Who's talking about GetStream/Agents

The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 8

Talked about on GitHub (8 times).

On GitHub · 8

3 more on GitHub

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never use limit/offset. Lists take limit + cursor.

    line 8

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Pagination

Never use limit/offset. Lists take limit + cursor.

  • Offset is slow: Postgres reads and discards every skipped row. A cursor is an indexed WHERE.
  • Offset is wrong when data changes: an insert repeats a row on the next page, a delete skips one.

Rules

  • Response is {items, has_more, next_cursor}, like SessionPage. Never a bare array.
  • Cursors are opaque base64url. Clients never build or parse them.
  • Sort ends with id so the order is total. The cursor holds every sort key.
  • Fetch limit + 1 to set has_more. No counts.
  • Filters are resent with every page; the cursor only holds a position.
  • A bad cursor is a 400.
  • Index the sort keys behind the filter, e.g. (customer_id, updated_at DESC, id DESC).
  • A list that filters and sorts takes a body instead of query parameters: see the query skill.

Example: querySessions

Spec: SessionQuery carries limit and cursor in the body, and SessionPage is the 200.

Position, in internal/store/models.go:

type SessionPosition struct {
	UpdatedAt time.Time `json:"u"`
	ID        string    `json:"id"`
	Rank      float32   `json:"r,omitempty"`
}

Store, in QuerySessions:

if after := filter.Cursor; after != nil {
	query = query.Where("(updated_at, id) < (?, ?)", after.UpdatedAt, after.ID)
}
query = query.Limit(SessionLimit(filter.Limit) + 1)

Handler: decodeCursor and encodeCursor in internal/api/cursor.go; page trims the extra row and says whether it was there. The session cursor also records which sort it came from, so a cursor from one sort is refused by another.

Live sessions that nothing records get the same cut and sort in Manager.find, on their created, which is truncated to microseconds (what Postgres keeps) so that a cursor from one half does not repeat the other. A recorded live session is listed through its row.

A text search sorts by relevance, and its cursor adds the rank: (rank, updated_at, id) < (?, ?, ?).

Go SDK: list methods return the page and take a cursor; Items.Unwind follows it.

Lists without a cursor yet

listCalls, listSimulationRuns and getCallEvents take a limit and no way to continue.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.