plugins/github-copilot-modernization/skills/architecture-diagram/SKILL.md
Generate architecture diagram with component relationship details from project analysis
npx skillsauth add microsoft/github-copilot-modernization architecture-diagramInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill generates a two-layer architecture visualization: a high-level application architecture diagram and a detailed component relationship diagram. Produce both in a single pass and save to .github/modernize/assessment/engines/facts/architecture-diagram.md.
workspace-path (optional): Path to the project to analyze (defaults to current directory)Mermaid is unforgiving: one illegal character anywhere in a block crashes the whole diagram with Syntax error in text, not just the offending line. There is no partial rendering. Stay strictly inside this subset:
Chart kind. Only flowchart TD (Step 1) or flowchart LR (Step 2). Never graph TD, never mixed.
Subgraph form. Always subgraph <AlphaNumId>["display label"]. The id must match [A-Za-z][A-Za-z0-9_]* (no spaces, no punctuation). NEVER use the anonymous form subgraph "label" — it crashes whenever the label contains (, ), :, /, -, etc., and the parser error appears on an unrelated line.
Node form. Only one of: Id["label"] (rectangle), Id(("label")) (circle), Id[("label")] (cylinder for data stores). Pick one shape per node — do not stack brackets.
Arrow form. Solid -->, dotted -.->. If you put a label on an arrow it MUST be double-quoted: -->|"label"|. Never bare -->|label|.
No line breaks in labels. The escape \n was removed in modern Mermaid and is the #1 cause of failures. Use <br/> in flowcharts when you really must break a line. Strongly prefer single-line ≤ 60-char labels — put detail in the Inventory / Stack tables instead.
Banned characters inside any label or subgraph title. Use the ASCII replacement:
| Banned | Why it breaks | Replacement |
|---|---|---|
| \n (literal two chars) | escape removed | <br/> or drop |
| — (em-dash, U+2014) | parser treats as edge | - (ASCII hyphen) |
| – (en-dash, U+2013) | parser treats as edge | - |
| { } (e.g. {id}) | opens an entity block | drop braces — write id or :id |
| " inside a label | closes the label early | ' (single quote) |
| \| inside a label | breaks edge-label parser | rephrase |
| @ # $ % & | unsafe in many positions | rephrase or drop |
| ( ) outside a ["..."] quoted label | unbalanced parens crash | only inside the quoted label |
| smart quotes " " ' ' | not ASCII | regular " and ' |
Unique node IDs across the whole file. If Layer 1 has DB, Layer 2 cannot also have DB. Use DB1 and DB2 (or AppDb, ComponentDb).
subgraph must be closed by a matching end on its own line. No end, no diagram.
Immediately before writing each ```mermaid opening fence, emit this exact one-line HTML comment in the markdown (the comment will not render — it is for your own visible attestation that you have re-checked the block):
<!-- mermaid-checked: no \n, no em-dash/en-dash, no {} in labels, subgraphs are id["label"], arrows are -->|"label"|, all subgraphs closed by end, ids unique -->
If you cannot truthfully emit that comment, fix the diagram first.
Analyze the project and produce the complete ## Application Architecture section in one pass.
Analysis:
Diagram — Mermaid flowchart TD (re-read the Safety Constraints above before writing):
subgraph for grouping)Do NOT include: individual classes/methods or migration directions.
Reference example (this block satisfies every Safety Constraint — match its shape):
<!-- mermaid-checked: no \n, no em-dash/en-dash, no {} in labels, subgraphs are id["label"], arrows are -->|"label"|, all subgraphs closed by end, ids unique -->flowchart TD
subgraph Client["Client Layer"]
Browser["Web Browser"]
end
subgraph App["Application Layer - Spring Boot 2.7"]
Web["Spring MVC + Thymeleaf"]
Security["Spring Security"]
Service["Business Services"]
end
subgraph Data["Data Layer"]
JPA["Spring Data JPA"]
DB[("PostgreSQL 14")]
Cache[("Redis")]
end
subgraph External["External Services"]
SMTP["SMTP Email Service"]
S3["AWS S3 Storage"]
end
Browser -->|"HTTP requests"| Web
Web --> Security -->|"authorized"| Service
Service -->|"CRUD operations"| JPA
JPA -->|"SQL queries"| DB
Service -->|"session cache"| Cache
Service -->|"send email"| SMTP
Service -->|"file upload"| S3
Textual explanations (write immediately after the diagram):
⚠ Move detail OUT of node labels and INTO this table. A diagram with short labels and a rich table renders; a diagram with long labels does not.
Analyze component interactions and produce the complete ## Component Relationships section in one pass.
Analysis:
Diagram — Mermaid flowchart LR (re-read the Safety Constraints above before writing):
subgraph (Presentation, Business Logic, Data Access, Infrastructure)c for Component: cWeb, cService).Do NOT include: method signatures, private helpers, or external dependencies (covered by dependency-map skill).
Reference example (satisfies every Safety Constraint):
<!-- mermaid-checked: no \n, no em-dash/en-dash, no {} in labels, subgraphs are id["label"], arrows are -->|"label"|, all subgraphs closed by end, ids unique -->flowchart LR
subgraph PresentationLayer["Presentation"]
UserCtrl["UserController"]
OrderCtrl["OrderController"]
end
subgraph BusinessLayer["Business Logic"]
UserSvc["UserService"]
OrderSvc["OrderService"]
NotifSvc["NotificationService"]
end
subgraph DataAccessLayer["Data Access"]
UserRepo["UserRepository"]
OrderRepo["OrderRepository"]
end
subgraph InfraLayer["Infrastructure"]
AuthFilter["AuthenticationFilter"]
LogMiddleware["LoggingMiddleware"]
end
UserCtrl -->|"delegates"| UserSvc
OrderCtrl -->|"delegates"| OrderSvc
OrderSvc -->|"lookups"| UserSvc
OrderSvc -->|"triggers"| NotifSvc
UserSvc -->|"queries"| UserRepo
OrderSvc -->|"queries"| OrderRepo
AuthFilter -.->|"intercepts"| UserCtrl
AuthFilter -.->|"intercepts"| OrderCtrl
LogMiddleware -.->|"wraps"| PresentationLayer
Textual explanation (write immediately after the diagram):
Save the combined output to .github/modernize/assessment/engines/facts/architecture-diagram.md with this exact structure:
# Architecture Diagram
A brief introduction (1-2 sentences).
## Application Architecture
< Layer 1 Mermaid flowchart TD here >
### Technology Stack Summary
[Table: Layer | Technology | Version | Purpose]
### Data Storage & External Services
[Short paragraph on databases, caches, external APIs]
### Key Architectural Decisions
[1-3 bullet points on notable patterns]
## Component Relationships
< Layer 2 Mermaid flowchart LR here >
### Component Inventory
[Table: Component | Layer | Type | Responsibility]
com.example.orders as one node instead of listing every class) — this also keeps labels short and safe.Each row below is something the model actually produced and crashed the diagram. Use the ✅ form.
| ❌ Past mistake | ✅ Safe form | Why the ❌ crashed |
|---|---|---|
| subgraph "Spring Boot Application (port 8080)" | subgraph SpringApp["Spring Boot Application (port 8080)"] | Anonymous subgraph + parentheses in title |
| HC["HomeController\n GET / — gallery page"] | HC["HomeController GET /"] (move detail to table) | Literal \n + em-dash |
| PHOTOS_TABLE["PHOTOS table\n id (UUID PK)\n photo_data (BLOB)"] | PHOTOS_TABLE["PHOTOS"] (columns belong in a table) | \n and overlong label |
| PFC["PhotoFileController\n GET /photo/{id}"] | PFC["PhotoFileController GET /photo/:id"] | \n + {id} |
| Spring["Spring Boot\n2.7.18"] | Spring["Spring Boot 2.7.18"] | \n |
| A -->|fetches users| B | A -->|"fetches users"| B | Bare (unquoted) arrow label |
> ERROR: Unsupported project type. This skill supports Java, .NET, JavaScript, and TypeScript projects only.> ERROR: No recognized source files found at workspace-path. Verify the path is correct.Note["Some components could not be identified"]<!-- mermaid-checked: ... --> attestation comment.github/modernize/assessment/engines/facts/architecture-diagram.mddevelopment
Scan dependency manifests against known CVEs and remediate by upgrading vulnerable dependencies to patched versions, then rebuild and re-scan to confirm. Self-contained scan→fix→verify loop for any project with a dependency manifest. Use when: a cve-remediation task is dispatched; dependency set changed (version bump, new framework); assessment flagged vulnerable or EOL dependencies; or user asked to "fix CVEs", "patch vulnerabilities", or "dependency security". Triggers: "cve", "remediate cve", "fix cves", "patch vulnerable dependencies", "vulnerability scanning", "dependency security", "vulnerable dependencies", "security advisories", "npm audit", "pnpm audit", "maven audit", "gradle audit", "dependency scan", "vulnerability remediation". NOT for: security audit of auth/input/secrets/OWASP code paths (use security-review).
development
Generate dependency map diagram from project build files
documentation
Generate data architecture and persistence layer documentation with data model diagram
documentation
Generate core business workflow documentation with sequence diagram