Managing Menus Skill
Relevant source files
The following files were used as context for generating this wiki page:
The Managing Menus Skill provides expert guidance for creating, modifying, and debugging Infrahub custom navigation menus. These menus control the left-side sidebar in the Infrahub web interface, allowing developers to organize schema node types into logical groups and hierarchies.
Sources: skills/infrahub-managing-menus/SKILL.md:1-24, README.md:143-144
This skill augments the auto-generated menu by allowing manual overrides for labels, icons, and nesting. It is triggered when designing sidebar menus, grouping node types in the UI, or customizing web interface navigation.
Sources: skills/infrahub-managing-menus/SKILL.md:6-10, skills/infrahub-managing-menus/SKILL.md:52-54
Architecture and File Structure
Custom menus are defined in YAML files and must be registered in the .infrahub.yml project configuration. Infrahub parses these files through a strict Pydantic model. If a file deviates from the required structure, the system rejects it and falls back to the auto-generated menu.
Sources: skills/infrahub-managing-menus/rules/format-structure.md:6-12, skills/infrahub-managing-menus/rules/format-structure.md:28-33
Menu Components Hierarchy
The following diagram illustrates the relationship between the project configuration, the menu file, and the resulting UI items.
The diagram shows how menu items are structured within the YAML and linked to schema nodes.
Sources: skills/infrahub-managing-menus/rules/format-structure.md:17-26, evaluations/infrahub-managing-menus.json:71-76
Required Fields
Every menu file requires the following top-level fields:
| Field | Value | Description |
|---|---|---|
apiVersion | infrahub.app/v1 | Required API version identifier. |
kind | Menu | Identifies the file as a navigation menu. |
spec.data | List | An array containing the top-level menu items. |
Sources: skills/infrahub-managing-menus/rules/format-structure.md:17-26, skills/infrahub-managing-menus/SKILL.md:94-105
Implementation Workflow
The workflow for creating a menu involves requirement gathering, YAML generation, and coordination with schema settings.
Sources: skills/infrahub-managing-menus/SKILL.md:107-133
Workflow Steps
- Requirement Gathering: Identify existing schema nodes and desired logical groupings.
- Rule Review: Consult formatting rules for YAML structure, item properties, and MDI (Material Design Icons) references.
- YAML Generation: Create the file including the
$schemacomment andapiVersion/kind/specstructure. - Registration and Guidance: Add comments for
.infrahub.ymlregistration and schema node suppression (include_in_menu: false).
Sources: skills/infrahub-managing-menus/SKILL.md:109-133
Schema Integration
A custom menu depends on cooperating settings within the schema to avoid duplicate entries in the UI.
The diagram shows the interaction between the custom menu and schema to prevent UI duplication.
Sources: skills/infrahub-managing-menus/SKILL.md:52-64, skills/infrahub-managing-menus/SKILL.md:75-80
Menu Item Configuration
Menu items can be flat or hierarchical. A non-clickable group header is created by omitting the kind property from an item and adding nested children.
Sources: skills/infrahub-managing-menus/SKILL.md:38-42, evaluations/infrahub-managing-menus.json:71-76
Item Properties
| Property | Type | Description |
|---|---|---|
name | String | Unique identifier for the item. |
namespace | String | The namespace the item belongs to. |
label | String | The human-readable text displayed in the UI. |
icon | String | Icon reference using the mdi: prefix. |
kind | String | Links to a schema node list view (e.g., DcimDevice). |
parent | List | Attaches an item to an existing section (e.g., [Builtin, IPAM]). |
children.data | List | Wrapper for nested child menu items. |
Sources: skills/infrahub-managing-menus/SKILL.md:96-105, skills/infrahub-managing-menus/rules/_sections.md:5-13, evaluations/infrahub-managing-menus.json:80-84
Example: Hierarchical Menu Structure
apiVersion: infrahub.app/v1
kind: Menu
spec:
data:
- namespace: Dcim
name: InfrastructureGroup
label: "Infrastructure"
icon: "mdi:server"
# No 'kind' here makes this a non-clickable header
children:
data:
- namespace: Dcim
name: DeviceMenu
label: "Devices"
icon: "mdi:server-network"
kind: DcimDevice
Sources: skills/infrahub-managing-menus/SKILL.md:96-105, evaluations/infrahub-managing-menus.json:71-76
Summary
The Managing Menus Skill ensures that Infrahub navigation is structured, user-friendly, and technically valid. By following the three-level loading system—Metadata, SKILL body, and Supporting Files—the skill provides targeted guidance for complex UI hierarchies while maintaining project configuration standards.
Sources: dev/knowledges/architecture.md:43-56, skills/infrahub-managing-menus/SKILL.md:17-20