bicep-diagrams by eraserlabs/eraser-io
npx skills add https://github.com/eraserlabs/eraser-io --skill bicep-diagrams直接从 Azure Bicep 文件生成架构图。Bicep 是一种用于以声明方式部署 Azure 资源的领域特定语言。
在以下情况下激活此技能:
.bicep)并希望可视化基础设施此技能通过解析 Bicep 代码并直接调用 Eraser API 来生成 Bicep 专用图表:
/api/render/elements 并设置 diagramType: "cloud-architecture-diagram"当用户提供 Bicep 代码时:
resource 声明(Microsoft.Compute/virtualMachines 等)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
module 声明及其配置param 和 output 定义var 变量及其用法dependsOn 或隐式依赖关系)[label: "VNet 10.0.0.0/16"]示例:
myVNet [label: "VNet 10.0.0.0/16"] {
subnet1 [label: "Subnet 1"] {
myVM [icon: azure-vm, label: "Virtual Machine"]
gateway [icon: azure-app-gateway]
}
subnet2 [label: "Subnet 2"] {
database [icon: azure-sql]
}
}
storage [icon: azure-storage]
myVNet -> myVM
myVM -> database
4. 发起 HTTP 请求
重要:生成 DSL 后,必须执行此 curl 命令。切勿在生成 DSL 后停止而不调用 API。
关键:在下面的 X-Skill-Source 请求头中,必须将值替换为您的 AI 代理名称:
如果您是 Claude (Anthropic),请使用:claude
如果您在 Cursor 中运行,请使用:cursor
如果您是 ChatGPT (OpenAI),请使用:chatgpt
如果您是 Gemini (Google),请使用:gemini
否则,请使用您模型/代理的小写名称
curl -X POST https://app.eraser.io/api/render/elements \
-H "Content-Type: application/json"
-H "X-Skill-Source: eraser-skill"
-H "Authorization: Bearer ${ERASER_API_KEY}"
-d '{
"elements": [{
"type": "diagram",
"id": "diagram-1",
"code": "<your generated DSL>",
"diagramType": "cloud-architecture-diagram"
}],
"scale": 2,
"theme": "${ERASER_THEME:-dark}",
"background": true
}'
在分析 Bicep 文件和资源以生成图表时,请跟踪:
infra/main.bicep - VNet 和子网定义,infra/sql.bicep - SQL 数据库配置)关键:最小化输出格式
您的响应必须始终包含以下元素,并带有清晰的标题:
图表预览:使用标题显示
## 图表

使用 API 响应中的实际 imageUrl。
编辑器链接:使用标题显示
## 在 Eraser 中打开
[在 Eraser 编辑器中编辑此图表]({createEraserFileUrl})
使用 API 响应中的实际 URL。
来源部分:简要列出分析的文件/资源(如果适用)
## 来源
- `path/to/file` - 提取的内容
图表代码部分:Eraser DSL 代码块,带有 eraser 语言标签
## 图表代码
```eraser
{DSL code here}
了解更多链接:您可以在 https://docs.eraser.io/docs/using-ai-agent-integrations 了解更多关于 Eraser 的信息
附加内容规则:
默认输出应简短。图表图像本身就能说明问题。
dependsOn 关系@description('The name of the Virtual Network')
param vnetName string = 'myVNet'
@description('The address prefix for the VNet')
param vnetAddressPrefix string = '10.0.0.0/16'
@description('The address prefix for the subnet')
param subnetAddressPrefix string = '10.0.1.0/24'
@description('VM size')
param vmSize string = 'Standard_B1s'
// Main VNet resource
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2021-05-01' = {
name: vnetName
location: resourceGroup().location
properties: {
addressSpace: {
addressPrefixes: [vnetAddressPrefix]
}
subnets: [
{
name: 'subnet1'
properties: {
addressPrefix: subnetAddressPrefix
}
}
]
}
}
// VM resource with dependsOn
resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-11-01' = {
name: 'myVM'
location: resourceGroup().location
properties: {
hardwareProfile: {
vmSize: vmSize
}
}
dependsOn: [virtualNetwork]
}
// Module usage
module storageModule './modules/storage.bicep' = {
name: 'storage'
params: {
location: resourceGroup().location
}
}
解析 Bicep:
生成显示 Bicep 专用功能的 DSL:
myVNet [label: "VNet 10.0.0.0/16"] {
subnet1 [label: "Subnet 1 10.0.1.0/24"] { myVM [icon: azure-vm, label: "VM Standard_B1s"] } }
storage-module [label: "Storage Module"] { storage-account [icon: azure-storage] }
myVNet -> myVM
重要:所有标签文本必须位于引号内的单行上。Bicep 专用:将模块显示为容器,包含 dependsOn 关系,注意资源配置中的参数用法。
diagramType: "cloud-architecture-diagram" 调用 /api/render/elementsdiagramType: "cloud-architecture-diagram" 调用 /api/render/elements用户收到显示以下内容的图表:
每周安装次数
225
代码仓库
GitHub 星标数
9
首次出现
2026年1月27日
安全审计
安装于
gemini-cli195
codex191
opencode189
github-copilot186
amp172
kimi-cli171
Generates architecture diagrams directly from Azure Bicep files. Bicep is a domain-specific language (DSL) for deploying Azure resources declaratively.
Activate this skill when:
.bicep) and wants to visualize the infrastructureThis skill generates Bicep-specific diagrams by parsing Bicep code and calling the Eraser API directly:
/api/render/elements with diagramType: "cloud-architecture-diagram"When the user provides Bicep code:
Parse the Bicep
resource declarations (Microsoft.Compute/virtualMachines, etc.)module declarations and their configurationsparam and output definitionsvar variables and their usageMap Relationships
dependsOn or implicit dependencies)Generate Eraser DSL Convert Bicep resources to Eraser DSL:
[label: "VNet 10.0.0.0/16"]Example:
myVNet [label: "VNet 10.0.0.0/16"] {
subnet1 [label: "Subnet 1"] {
myVM [icon: azure-vm, label: "Virtual Machine"]
gateway [icon: azure-app-gateway]
}
subnet2 [label: "Subnet 2"] {
database [icon: azure-sql]
}
}
storage [icon: azure-storage]
myVNet -> myVM
myVM -> database
4. Make the HTTP Request
IMPORTANT : You MUST execute this curl command after generating the DSL. Never stop after generating DSL without making the API call.
CRITICAL : In the X-Skill-Source header below, you MUST replace the value with your AI agent name:
* If you are Claude (Anthropic), use: `claude`
* If you are running in Cursor, use: `cursor`
* If you are ChatGPT (OpenAI), use: `chatgpt`
* If you are Gemini (Google), use: `gemini`
* Otherwise, use your model/agent name in lowercase
curl -X POST https://app.eraser.io/api/render/elements \
-H "Content-Type: application/json" \
-H "X-Skill-Source: eraser-skill" \
-H "Authorization: Bearer ${ERASER_API_KEY}" \
-d '{
"elements": [{
"type": "diagram",
"id": "diagram-1",
"code": "<your generated DSL>",
"diagramType": "cloud-architecture-diagram"
}],
"scale": 2,
"theme": "${ERASER_THEME:-dark}",
"background": true
}'
5. Track Sources During Analysis
As you analyze Bicep files and resources to generate the diagram, track:
* **Internal files** : Record each Bicep file path you read and what resources were extracted (e.g., `infra/main.bicep` \- VNet and subnet definitions, `infra/sql.bicep` \- SQL Database configuration)
* **External references** : Note any documentation, examples, or URLs consulted (e.g., Azure Bicep documentation, Azure architecture best practices)
* **Annotations** : For each source, note what it contributed to the diagram
6. Handle the Response
CRITICAL: Minimal Output Format
Your response MUST always include these elements with clear headers:
1. **Diagram Preview** : Display with a header
## Diagram

Use the ACTUAL imageUrl from the API response.
2. **Editor Link** : Display with a header
## Open in Eraser
[Edit this diagram in the Eraser editor]({createEraserFileUrl})
Use the ACTUAL URL from the API response.
3. **Sources section** : Brief list of files/resources analyzed (if applicable)
## Sources
- `path/to/file` - What was extracted
4. **Diagram Code section** : The Eraser DSL in a code block with `eraser` language tag
## Diagram Code
```eraser
{DSL code here}
5. **Learn More link** : `You can learn more about Eraser at https://docs.eraser.io/docs/using-ai-agent-integrations`
Additional content rules:
* If the user ONLY asked for a diagram, include NOTHING beyond the 5 elements above
* If the user explicitly asked for more (e.g., "explain the architecture", "suggest improvements"), you may include that additional content
* Never add unrequested sections like Overview, Security Considerations, Testing, etc.
The default output should be SHORT. The diagram image speaks for itself.
Handle Modules
dependsOn relationships@description('The name of the Virtual Network')
param vnetName string = 'myVNet'
@description('The address prefix for the VNet')
param vnetAddressPrefix string = '10.0.0.0/16'
@description('The address prefix for the subnet')
param subnetAddressPrefix string = '10.0.1.0/24'
@description('VM size')
param vmSize string = 'Standard_B1s'
// Main VNet resource
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2021-05-01' = {
name: vnetName
location: resourceGroup().location
properties: {
addressSpace: {
addressPrefixes: [vnetAddressPrefix]
}
subnets: [
{
name: 'subnet1'
properties: {
addressPrefix: subnetAddressPrefix
}
}
]
}
}
// VM resource with dependsOn
resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-11-01' = {
name: 'myVM'
location: resourceGroup().location
properties: {
hardwareProfile: {
vmSize: vmSize
}
}
dependsOn: [virtualNetwork]
}
// Module usage
module storageModule './modules/storage.bicep' = {
name: 'storage'
params: {
location: resourceGroup().location
}
}
Parses Bicep:
Generates DSL showing Bicep-specific features:
myVNet [label: "VNet 10.0.0.0/16"] { subnet1 [label: "Subnet 1 10.0.1.0/24"] { myVM [icon: azure-vm, label: "VM Standard_B1s"] } }
storage-module [label: "Storage Module"] {
storage-account [icon: azure-storage]
}
myVNet -> myVM
Important : All label text must be on a single line within quotes. Bicep-specific: Show modules as containers, include dependsOn relationships, note parameter usage in resource configuration.
Calls /api/render/elements with diagramType: "cloud-architecture-diagram"
Calls /api/render/elements with diagramType: "cloud-architecture-diagram"
User receives a diagram showing:
Weekly Installs
225
Repository
GitHub Stars
9
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
gemini-cli195
codex191
opencode189
github-copilot186
amp172
kimi-cli171