infrahub-analyst

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Overview

概述

Expert guidance for interactive data analysis against a live Infrahub instance. This skill uses the Infrahub MCP server to query, correlate, and reason over infrastructure data on demand — answering operational questions that span multiple node types and relationships.
Use this skill for any question of the form "what does Infrahub currently know about X, and how does it relate to Y?"
Typical question patterns:
  • Compliance — "Are all devices following the naming convention?"
  • Service impact — "Which services are hosted on devices in this rack?"
  • Maintenance windows — "Which devices are currently in a maintenance window, and what depends on them?"
  • Drift detection — "Which realized devices differ from their topology design?"
  • Capacity — "Which racks are over 80% full?"
  • Change impact — "What BGP sessions, services, and IPs depend on this prefix?"
  • Inventory gaps — "Which devices have no platform or OS version recorded?"
For automated, pipeline-enforced checks that block proposed changes, see
../infrahub-check-creator/SKILL.md
. For repeatable scheduled reports exported as artifacts, see
../infrahub-transform-creator/SKILL.md
.
针对实时Infrahub实例的交互式数据分析专业指南。本技能使用Infrahub MCP服务器按需查询、关联和推理基础设施数据,回答涉及多种节点类型和关联关系的运维问题。
当你有如下形式的问题时可使用本技能: "Infrahub当前对X有哪些了解,它和Y有什么关联?"
典型问题场景:
  • 合规 — "所有设备都遵循命名规范吗?"
  • 服务影响 — "这个机架中的设备承载了哪些服务?"
  • 维护窗口 — "哪些设备当前处于维护窗口中,哪些资源依赖于这些设备?"
  • 漂移检测 — "哪些已部署的设备与其拓扑设计存在差异?"
  • 容量 — "哪些机架的使用率超过80%?"
  • 变更影响 — "哪些BGP会话、服务和IP依赖于这个前缀?"
  • 库存缺口 — "哪些设备没有记录平台或OS版本信息?"
如需自动化、流水线强制的校验来拦截待提交的变更,请查看
../infrahub-check-creator/SKILL.md
。如需导出为制品的可重复定时报告,请查看
../infrahub-transform-creator/SKILL.md

When to Use

适用场景

  • Answering operational questions interactively via natural language
  • Cross-referencing two or more node types to find relationships or gaps
  • Investigating the blast radius of a change before executing it
  • Auditing data quality across the inventory
  • Producing one-time or on-demand reports for stakeholders
  • Exploring schema structure and data before writing a generator or check
  • 通过自然语言交互式回答运维问题
  • 交叉引用两种或多种节点类型,查找关联关系或缺口
  • 在执行变更前调查变更的影响范围
  • 审计整个资产清单的数据质量
  • 为利益相关方生成一次性或按需报告
  • 在编写生成器或校验规则前探索模式结构和数据

How It Works

工作原理

The Infrahub MCP server exposes tools that let Claude query Infrahub data directly. The typical workflow:
  1. Query — use MCP tools to fetch current state from Infrahub
  2. Correlate — join, diff, or filter the data against a policy or second dataset
  3. Reason — identify gaps, anomalies, or relationships
  4. Report — surface findings with context and remediation hints
Infrahub MCP服务器提供了可让Claude直接查询Infrahub数据的工具。典型工作流:
  1. 查询 — 使用MCP工具从Infrahub获取当前状态
  2. 关联 — 结合策略或第二个数据集对数据进行拼接、比对或过滤
  3. 推理 — 识别缺口、异常或关联关系
  4. 报告 — 输出带有上下文和修复建议的发现结果

Rule Categories

规则分类

PriorityCategoryPrefixDescription
CRITICALMCP Tools
mcp-
Available Infrahub MCP tools, invocation patterns, response structure
CRITICALQuery Patterns
query-
GraphQL structures for fetching, filtering, and traversing relationships
HIGHCorrelation
correlation-
Joining, diffing, and reasoning over data from multiple queries
HIGHReporting Output
reporting-
Presenting findings: summaries, tables, per-object detail, remediation hints
MEDIUMApproach Selection
approach-
When to use MCP analysis vs InfrahubCheck vs Transform
优先级分类前缀描述
CRITICALMCP工具
mcp-
可用的Infrahub MCP工具、调用模式、响应结构
CRITICAL查询模式
query-
用于获取、过滤和遍历关联关系的GraphQL结构
HIGH关联分析
correlation-
对多个查询返回的数据进行拼接、比对和推理
HIGH报告输出
reporting-
呈现发现结果:摘要、表格、单对象详情、修复建议
MEDIUM方案选择
approach-
何时使用MCP分析、InfrahubCheck或Transform

MCP Server Basics

MCP服务器基础

When the Infrahub MCP server is connected, Claude can call tools such as:
  • mcp__infrahub__infrahub_query
    — Execute a GraphQL query (primary tool)
  • mcp__infrahub__infrahub_list_schema
    — List available node kinds
  • mcp__infrahub__infrahub_get
    — Retrieve a specific object by ID or filters
  • mcp__infrahub__infrahub_create
    — Create an object (remediation, on a branch)
  • mcp__infrahub__infrahub_update
    — Update an object (remediation, on a branch)
graphql
undefined
当连接Infrahub MCP服务器后,Claude可以调用如下工具:
  • mcp__infrahub__infrahub_query
    — 执行GraphQL查询(核心工具)
  • mcp__infrahub__infrahub_list_schema
    — 列出可用的节点类型
  • mcp__infrahub__infrahub_get
    — 通过ID或过滤器检索特定对象
  • mcp__infrahub__infrahub_create
    — 创建对象(修复场景,在分支上操作)
  • mcp__infrahub__infrahub_update
    — 更新对象(修复场景,在分支上操作)
graphql
undefined

Example: find all devices in an active

Example: find all devices in an active

maintenance window

maintenance window

query MaintenanceDevices { MaintenanceWindow(status__value: "active") { edges { node { name { value } start_time { value } end_time { value } devices { edges { node { name { value } role { value } site { node { name { value } } } } } } } } } }
undefined
query MaintenanceDevices { MaintenanceWindow(status__value: "active") { edges { node { name { value } start_time { value } end_time { value } devices { edges { node { name { value } role { value } site { node { name { value } } } } } } } } } }
undefined

Typical Analysis Workflow

典型分析工作流

text
1. Understand the question
   → "Which services depend on devices currently
      in a maintenance window?"

2. Identify the node types involved
   → MaintenanceWindow, DcimDevice, Service
     (or equivalent in your schema)

3. Query current state
   → mcp__infrahub__infrahub_query — one query
     per node type, or combined

4. Correlate the data
   → Join across node types, filter, count, diff

5. Report findings
   → Summarize with counts, list affected objects,
     suggest next steps
text
1. Understand the question
   → "Which services depend on devices currently
      in a maintenance window?"

2. Identify the node types involved
   → MaintenanceWindow, DcimDevice, Service
     (or equivalent in your schema)

3. Query current state
   → mcp__infrahub__infrahub_query — one query
     per node type, or combined

4. Correlate the data
   → Join across node types, filter, count, diff

5. Report findings
   → Summarize with counts, list affected objects,
     suggest next steps

Supporting References

参考资料

  • examples.md — Analysis patterns (naming, VLAN, BGP, maintenance, service impact)
  • ../infrahub-common/graphql-queries.md — GraphQL query writing reference
  • ../infrahub-common/infrahub-yml-reference.md — .infrahub.yml project configuration
  • ../infrahub-check-creator/SKILL.md — Automated pipeline checks (for enforcement)
  • ../infrahub-transform-creator/SKILL.md — Transforms for scheduled report artifacts
  • rules/ — Individual rules organized by category prefix
  • examples.md — 分析模式(命名、VLAN、BGP、维护、服务影响)
  • ../infrahub-common/graphql-queries.md — GraphQL查询编写参考
  • ../infrahub-common/infrahub-yml-reference.md — .infrahub.yml项目配置参考
  • ../infrahub-check-creator/SKILL.md — 自动化流水线校验(用于强制管控)
  • ../infrahub-transform-creator/SKILL.md — 用于生成定时报告制品的Transform
  • rules/ — 按分类前缀组织的独立规则