From infrahub
Creates Infrahub data transforms using Python classes or Jinja2 templates, with YAML-driven testing and artifact pipeline integration. Useful for config generation, CSV reports, and format conversion.
How this skill is triggered — by the user, by Claude, or both
Slash command
/infrahub:infrahub-managing-transforms [transform-name] [format][transform-name] [format]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Expert guidance for creating Infrahub transforms.
examples.mdreference.mdrules/_sections.mdrules/_template.mdrules/api-reference.mdrules/artifacts-async-regen-polling.mdrules/artifacts-definitions.mdrules/hybrid-python-jinja2.mdrules/jinja2-template.mdrules/patterns-common.mdrules/python-transform.mdrules/queries-union-fragments.mdrules/testing-commands.mdrules/testing-resource-framework.mdrules/types-overview.mdExpert guidance for creating Infrahub transforms. Transforms convert Infrahub data into different formats -- JSON, text, CSV, device configs, or any text-based output -- using Python classes or Jinja2 templates.
Infrahub config:
!cat .infrahub.yml 2>/dev/null || echo "No .infrahub.yml found"
Existing transforms:
!find . -name "*.py" -path "*/transforms/*" -o -name "*.j2" -path "*/templates/*" 2>/dev/null | head -20
| Priority | Category | Prefix | Description |
|---|---|---|---|
| CRITICAL | Types | types- | Python vs Jinja2 choice |
| CRITICAL | Python | python- | InfrahubTransform class |
| CRITICAL | Jinja2 | jinja2- | Template syntax, filters |
| HIGH | Hybrid | hybrid- | Python + Jinja2 combined |
| HIGH | Artifacts | artifacts- | Output files, targets |
| HIGH | API Ref | api- | Class attrs, methods |
| MEDIUM | Patterns | patterns- | Utilities, CSV, shared |
| HIGH | Testing | testing- | Resources Testing Framework, transform/render commands |
A transform reads schema-shaped data and produces a file. Misalignment between the transform and the schema fails late — at artifact-render time, when someone is waiting for the output.
| If the transform... | The schema (or .infrahub.yml) must... | See |
|---|---|---|
Will feed an artifact_definitions entry | The target node must inherit_from: CoreArtifactTarget so the artifact pipeline can attach to it | ../infrahub-managing-schemas/rules/extension-artifact-target.md |
| Reads attributes from a node | Define those attributes with their full __value access path in GraphQL — silent empty strings come from accessing the node, not the value | ../infrahub-managing-schemas/rules/attribute-defaults-and-types.md |
| Picks a template per device by platform/role | The schema must expose that platform/role as a real attribute or relationship — string-matching on display_label is brittle | ../infrahub-managing-schemas/rules/display-human-friendly-id.md |
Is referenced from artifact_definitions.transformation | The transform's registered name must match the transformation: field exactly — mismatch produces "transformation not found" at render time | rules/artifacts-definitions.md |
| Uses Jinja2 (not Python) | Register under jinja2_transforms with a top-level query: field — python_transforms binds query on the class, the two keys are not interchangeable | rules/api-reference.md |
Two types of transforms:
| Type | Output | Entry Point |
|---|---|---|
| Python | JSON/dict or text | InfrahubTransform.transform() |
| Jinja2 | Text | .j2 template file |
from infrahub_sdk.transforms import InfrahubTransform
class MyTransform(InfrahubTransform):
query = "my_query"
async def transform(self, data: dict) -> dict:
device = data["DcimDevice"]["edges"][0]["node"]
return {"hostname": device["name"]["value"]}
Follow these steps when creating a transform:
.gql file
that fetches the data to transform. Read
../infrahub-common/graphql-queries.md
for query patterns.InfrahubTransform and implement transform().
Read rules/python-transform.md.
For Jinja2, create a .j2 template. Read
rules/jinja2-template.md.
For hybrid, read
rules/hybrid-python-jinja2.md.python_transforms or jinja2_transforms. See
rules/api-reference.md.infrahubctl transform or
infrahubctl render to validate. See
rules/testing-commands.md..infrahub.yml
registration shapes, filter env overviewnpx claudepluginhub opsmill/claude-marketplace --plugin infrahubCreates, validates, and modifies Infrahub schema YAML files — nodes, generics, attributes, relationships, and extensions. Use when designing data models, validating schemas, or planning migrations.
Generates and debugs Bloblang transformation scripts from natural language descriptions. Covers data mapping, field parsing, timestamp conversion, and array filtering for Redpanda Connect pipelines.
Provides expert guidance on Harness templates for steps, stages, pipelines; runtime inputs, expression language, and patterns like CI/CD, GitOps, Canary, Blue-Green deployments.