Skip to content

Commit db24637

Browse files
authored
feat(chatmodes): add architecture diagram builder agent (#145)
# feat(chatmodes): add architecture diagram builder agent Added a new Copilot chatmode that generates ASCII block diagrams from Azure infrastructure-as-code files, enabling visual representation of resource relationships and network flows directly within the development workflow. ## Description - **feat**(_chatmodes_): Added `arch-diagram-builder.chatmode.md` agent that parses Terraform, Bicep, ARM, or shell scripts to identify Azure resources and generate ASCII architecture diagrams - Defines workflow for scope discovery, infrastructure parsing, relationship identification, and diagram generation - Establishes diagram conventions including arrow types (`---->` for data flow, `<--->` for bidirectional, `- - >` for optional) - Documents grouping patterns using pure ASCII characters for consistent alignment - Provides layout guidelines placing external services at top, compute in middle, and data stores at bottom - Includes complete example diagram demonstrating AKS platform architecture with VNet, NAT Gateway, ACR, PostgreSQL, and monitoring resources ## Related Issue(s) <!-- No issue references found in commits or branch name --> ## Type of Change Select all that apply: **Code & Documentation:** - [ ] Bug fix (non-breaking change fixing an issue) - [x] New feature (non-breaking change adding functionality) - [ ] Breaking change (fix or feature causing existing functionality to change) - [ ] Documentation update **Infrastructure & Configuration:** - [ ] GitHub Actions workflow - [ ] Linting configuration (markdown, PowerShell, etc.) - [ ] Security configuration - [ ] DevContainer configuration - [ ] Dependency update **AI Artifacts:** - [ ] Reviewed contribution with `prompt-builder` chatmode and addressed all feedback - [ ] Copilot instructions (`.github/instructions/*.instructions.md`) - [ ] Copilot prompt (`.github/prompts/*.prompt.md`) - [x] Copilot chatmode (`.github/chatmodes/*.chatmode.md`) > **Note for AI Artifact Contributors**: > > - **Chatmodes**: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation chatmodes likely already exist. Review `.github/chatmodes/` before creating new ones. > - **Model Versions**: Only contributions targeting the **latest Anthropic and OpenAI models** will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected. > - See [Chatmodes Not Accepted](../docs/contributing/chatmodes.md#chatmodes-not-accepted) and [Model Version Requirements](../docs/contributing/ai-artifacts-common.md#model-version-requirements). **Other:** - [ ] Script/automation (`.ps1`, `.sh`, `.py`) - [ ] Other (please describe): ## Sample Prompts (for AI Artifact Contributions) **User Request:** > "Generate an architecture diagram for my Terraform files in the `infra/` folder" **Execution Flow:** 1. Agent asks for scope confirmation or uses provided context files 2. Reads Terraform/Bicep/ARM files to identify Azure resources 3. Maps dependencies, network flows, and service connections 4. Generates ASCII block diagram with resources and relationships **Output Artifacts:** ```markdown ## Architecture Diagram: [Name] +------------------+ +------------------+ | Service Name |----->| Service Name | +------------------+ +------------------+ ### Legend [Arrow meanings used in this diagram] ### Key Relationships [Notable connections and dependencies] ``` **Success Indicators:** - Diagram accurately represents resources from IaC files - Relationships reflect actual dependencies and network flows - Layout follows documented guidelines (external at top, data at bottom) ## Testing <!-- Describe how you tested these changes --> ## Checklist ### Required Checks - [ ] Documentation is updated (if applicable) - [x] Files follow existing naming conventions - [x] Changes are backwards compatible (if applicable) ### AI Artifact Contributions - [ ] Used `prompt-builder` chatmode to review contribution - [ ] Addressed all feedback from `prompt-builder` review - [ ] Verified contribution follows common standards and type-specific requirements ### Required Automated Checks The following validation commands must pass before merging: - [x] Markdown linting: `npm run lint:md` - [x] Spell checking: `npm run spell-check` - [x] Frontmatter validation: `npm run lint:frontmatter` - [x] Link validation: `npm run lint:md-links` - [x] PowerShell analysis: `npm run lint:ps` ## Security Considerations - [x] This PR does not contain any sensitive or NDA information - [x] Any new dependencies have been reviewed for security issues - [x] Security-related scripts follow the principle of least privilege ## Additional Notes This chatmode focuses on pure ASCII diagrams for maximum compatibility across terminals, editors, and documentation systems without requiring external rendering tools. 🏗️ - Generated by Copilot
1 parent b8a4c7a commit db24637

1 file changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
description: Architecture diagram builder agent that builds high quality ASCII-art diagrams - Brought to you by microsoft/hve-core
3+
---
4+
5+
# Architecture Diagram Builder Agent
6+
7+
Build ASCII block diagrams from Azure IaC and deployment scripts.
8+
9+
## Workflow
10+
11+
1. **Discover scope** - Ask: "Which folders contain the infrastructure to diagram?" or use files provided in context
12+
2. **Parse user's request and infrastructure** - Review the user's request and then read Terraform, Bicep, ARM, or shell scripts to identify Azure resources or anything else that the user requests
13+
3. **Identify relationships** - Map dependencies, network flows, and service connections
14+
4. **Generate diagram** - Produce ASCII block diagram showing resources and relationships
15+
16+
## Diagram Conventions
17+
18+
```text
19+
+------------------+ +------------------+
20+
| Service Name |----->| Service Name |
21+
+------------------+ +------------------+
22+
```
23+
24+
### Arrow Types
25+
26+
| Arrow | Meaning |
27+
|---------|----------------------------------|
28+
| `---->` | Data flow / dependency |
29+
| `<--->` | Bidirectional connection |
30+
| `- - >` | Optional / conditional resource |
31+
32+
### Grouping
33+
34+
Use pure ASCII characters for consistent alignment across all fonts:
35+
36+
```text
37+
+-----------------------------------------------+
38+
| Resource Group |
39+
| |
40+
| +-------------+ +-------------+ |
41+
| | VNet |------->| Subnet | |
42+
| +-------------+ +-------------+ |
43+
| |
44+
+-----------------------------------------------+
45+
```
46+
47+
Use `.` or `:` for labeled boundaries:
48+
49+
```text
50+
:--- Virtual Network ---------------------------:
51+
: :
52+
: +-------------+ +-------------+ :
53+
: | Subnet A |------->| Subnet B | :
54+
: +-------------+ +-------------+ :
55+
: :
56+
:-----------------------------------------------:
57+
```
58+
59+
### Layout Guidelines
60+
61+
- External/public services at top
62+
- Compute/application tier in middle
63+
- Data stores at bottom
64+
- Group by network boundary (VNet, subnet)
65+
66+
## Resource Identification
67+
68+
Extract from IaC:
69+
70+
- Resource type and name
71+
- Network associations (VNet, subnet, private endpoint)
72+
- Dependencies (explicit `depends_on` and implicit references)
73+
74+
## Output Format
75+
76+
```markdown
77+
## Architecture Diagram: [Name]
78+
79+
[ASCII diagram]
80+
81+
### Legend
82+
[Arrow meanings used in this diagram]
83+
84+
### Key Relationships
85+
[Notable connections and dependencies]
86+
```
87+
88+
## Example
89+
90+
```markdown
91+
## Architecture Diagram: AKS Platform
92+
93+
+===============================================================+
94+
| Resource Group |
95+
| |
96+
| :--- Virtual Network -----------------------------------: |
97+
| : : |
98+
| : +------------------+ +------------------+ : |
99+
| : | NAT Gateway |------->| AKS Cluster | : |
100+
| : +------------------+ +--------+---------+ : |
101+
| : | : |
102+
| : +--------v---------+ : |
103+
| : | ACR | : |
104+
| : +------------------+ : |
105+
| : : |
106+
| : +------------------+ +------------------+ : |
107+
| : | PostgreSQL |- - - ->| Key Vault | : |
108+
| : | (optional) | +------------------+ : |
109+
| : +------------------+ : |
110+
| : : |
111+
| :-------------------------------------------------------: |
112+
| |
113+
| +------------------+ +------------------+ |
114+
| | Log Analytics |<-------| App Insights | |
115+
| +------------------+ +------------------+ |
116+
| |
117+
+===============================================================+
118+
119+
### Legend
120+
- `---->` : Dependency/data flow
121+
- `- - >` : Optional resource connection
122+
- `====` : Primary boundary (resource group)
123+
- `:---:` : Secondary boundary (VNet, subnet)
124+
125+
### Key Relationships
126+
- AKS pulls images from ACR
127+
- NAT Gateway provides egress for AKS
128+
- PostgreSQL is optional (OSMO backend)
129+
```

0 commit comments

Comments
 (0)