Skip to main content

Installation and setup

Infrahub Skills can be installed into any AI tool that supports skills or custom context files. Installation takes one command for most setups: install into a specific Infrahub repository to work in that project, or install globally to use the skills across all your projects.

Prerequisites​

  • AI coding assistant: any tool that supports the Agent Skills format or reads custom context files: Claude Code, GitHub Copilot, Cursor, Windsurf, Amp, Cline, Codex, and others
  • Infrahub instance: version 1.7 or later (earlier versions may work but are not tested). See the Infrahub installation docs for setup instructions
  • infrahubctl: required for loading generated schemas, objects, and running generators. See the infrahubctl docs
  • Infrahub MCP server (optional): required only for the Data Analyzer skill, beneficial but not required for other skills. See the MCP server docs

One .infrahub.yml section needs a newer Infrahub​

Most of .infrahub.yml works across every version above. One section does not: graphql_fragments, which lets several queries share the same GraphQL selection by name instead of repeating it. It requires Infrahub 1.9.0, which in turn requires infrahub-sdk 1.20.0.

The config model rejects unknown keys, so an older Infrahub does not skip the section. It rejects the whole .infrahub.yml file. Check your target version before adding graphql_fragments to a repository that runs an older release.

Supported AI tools​

AI ToolInstallation MethodAuto-detectionDirect Skill Invocation
Claude Code (plugin)/plugin install infrahub@opsmillYes (skill descriptions)Yes (/infrahub:managing-schemas, etc.)
Claude Code (npx)npx skills addYes (skill descriptions)Yes
GitHub Copilotnpx skills addNo, passive onlyNo, passive only
Cursornpx skills addNo, passive onlyNo, passive only
Windsurfnpx skills addNo, passive onlyNo, passive only
Ampnpx skills addNo, passive onlyNo, passive only
Clinenpx skills addNo, passive onlyNo, passive only
Codexnpx skills addNo, passive onlyNo, passive only

Auto-detection means Claude Code reads each skill's description and loads the skill whose description matches your request, without you naming it. This works for both the plugin and the npx install.

Direct skill invocation means calling a skill by name, for example /infrahub:managing-schemas. Available where the agent supports plugins. Every other tool is passive: it reads skill content as context when the request is relevant. For those, describe what you want and the AI applies the right skill.

Installation​

The npx installer detects which AI tools you have configured and installs the skills in the correct format for each one automatically.

npx skills add opsmill/infrahub-skills

The installer determines whether to install the skills in the current project directory or globally. If installing per-project, run the command from your Infrahub project root.

Tool-specific configuration​

After installing via npx or manual copy, some tools benefit from a small configuration file to activate the skills more reliably. These tools will use the skills without these files, but adding them improves consistency.

GitHub Copilot​

Create .github/instructions/infrahub.instructions.md in your project root:

---
applyTo: "**"
---

Use the skills in the `skills/` directory when working on Infrahub schemas,
objects, checks, generators, transforms, or menus. Each skill's SKILL.md
file describes when and how to use it.

Cursor​

Create .cursor/rules/infrahub.mdc in your project root:

---
description: Infrahub development skills for schemas, objects, checks, generators, transforms, and menus
globs: "**/*.{yml,yaml,py,gql,j2}"
alwaysApply: false
---

Use the skills in the `skills/` directory when working on Infrahub resources.
Each skill's SKILL.md file describes when and how to use it.

Windsurf​

Windsurf reads Markdown files from the project automatically. Optionally, reference the skills from .windsurfrules:

For Infrahub development tasks, use the skills in the `skills/` directory.
Each skill's SKILL.md file describes when and how to use it.

Claude Code (plugin)​

Skills load without configuration: Claude Code chooses a skill from its description when your request matches it.

A request such as "fix the failing test in generators/create_dc.py" names a file, not a task, so the matching skill may not load. To make Claude Code read the right skill before it edits a file, add this section to the CLAUDE.md at the root of your Infrahub repository:

## Infrahub skills

Before editing a file in these paths, read the matching skill from the
infrahub plugin. Each rule named here is a file in the `rules/` directory
of that skill, next to its `SKILL.md`:

- `generators/**/*.py` or `generators/**/*.gql`: `infrahub-managing-generators`,
including `rules/python-relationship-references.md` and
`rules/python-multi-peer-add.md`
- `transforms/**/*.py` or `templates/**/*.j2`: `infrahub-managing-transforms`,
including `rules/artifacts-async-regen-polling.md` before writing code
that calls `/api/artifact/generate`
- `checks/**/*.py`: `infrahub-managing-checks`
- `queries/**/*.gql`: find which transform, check or generator uses the
query, from its `.infrahub.yml` entry or the `query` attribute of its
Python class, then read `infrahub-managing-transforms` (including
`rules/queries-union-fragments.md`), `infrahub-managing-checks` or
`infrahub-managing-generators`
- Any YAML file with `apiVersion: infrahub.app/v1` and `kind: Object`,
usually under `objects/` or `data/`: `infrahub-managing-objects`
- `menus/**/*.{yml,yaml}`, or any file with `kind: Menu`: `infrahub-managing-menus`
- Any `.gql` file: also `rules/deployment-gql-dry-run.md` in the
`infrahub-common` skill

Before running any `infrahubctl` command, detect the project's Python
environment as `rules/connectivity-python-environment.md` in the
`infrahub-common` skill describes.

These path rules matter most for generators and transforms. Code written from the patterns already in a repository can pass its unit tests and still fail against a live Infrahub server, and the skills hold the rules that prevent that.

MCP server setup (Data Analyzer skill)​

The Data Analyzer skill uses the Infrahub MCP server to query live data from a running instance. All other skills work without it.

See the Infrahub MCP server docs for setup instructions.

tip

Without MCP, the AI can still query Infrahub data by constructing GraphQL API calls directly. The interaction is more verbose, but functional.

Verifying the installation​

  1. Check the files are present: confirm that skills/*/SKILL.md files exist in your project directory (or globally, depending on your install method).

  2. Test skill activation: open the project in your AI tool and ask:

    What Infrahub skills do you have available?

    The AI should list the installed skills.

  3. Test skill output: ask the AI to create a small schema:

    Create a Device node with a name and status attribute.

    If the skills are active, the output should:

    • Start with version: "1.0"
    • Use kind: Dropdown for the status field with choice objects
    • Include human_friendly_id and display_label

    Without the skills, most AI assistants produce a simpler or incorrect schema that misses these conventions.

Upgrading​

npx skills update