rails-pagination-kaminari

Implement Kaminari pagination for Rails controllers, APIs, arrays, and views.

14|Updated Dec 16, 2025
One-click install
npx skills add https://github.com/Shoebtamboli/rails_claude_skills --skill rails-pagination-kaminari
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-pagination-kaminari
Source: https://github.com/Shoebtamboli/rails_claude_skills/tree/main/lib/generators/claude/skills_library/rails-pagination-kaminari
Command: npx skills add https://github.com/Shoebtamboli/rails_claude_skills --skill rails-pagination-kaminari

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provide easy, consistent pagination for Rails applications so large result sets and lists can be navigated, served in APIs, and rendered in views without manual offset calculation or inconsistent UX.

Core Features & Use Cases

  • Controller integration: Use page and per parameters to paginate ActiveRecord queries and associations.
  • API pagination: Produce pagination metadata and links for JSON responses and support Link headers or JSON:API-style links.
  • View helpers & themes: Render pagination controls with built-in helpers and swap themes for Bootstrap, Tailwind, or custom templates.
  • Performance patterns: Support without_count, cached totals, counter caches, and cursor-style pagination for very large datasets.
  • Array and custom collection pagination: Paginate arrays or precomputed collections and combine with filtering, searching, and infinite scroll.

Quick Start

Install and configure Kaminari, call page(params[:page]) in your controller, and add paginate to your index view to display links.

Frequently Asked Questions about rails-pagination-kaminari

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Kaminari pagination to a Rails controller and view?

To add Kaminari pagination in Rails, call page(params[:page]) on your ActiveRecord query in the controller, then use the paginate helper in your index view to render navigation links for large result sets.

How does Rails API pagination work with JSON responses?

Rails API pagination generates JSON metadata and links for your responses. It supports standard page and per parameters, allowing API endpoints to provide JSON:API-style links or Link headers for navigable data sets.

Can I paginate arrays or precomputed collections in Rails?

Yes, you can paginate arrays and precomputed collections in Rails. This approach works when combining pagination with filtering or searching, allowing you to apply page limits to non-ActiveRecord data structures.

What is the best way to optimize Rails pagination for large datasets?

To optimize Rails pagination for large datasets, use the without_count optimization to skip expensive count queries. You can also leverage cached totals, counter caches, or cursor-style pagination patterns for improved performance.

Does Kaminari support infinite scroll and custom view themes?

Yes, Kaminari supports infinite scroll and custom view themes. You can render pagination controls with built-in helpers and swap themes for Bootstrap, Tailwind, or custom templates, adding rel next/prev tags for navigation.