PlantUML ASCII Diagrams

PlantUML ASCII Diagrams

Creates text-mode ASCII and Unicode diagrams from PlantUML for sequence, class and flow diagrams in terminals, READMEs and emails.

Skill files1 file
SKILL.md306 lines
1
---
2
name: plantuml-ascii
3
description: "Generate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or mentions plantuml ascii, text diagram, ascii art diagram. Supports: Converting PlantUML diagrams to ASCII art, Creating sequence diagrams, class diagrams, flowcharts in ASCII format, Generating Unicode-enhanced ASCII art with -utxt flag"
4
license: MIT
5
allowed-tools: Bash, Write, Read
6
---
7
8
# PlantUML ASCII Art Diagram Generator
9
10
## Overview
11
12
Create text-based ASCII art diagrams using PlantUML. Perfect for documentation in terminal environments, README files, emails, or any scenario where graphical diagrams aren't suitable.
13
14
## What is PlantUML ASCII Art?
15
16
PlantUML can generate diagrams as plain text (ASCII art) instead of images. This is useful for:
17
18
- Terminal-based workflows
19
- Git commits/PRs without image support
20
- Documentation that needs to be version-controlled
21
- Environments where graphical tools aren't available
22
23
## Installation
24
25
```bash
26
# macOS
27
brew install plantuml
28
29
# Linux (varies by distro)
30
sudo apt-get install plantuml # Ubuntu/Debian
31
sudo yum install plantuml # RHEL/CentOS
32
33
# Or download JAR directly
34
wget https://github.com/plantuml/plantuml/releases/download/v1.2024.0/plantuml-1.2024.0.jar
35
```
36
37
## Output Formats
38
39
| Flag | Format | Description |
40
| ------- | ------------- | ------------------------------------ |
41
| `-txt` | ASCII | Pure ASCII characters |
42
| `-utxt` | Unicode ASCII | Enhanced with box-drawing characters |
43
44
## Basic Workflow
45
46
### 1. Create PlantUML Diagram File
47
48
```plantuml
49
@startuml
50
participant Bob
51
actor Alice
52
53
Bob -> Alice : hello
54
Alice -> Bob : Is it ok?
55
@enduml
56
```
57
58
### 2. Generate ASCII Art
59
60
```bash
61
# Standard ASCII output
62
plantuml -txt diagram.puml
63
64
# Unicode-enhanced output (better looking)
65
plantuml -utxt diagram.puml
66
67
# Using JAR directly
68
java -jar plantuml.jar -txt diagram.puml
69
java -jar plantuml.jar -utxt diagram.puml
70
```
71
72
### 3. View Output
73
74
Output is saved as `diagram.atxt` (ASCII) or `diagram.utxt` (Unicode).
75
76
## Diagram Types Supported
77
78
### Sequence Diagram
79
80
```plantuml
81
@startuml
82
actor User
83
participant "Web App" as App
84
database "Database" as DB
85
86
User -> App : Login Request
87
App -> DB : Validate Credentials
88
DB --> App : User Data
89
App --> User : Auth Token
90
@enduml
91
```
92
93
### Class Diagram
94
95
```plantuml
96
@startuml
97
class User {
98
+id: int
99
+name: string
100
+email: string
101
+login(): bool
102
}
103
104
class Order {
105
+id: int
106
+total: float
107
+items: List
108
+calculateTotal(): float
109
}
110
111
User "1" -- "*" Order : places
112
@enduml
113
```
114
115
### Activity Diagram
116
117
```plantuml
118
@startuml
119
start
120
:Initialize;
121
if (Is Valid?) then (yes)
122
:Process Data;
123
:Save Result;
124
else (no)
125
:Log Error;
126
stop
127
endif
128
:Complete;
129
stop
130
@enduml
131
```
132
133
### State Diagram
134
135
```plantuml
136
@startuml
137
[*] --> Idle
138
Idle --> Processing : start
139
Processing --> Success : complete
140
Processing --> Error : fail
141
Success --> [*]
142
Error --> Idle : retry
143
@enduml
144
```
145
146
### Component Diagram
147
148
```plantuml
149
@startuml
150
[Client] as client
151
[API Gateway] as gateway
152
[Service A] as svcA
153
[Service B] as svcB
154
[Database] as db
155
156
client --> gateway
157
gateway --> svcA
158
gateway --> svcB
159
svcA --> db
160
svcB --> db
161
@enduml
162
```
163
164
### Use Case Diagram
165
166
```plantuml
167
@startuml
168
actor "User" as user
169
actor "Admin" as admin
170
171
rectangle "System" {
172
user -- (Login)
173
user -- (View Profile)
174
user -- (Update Settings)
175
admin -- (Manage Users)
176
admin -- (Configure System)
177
}
178
@enduml
179
```
180
181
### Deployment Diagram
182
183
```plantuml
184
@startuml
185
actor "User" as user
186
node "Load Balancer" as lb
187
node "Web Server 1" as ws1
188
node "Web Server 2" as ws2
189
database "Primary DB" as db1
190
database "Replica DB" as db2
191
192
user --> lb
193
lb --> ws1
194
lb --> ws2
195
ws1 --> db1
196
ws2 --> db1
197
db1 --> db2 : replicate
198
@enduml
199
```
200
201
## Command-Line Options
202
203
```bash
204
# Specify output directory
205
plantuml -txt -o ./output diagram.puml
206
207
# Process all files in directory
208
plantuml -txt ./diagrams/
209
210
# Include dot files (hidden files)
211
plantuml -txt -includeDot diagrams/
212
213
# Verbose output
214
plantuml -txt -v diagram.puml
215
216
# Specify charset
217
plantuml -txt -charset UTF-8 diagram.puml
218
```
219
220
## Ant Task Integration
221
222
```xml
223
<target name="generate-ascii">
224
<plantuml dir="./src" format="txt" />
225
</target>
226
227
<target name="generate-unicode-ascii">
228
<plantuml dir="./src" format="utxt" />
229
</target>
230
```
231
232
## Tips for Better ASCII Diagrams
233
234
1. **Keep it simple**: Complex diagrams don't render well in ASCII
235
2. **Short labels**: Long text breaks ASCII alignment
236
3. **Use Unicode (`-utxt`)**: Better visual quality with box-drawing chars
237
4. **Test before sharing**: Verify in terminal with fixed-width font
238
5. **Consider alternatives**: For complex diagrams, use Mermaid.js or graphviz
239
240
## Example Output Comparison
241
242
**Standard ASCII (`-txt`)**:
243
244
```
245
,---. ,---.
246
|Bob| |Alice|
247
`---' `---'
248
| hello |
249
|------------->|
250
| |
251
| Is it ok? |
252
|<-------------|
253
| |
254
```
255
256
**Unicode ASCII (`-utxt`)**:
257
258
```
259
┌─────┐ ┌─────┐
260
│ Bob │ │Alice│
261
└─────┘ └─────┘
262
│ hello │
263
│─────────────>│
264
│ │
265
│ Is it ok? │
266
│<─────────────│
267
│ │
268
```
269
270
## Quick Reference
271
272
```bash
273
# Create sequence diagram in ASCII
274
cat > seq.puml << 'EOF'
275
@startuml
276
Alice -> Bob: Request
277
Bob --> Alice: Response
278
@enduml
279
EOF
280
281
plantuml -txt seq.puml
282
cat seq.atxt
283
284
# Create with Unicode
285
plantuml -utxt seq.puml
286
cat seq.utxt
287
```
288
289
## Troubleshooting
290
291
**Problem**: Garbled Unicode characters
292
293
- **Solution**: Ensure terminal supports UTF-8 and has proper font
294
295
**Problem**: Diagram looks misaligned
296
297
- **Solution**: Use fixed-width font (Courier, Monaco, Consolas)
298
299
**Problem**: Command not found
300
301
- **Solution**: Install PlantUML or use Java JAR directly
302
303
**Problem**: Output file not created
304
305
- **Solution**: Check file permissions, ensure PlantUML has write access
306

© awesome-copilot contributors · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,508 prompts

More by @OpenSourceBuffGuy

See all
Liquid Metal Brand Logo Glyph Template prompt image

Liquid Metal Brand Logo Glyph Template

Turns any brand's logo into a pearl-white liquid-metal sculptural glyph rendered in a studio on a plain background, from a two-slot template.

image-prompt, gpt-image, placeholders, template, logo, branding, 3d-render, studio-lighting, white-background, square-format, product-photography, luxury, negative-prompt, for-designers, long-form, sculpture, graphic-design, structured-output, minimalist, close-up

Pink haired girl on broomstick over Korean palace roofs prompt image

Pink haired girl on broomstick over Korean palace roofs

Generates a 30-second fantasy aerial video of a pink-haired woman flying a broomstick over Korean palace roofs, mountains and a lake, with a fixed character sheet.

video-prompt, wan, drone-shot, timed-beats, multi-shot, camera-movement, tracking-shot, fantasy-world, korea, character-consistency, negative-prompt, guardrails, landscape, mountains, aerial-view, photorealistic, cinematic, natural-light, wide-shot, architecture, for-filmmakers, long-form, visual-effects, scene-transitions

Rabbit bouncer brawls bulldog boss in toon alley prompt image

Rabbit bouncer brawls bulldog boss in toon alley

Generates a 15-second hand-drawn 1990s toon-noir brawl between a rabbit bouncer and a bulldog mob boss, with timed beats, fixed character looks and named sound effects.

video-prompt, seedance, animation, action, timed-beats, multi-shot, camera-movement, tracking-shot, cartoon, humorous, character-consistency, film-noir, vintage, cityscape, animals, neon, night-scene, rain, visual-effects, sound-effects, jazz, widescreen, long-form, advanced, for-filmmakers, for-content-creators

Reviews

Loading reviews…

Discussion

Loading comments…