Validate ASCII diagram alignment and iteratively fix issues. Automatically validates and iteratively fixes diagrams created or modified by Claude.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ascii-diagram-validator:ascii-validator [<file-path>][<file-path>]**/*.md**/*.txt**/*.asciiThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill validates ASCII diagrams for alignment issues using the `validate_ascii.pl` Perl script and iteratively corrects problems until validation passes.
This skill validates ASCII diagrams for alignment issues using the validate_ascii.pl Perl script and iteratively corrects problems until validation passes.
IMPORTANT: Use this skill automatically whenever you create or modify an ASCII diagram that uses box-drawing characters (─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ etc.).
The validator is located in the plugin root directory and checks:
Write the ASCII diagram to a temporary file:
cat > /tmp/ascii-diagram.txt << 'EOF'
┌─────────────────────────────────────┐
│ Your diagram content here │
└─────────────────────────────────────┘
EOF
Run the validator:
../validate_ascii.pl /tmp/ascii-diagram.txt
The validator provides actionable error messages with explicit FIX instructions:
FORBIDDEN_CHAR_CRITICAL/HIGH/MEDIUM: Forbidden character detected
Forbidden character '⟶' (U+27F6) renders at 3-4x normal width. FIX: Replace with '──→' or '-->'WIDTH_MISMATCH: Line width differs from expected
Line has width 54, expected 55 (off by -1). FIX: Add 1 space(s) to pad this line to width 55VERTICAL_MISALIGNED: Vertical lines don't align
Vertical '│' at column 55 should align with '│' above (line 7, column 54). FIX: Move '│' on line 8 left by 1 position(s) to column 54BOX_CORNER_MISALIGNED: Box corners don't align vertically
Bottom-left corner '└' at column 3 should align with top-left '┌' at line 1, column 4. FIX: Move '└' right by 1 position(s) to column 4WIDE_CHAR: Double-width character (CJK, emoji) detected
Wide character '中' (U+4E2D) occupies 2 columns but counts as 1 character. FIX: Replace with ASCII equivalentAfter making corrections, run the validator again. Repeat steps 3-4 until the validator reports PASS.
$ ../validate_ascii.pl /tmp/diagram.txt
File: /tmp/diagram.txt
Status: FAIL
Issues Found:
1. Line 6, Col 16: [FORBIDDEN_CHAR_CRITICAL] Forbidden character '⟶' (U+27F6) renders at 3-4x normal width. FIX: Replace with '──→' or '-->'
2. Line 5, Col 55: [WIDTH_MISMATCH] Line has width 54, expected 55 (off by -1). FIX: Add 1 space(s) to pad this line to width 55
# Fix: Replace ⟶ with ──→ and add padding spaces
# Re-validate until PASS
Use these characters for reliable alignment:
Single line: ─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼
Double line: ═ ║ ╔ ╗ ╚ ╝ ╠ ╣ ╦ ╩ ╬
Heavy line: ━ ┃ ┏ ┓ ┗ ┛
Rounded: ╭ ╮ ╰ ╯
Arrows: → ← ↑ ↓ ↔ ↕
These cause alignment issues in most fonts:
NEVER: ⟶ ⟵ ⟹ ⟸ ⟷ ⟺ (3-4x width)
AVOID: ⇒ ⇐ ⇔ ⇑ ⇓ (1.5-2x width)
When the file containing an ASCII diagram is not purely a diagram (e.g., a markdown file with embedded diagrams, a README, or a source file with diagram comments), follow these steps:
Look for diagram regions bounded by:
``` blocks (the diagram is the content between fences)─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ║ etc.//, #, or * that contain box-drawing charactersNote the start line, end line, and indentation prefix (e.g., 4 spaces, or // ) for each diagram region.
For each identified diagram region:
# Example: extract lines 138-156 from README.md, stripping no prefix
sed -n '138,156p' README.md > /tmp/ascii-diagram.txt
Run the validator on the extracted diagram:
../validate_ascii.pl /tmp/ascii-diagram.txt
Fix issues as described in the standard workflow (Steps 3-4 above). Repeat until PASS.
Replace the original diagram region with the fixed version:
Important: Only modify the diagram content itself. Never alter:
```)If a file contains multiple diagram regions, process each one independently. Extract, validate, fix, and re-insert one at a time to avoid cross-contamination of fixes.
Guides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.
Dispatches multiple subagents concurrently for independent tasks without shared state. Use when facing 2+ unrelated failures or subsystems that can be investigated in parallel.
npx claudepluginhub dzwduan/ascii-diagram-validator --plugin ascii-diagram-validator