AgentSkillsCN

excalidraw-architect

分析代码,生成架构的Excalidraw JSON图。

SKILL.md
--- frontmatter
name: excalidraw-architect
description: Analyze code and generate an Excalidraw JSON diagram of the architecture.

Excalidraw Architect Skill

Description

This skill analyzes source code files and generates an architectural diagram in Excalidraw JSON format. It identifies classes, functions, and their relationships, then visualizes them as connected rectangles.

Instructions

  1. Analyze: Use List Directory and File Read to understand the codebase structure and relationships.
  2. Design: Plan a visual layout where:
    • Files/Modules are large rectangles.
    • Classes are rectangles within modules.
    • Relationships (imports, inheritance, calls) are arrows connecting them.
  3. Generate JSON: Construct a valid Excalidraw JSON object.
    • Use type: "rectangle" for components.
    • Use type: "arrow" for connections.
    • Use type: "text" for labels.
    • Ensure unique ids for all elements.
  4. Output: Write the JSON content to a file named architecture.excalidraw.

Excalidraw JSON Template (Simplified)

json
{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [
    {
      "id": "unique-id-1",
      "type": "rectangle",
      "x": 100,
      "y": 100,
      "width": 200,
      "height": 100,
      "strokeColor": "#000000",
      "backgroundColor": "transparent",
      "fillStyle": "hachure",
      "strokeWidth": 1,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "groupIds": [],
      "strokeSharpness": "sharp",
      "seed": 123456,
      "version": 1,
      "versionNonce": 0,
      "isDeleted": false,
      "boundElements": null,
      "updated": 1,
      "link": null,
      "locked": false
    },
    {
      "id": "unique-id-2",
      "type": "text",
      "x": 110,
      "y": 110,
      "width": 180,
      "height": 80,
      "text": "ClassName",
      "fontSize": 20,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle"
    }
  ],
  "appState": {
    "viewBackgroundColor": "#ffffff",
    "gridSize": null
  }
}