Agent skill
kirby-collections-and-navigation
Builds Kirby listings, pagination, search, filtering/sorting/grouping, and navigation menus. Use when implementing collection logic in templates/controllers/snippets.
Install this agent skill to your Project
npx add-skill https://github.com/bnomei/kirby-mcp/tree/main/skills/kirby-collections-and-navigation
SKILL.md
Kirby Collections and Navigation
KB entry points
kirby://kb/scenarios/07-paginationkirby://kb/scenarios/08-search-pagekirby://kb/scenarios/09-filtering-with-tagskirby://kb/scenarios/11-navigation-menuskirby://kb/scenarios/23-collections-filtering
Required inputs
- Collection source (page/section/template or ids).
- Filters, sort order, and pagination size.
- Target templates/snippets and UI expectations.
Default pattern
- Keep collection building in the controller; return a single
itemscollection andpagination. - Render items via a snippet to avoid repeated template logic.
- Provide empty-state and active-navigation UI.
- Default sort: use
date descwhen the field exists; otherwise fall back totitle asc.
Example
Controller:
return function ($page) {
$items = $page->children()->listed()->sortBy('date', 'desc')->paginate(10);
return [
'items' => $items,
'pagination' => $items->pagination(),
];
};
Snippet:
<?php if ($items->isEmpty()): ?>
<p>No items yet.</p>
<?php else: ?>
<?php foreach ($items as $item): ?>
<!-- render item -->
<?php endforeach ?>
<?php snippet('pagination', ['pagination' => $pagination]) ?>
<?php endif ?>
Output checklist
- Ensure pagination URLs preserve filters and tags.
- Render empty states without PHP notices.
- Confirm active navigation matches the current page.
Common pitfalls
- Dropping query params or tag filters on pagination links.
- Implementing heavy collection logic in templates instead of controllers.
Workflow
- Clarify collection scope (site vs section), filters, sort order, and UI (pagination, tag filters, menu style).
- Call
kirby:kirby_initand readkirby://roots. - Inspect existing templates/controllers/snippets to reuse patterns:
kirby:kirby_templates_indexkirby:kirby_controllers_indexkirby:kirby_snippets_index
- Prefer controllers for collection logic; keep templates thin.
- Search the KB with
kirby:kirby_searchfor task playbooks (examples: "pagination", "search page", "filtering with tags", "navigation menus", "collections filtering"). - Implement or adjust collection queries; add snippets for repeated UI.
- Verify rendering and pagination URLs with
kirby:kirby_render_page(noCache=true).
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
kirby-i18n-workflows
Manages Kirby multi-language workflows, translations, and localized labels. Use when dealing with languages, translation keys, placeholders, or importing/exporting translations.
kirby-security-and-auth
Secures Kirby sites with access restriction, user roles, permissions, and protected downloads. Use when implementing login/role-based access, permissions, or file protection.
kirby-headless-api
Exposes Kirby content to headless clients using the API, KQL, and JSON representations. Use when building API endpoints, KQL queries, or headless frontends.
kirby-performance-and-media
Improves Kirby performance and media delivery (cache tuning, CDN, responsive images, lazy loading). Use when optimizing page speed, caching, or image handling.
kirby-panel-and-blueprints
Designs Kirby blueprints and Panel UI, including blueprint reuse/extends, programmable blueprints, and custom Panel fields/sections/areas. Use when changing the Panel experience or schema.
kirby-upgrade-and-maintenance
Upgrades Kirby and maintains dependencies safely using composer audit, plugin compatibility checks, and official docs. Use when updating Kirby versions or making maintenance changes that affect runtime.
Didn't find tool you were looking for?