Initial commit to new repository
This commit is contained in:
99
dist/AxCopilot/skills/diagram-generator.skill.md
vendored
Normal file
99
dist/AxCopilot/skills/diagram-generator.skill.md
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
---
|
||||
name: diagram-generator
|
||||
label: 다이어그램 생성
|
||||
description: Python matplotlib/graphviz를 사용하여 플로차트, 시퀀스, ER 다이어그램 등을 생성합니다.
|
||||
icon: \uE9D9
|
||||
requires: python
|
||||
tabs: cowork
|
||||
---
|
||||
|
||||
사용자의 요구에 맞는 다이어그램을 Python으로 생성하세요.
|
||||
|
||||
## 사전 준비
|
||||
필요한 패키지를 설치하세요:
|
||||
```
|
||||
process_run: pip install matplotlib graphviz
|
||||
```
|
||||
시스템에 Graphviz가 설치되어 있어야 합니다 (https://graphviz.org/download/).
|
||||
|
||||
## 작업 절차
|
||||
1. **요구사항 파악**: 다이어그램 유형, 노드/관계, 스타일 확인
|
||||
2. **Python 스크립트 작성**: file_write로 .py 파일 생성
|
||||
3. **스크립트 실행**: process_run으로 Python 스크립트 실행
|
||||
4. **결과 확인**: 생성된 이미지 파일 경로를 사용자에게 안내
|
||||
|
||||
## 다이어그램 유형별 템플릿
|
||||
|
||||
### 플로차트 (Graphviz)
|
||||
```python
|
||||
from graphviz import Digraph
|
||||
|
||||
dot = Digraph(comment='Flowchart', format='png')
|
||||
dot.attr(rankdir='TB', fontname='Malgun Gothic')
|
||||
dot.attr('node', shape='box', style='rounded,filled', fillcolor='#E8F0FE')
|
||||
|
||||
dot.node('start', '시작', shape='ellipse', fillcolor='#34A853', fontcolor='white')
|
||||
dot.node('process1', '데이터 수집')
|
||||
dot.node('decision', '조건 확인?', shape='diamond', fillcolor='#FBBC04')
|
||||
dot.node('process2', '처리')
|
||||
dot.node('end', '종료', shape='ellipse', fillcolor='#EA4335', fontcolor='white')
|
||||
|
||||
dot.edge('start', 'process1')
|
||||
dot.edge('process1', 'decision')
|
||||
dot.edge('decision', 'process2', label='예')
|
||||
dot.edge('decision', 'end', label='아니오')
|
||||
dot.edge('process2', 'end')
|
||||
|
||||
dot.render('flowchart', cleanup=True)
|
||||
```
|
||||
|
||||
### 시퀀스 다이어그램 (matplotlib)
|
||||
```python
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.patches as patches
|
||||
|
||||
fig, ax = plt.subplots(1, 1, figsize=(10, 8))
|
||||
# 액터 라이프라인, 메시지 화살표 등을 matplotlib으로 직접 그리기
|
||||
ax.set_xlim(0, 10)
|
||||
ax.set_ylim(0, 10)
|
||||
ax.invert_yaxis()
|
||||
ax.axis('off')
|
||||
plt.savefig('sequence.png', dpi=150, bbox_inches='tight')
|
||||
```
|
||||
|
||||
### ER 다이어그램 (Graphviz)
|
||||
```python
|
||||
from graphviz import Graph
|
||||
|
||||
er = Graph('ER', format='png', engine='neato')
|
||||
er.attr('node', shape='box', style='filled', fillcolor='#E8F0FE')
|
||||
|
||||
er.node('user', 'User\n─────\nid (PK)\nname\nemail')
|
||||
er.node('order', 'Order\n─────\nid (PK)\nuser_id (FK)\ntotal')
|
||||
|
||||
er.edge('user', 'order', label='1:N')
|
||||
er.render('er_diagram', cleanup=True)
|
||||
```
|
||||
|
||||
### 조직도 (Graphviz)
|
||||
```python
|
||||
from graphviz import Digraph
|
||||
|
||||
org = Digraph(format='png')
|
||||
org.attr(rankdir='TB')
|
||||
org.attr('node', shape='box', style='rounded,filled', fillcolor='#E3F2FD')
|
||||
|
||||
org.node('ceo', 'CEO')
|
||||
org.node('cto', 'CTO')
|
||||
org.node('cfo', 'CFO')
|
||||
org.edges([('ceo', 'cto'), ('ceo', 'cfo')])
|
||||
org.render('org_chart', cleanup=True)
|
||||
```
|
||||
|
||||
## 스타일 옵션
|
||||
- 폰트: `fontname='Malgun Gothic'` (한글 지원)
|
||||
- 색상: HTML 컬러 코드 지원
|
||||
- 출력 형식: png, svg, pdf
|
||||
- 레이아웃 엔진: dot(계층), neato(스프링), circo(원형), fdp(포스)
|
||||
|
||||
한국어로 안내하세요. 작업 폴더에 Python 스크립트와 결과 파일을 저장하세요.
|
||||
Reference in New Issue
Block a user