PostgreSQL Patterns Skill for Keyset Pagination
Use a stable key cursor for successive pages and verify boundaries and ordering with a local fixture.
中文Install in Claude Code
Use PostgreSQL and a synthetic products table with unique increasing numeric IDs.
- Get the complete `skills/postgres-patterns` directory from the pinned GitHub commit.
- Copy it into the target project's `.claude/skills/`. Check `.claude/skills/postgres-patterns/SKILL.md`, start Claude Code at the project root, and call `/postgres-patterns`.
Example task
Add IDs 10, 20, 30, 40, and 50. Read two rows at a time with ORDER BY id and id > last_id. Check the result after the final cursor.What to check
The pages are [10,20], [30,40], and [50]. Together they contain all five IDs without overlap.
Original SKILL.md on GitHub · Updated
Frequently asked question
What if sorting by time produces duplicate timestamps?
Use a unique ID as a tie-breaker in both ordering and cursor. Keep the query and index aligned with that order.