infrahub-analyzing-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOverview
概述
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
.
For repeatable scheduled reports exported as
artifacts, see .
../infrahub-managing-checks/SKILL.md../infrahub-managing-transforms/SKILL.md针对实时 Infrahub 实例进行交互式数据分析的
专家指南。此 skill 使用
Infrahub MCP server 按需查询、关联并推理
基础设施数据——回答横跨多个
node type 和 relationship 的运维问题。
对于以下形式的问题,请使用此 skill:
“Infrahub 当前对 X 了解多少,
以及它与 Y 有何关系?”
典型问题模式:
- 合规性 — “所有设备是否都遵循命名约定?”
- 服务影响 — “哪些服务托管在此机架中的设备上?”
- 维护窗口 — “哪些设备当前处于维护窗口中,以及哪些内容依赖它们?”
- 漂移检测 — “哪些 realized devices 与其 topology design 存在差异?”
- 容量 — “哪些机架的容量使用率超过 80%?”
- 变更影响 — “此 prefix 依赖哪些 BGP sessions、services 和 IPs?”
- 资产清单缺口 — “哪些设备未记录 platform 或 OS version?”
对于能够阻止拟议变更的自动化、由 pipeline 强制执行的检查,请参阅
。
对于以 artifact 形式导出的可重复定时报告,请参阅
。
../infrahub-managing-checks/SKILL.md../infrahub-managing-transforms/SKILL.mdProject Context
项目上下文
This skill runs in a forked subagent context and has no visibility into the
parent conversation. The user's question MUST be passed via arguments.
-
If invoked with arguments (e.g.,), treat the arguments as the question to answer.
/infrahub:analyzing-data Which devices have no platform assigned? -
If invoked with no arguments, do not guess, do not use any example question from this file, and do not proceed. Return immediately with:Error: No question was passed to. This skill runs in a forked context and requires the user's question as args. Re-invoke with the question, e.g.
infrahub-analyzing-data.Skill(skill="infrahub-analyzing-data", args="<the user's question>")
此 skill 运行在 forked subagent context 中,无法查看
父对话。用户的问题必须通过 arguments 传递。
-
如果带参数调用(例如), 则应将这些参数视为需要回答的问题。
/infrahub:analyzing-data Which devices have no platform assigned? -
如果调用时没有参数,不要猜测,不要使用本文件中的任何 示例问题,也不要继续执行。立即返回:Error: 未向传入问题。此 skill 运行在 forked context 中,要求将用户的问题作为 args 传入。请携带 问题重新调用,例如
infrahub-analyzing-data。Skill(skill="infrahub-analyzing-data", args="<the user's question>")
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
- 通过自然语言交互式回答运维问题
- 交叉引用两个或更多 node types,以查找 relationships 或 gaps
- 在执行变更前调查其影响范围
- 审计整个 inventory 的数据质量
- 面向利益相关者生成一次性或按需报告
- 在编写 generator 或 check 前探索 schema 结构和数据
How It Works
工作原理
The Infrahub MCP server exposes tools that let
Claude query Infrahub data directly.
The typical workflow:
- Query — use MCP tools to fetch current state from Infrahub
- Correlate — join, diff, or filter the data against a policy or second dataset
- Reason — identify gaps, anomalies, or relationships
- Report — surface findings with context and remediation hints
Infrahub MCP server 提供了一组工具,使 Claude 可以直接查询
Infrahub 数据。典型工作流如下:
- 查询 — 使用 MCP tools 从 Infrahub 获取当前状态
- 关联 — 对数据进行 join、diff 或 filter,并与 policy 或第二个 dataset 对照
- 推理 — 识别 gaps、anomalies 或 relationships
- 报告 — 结合上下文呈现发现,并给出修复建议
Rule Categories
规则类别
| Priority | Category | Prefix | Description |
|---|---|---|---|
| CRITICAL | MCP Tools | | Available Infrahub MCP tools, invocation patterns, response structure |
| CRITICAL | Query Patterns | | GraphQL structures for fetching, filtering, and traversing relationships |
| HIGH | Correlation | | Joining, diffing, and reasoning over data from multiple queries |
| HIGH | Reporting Output | | Presenting findings: summaries, tables, per-object detail, remediation hints |
| MEDIUM | Approach Selection | | When to use MCP analysis vs InfrahubCheck vs Transform |
| 优先级 | 类别 | 前缀 | 描述 |
|---|---|---|---|
| CRITICAL | MCP 工具 | | 可用的 Infrahub MCP tools、调用模式和响应结构 |
| CRITICAL | 查询模式 | | 用于获取、筛选和遍历 relationships 的 GraphQL 结构 |
| HIGH | 数据关联 | | 对多个查询的数据执行 join、diff 和推理 |
| HIGH | 报告输出 | | 呈现发现:摘要、表格、单对象详情和修复建议 |
| MEDIUM | 方法选择 | | 何时使用 MCP 分析、InfrahubCheck 或 Transform |
MCP Server Basics
MCP server 基础
When the Infrahub MCP server (v1.1.7) is connected,
Claude can call these tools.
Read:
- — List nodes of a kind with filtering/pagination (preferred typed read)
mcp__infrahub__get_nodes - — Find nodes of a kind by partial substring
mcp__infrahub__search_nodes - — Discover schema kinds and their filters
mcp__infrahub__get_schema - — Execute a read-only GraphQL query
mcp__infrahub__query_graphql - — Report the active session branch and instance address
mcp__infrahub__get_session_info
Write (branch-isolated — land on an auto-created
branch, never the default branch):
mcp/session-*- — Create or update an object
mcp__infrahub__node_upsert - — Delete an object
mcp__infrahub__node_delete - — Run a GraphQL mutation for complex writes
mcp__infrahub__mutate_graphql - — Open a Proposed Change for human review
mcp__infrahub__propose_changes - — Reset or switch the active session branch
mcp__infrahub__reset_session_branch
Full per-tool signatures (parameters, examples,
response shapes) and the branch model are in
rules/mcp-tools.md — read
that before invoking any of these.
graphql
undefined连接 Infrahub MCP server(v1.1.7)后,Claude 可以调用以下工具。
读取:
- — 列出指定 kind 的 nodes,支持 filtering/pagination(首选的类型化读取方式)
mcp__infrahub__get_nodes - — 通过部分 substring 查找指定 kind 的 nodes
mcp__infrahub__search_nodes - — 发现 schema kinds 及其 filters
mcp__infrahub__get_schema - — 执行只读 GraphQL 查询
mcp__infrahub__query_graphql - — 报告当前 session branch 和 instance address
mcp__infrahub__get_session_info
写入(branch 隔离——写入自动创建的
branch,绝不写入默认 branch):
mcp/session-*- — 创建或更新 object
mcp__infrahub__node_upsert - — 删除 object
mcp__infrahub__node_delete - — 执行 GraphQL mutation 以完成复杂写入
mcp__infrahub__mutate_graphql - — 创建一个供人工审查的 Proposed Change
mcp__infrahub__propose_changes - — 重置或切换当前 session branch
mcp__infrahub__reset_session_branch
每个工具的完整签名(参数、示例和响应结构)以及 branch model 位于
rules/mcp-tools.md——调用其中任何工具之前,
请先阅读该文档。
graphql
undefinedExample: 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 } }
}
}
}
}
}
}
}
}
undefinedquery 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 } }
}
}
}
}
}
}
}
}
undefinedTypical 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__get_nodes per kind (typed), or
mcp__infrahub__query_graphql — 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 stepstext
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__get_nodes per kind (typed), or
mcp__infrahub__query_graphql — 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 stepsSupporting 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-managing-checks/SKILL.md — Automated pipeline checks (for enforcement)
- ../infrahub-managing-transforms/SKILL.md — Transforms for scheduled report artifacts
- ../infrahub-common/rules/workflow-information-priority.md
-- Skill content first; how to consult on a genuine gap (e.g. deleting nodes)
docs.infrahub.app - 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-managing-checks/SKILL.md — 自动化 pipeline checks(用于强制执行)
- ../infrahub-managing-transforms/SKILL.md — 用于定时报告 artifacts 的 Transforms
- ../infrahub-common/rules/workflow-information-priority.md
-- 优先使用 Skill 内容;确有信息缺口时(例如删除 nodes),
查询
docs.infrahub.app - rules/ — 按类别前缀组织的各项规则