Use Claude to Implement Cursor-Based Pagination
Offset pagination (LIMIT 20 OFFSET 1000) is slow on large tables and breaks if rows are inserted or deleted between pages. Cursor-based pagination is the scalable alternative — and Claude can implement it for you.
Implement cursor-based pagination for my /api/posts endpoint.
Use the post ID as the cursor, encoded as base64.
Return a next_cursor field in the response and accept a cursor query param.
Paste in your existing controller and Claude will refactor the query, add the cursor encode/decode logic, and update the response shape. It understands the tradeoffs and can explain them as it writes.
For tie-breaking on timestamp columns, be explicit:
Add cursor pagination to PostController@index.
The cursor should encode both created_at and id to handle posts
created at the same timestamp. Use base64 encoding.
Paginate 15 results per page.
Claude will generate the correct WHERE (created_at, id) < (?, ?) clause and handle both ascending and descending sort orders. For Laravel users, it can use the built-in cursorPaginate() method or build a raw implementation depending on your constraints.
Cursor pagination scales to millions of rows — ask Claude to implement it once and move on.
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.