Infrahub Menu Creator
Overview
Expert guidance for creating Infrahub custom menus.
Menus control the left-side navigation in the web
interface, organizing schema node types into a custom
hierarchy.
Project Context
Existing menu files:
!find . -name "*.yml" -path "*/menus/*" 2>/dev/null | head -10
Schema files (to identify available node types):
!find . -name "*.yml" -path "*/schemas/*" -o -name "*schema*" -name "*.yml" 2>/dev/null | head -10
When to Use
- Designing navigation menus for the Infrahub web UI
- Organizing node types into logical groups
and hierarchies
- Adding icons and labels to menu items
- Setting up group headers (non-clickable)
with nested children
- Configuring schema nodes to use custom menus
instead of auto-generated ones
Rule Categories
| Priority |
Category |
Prefix |
Description |
| CRITICAL |
Format |
format- |
apiVersion, kind, spec |
| CRITICAL |
Properties |
item- |
name, namespace, label, kind |
| HIGH |
Hierarchy |
hierarchy- |
Nesting, group headers, data |
| HIGH |
Icons |
icons- |
MDI icon reference, choices |
| MEDIUM |
Schema |
schema- |
include_in_menu, kind links |
| LOW |
Patterns |
patterns- |
Flat menu, comments, links |
Schema Features This Skill Depends On
A custom menu doesn't replace the auto-menu — it
augments it. Schemas need cooperating settings to
avoid duplicates and stay UI-stable.
Audit include_in_menu on every node you reference
from the menu file — the sidebar duplicates that
this prevents look to users like the custom menu is
"broken", but the fix is on the schema side.
Menu File Basics
---
apiVersion: infrahub.app/v1
kind: Menu
spec:
data:
- namespace: Dcim
name: DeviceMenu
label: "Devices"
icon: "mdi:server"
kind: DcimDevice # Links to schema node list view
apiVersion, kind: Menu, and spec.data are always
required. Each menu item needs name and namespace.
Workflow
Follow these steps when creating a menu:
Gather requirements — Ask what schema nodes
exist, how they should be grouped, and whether
the user wants flat or hierarchical navigation.
Read relevant rules — Read rules/format-structure.md
for the required YAML structure, rules/item-properties.md
for item fields, and rules/hierarchy-nesting.md
if nesting is needed. Read rules/icons-reference.md
to pick appropriate MDI icons.
Generate the menu YAML — Start with the
$schema comment and apiVersion/kind/spec
structure. Apply rules from step 2.
Add registration and schema guidance — Every
menu file output must include:
- A YAML comment block showing how to register
the file in
.infrahub.yml under the menus:
key (see rules/format-structure.md)
- A YAML comment block advising to set
include_in_menu: false on every schema node
that appears in the custom menu, to prevent
duplicate sidebar entries
(see rules/schema-integration.md)
Include these as comments at the top of the file,
before the --- document separator. This ensures
the user sees the guidance alongside the menu
definition.
Supporting References
- examples.md -- Four worked
menu hierarchies (flat, grouped, generic-linked,
full multi-domain) ready to copy and adapt
- infrahub-yml-reference.md
-- .infrahub.yml project configuration
- common/rules/
-- Shared rules (git integration, caching gotchas)
that apply across all skills
- managing-schemas
-- Schema node kinds that menus link to
- rules/
-- Individual rules organized by category prefix
1---2name: infrahub-managing-menus-23description: "Creates Infrahub custom navigation menus for the web UI sidebar, organizing node types into logical groups. TRIGGER when: designing sidebar menus, grouping node types in UI, customizing Infrahub web interface navigation. DO NOT TRIGGER when: designing schemas, writing checks or transforms, populating data objects."4---56# Infrahub Menu Creator78## Overview910Expert guidance for creating Infrahub custom menus.11Menus control the left-side navigation in the web12interface, organizing schema node types into a custom13hierarchy.1415## Project Context1617Existing menu files:18!`find . -name "*.yml" -path "*/menus/*" 2>/dev/null | head -10`1920Schema files (to identify available node types):21!`find . -name "*.yml" -path "*/schemas/*" -o -name "*schema*" -name "*.yml" 2>/dev/null | head -10`2223## When to Use2425- Designing navigation menus for the Infrahub web UI26- Organizing node types into logical groups27 and hierarchies28- Adding icons and labels to menu items29- Setting up group headers (non-clickable)30 with nested children31- Configuring schema nodes to use custom menus32 instead of auto-generated ones3334## Rule Categories3536| Priority | Category | Prefix | Description |37| -------- | ---------- | ------------ | ---------------------------- |38| CRITICAL | Format | `format-` | apiVersion, kind, spec |39| CRITICAL | Properties | `item-` | name, namespace, label, kind |40| HIGH | Hierarchy | `hierarchy-` | Nesting, group headers, data |41| HIGH | Icons | `icons-` | MDI icon reference, choices |42| MEDIUM | Schema | `schema-` | include_in_menu, kind links |43| LOW | Patterns | `patterns-` | Flat menu, comments, links |4445## Schema Features This Skill Depends On4647A custom menu doesn't replace the auto-menu — it48augments it. Schemas need cooperating settings to49avoid duplicates and stay UI-stable.5051| If the menu item... | The schema must... | See |52| ------------------- | ------------------ | --- |53| Links to a schema node's list view via `kind:` | Define that node (or generic) so the URL resolves — and set `include_in_menu: false` on it to suppress the duplicate auto-menu entry | [rules/schema-integration.md](./rules/schema-integration.md) |54| Shows all subtypes under one entry via a generic kind | Have the generic defined, with all the relevant nodes `inherit_from` it | [../infrahub-managing-schemas/rules/hierarchy-setup.md](../infrahub-managing-schemas/rules/hierarchy-setup.md) |55| Should appear at a specific position when auto-menu is in play | Set `order_weight` on the schema node (auto-menu uses it; custom menu ignores it) | [../infrahub-managing-schemas/rules/display-order-weight.md](../infrahub-managing-schemas/rules/display-order-weight.md) |56| Groups subtypes under a parent node entry | Set `menu_placement: <FullKind>` on each subtype so the auto-menu side groups consistently with the custom menu | [../infrahub-managing-schemas/rules/display-menu-placement.md](../infrahub-managing-schemas/rules/display-menu-placement.md) |5758Audit `include_in_menu` on every node you reference59from the menu file — the sidebar duplicates that60this prevents look to users like the custom menu is61"broken", but the fix is on the schema side.6263## Menu File Basics6465```yaml66---67apiVersion: infrahub.app/v168kind: Menu69spec:70 data:71 - namespace: Dcim72 name: DeviceMenu73 label: "Devices"74 icon: "mdi:server"75 kind: DcimDevice # Links to schema node list view76```7778`apiVersion`, `kind: Menu`, and `spec.data` are always79required. Each menu item needs `name` and `namespace`.8081## Workflow8283Follow these steps when creating a menu:84851. **Gather requirements** — Ask what schema nodes86 exist, how they should be grouped, and whether87 the user wants flat or hierarchical navigation.882. **Read relevant rules** — Read `rules/format-structure.md`89 for the required YAML structure, `rules/item-properties.md`90 for item fields, and `rules/hierarchy-nesting.md`91 if nesting is needed. Read `rules/icons-reference.md`92 to pick appropriate MDI icons.933. **Generate the menu YAML** — Start with the94 `$schema` comment and `apiVersion`/`kind`/`spec`95 structure. Apply rules from step 2.964. **Add registration and schema guidance** — Every97 menu file output must include:98 - A YAML comment block showing how to register99 the file in `.infrahub.yml` under the `menus:`100 key (see `rules/format-structure.md`)101 - A YAML comment block advising to set102 `include_in_menu: false` on every schema node103 that appears in the custom menu, to prevent104 duplicate sidebar entries105 (see `rules/schema-integration.md`)106107 Include these as comments at the top of the file,108 before the `---` document separator. This ensures109 the user sees the guidance alongside the menu110 definition.111112## Supporting References113114- **[examples.md](./examples.md)** -- Four worked115 menu hierarchies (flat, grouped, generic-linked,116 full multi-domain) ready to copy and adapt117- **[infrahub-yml-reference.md](../infrahub-common/infrahub-yml-reference.md)**118 -- .infrahub.yml project configuration119- **[common/rules/](../infrahub-common/rules/)**120 -- Shared rules (git integration, caching gotchas)121 that apply across all skills122- **[managing-schemas](../infrahub-managing-schemas/SKILL.md)**123 -- Schema node kinds that menus link to124- **[rules/](./rules/)**125 -- Individual rules organized by category prefix