michtio/craftcms-claude-skills / skills/craft-plugins
craft-plugins
VerifiedIndex and router for plugin-specific Craft CMS 5 guidance — configuration, Twig API, PHP API, migrations, deployment, and pitfalls for the plugins this pack documents. Load whenever a task names a plugin this pack documents, and for passwordless or magic-link auth with no plugin named; read references/<plugin>.md first.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.4 KB |
| references/amazon-ses.md | markdown | 2.9 KB |
| references/blitz.md | markdown | 10.5 KB |
| references/cache-igniter.md | markdown | 2.8 KB |
| references/ckeditor.md | markdown | 18.5 KB |
| references/colour-swatches.md | markdown | 7.0 KB |
| references/element-api.md | markdown | 7.0 KB |
| references/elements-panel.md | markdown | 2.4 KB |
| references/embedded-assets.md | markdown | 5.1 KB |
| references/feed-me.md | markdown | 8.8 KB |
| references/formie.md | markdown | 27.5 KB |
| references/hyper.md | markdown | 5.4 KB |
| references/image-optimize.md | markdown | 27.6 KB |
| references/imager-x.md | markdown | 15.1 KB |
| references/knock-knock.md | markdown | 2.5 KB |
| references/navigation.md | markdown | 6.8 KB |
| references/password-policy.md | markdown | 5.1 KB |
| references/retour.md | markdown | 4.1 KB |
| references/seomatic.md | markdown | 23.2 KB |
| references/sherlock.md | markdown | 3.2 KB |
| references/sprig.md | markdown | 9.7 KB |
| references/timeloop.md | markdown | 6.7 KB |
| references/typogrify.md | markdown | 2.9 KB |
| references/vite.md | markdown | 6.1 KB |
| references/warp.md | markdown | 12.4 KB |
references/navigation.md
View on GitHub# Navigation
Menu management plugin by Verbb. Create and manage navigation menus with drag-and-drop, nested structures, custom fields on nodes, multi-site support, and a rich Twig rendering API. The standard navigation solution for Craft CMS — 20,000+ active installs.
`verbb/navigation` — $19
## Documentation
- Docs: https://verbb.io/craft-plugins/navigation/docs
- Rendering: https://verbb.io/craft-plugins/navigation/docs/template-guides/rendering-nodes
- Custom fields: https://verbb.io/craft-plugins/navigation/docs/get-started/custom-fields
- GitHub: https://github.com/verbb/navigation
When unsure about a Navigation feature, `WebFetch` the docs.
## Common Pitfalls
- Querying nodes without `.all()` or `.one()` — `craft.navigation.nodes()` returns an element query, not results. Always call `.all()` to execute it.
- Not using `.level()` for flat menus — without it, nested child nodes are included. Use `.level(1)` for top-level only.
- Forgetting `.eagerly()` on node element fields — if nodes have custom relation fields, eager-load them to avoid N+1 queries.
- Rendering with `craft.navigation.render()` then fighting the HTML — the render function outputs complete `<ul><li>` markup. If you need custom HTML, query nodes and build your own markup instead.
- Not handling external URLs vs entry-linked nodes — some nodes link to entries (have an element), others are manual URLs. Template code must handle both.
- Caching navigation without invalidation — navigation rarely changes, but when it does, cached markup is stale. Use `{% cache %}` with a key, or use Blitz which auto-invalidates.
- Running below 4.0.7 — 4.0.4 closed an information-disclosure advisory, 4.0.5 stopped legacy `{siteUrl}` tokens and invalid author-entered URL templates from erroring on the front end, and 4.0.7 hides menu settings in the builder when `allowAdminChanges` is off (before that they stayed editable on production).
## Twig API
### Quick Render (Default Markup)
```twig
{{ craft.navigation.render('mainNav') }}
```
Outputs a complete `<nav><ul><li>` structure with nested children. Good for prototyping, but you'll want custom rendering for production.
### Render with Options
```twig
{{ craft.navigation.render('mainNav', {
id: 'main-navigation',
class: 'nav-list',
ulClass: 'nav-list__items',
liClass: 'nav-list__item',
aClass: 'nav-list__link',
activeClass: 'is-active',
ulAttributes: { 'data-nav': 'main' },
}) }}
```
### Custom Rendering (Recommended)
Query nodes and build your own markup for full control:
```twig
{% set nodes = craft.navigation.nodes()
.handle('mainNav')
.level(1)
.all() %}
<nav aria-label="Main navigation">
<ul class="flex gap-6">
{% for node in nodes %}
<li>
<a href="{{ node.url }}"
class="nav-link {{ node.active ? 'is-active' : '' }}"
{{ node.newWindow ? 'target="_blank" rel="noopener noreferrer"' }}
{{ node.active ? 'aria-current="page"' }}>
{{ node.title }}
</a>
{# Nested children #}
{% if node.hasDescendants %}
<ul class="submenu">
{% for child in node.children %}
<li>
<a href="{{ child.url }}"
class="submenu-link {{ child.active ? 'is-active' : '' }}">
{{ child.title }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
```
### Node Properties
```twig
{{ node.title }} {# Node label #}
{{ node.url }} {# Full URL #}
{{ node.active }} {# Boolean — is this node or a descendant active? #}
{{ node.isCurrent }} {# Boolean — is this exact node active? #}
{{ node.newWindow }} {# Boolean — opens in new tab? #}
{{ node.classes }} {# Custom CSS classes #}
{{ node.customAttributes }} {# Custom key/value attributes #}
{{ node.type }} {# Node type (e.g., 'craft\elements\Entry') #}
{{ node.element }} {# Linked Craft element (entry, category, etc.) or null #}
{{ node.hasDescendants }} {# Boolean — has children? #}
{{ node.children }} {# Child nodes array #}
{{ node.level }} {# Nesting level (1 = top) #}
{{ node.parent }} {# Parent node or null #}
```
### Querying Nodes
```twig
{# All top-level nodes for a nav #}
{% set nodes = craft.navigation.nodes()
.handle('mainNav')
.level(1)
.all() %}
{# Specific nav for a specific site #}
{% set nodes = craft.navigation.nodes()
.handle('footerNav')
.siteId(currentSite.id)
.all() %}
{# With eager-loaded custom fields #}
{% set nodes = craft.navigation.nodes()
.handle('mainNav')
.with(['icon'])
.all() %}
```
### Active State Detection
Navigation automatically detects which node matches the current URL:
```twig
{% for node in nodes %}
{# node.active — true if this node OR any descendant matches current URL #}
{# node.isCurrent — true only if THIS node matches current URL #}
<a href="{{ node.url }}"
class="{{ node.active ? 'is-active' : '' }}"
{{ node.isCurrent ? 'aria-current="page"' }}>
{{ node.title }}
</a>
{% endfor %}
```
## Node Types
| Type | Description |
|------|-------------|
| Entry | Links to a Craft entry (URL auto-syncs) |
| Category | Links to a Craft category |
| Asset | Links to a Craft asset |
| URL | Manual URL (internal or external) |
| Custom | Custom node type via plugin |
Entry-linked nodes automatically update their URL when the entry's slug changes. Manual URL nodes are static.
## Custom Fields on Nodes
Navigation nodes support custom field layouts. Add fields in CP → Navigation → Settings → Field Layout. Common additions:
- **Icon field** — FontAwesome class or asset for nav icons
- **Subtitle field** — secondary text for mega-menu items
- **Image field** — thumbnails for visual navigation
Access in templates:
```twig
{% if node.icon %}
<i class="{{ node.icon }}"></i>
{% endif %}
{{ node.title }}
{% if node.subtitle %}
<span class="text-sm text-gray-500">{{ node.subtitle }}</span>
{% endif %}
```
## Console Commands
```bash
# Resave all navigation nodes
ddev craft resave/navigation-nodes
```
## GraphQL
```graphql
{
navigationNodes(navHandle: "mainNav", level: 1) {
title
url
level
newWindow
classes
children {
title
url
}
}
}
```
## Pair With
- **Blitz** — cache navigation globally. Blitz auto-invalidates when nav nodes change.
- **Hyper** — for in-content links alongside structural navigation.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |