Languages: English | ζ₯ζ¬θͺ
A skill that generates AWS Architecture Diagrams (interactive HTML diagrams) from Mermaid diagrams or text descriptions.
Before using this skill, you need to download and organize the AWS architecture icons published by AWS.
Download AWS Architecture Icons:
- Visit AWS official site: AWS Architecture Icons
- Download "Architecture icons" and "Architecture group icons"
- Extract the downloaded files to the following directory:
.claude/skills/aws-architecture-diagram/assets
- Architecture-Group-Icons
- Architecture-Service-Icons
- Category-Icons
- Resource-Icons
Example File Structure:
Each category folder (e.g., Arch_Compute) contains 48px SVG files with the following structure:
Arch_Compute/48/
βββ Arch_Amazon-EC2_48.svg
βββ Arch_Amazon-EC2-Auto-Scaling_48.svg
βββ Arch_Amazon-Elastic-Container-Service_48.svg
βββ Arch_AWS-Lambda_48.svg
βββ ... (other services)
Activate the skill and define your architecture using Mermaid or text descriptions.
Example:
flowchart LR
User[User] --> ELB[ELB]
ELB --> EC2[EC2]
EC2 --> RDS[RDS]
RDS -.-> S3[S3]
Legacy Method (β DEPRECATED):
- Base64-encoded data URIs
- Increased file size
- Visual quality loss
Current Method (β ADOPTED):
- SVG content embedded directly in HTML
- Full visual fidelity
- Scalable
Implementation Example:
const AWS_ICONS = {
'EC2': '<svg width="48" height="48" viewBox="0 0 64 64" xmlns="...">...</svg>',
'RDS': '<svg width="48" height="48" viewBox="0 0 64 64" xmlns="...">...</svg>',
'S3': '<svg width="48" height="48" viewBox="0 0 64 64" xmlns="...">...</svg>'
};
// Icon registration
iconRegistry[componentId] = {
svg: AWS_ICONS['EC2'],
x: posX - 8, // Top-left placement (offset: -8)
y: posY - 8,
name: 'EC2'
};Requirements:
- Icons positioned at top-left, slightly overlapping the component border
- Scale: 2/3 size (48px β ~32px)
- Offset:
x - 8, y - 8
Why this offset value?
- 48px icon scaled to 2/3 = ~32px display size
- 16px overhang (50% overlap with border)
- 8px offset = half of 16px overhang
Implementation:
// Listener for component position changes
graph.on('change:position', function(cell) {
if (cell.id in iconRegistry) {
const newPos = cell.position();
const iconElement = iconContainer.querySelector(`[data-icon="${cell.id}"]`);
if (iconElement) {
// Maintain icon's relative position during drag
iconElement.setAttribute('transform',
`translate(${newPos.x - 8}, ${newPos.y - 8}) scale(0.667)`);
}
}
});Offset Value Consistency is Critical:
- Registration offset:
x - 8, y - 8 - Drag update offset:
newPos.x - 8, newPos.y - 8 - If offsets differ, icons will drift away during dragging (critical bug)
Problem:
- Icons appear fixed during zoom/pan operations
Solution:
// Transform update function for icon container
function updateIconsTransform() {
const iconContainer = paper.svg.querySelector('[data-icons-container]');
if (!iconContainer) return;
const scale = paper.scale();
const translate = paper.translate();
// Reflect current Paper zoom/pan state
const transform = `translate(${translate.tx}, ${translate.ty}) scale(${scale.sx}, ${scale.sy})`;
iconContainer.setAttribute('transform', transform);
}
// Execute on zoom/pan events
paper.on('scale', updateIconsTransform);
paper.on('translate', updateIconsTransform);Implementation:
// Track group IDs
const groupIds = [];
// When creating a group
const awsCloud = createGroup('aws-cloud', 'AWS Cloud', 50, 50, 1400, 900);
elements.push(awsCloud);
groupIds.push(awsCloud.id); // Register ID
// Set up resize handler
paper.svg.addEventListener('mousedown', function(evt) {
// Detect 30x30px resize handle at bottom-right corner
for (let i = 0; i < groupIds.length; i++) {
const groupCell = graph.getCell(groupIds[i]);
const pos = groupCell.position();
const size = groupCell.size();
// Coordinate transformation (zoom/pan aware)
const scale = paper.scale().sx;
const translate = paper.translate();
const canvasX = (evt.clientX - svgBBox.left - translate.tx) / scale;
const canvasY = (evt.clientY - svgBBox.top - translate.ty) / scale;
// Check if in resize handle
const handleSize = 30;
if (canvasX >= pos.x + size.width - handleSize &&
canvasY >= pos.y + size.height - handleSize) {
// Start resizing
isResizing = true;
resizingGroup = groupCell;
}
}
}, true);Cursor Feedback:
// Change cursor when on resize handle
paper.svg.addEventListener('mousemove', function(evt) {
for (let i = 0; i < groupIds.length; i++) {
const groupCell = graph.getCell(groupIds[i]);
// ... coordinate calculation ...
if (isInHandle) {
paper.svg.style.cursor = 'nwse-resize'; // ββ
} else if (isInGroup) {
paper.svg.style.cursor = 'grab';
}
}
});Cause: Offset values differ between registration and drag update
Solution:
// β Incorrect
iconRegistry[id] = { x: posX + 8, y: posY + 8, ... };
// During drag
iconElement.setAttribute('transform', `translate(${newPos.x - 8}, ...)`);
// β
Correct
iconRegistry[id] = { x: posX - 8, y: posY - 8, ... };
// During drag
iconElement.setAttribute('transform', `translate(${newPos.x - 8}, ...)`);Cause: addIconsToPaper() executed before icon container is found
Solution:
// Delayed execution to wait for Paper rendering
setTimeout(() => {
addIconsToPaper();
updateIconsTransform();
}, 100);Cause: updateIconsTransform() not being executed
Solution:
// Verify event listeners are registered
paper.on('scale', updateIconsTransform);
paper.on('translate', updateIconsTransform);| Element | Registration | Drag Update | Description |
|---|---|---|---|
| Icon | x - 8, y - 8 |
newPos.x - 8, newPos.y - 8 |
Top-left, overlaps border |
| Icon Scale | 0.667 (2/3) | 0.667 (2/3) | 48px β 32px |
| Group Handle | - | 30x30px | Bottom-right resize area |
| Category | HEX Color | RGB |
|---|---|---|
| Compute | #ED7100 | Smile (Orange) |
| Database | #E7157B | Cosmos (Pink) |
| Analytics | #01A88D | Orbit (Teal) |
| Storage | #7AA116 | Endor (Green) |
| Security | #DD344C | Mars (Red) |
| Integration | #C925D1 | Nebula (Purple) |
| Management | #8C4FFF | Galaxy (Purple-Blue) |
| Networking | #8C4FFF | Galaxy (Purple-Blue) |
| External | #232F3E | Squid (Navy) |
.claude/skills/aws-architecture-diagram/
βββ README.md # Japanese documentation
βββ SKILL.md # Skill details
βββ REFERENCE.md # Technical reference
β
βββ templates/
β βββ diagram-template.html # JointJS base template
β
βββ assets/
β βββ Architecture-Service-Icons_02072025/ # AWS service icons
β β βββ Arch_Analytics/
β β βββ Arch_Compute/
β β βββ Arch_Database/
β β βββ ... (see setup section for details)
β β
β βββ Architecture-Group-Icons_02072025/ # AWS group icons
β βββ AWS-Cloud/
β βββ Region/
β βββ ... (see setup section for details)
β
βββ (generated diagram HTML files)
- Input Reception β Mermaid / text description
- Parsing β Identify AWS services, groups, and connections
- Layout Design β Position components based on categories
- HTML Generation β Generate JointJS-based HTML using template
- Icon registration (
iconRegistry) - Group creation (register in
groupIds) - Connection lines (arrows) creation
- Event handler setup
- Icon registration (
- File Output β
aws-architecture-[date].html
In the generated HTML file, open browser developer tools (F12) and check the console:
// Icon registry state
console.log('Icon Registry:', iconRegistry);
// Group registry state
console.log('Group IDs:', groupIds);
// Drag operation log
console.log('Updating icon position:', cellId, newPos.x, newPos.y);- β Icon embedding (direct SVG)
- β Drag & drop (full coordinate following)
- β Zoom/pan synchronization
- β Group container resizing
- β Cursor feedback (grab / nwse-resize)
- β Icon position adjustment (top-left, border overlap)
- β Icon scaling (2/3 size)
- β L-shaped arrows (orthogonal routing)
- β Grid background
- β Responsive design
- β Keyboard shortcuts (Ctrl + +/β/0)
- β SVG download functionality
Added:
- Group container resizing functionality
- Icon top-left positioning (
x - 8, y - 8) - Icon full coordinate following during drag
- Icon synchronization during zoom/pan
Fixed:
- Icon offset value unification (registration and update match)
- Icon drift bug during dragging
Documentation Updates:
- Added new features to SKILL.md
- Added icon mapping table to REFERENCE.md
- Added implementation guide to template
When extending this skill, note the following:
-
Icon Offset Value Unification
- Registration:
x - 8, y - 8 - Drag update:
newPos.x - 8, newPos.y - 8 - Zoom/pan:
paper.on('scale/translate')
- Registration:
-
Group ID Registration
- Always register new groups with
groupIds.push(groupId)
- Always register new groups with
-
Icon Lookup Algorithm
- Refer to "Icon Lookup Algorithm" in REFERENCE.md
- Pay attention to service name to filename mapping
Last Updated: 2025-11-15 Template Version: 1.0 Skill Status: β Production Ready
For more detailed information about the skill's implementation, please refer to:
.claude/skills/aws-architecture-diagram/README_en.md- English skill documentation.claude/skills/aws-architecture-diagram/SKILL.md- Feature details.claude/skills/aws-architecture-diagram/REFERENCE.md- Technical reference